From aa2ce4cc6cc826fff248346d53111f9b7f365e2a Mon Sep 17 00:00:00 2001 From: 317787106 <317787106@qq.com> Date: Tue, 27 Oct 2026 17:56:18 +0800 Subject: [PATCH 1/8] bump grpcVersion to 1.85.1, bump nettyVersion to 4.2.19.Final --- build.gradle | 5 +++-- framework/build.gradle | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index fb95b3e39f7..6f6481bd0f5 100644 --- a/build.gradle +++ b/build.gradle @@ -6,14 +6,14 @@ plugins { } ext { - grpcVersion = "1.83.1" + grpcVersion = "1.85.1" // Netty 4.2 split io.netty.handler.codec.protobuf out of netty-codec into its // own artifact. Both :framework and :p2p put the varint32 framing codecs on // their channel pipelines and so must declare it explicitly. Netty itself // arrives transitively through grpc-netty, so this version has to move with // grpcVersion above — keeping it here makes that coupling visible instead of // leaving two literals to drift apart. - nettyVersion = "4.2.15.Final" + nettyVersion = "4.2.19.Final" // Shared by :protocol and :p2p, which both generate from .proto files. protobufVersion = "3.25.8" // Shared by :framework, :plugins and :p2p. @@ -24,6 +24,7 @@ allprojects { version = "1.0.0" apply plugin: "java-library" ext { + // the latest version supporting JDK1.8 is 5.x.x springVersion = "5.3.39" errorproneVersion = "2.42.0" } diff --git a/framework/build.gradle b/framework/build.gradle index 769bb8f3682..2c92f0e9ecf 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -36,7 +36,7 @@ dependencies { exclude group: 'com.google.protobuf' exclude group: 'com.google.protobuf.nano' } - // http + // http. the latest version supporting JDK1.8 is 9.x.x implementation 'org.eclipse.jetty:jetty-server:9.4.58.v20250814' implementation 'org.eclipse.jetty:jetty-servlet:9.4.58.v20250814' // end http From 79af7a06bb373ae4fca6510dd43d3ba730e5beeb Mon Sep 17 00:00:00 2001 From: 317787106 <317787106@qq.com> Date: Tue, 27 Oct 2026 17:59:34 +0800 Subject: [PATCH 2/8] update gradle/verification-metadata.xml --- gradle/verification-metadata.xml | 234 +++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index a64a34bd199..63409578f8d 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1143,6 +1143,14 @@ + + + + + + + + @@ -1151,6 +1159,14 @@ + + + + + + + + @@ -1159,6 +1175,14 @@ + + + + + + + + @@ -1167,6 +1191,14 @@ + + + + + + + + @@ -1175,6 +1207,14 @@ + + + + + + + + @@ -1183,6 +1223,14 @@ + + + + + + + + @@ -1191,6 +1239,14 @@ + + + + + + + + @@ -1199,6 +1255,14 @@ + + + + + + + + @@ -1207,6 +1271,14 @@ + + + + + + + + @@ -1229,6 +1301,14 @@ + + + + + + + + @@ -1237,6 +1317,22 @@ + + + + + + + + + + + + + + + + @@ -1245,6 +1341,22 @@ + + + + + + + + + + + + + + + + @@ -1253,6 +1365,14 @@ + + + + + + + + @@ -1261,6 +1381,14 @@ + + + + + + + + @@ -1269,6 +1397,14 @@ + + + + + + + + @@ -1277,6 +1413,14 @@ + + + + + + + + @@ -1285,6 +1429,14 @@ + + + + + + + + @@ -1293,6 +1445,22 @@ + + + + + + + + + + + + + + + + @@ -1301,6 +1469,14 @@ + + + + + + + + @@ -1309,11 +1485,29 @@ + + + + + + + + + + + + + + + + + + @@ -1322,6 +1516,22 @@ + + + + + + + + + + + + + + + + @@ -1330,6 +1540,22 @@ + + + + + + + + + + + + + + + + @@ -1338,6 +1564,14 @@ + + + + + + + + From 4a5b1b6beb596ef275e7338b71d8ed474744ff03 Mon Sep 17 00:00:00 2001 From: 317787106 <317787106@qq.com> Date: Tue, 27 Oct 2026 18:21:39 +0800 Subject: [PATCH 3/8] fix testcase laterMessagesOnARejectedUnaryCallAreIgnored --- .../application/RpcServiceAdmissionTest.java | 77 +++++++++++-------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/framework/src/test/java/org/tron/common/application/RpcServiceAdmissionTest.java b/framework/src/test/java/org/tron/common/application/RpcServiceAdmissionTest.java index b556a23d3c6..89295a76e78 100644 --- a/framework/src/test/java/org/tron/common/application/RpcServiceAdmissionTest.java +++ b/framework/src/test/java/org/tron/common/application/RpcServiceAdmissionTest.java @@ -66,6 +66,8 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; import org.tron.api.DatabaseGrpc; import org.tron.api.GrpcAPI; import org.tron.api.MonitorGrpc; @@ -389,30 +391,58 @@ public void anyMethodRejectsOverBudgetRequestsAndCountsEachRejectionOnce() throw } @Test + @SuppressWarnings("unchecked") public void laterMessagesOnARejectedUnaryCallAreIgnored() throws Exception { Transaction flood = Transaction.parseFrom(retFlood(BUDGET + 1)); - int before = HANDLER_CALLS.get(); - // A unary call that carries a rejected message followed by a valid one. - assertEquals(Status.Code.INVALID_ARGUMENT, - rawUnaryCall(Arrays.asList(flood, legitimate())).getCode()); - // A valid message followed by a rejected one. - assertEquals(Status.Code.INVALID_ARGUMENT, - rawUnaryCall(Arrays.asList(legitimate(), flood)).getCode()); - // Two rejected messages: one rejection, counted once. + AtomicInteger delivered = new AtomicInteger(); + AtomicInteger halfClosed = new AtomicInteger(); + ServerMethodDefinition guarded = GuardedRequestMarshaller.guard( + ServerMethodDefinition.create(WalletGrpc.getBroadcastTransactionMethod(), + (call, headers) -> new ServerCall.Listener() { + @Override + public void onMessage(Transaction message) { + delivered.incrementAndGet(); + } + + @Override + public void onHalfClose() { + halfClosed.incrementAndGet(); + } + }), MAX_MESSAGE, BUDGET); + GuardedRequestMarshaller marshaller = + (GuardedRequestMarshaller) guarded.getMethodDescriptor() + .getRequestMarshaller(); + + // A unary client cannot reliably send multiple messages after the server closes the call. + // Exercise the server listener directly to verify its behavior on later messages. CommonParameter parameter = CommonParameter.getInstance(); boolean metrics = parameter.metricsPrometheusEnable; parameter.metricsPrometheusEnable = true; try { String name = WalletGrpc.getBroadcastTransactionMethod().getFullMethodName(); - double rejected = rejections(name, Reason.OVER_BUDGET); - assertEquals(Status.Code.INVALID_ARGUMENT, - rawUnaryCall(Arrays.asList(flood, flood)).getCode()); - assertEquals(rejected + 1, rejections(name, Reason.OVER_BUDGET), 0); + for (Transaction[] messages : new Transaction[][] { + {flood, legitimate()}, {legitimate(), flood}, {flood, flood}}) { + double rejected = rejections(name, Reason.OVER_BUDGET); + int deliveredBefore = delivered.get(); + ServerCall call = Mockito.mock(ServerCall.class); + Mockito.when(call.getMethodDescriptor()).thenReturn(guarded.getMethodDescriptor()); + ServerCall.Listener listener = + guarded.getServerCallHandler().startCall(call, new Metadata()); + for (Transaction message : messages) { + listener.onMessage(marshaller.parse(new ByteArrayInputStream(message.toByteArray()))); + } + listener.onHalfClose(); + + ArgumentCaptor status = ArgumentCaptor.forClass(Status.class); + Mockito.verify(call).close(status.capture(), Mockito.any(Metadata.class)); + assertEquals(Status.Code.INVALID_ARGUMENT, status.getValue().getCode()); + assertEquals(messages[0] == flood ? 0 : 1, delivered.get() - deliveredBefore); + assertEquals(0, halfClosed.get()); + assertEquals(rejected + 1, rejections(name, Reason.OVER_BUDGET), 0); + } } finally { parameter.metricsPrometheusEnable = metrics; } - assertEquals(before, HANDLER_CALLS.get()); - awaitTrue(() -> STARTED.get() == FINISHED.get()); } @Test @@ -596,25 +626,6 @@ private static Transaction legitimate() { return Transaction.newBuilder().addSignature(ByteString.copyFrom(new byte[65])).build(); } - private static Status rawUnaryCall(List messages) throws Exception { - ClientCall call = channel.newCall( - WalletGrpc.getBroadcastTransactionMethod(), - CallOptions.DEFAULT.withDeadlineAfter(DEADLINE_SECONDS, TimeUnit.SECONDS)); - CompletableFuture closed = new CompletableFuture<>(); - call.start(new ClientCall.Listener() { - @Override - public void onClose(Status status, Metadata trailers) { - closed.complete(status); - } - }, new Metadata()); - call.request(1); - for (Transaction message : messages) { - call.sendMessage(message); - } - call.halfClose(); - return closed.get(DEADLINE_SECONDS, TimeUnit.SECONDS); - } - private static final MethodDescriptor.Marshaller RAW = new MethodDescriptor.Marshaller() { @Override From c449c05d214c10a09f77f976e301a28157b7ec5f Mon Sep 17 00:00:00 2001 From: 317787106 <317787106@qq.com> Date: Tue, 27 Oct 2026 18:35:30 +0800 Subject: [PATCH 4/8] build(protocol): verify Linux ARM64 gRPC generator --- gradle/verification-metadata.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 63409578f8d..df8177bace2 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1302,6 +1302,9 @@ + + + From fa87451b61601e967fe52416331d1dd7357d931e Mon Sep 17 00:00:00 2001 From: 317787106 <317787106@qq.com> Date: Tue, 27 Oct 2026 18:43:22 +0800 Subject: [PATCH 5/8] build(deps): remove obsolete gRPC and Netty checksums --- gradle/verification-metadata.xml | 195 ------------------------------- 1 file changed, 195 deletions(-) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index df8177bace2..5600d7a7857 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1135,14 +1135,6 @@ - - - - - - - - @@ -1151,14 +1143,6 @@ - - - - - - - - @@ -1167,14 +1151,6 @@ - - - - - - - - @@ -1183,14 +1159,6 @@ - - - - - - - - @@ -1199,14 +1167,6 @@ - - - - - - - - @@ -1215,14 +1175,6 @@ - - - - - - - - @@ -1231,14 +1183,6 @@ - - - - - - - - @@ -1247,14 +1191,6 @@ - - - - - - - - @@ -1263,14 +1199,6 @@ - - - - - - - - @@ -1287,20 +1215,6 @@ - - - - - - - - - - - - - - @@ -1312,14 +1226,6 @@ - - - - - - - - @@ -1336,14 +1242,6 @@ - - - - - - - - @@ -1360,14 +1258,6 @@ - - - - - - - - @@ -1376,14 +1266,6 @@ - - - - - - - - @@ -1392,14 +1274,6 @@ - - - - - - - - @@ -1408,14 +1282,6 @@ - - - - - - - - @@ -1424,14 +1290,6 @@ - - - - - - - - @@ -1440,14 +1298,6 @@ - - - - - - - - @@ -1464,14 +1314,6 @@ - - - - - - - - @@ -1480,14 +1322,6 @@ - - - - - - - - @@ -1496,11 +1330,6 @@ - - - - - @@ -1511,14 +1340,6 @@ - - - - - - - - @@ -1535,14 +1356,6 @@ - - - - - - - - @@ -1559,14 +1372,6 @@ - - - - - - - - From 24f2c8d1bf7d1cca8c07d6ea49345b49aa504642 Mon Sep 17 00:00:00 2001 From: 317787106 <317787106@qq.com> Date: Tue, 27 Oct 2026 21:53:19 +0800 Subject: [PATCH 6/8] use netty-bom to bind 4.2.19.Final --- build.gradle | 7 +- gradle/verification-metadata.xml | 116 ++++++++++--------------------- p2p/build.gradle | 1 + protocol/build.gradle | 1 + 4 files changed, 42 insertions(+), 83 deletions(-) diff --git a/build.gradle b/build.gradle index 6f6481bd0f5..15572946b36 100644 --- a/build.gradle +++ b/build.gradle @@ -8,11 +8,8 @@ plugins { ext { grpcVersion = "1.85.1" // Netty 4.2 split io.netty.handler.codec.protobuf out of netty-codec into its - // own artifact. Both :framework and :p2p put the varint32 framing codecs on - // their channel pipelines and so must declare it explicitly. Netty itself - // arrives transitively through grpc-netty, so this version has to move with - // grpcVersion above — keeping it here makes that coupling visible instead of - // leaving two literals to drift apart. + // own artifact. :framework and :p2p declare that codec directly, while the + // Netty BOM in :protocol and :p2p aligns the modules brought in by grpc-netty. nettyVersion = "4.2.19.Final" // Shared by :protocol and :p2p, which both generate from .proto files. protobufVersion = "3.25.8" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 5600d7a7857..a02669a2f8e 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1226,12 +1226,9 @@ - - - - - - + + + @@ -1242,14 +1239,6 @@ - - - - - - - - @@ -1258,28 +1247,28 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -1290,20 +1279,12 @@ - - - + + + - - - - - - - - - - + + @@ -1314,25 +1295,20 @@ - - - + + + - - + + - - - + + + - - - - - - - + + @@ -1340,14 +1316,6 @@ - - - - - - - - @@ -1356,14 +1324,6 @@ - - - - - - - - @@ -1372,12 +1332,12 @@ - - - + + + - - + + diff --git a/p2p/build.gradle b/p2p/build.gradle index 80290d1b1ed..42d77b7fe57 100644 --- a/p2p/build.gradle +++ b/p2p/build.gradle @@ -82,6 +82,7 @@ configurations.configureEach { } dependencies { + implementation platform("io.netty:netty-bom:${rootProject.nettyVersion}") // protobuf & grpc (implementation scope: not leaked to consumers) implementation "com.google.protobuf:protobuf-java:${rootProject.protobufVersion}" implementation "com.google.protobuf:protobuf-java-util:${rootProject.protobufVersion}" diff --git a/protocol/build.gradle b/protocol/build.gradle index 741f887c8ed..f199640c74e 100644 --- a/protocol/build.gradle +++ b/protocol/build.gradle @@ -4,6 +4,7 @@ apply from: 'protoLint.gradle' dependencies { api group: 'com.google.protobuf', name: 'protobuf-java', version: rootProject.protobufVersion + api platform("io.netty:netty-bom:${rootProject.nettyVersion}") // checkstyleConfig "com.puppycrawl.tools:checkstyle:${versions.checkstyle}" // google grpc From 2635ee37e2dd006657926e6f161d434cb0c90e89 Mon Sep 17 00:00:00 2001 From: 317787106 <317787106@qq.com> Date: Tue, 27 Oct 2026 23:16:07 +0800 Subject: [PATCH 7/8] build(deps): verify macOS x86 gRPC generator --- gradle/verification-metadata.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index a02669a2f8e..c6c788379a9 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1222,6 +1222,9 @@ + + + From 7e0dd0e8988453889b70200c366e35351ba0217f Mon Sep 17 00:00:00 2001 From: 317787106 <317787106@qq.com> Date: Tue, 27 Oct 2026 23:34:37 +0800 Subject: [PATCH 8/8] build(deps): use gRPC 1.85.0 and restore transport test --- build.gradle | 2 +- .../application/RpcServiceAdmissionTest.java | 77 ++++++------- gradle/verification-metadata.xml | 108 +++++++++--------- 3 files changed, 88 insertions(+), 99 deletions(-) diff --git a/build.gradle b/build.gradle index 15572946b36..a5ac0dbf687 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { } ext { - grpcVersion = "1.85.1" + grpcVersion = "1.85.0" // Netty 4.2 split io.netty.handler.codec.protobuf out of netty-codec into its // own artifact. :framework and :p2p declare that codec directly, while the // Netty BOM in :protocol and :p2p aligns the modules brought in by grpc-netty. diff --git a/framework/src/test/java/org/tron/common/application/RpcServiceAdmissionTest.java b/framework/src/test/java/org/tron/common/application/RpcServiceAdmissionTest.java index 89295a76e78..b556a23d3c6 100644 --- a/framework/src/test/java/org/tron/common/application/RpcServiceAdmissionTest.java +++ b/framework/src/test/java/org/tron/common/application/RpcServiceAdmissionTest.java @@ -66,8 +66,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; import org.tron.api.DatabaseGrpc; import org.tron.api.GrpcAPI; import org.tron.api.MonitorGrpc; @@ -391,58 +389,30 @@ public void anyMethodRejectsOverBudgetRequestsAndCountsEachRejectionOnce() throw } @Test - @SuppressWarnings("unchecked") public void laterMessagesOnARejectedUnaryCallAreIgnored() throws Exception { Transaction flood = Transaction.parseFrom(retFlood(BUDGET + 1)); - AtomicInteger delivered = new AtomicInteger(); - AtomicInteger halfClosed = new AtomicInteger(); - ServerMethodDefinition guarded = GuardedRequestMarshaller.guard( - ServerMethodDefinition.create(WalletGrpc.getBroadcastTransactionMethod(), - (call, headers) -> new ServerCall.Listener() { - @Override - public void onMessage(Transaction message) { - delivered.incrementAndGet(); - } - - @Override - public void onHalfClose() { - halfClosed.incrementAndGet(); - } - }), MAX_MESSAGE, BUDGET); - GuardedRequestMarshaller marshaller = - (GuardedRequestMarshaller) guarded.getMethodDescriptor() - .getRequestMarshaller(); - - // A unary client cannot reliably send multiple messages after the server closes the call. - // Exercise the server listener directly to verify its behavior on later messages. + int before = HANDLER_CALLS.get(); + // A unary call that carries a rejected message followed by a valid one. + assertEquals(Status.Code.INVALID_ARGUMENT, + rawUnaryCall(Arrays.asList(flood, legitimate())).getCode()); + // A valid message followed by a rejected one. + assertEquals(Status.Code.INVALID_ARGUMENT, + rawUnaryCall(Arrays.asList(legitimate(), flood)).getCode()); + // Two rejected messages: one rejection, counted once. CommonParameter parameter = CommonParameter.getInstance(); boolean metrics = parameter.metricsPrometheusEnable; parameter.metricsPrometheusEnable = true; try { String name = WalletGrpc.getBroadcastTransactionMethod().getFullMethodName(); - for (Transaction[] messages : new Transaction[][] { - {flood, legitimate()}, {legitimate(), flood}, {flood, flood}}) { - double rejected = rejections(name, Reason.OVER_BUDGET); - int deliveredBefore = delivered.get(); - ServerCall call = Mockito.mock(ServerCall.class); - Mockito.when(call.getMethodDescriptor()).thenReturn(guarded.getMethodDescriptor()); - ServerCall.Listener listener = - guarded.getServerCallHandler().startCall(call, new Metadata()); - for (Transaction message : messages) { - listener.onMessage(marshaller.parse(new ByteArrayInputStream(message.toByteArray()))); - } - listener.onHalfClose(); - - ArgumentCaptor status = ArgumentCaptor.forClass(Status.class); - Mockito.verify(call).close(status.capture(), Mockito.any(Metadata.class)); - assertEquals(Status.Code.INVALID_ARGUMENT, status.getValue().getCode()); - assertEquals(messages[0] == flood ? 0 : 1, delivered.get() - deliveredBefore); - assertEquals(0, halfClosed.get()); - assertEquals(rejected + 1, rejections(name, Reason.OVER_BUDGET), 0); - } + double rejected = rejections(name, Reason.OVER_BUDGET); + assertEquals(Status.Code.INVALID_ARGUMENT, + rawUnaryCall(Arrays.asList(flood, flood)).getCode()); + assertEquals(rejected + 1, rejections(name, Reason.OVER_BUDGET), 0); } finally { parameter.metricsPrometheusEnable = metrics; } + assertEquals(before, HANDLER_CALLS.get()); + awaitTrue(() -> STARTED.get() == FINISHED.get()); } @Test @@ -626,6 +596,25 @@ private static Transaction legitimate() { return Transaction.newBuilder().addSignature(ByteString.copyFrom(new byte[65])).build(); } + private static Status rawUnaryCall(List messages) throws Exception { + ClientCall call = channel.newCall( + WalletGrpc.getBroadcastTransactionMethod(), + CallOptions.DEFAULT.withDeadlineAfter(DEADLINE_SECONDS, TimeUnit.SECONDS)); + CompletableFuture closed = new CompletableFuture<>(); + call.start(new ClientCall.Listener() { + @Override + public void onClose(Status status, Metadata trailers) { + closed.complete(status); + } + }, new Metadata()); + call.request(1); + for (Transaction message : messages) { + call.sendMessage(message); + } + call.halfClose(); + return closed.get(DEADLINE_SECONDS, TimeUnit.SECONDS); + } + private static final MethodDescriptor.Marshaller RAW = new MethodDescriptor.Marshaller() { @Override diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index c6c788379a9..8c814d2586d 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1135,76 +1135,76 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -1215,18 +1215,18 @@ - - - + + + - - + + - - + + - - + +