From 7e61f74ff79ae845a262dc2f6f09a6cce9761780 Mon Sep 17 00:00:00 2001 From: Stefan Pingel <16143240+pinges@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:03:56 +1000 Subject: [PATCH 1/9] Add requests root to empty block check (#7785) * add requests root to empty block check and move it to BlockHeader Signed-off-by: stefan.pingel@consensys.net --- .../hyperledger/besu/ethereum/core/BlockHeader.java | 13 +++++++++++++ .../ethereum/eth/sync/tasks/CompleteBlocksTask.java | 12 +----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java index 42f99fafb6..7ff841280d 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java @@ -92,6 +92,19 @@ public class BlockHeader extends SealableBlockHeader this.parsedExtraData = Suppliers.memoize(() -> blockHeaderFunctions.parseExtraData(this)); } + public static boolean hasEmptyBlock(final BlockHeader blockHeader) { + return blockHeader.getOmmersHash().equals(Hash.EMPTY_LIST_HASH) + && blockHeader.getTransactionsRoot().equals(Hash.EMPTY_TRIE_HASH) + && blockHeader + .getWithdrawalsRoot() + .map(wsRoot -> wsRoot.equals(Hash.EMPTY_TRIE_HASH)) + .orElse(true) + && blockHeader + .getRequestsRoot() + .map(reqRoot -> reqRoot.equals(Hash.EMPTY_TRIE_HASH)) + .orElse(true); + } + /** * Returns the block mixed hash. * diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/CompleteBlocksTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/CompleteBlocksTask.java index 524851af5f..ec679e53a1 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/CompleteBlocksTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/CompleteBlocksTask.java @@ -19,7 +19,6 @@ import static java.util.Collections.emptyList; import static java.util.concurrent.CompletableFuture.completedFuture; import static java.util.stream.Collectors.toMap; -import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; @@ -75,7 +74,7 @@ public class CompleteBlocksTask extends AbstractRetryingPeerTask> { this.headers = headers; this.blocks = headers.stream() - .filter(this::hasEmptyBody) + .filter(BlockHeader::hasEmptyBlock) .collect( toMap( BlockHeader::getNumber, @@ -102,15 +101,6 @@ public class CompleteBlocksTask extends AbstractRetryingPeerTask> { return protocolSchedule.getByBlockHeader(header).getWithdrawalsProcessor().isPresent(); } - private boolean hasEmptyBody(final BlockHeader header) { - return header.getOmmersHash().equals(Hash.EMPTY_LIST_HASH) - && header.getTransactionsRoot().equals(Hash.EMPTY_TRIE_HASH) - && header - .getWithdrawalsRoot() - .map(wsRoot -> wsRoot.equals(Hash.EMPTY_TRIE_HASH)) - .orElse(true); - } - public static CompleteBlocksTask forHeaders( final ProtocolSchedule protocolSchedule, final EthContext ethContext, From 937c25acdd1389f892fc1884db170d050f5dfb1e Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Mon, 21 Oct 2024 11:49:06 +0200 Subject: [PATCH 2/9] Update Java dependencies (#7786) Signed-off-by: Fabio Di Fabio --- CHANGELOG.md | 1 + build.gradle | 1 - gradle/verification-metadata.xml | 2142 +++++++++-------- .../nat/kubernetes/KubernetesNatManager.java | 2 +- platform/build.gradle | 53 +- 5 files changed, 1127 insertions(+), 1072 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2234201da3..f862ed866f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Additions and Improvements - Fine tune already seen txs tracker when a tx is removed from the pool [#7755](https://github.com/hyperledger/besu/pull/7755) - Create and publish Besu BOM (Bill of Materials) [#7615](https://github.com/hyperledger/besu/pull/7615) +- Update Java dependencies [#7786](https://github.com/hyperledger/besu/pull/7786) ### Bug fixes diff --git a/build.gradle b/build.gradle index de8f3e23d1..b3a29ac656 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,6 @@ import java.util.regex.Pattern plugins { id 'com.diffplug.spotless' version '6.25.0' - id 'com.github.ben-manes.versions' version '0.51.0' id 'com.github.jk1.dependency-license-report' version '2.9' id 'com.jfrog.artifactory' version '5.2.5' id 'me.champeau.jmh' version '0.7.2' apply false diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 507b031b58..0c72f91416 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -17,6 +17,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -114,6 +143,11 @@ + + + + + @@ -139,9 +173,9 @@ - - - + + + @@ -174,6 +208,11 @@ + + + + + @@ -194,6 +233,11 @@ + + + + + @@ -223,12 +267,12 @@ - - - + + + - - + + @@ -260,12 +304,12 @@ - - - + + + - - + + @@ -302,12 +346,25 @@ - - - + + + - - + + + + + + + + + + + + + + + @@ -315,15 +372,25 @@ - - - + + + + + + - - + + - - + + + + + + + + + @@ -331,20 +398,20 @@ - - - + + + - - - + + + - - + + - - + + @@ -352,15 +419,15 @@ - - - + + + - - + + - - + + @@ -368,17 +435,9 @@ - - - - - - - - - - - + + + @@ -392,11 +451,6 @@ - - - - - @@ -618,17 +672,17 @@ - - - + + + - - + + - - - + + + @@ -639,6 +693,14 @@ + + + + + + + + @@ -736,6 +798,14 @@ + + + + + + + + @@ -752,6 +822,11 @@ + + + + + @@ -783,14 +858,6 @@ - - - - - - - - @@ -804,11 +871,6 @@ - - - - - @@ -1013,15 +1075,15 @@ - - - + + + - - + + - - + + @@ -1049,9 +1111,9 @@ - - - + + + @@ -1109,26 +1171,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -1139,43 +1181,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1192,26 +1197,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -1246,12 +1231,12 @@ - - - + + + - - + + @@ -1302,6 +1287,14 @@ + + + + + + + + @@ -1310,6 +1303,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1350,33 +1375,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1420,11 +1418,6 @@ - - - - - @@ -1433,11 +1426,6 @@ - - - - - @@ -1538,6 +1526,14 @@ + + + + + + + + @@ -1546,6 +1542,11 @@ + + + + + @@ -1591,12 +1592,12 @@ - - - + + + - - + + @@ -1628,9 +1629,15 @@ - - - + + + + + + + + + @@ -1673,230 +1680,230 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + @@ -1904,17 +1911,12 @@ - - - - - - + + + - - - - + + @@ -1922,9 +1924,9 @@ - - - + + + @@ -1932,36 +1934,36 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -1969,12 +1971,12 @@ - - - + + + - - + + @@ -1982,68 +1984,68 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -2051,12 +2053,12 @@ - - - + + + - - + + @@ -2064,12 +2066,12 @@ - - - + + + - - + + @@ -2077,20 +2079,20 @@ - - - + + + - - + + - - - + + + - - + + @@ -2098,9 +2100,9 @@ - - - + + + @@ -2108,12 +2110,12 @@ - - - + + + - - + + @@ -2121,52 +2123,57 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - + + - - - - - - + + + - - + + - - - + + + + + + + + + + + @@ -2174,28 +2181,28 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -2203,21 +2210,21 @@ - - - + + + - - + + - - + + - - + + - - + + @@ -2225,18 +2232,18 @@ - - - + + + - - + + - - + + - - + + @@ -2244,36 +2251,36 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -2292,174 +2299,174 @@ - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + @@ -2470,28 +2477,28 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -2502,15 +2509,15 @@ - - - + + + - - + + - - + + @@ -2709,17 +2716,17 @@ - - - + + + - - + + - - - + + + @@ -2818,54 +2825,54 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -2878,33 +2885,33 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -2912,59 +2919,59 @@ - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -2975,6 +2982,14 @@ + + + + + + + + @@ -2993,6 +3008,19 @@ + + + + + + + + + + + + + @@ -3009,6 +3037,14 @@ + + + + + + + + @@ -3046,20 +3082,20 @@ - - - + + + - - + + - - - + + + - - + + @@ -3067,9 +3103,9 @@ - - - + + + @@ -3082,12 +3118,12 @@ - - - + + + - - + + @@ -3098,6 +3134,14 @@ + + + + + + + + @@ -3132,6 +3176,14 @@ + + + + + + + + @@ -3140,6 +3192,14 @@ + + + + + + + + @@ -3148,6 +3208,11 @@ + + + + + @@ -3284,11 +3349,6 @@ - - - - - @@ -3410,11 +3470,6 @@ - - - - - @@ -3450,6 +3505,11 @@ + + + + + @@ -3471,6 +3531,19 @@ + + + + + + + + + + + + + @@ -3479,6 +3552,11 @@ + + + + + @@ -3549,9 +3627,9 @@ - - - + + + @@ -3564,9 +3642,9 @@ - - - + + + @@ -3574,17 +3652,17 @@ - - - + + + - - + + - - - + + + @@ -3592,46 +3670,46 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + - - - + + + @@ -3716,20 +3794,12 @@ - - - - - - - - - - - + + + - - + + @@ -3740,11 +3810,6 @@ - - - - - @@ -3812,11 +3877,6 @@ - - - - - @@ -3887,6 +3947,11 @@ + + + + + @@ -3993,11 +4058,6 @@ - - - - - @@ -5190,14 +5250,6 @@ - - - - - - - - @@ -5211,11 +5263,6 @@ - - - - - @@ -5451,6 +5498,14 @@ + + + + + + + + @@ -5475,6 +5530,14 @@ + + + + + + + + @@ -5531,26 +5594,26 @@ - - - + + + - - + + - - + + - - - + + + - - + + - - + + @@ -5561,15 +5624,15 @@ - - - + + + - - + + - - + + @@ -5580,26 +5643,26 @@ - - - + + + - - + + - - + + - - - + + + - - + + - - + + @@ -5615,23 +5678,23 @@ - - - + + + - - + + - - - + + + - - + + - - + + @@ -5647,12 +5710,12 @@ - - - + + + - - + + @@ -5663,25 +5726,20 @@ - - - + + + - - + + - - - + + + - - - - - - - + + @@ -5723,25 +5781,25 @@ - - - + + + - - - + + + - - + + - - - + + + - - + + @@ -5934,6 +5992,14 @@ + + + + + + + + @@ -6214,12 +6280,12 @@ - - - + + + - - + + @@ -6233,12 +6299,12 @@ - - - + + + - - + + @@ -6262,26 +6328,26 @@ - - - + + + - - + + - - + + - - - + + + - - + + - - + + @@ -6300,15 +6366,15 @@ - - - + + + - - + + - - + + @@ -6319,26 +6385,26 @@ - - - + + + - - + + - - + + - - - + + + - - + + - - + + @@ -6354,15 +6420,15 @@ - - - + + + - - + + - - + + @@ -6373,15 +6439,15 @@ - - - + + + - - + + - - + + @@ -6392,15 +6458,15 @@ - - - + + + - - + + - - + + @@ -6443,12 +6509,12 @@ - - - + + + - - + + @@ -6480,14 +6546,6 @@ - - - - - - - - @@ -6515,15 +6573,15 @@ - - - + + + - - + + - - + + diff --git a/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java b/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java index f8af2bdddb..6a9c02a31c 100644 --- a/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java +++ b/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java @@ -84,7 +84,7 @@ public class KubernetesNatManager extends AbstractNatManager { final V1Service service = api .listServiceForAllNamespaces( - null, null, null, null, null, null, null, null, null, null) + null, null, null, null, null, null, null, null, null, null, null) .getItems() .stream() .filter( diff --git a/platform/build.gradle b/platform/build.gradle index 7234a1006d..e42d3e0774 100644 --- a/platform/build.gradle +++ b/platform/build.gradle @@ -27,17 +27,17 @@ javaPlatform { } dependencies { - api platform('com.fasterxml.jackson:jackson-bom:2.17.2') - api platform('io.grpc:grpc-bom:1.66.0') - api platform('io.netty:netty-bom:4.1.112.Final') - api platform('io.opentelemetry:opentelemetry-bom:1.41.0') + api platform('com.fasterxml.jackson:jackson-bom:2.18.0') + api platform('io.grpc:grpc-bom:1.68.0') + api platform('io.netty:netty-bom:4.1.114.Final') + api platform('io.opentelemetry:opentelemetry-bom:1.43.0') api platform('io.prometheus:simpleclient_bom:0.16.0') - api platform('io.vertx:vertx-stack-depchain:4.5.9') - api platform('org.apache.logging.log4j:log4j-bom:2.23.1') + api platform('io.vertx:vertx-stack-depchain:4.5.10') + api platform('org.apache.logging.log4j:log4j-bom:2.24.1') api platform('org.assertj:assertj-bom:3.26.3') api platform('org.immutables:bom:2.10.1') - api platform('org.junit:junit-bom:5.11.0') - api platform('org.mockito:mockito-bom:5.13.0') + api platform('org.junit:junit-bom:5.11.2') + api platform('org.mockito:mockito-bom:5.14.2') api platform('org.slf4j:slf4j-bom:2.0.16') constraints { @@ -60,39 +60,37 @@ dependencies { api 'com.github.ben-manes.caffeine:caffeine:3.1.8' - api 'org.bitbucket.b_c:jose4j:0.9.4' - - api 'com.github.oshi:oshi-core:6.6.3' + api 'com.github.oshi:oshi-core:6.6.5' api 'com.google.auto.service:auto-service:1.1.1' api 'com.google.dagger:dagger-compiler:2.52' api 'com.google.dagger:dagger:2.52' - api 'com.google.guava:guava:33.3.0-jre' + api 'com.google.guava:guava:33.3.1-jre' api 'com.google.protobuf:protobuf-java:3.25.5' - api 'com.graphql-java:graphql-java:22.2' + api 'com.graphql-java:graphql-java:22.3' api 'com.splunk.logging:splunk-library-javalogging:1.11.8' api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'commons-io:commons-io:2.16.1' + api 'commons-io:commons-io:2.17.0' api 'commons-net:commons-net:3.11.1' - api 'dnsjava:dnsjava:3.6.1' + api 'dnsjava:dnsjava:3.6.2' api 'info.picocli:picocli:4.7.6' api 'info.picocli:picocli-codegen:4.7.6' - api 'io.kubernetes:client-java:18.0.1' + api 'io.kubernetes:client-java:21.0.1-legacy' - api 'io.opentelemetry.instrumentation:opentelemetry-okhttp-3.0:2.7.0-alpha' + api 'io.opentelemetry.instrumentation:opentelemetry-okhttp-3.0:2.9.0-alpha' api 'io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha' - api 'io.opentelemetry.semconv:opentelemetry-semconv:1.27.0-alpha' + api 'io.opentelemetry.semconv:opentelemetry-semconv:1.28.0-alpha' api 'io.opentracing:opentracing-api:0.33.0' api 'io.opentracing:opentracing-util:0.33.0' @@ -113,7 +111,7 @@ dependencies { api 'junit:junit:4.13.2' - api 'net.java.dev.jna:jna:5.14.0' + api 'net.java.dev.jna:jna:5.15.0' api 'org.antlr:antlr4:4.11.1' api 'org.antlr:antlr4-runtime:4.11.1' @@ -123,7 +121,7 @@ dependencies { api 'org.apache.commons:commons-lang3:3.17.0' api 'org.apache.commons:commons-text:1.12.0' - api 'org.apache.maven:maven-artifact:3.9.6' + api 'org.apache.maven:maven-artifact:3.9.9' api 'org.awaitility:awaitility:4.2.2' @@ -146,7 +144,6 @@ dependencies { api 'org.jacoco:org.jacoco.core:0.8.12' api 'org.junit.platform:junit-platform-runner:1.9.2' - api 'org.junit.vintage:junit-vintage-engine:5.10.1' api 'org.jupnp:org.jupnp:3.0.2' api 'org.jupnp:org.jupnp.support:3.0.2' @@ -162,21 +159,21 @@ dependencies { api 'org.springframework.security:spring-security-crypto:6.3.3' - api 'org.testcontainers:testcontainers:1.20.1' + api 'org.testcontainers:testcontainers:1.20.2' api 'org.wiremock:wiremock:3.9.1' - api 'org.web3j:abi:4.12.1' - api 'org.web3j:besu:4.12.1' - api 'org.web3j:core:4.12.1' - api 'org.web3j:crypto:4.12.1' + api 'org.web3j:abi:4.12.2' + api 'org.web3j:besu:4.12.2' + api 'org.web3j:core:4.12.2' + api 'org.web3j:crypto:4.12.2' api 'org.web3j:quorum:4.10.0' - api 'org.xerial.snappy:snappy-java:1.1.10.6' + api 'org.xerial.snappy:snappy-java:1.1.10.7' api 'tech.pegasys:jc-kzg-4844:1.0.0' - api 'tech.pegasys.discovery:discovery:24.6.0' + api 'tech.pegasys.discovery:discovery:24.9.1' } } From 1b0da83f19a11f1f099d5c84f4992714d31e9cc2 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Tue, 22 Oct 2024 06:56:09 +1000 Subject: [PATCH 3/9] use junit5 version of parameterized test (#7789) Signed-off-by: Sally MacFarlane --- .../besu/ForkIdsNetworkConfigTest.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java b/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java index 28d4c77036..5a58091577 100644 --- a/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java +++ b/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java @@ -15,6 +15,7 @@ package org.hyperledger.besu; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -46,20 +47,14 @@ import java.util.stream.Stream; import com.google.common.collect.Streams; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import org.mockito.junit.jupiter.MockitoExtension; -@RunWith(Parameterized.class) +@ExtendWith(MockitoExtension.class) public class ForkIdsNetworkConfigTest { - @Parameterized.Parameter public NetworkName chainName; - - @Parameterized.Parameter(1) - public List expectedForkIds; - - @Parameterized.Parameters(name = "{0}") public static Collection parameters() { return List.of( new Object[] { @@ -149,8 +144,8 @@ public class ForkIdsNetworkConfigTest { final AtomicLong blockNumber = new AtomicLong(); when(mockBlockchain.getChainHeadHeader()).thenReturn(mockBlockHeader); - when(mockBlockHeader.getNumber()).thenAnswer(o -> blockNumber.get()); - when(mockBlockHeader.getTimestamp()).thenAnswer(o -> blockNumber.get()); + lenient().when(mockBlockHeader.getNumber()).thenAnswer(o -> blockNumber.get()); + lenient().when(mockBlockHeader.getTimestamp()).thenAnswer(o -> blockNumber.get()); final ForkIdManager forkIdManager = new ForkIdManager( From d8d1237252bd84fa3d797480e47b20bb4c0e5ff1 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Tue, 22 Oct 2024 10:11:28 +1000 Subject: [PATCH 4/9] [TESTING] remove junit4 assumeThat (#7788) * use junit5 assumeTrue/false Signed-off-by: Sally MacFarlane --------- Signed-off-by: Sally MacFarlane --- .../crypto/SECP256R1AcceptanceTest.java | 4 ++-- .../hyperledger/besu/cli/BesuCommandTest.java | 7 +++---- .../besu/cli/PrivacyOptionsTest.java | 10 ++++------ .../vm/BlockchainReferenceTestTools.java | 17 +++++++---------- .../evm/operation/DataCopyOperationTest.java | 6 +++--- 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/crypto/SECP256R1AcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/crypto/SECP256R1AcceptanceTest.java index 27679463bf..cc2d1a36bc 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/crypto/SECP256R1AcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/crypto/SECP256R1AcceptanceTest.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.tests.acceptance.crypto; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assumptions.assumeThat; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import org.hyperledger.besu.crypto.KeyPair; import org.hyperledger.besu.crypto.SECP256R1; @@ -80,7 +80,7 @@ public class SECP256R1AcceptanceTest extends AcceptanceTestBase { // the signature algorithm instance to SECP256R1 as it could influence other tests running at // the same time. So we only execute the test when ProcessBesuNodeRunner is used, as there is // not conflict because we use separate processes. - assumeThat(BesuNodeRunner.isProcessBesuNodeRunner()).isTrue(); + assumeTrue(BesuNodeRunner.isProcessBesuNodeRunner()); minerNode.verify(net.awaitPeerCount(1)); otherNode.verify(net.awaitPeerCount(1)); diff --git a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java index e5848ee5f3..399b82be12 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java @@ -16,7 +16,6 @@ package org.hyperledger.besu.cli; import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.is; import static org.hyperledger.besu.cli.config.NetworkName.CLASSIC; import static org.hyperledger.besu.cli.config.NetworkName.DEV; import static org.hyperledger.besu.cli.config.NetworkName.EPHEMERY; @@ -33,7 +32,7 @@ import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfigura import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.SEPOLIA_BOOTSTRAP_NODES; import static org.hyperledger.besu.ethereum.p2p.config.DefaultDiscoveryConfiguration.SEPOLIA_DISCOVERY_URL; import static org.hyperledger.besu.plugin.services.storage.DataStorageFormat.BONSAI; -import static org.junit.Assume.assumeThat; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.contains; import static org.mockito.ArgumentMatchers.eq; @@ -2392,7 +2391,7 @@ public class BesuCommandTest extends CommandTestAbstract { @Test public void logsWarningWhenFailToLoadJemalloc() { - assumeThat(PlatformDetector.getOSType(), is("linux")); + assumeTrue(PlatformDetector.getOSType().equals("linux")); setEnvironmentVariable("BESU_USING_JEMALLOC", "true"); parseCommand(); verify(mockLogger) @@ -2404,7 +2403,7 @@ public class BesuCommandTest extends CommandTestAbstract { @Test public void logsSuggestInstallingJemallocWhenEnvVarNotPresent() { - assumeThat(PlatformDetector.getOSType(), is("linux")); + assumeTrue(PlatformDetector.getOSType().equals("linux")); parseCommand(); verify(mockLogger) .info("jemalloc library not found, memory usage may be reduced by installing it"); diff --git a/besu/src/test/java/org/hyperledger/besu/cli/PrivacyOptionsTest.java b/besu/src/test/java/org/hyperledger/besu/cli/PrivacyOptionsTest.java index af43535a8f..6a2c376436 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/PrivacyOptionsTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/PrivacyOptionsTest.java @@ -16,8 +16,7 @@ package org.hyperledger.besu.cli; import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.startsWith; -import static org.junit.Assume.assumeThat; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -415,10 +414,9 @@ public class PrivacyOptionsTest extends CommandTestAbstract { @Test public void privEnclaveKeyFileDoesNotExist() { - assumeThat( - "Ignored if system language is not English", - System.getProperty("user.language"), - startsWith("en")); + assumeTrue( + System.getProperty("user.language").startsWith("en"), + "Ignored if system language is not English"); parseCommand("--privacy-enabled=true", "--privacy-public-key-file", "/non/existent/file"); assertThat(commandOutput.toString(UTF_8)).isEmpty(); diff --git a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java index aabc674087..f7a15e5eae 100644 --- a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java +++ b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.ethereum.vm; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assumptions.assumeThat; +import static org.junit.jupiter.api.Assumptions.assumeFalse; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; @@ -148,18 +148,15 @@ public class BlockchainReferenceTestTools { } static void verifyJournaledEVMAccountCompatability( - final MutableWorldState worldState, final ProtocolSpec protocolSpec) { + final MutableWorldState worldState, final ProtocolSpec protocolSpec) { EVM evm = protocolSpec.getEvm(); if (evm.getEvmConfiguration().worldUpdaterMode() == WorldUpdaterMode.JOURNALED) { - assumeThat( + assumeFalse( worldState - .streamAccounts(Bytes32.ZERO, Integer.MAX_VALUE) - .anyMatch(AccountState::isEmpty)) - .withFailMessage("Journaled account configured and empty account detected") - .isFalse(); - assumeThat(EvmSpecVersion.SPURIOUS_DRAGON.compareTo(evm.getEvmVersion()) > 0) - .withFailMessage("Journaled account configured and fork prior to the merge specified") - .isFalse(); + .streamAccounts(Bytes32.ZERO, Integer.MAX_VALUE).anyMatch(AccountState::isEmpty), + "Journaled account configured and empty account detected"); + assumeFalse(EvmSpecVersion.SPURIOUS_DRAGON.compareTo(evm.getEvmVersion()) > 0, + "Journaled account configured and fork prior to the merge specified"); } } } diff --git a/evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java b/evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java index aa2ed37b5c..a4e93bf9d3 100644 --- a/evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java +++ b/evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.evm.operation; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assumptions.assumeThat; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import org.hyperledger.besu.evm.Code; import org.hyperledger.besu.evm.EVM; @@ -136,7 +136,7 @@ class DataCopyOperationTest { "0xef0001010004020001001d04%04x000080000367%016x67%016x67%016xd300%s" .formatted(data.size(), dst, src, len, data.toUnprefixedHexString()); Code code = evm.getCodeUncached(Bytes.fromHexString(eofCode)); - assumeThat(code.isValid()).isTrue(); + assumeTrue(code.isValid()); MessageFrame frame = new TestMessageFrameBuilder() @@ -158,7 +158,7 @@ class DataCopyOperationTest { void legacyCallFails() { DataCopyOperation subject = new DataCopyOperation(new PragueGasCalculator()); Code code = evm.getCodeUncached(Bytes.fromHexString("0x600460046004d3")); - assumeThat(code.isValid()).isTrue(); + assumeTrue(code.isValid()); MessageFrame frame = new TestMessageFrameBuilder() From 73a6042e0b552c62a175295882507c11103af694 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 22 Oct 2024 14:07:11 +1000 Subject: [PATCH 5/9] Update release checklist (#7794) Signed-off-by: Simon Dudley --- .github/ISSUE_TEMPLATE/release-checklist.md | 31 +++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/release-checklist.md b/.github/ISSUE_TEMPLATE/release-checklist.md index 413d68933f..dcf10977f0 100644 --- a/.github/ISSUE_TEMPLATE/release-checklist.md +++ b/.github/ISSUE_TEMPLATE/release-checklist.md @@ -12,25 +12,34 @@ assignees: '' - [ ] Notify maintainers about updating changelog for in-flight PRs - [ ] Optional: for hotfixes, create a release branch and cherry-pick, e.g. `release--hotfix` - [ ] Optional: for hotfixes, create a PR into main from the hotfix branch to see the CI checks pass -- [ ] On the appropriate branch/commit, create a calver tag for the release candidate, format example: `24.4.0-RC2` - - [ ] git tag 24.4.0-RC2 - - [ ] git push upstream 24.4.0-RC2 +- [ ] On the appropriate branch/commit, create a calver tag for the release candidate, format example: `24.4.0-RC1` + - [ ] git tag 24.4.0-RC1 + - [ ] git push upstream 24.4.0-RC1 - [ ] Sign-off with team; announce the tag in #besu-release in Discord - - [ ] Targeting this tag for the burn-in: https://github.com/hyperledger/besu/releases/tag/24.4.0-RC2 + - [ ] Targeting this tag for the burn-in: https://github.com/hyperledger/besu/releases/tag/24.4.0-RC1 - [ ] Consensys staff start burn-in using this tag - [ ] Seek sign off for burn-in - [ ] Pass? Go ahead and complete the release process - [ ] Fail? Put a message in #besu-release in Discord indicating the release will be aborted because it failed burn-in -- [ ] Using the same git sha, create a calver tag for the FULL RELEASE, example format `24.4.0` -- [ ] Using the FULL RELEASE tag, create a release in github to trigger the workflows. Once published: +- [ ] Optional: Perform a dry run with https://github.com/consensys/protocols-release-sandbox to test the workflows + - [ ] Sync fork + - [ ] git checkout + - [ ] git tag 24.4.0 + - [ ] git push origin 24.4.0 + - [ ] Manually run https://github.com/Consensys/protocols-release-sandbox/actions/workflows/draft-release.yml using `main` branch and `24.4.0` tag +- [ ] Back on besu, using the same git sha as 24.4.0-RC1, create a calver tag for the FULL RELEASE, example format `24.4.0` + - [ ] git checkout 24.4.0-RC1 + - [ ] git tag 24.4.0 + - [ ] git push upstream 24.4.0 +- [ ] Manually run https://github.com/hyperledger/besu/actions/workflows/draft-release.yml using `main` branch` and the FULL RELEASE tag name, i.e. `24.4.0`. Note, this workflow should always be run from `main` branch (hotfix tags will still be released even if they were created based on another branch) + - publishes artefacts and version-specific docker tags but does not fully publish the GitHub release so subscribers are not yet notified +- [ ] Check all draft-release workflow jobs went green +- [ ] Check binary SHAs are correct on the release page +- [ ] Update release notes in the GitHub draft release, save draft and sign-off with team +- [ ] Publish draft release ensuring it is marked as latest release (if appropriate) - this is now public and notifies subscribed users - makes the release "latest" in github - - publishes artefacts and version-specific docker tags - publishes the docker `latest` tag variants -- [ ] Check binary SHAs are correct on the release page -- [ ] Check "Container Verify" GitHub workflow has run successfully -- [ ] Update the besu-docs version [update-version workflow](https://github.com/hyperledger/besu-docs/actions/workflows/update-version.yml) - - If the PR has not been automatically created, create the PR manually using the created branch `besu-version-` - [ ] Create homebrew release using [update-version workflow](https://github.com/hyperledger/homebrew-besu/actions/workflows/update-version.yml) - If the PR has not been automatically created, create the PR manually using the created branch `update-` - Run commands `brew tap hyperledger/besu && brew install besu` on MacOSX and verify latest version has been installed From 76060a0416913b711d7b64072e1218622fd0d52f Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Wed, 23 Oct 2024 07:52:51 +1000 Subject: [PATCH 6/9] [TESTING] remove junit4 dependency (#7793) * migrate to junit5 * remove junit4 dep * remove vintage dep Signed-off-by: Sally MacFarlane --------- Signed-off-by: Sally MacFarlane --- acceptance-tests/dsl/build.gradle | 1 - acceptance-tests/test-plugins/build.gradle | 2 -- acceptance-tests/tests/build.gradle | 3 --- .../tests/acceptance/mining/MiningAcceptanceTest.java | 10 +++++----- ethereum/evmtool/build.gradle | 2 -- platform/build.gradle | 2 -- plugins/rocksdb/build.gradle | 2 -- 7 files changed, 5 insertions(+), 17 deletions(-) diff --git a/acceptance-tests/dsl/build.gradle b/acceptance-tests/dsl/build.gradle index 6c9090fe9b..aa5db9ce1e 100644 --- a/acceptance-tests/dsl/build.gradle +++ b/acceptance-tests/dsl/build.gradle @@ -33,7 +33,6 @@ dependencies { implementation 'info.picocli:picocli' implementation 'io.reactivex.rxjava2:rxjava' implementation 'io.vertx:vertx-core' - implementation 'junit:junit' implementation 'io.opentelemetry:opentelemetry-api' implementation 'io.tmio:tuweni-bytes' implementation 'io.tmio:tuweni-io' diff --git a/acceptance-tests/test-plugins/build.gradle b/acceptance-tests/test-plugins/build.gradle index 65a3dc64dc..7c70c52c81 100644 --- a/acceptance-tests/test-plugins/build.gradle +++ b/acceptance-tests/test-plugins/build.gradle @@ -14,8 +14,6 @@ dependencies { testImplementation 'org.assertj:assertj-core' testImplementation 'org.junit.jupiter:junit-jupiter' - - testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' } task testPluginsJar(type: Jar) { diff --git a/acceptance-tests/tests/build.gradle b/acceptance-tests/tests/build.gradle index 809d82957b..e9724151ab 100644 --- a/acceptance-tests/tests/build.gradle +++ b/acceptance-tests/tests/build.gradle @@ -68,7 +68,6 @@ dependencies { testImplementation 'io.opentracing:opentracing-api' testImplementation 'io.opentracing:opentracing-util' testImplementation 'io.vertx:vertx-core' - testImplementation 'junit:junit' testImplementation 'org.apache.commons:commons-compress' testImplementation 'org.apache.logging.log4j:log4j-core' testImplementation 'io.tmio:tuweni-crypto' @@ -81,8 +80,6 @@ dependencies { testImplementation 'org.web3j:core' testImplementation 'org.wiremock:wiremock' testImplementation project(path: ':acceptance-tests:tests:shanghai') - - testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' } test.enabled = false diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/mining/MiningAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/mining/MiningAcceptanceTest.java index 69d6d19d18..a0de84fb3b 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/mining/MiningAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/mining/MiningAcceptanceTest.java @@ -18,21 +18,21 @@ import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; import org.hyperledger.besu.tests.acceptance.dsl.node.Node; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class MiningAcceptanceTest extends AcceptanceTestBase { +class MiningAcceptanceTest extends AcceptanceTestBase { private Node minerNode; - @Before + @BeforeEach public void setUp() throws Exception { minerNode = besu.createMinerNode("miner1"); cluster.start(minerNode); } @Test - public void shouldMineTransactions() { + void shouldMineTransactions() { final Account sender = accounts.createAccount("account1"); final Account receiver = accounts.createAccount("account2"); minerNode.execute(accountTransactions.createTransfer(sender, 50)); diff --git a/ethereum/evmtool/build.gradle b/ethereum/evmtool/build.gradle index c4c83883b5..b62287b0ca 100644 --- a/ethereum/evmtool/build.gradle +++ b/ethereum/evmtool/build.gradle @@ -65,8 +65,6 @@ dependencies { testImplementation 'org.mockito:mockito-core' testImplementation 'org.mockito:mockito-junit-jupiter' - testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' - // No logging in graalvm EvmTool nativeImageClasspath 'org.slf4j:slf4j-nop' } diff --git a/platform/build.gradle b/platform/build.gradle index e42d3e0774..2fda97e866 100644 --- a/platform/build.gradle +++ b/platform/build.gradle @@ -109,8 +109,6 @@ dependencies { api 'io.tmio:tuweni-toml:2.4.2' api 'io.tmio:tuweni-units:2.4.2' - api 'junit:junit:4.13.2' - api 'net.java.dev.jna:jna:5.15.0' api 'org.antlr:antlr4:4.11.1' diff --git a/plugins/rocksdb/build.gradle b/plugins/rocksdb/build.gradle index e5ca782504..d487cf9824 100644 --- a/plugins/rocksdb/build.gradle +++ b/plugins/rocksdb/build.gradle @@ -58,6 +58,4 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.assertj:assertj-core' testImplementation 'org.mockito:mockito-junit-jupiter' - - testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' } From b23fd78da272921b24ea3ca6dc3f7d8e2e04c52e Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Wed, 23 Oct 2024 00:37:26 +0200 Subject: [PATCH 7/9] Add metrics related services to the Besu context for acceptance tests (#7797) Signed-off-by: Fabio Di Fabio --- .../acceptance/dsl/node/ThreadBesuNodeRunner.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index d4334fd93c..42c0df73c7 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -54,6 +54,7 @@ import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMer import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; import org.hyperledger.besu.evm.internal.EvmConfiguration; +import org.hyperledger.besu.metrics.MetricCategoryRegistryImpl; import org.hyperledger.besu.metrics.MetricsSystemModule; import org.hyperledger.besu.metrics.ObservableMetricsSystem; import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration; @@ -71,6 +72,7 @@ import org.hyperledger.besu.plugin.services.StorageService; import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService; import org.hyperledger.besu.plugin.services.TransactionSelectionService; import org.hyperledger.besu.plugin.services.TransactionSimulationService; +import org.hyperledger.besu.plugin.services.metrics.MetricCategoryRegistry; import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin; import org.hyperledger.besu.services.BesuConfigurationImpl; import org.hyperledger.besu.services.BesuEventsImpl; @@ -396,6 +398,12 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { retval.init(blockchain, transactionSimulator); return retval; } + + @Provides + @Singleton + MetricCategoryRegistryImpl provideMetricCategoryRegistry() { + return new MetricCategoryRegistryImpl(); + } } @Module @@ -476,6 +484,8 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { final RpcEndpointServiceImpl rpcEndpointServiceImpl, final BesuConfiguration commonPluginConfiguration, final PermissioningServiceImpl permissioningService, + final MetricCategoryRegistryImpl metricCategoryRegistry, + final MetricsSystem metricsSystem, final @Named("ExtraCLIOptions") List extraCLIOptions, final @Named("RequestedPlugins") List requestedPlugins) { final CommandLine commandLine = new CommandLine(CommandSpec.create()); @@ -492,6 +502,8 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { TransactionSimulationService.class, transactionSimulationServiceImpl); besuPluginContext.addService(BlockchainService.class, blockchainServiceImpl); besuPluginContext.addService(BesuConfiguration.class, commonPluginConfiguration); + besuPluginContext.addService(MetricCategoryRegistry.class, metricCategoryRegistry); + besuPluginContext.addService(MetricsSystem.class, metricsSystem); final Path pluginsPath; final String pluginDir = System.getProperty("besu.plugins.dir"); From 653ebcbd70367227b858807459cb98134f5711e4 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Wed, 23 Oct 2024 11:00:07 +1000 Subject: [PATCH 8/9] switch to junit 5 (#7799) Signed-off-by: Sally MacFarlane --- .../dsl/condition/blockchain/ExpectBlockNotCreated.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/blockchain/ExpectBlockNotCreated.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/blockchain/ExpectBlockNotCreated.java index 4deb1c1ee3..42cab06539 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/blockchain/ExpectBlockNotCreated.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/blockchain/ExpectBlockNotCreated.java @@ -14,7 +14,7 @@ */ package org.hyperledger.besu.tests.acceptance.dsl.condition.blockchain; -import static junit.framework.TestCase.fail; +import static org.junit.jupiter.api.Assertions.fail; import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; import org.hyperledger.besu.tests.acceptance.dsl.node.Node; From d583863225859772559af43dcfa7dcdb804db51c Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Wed, 23 Oct 2024 11:04:11 -0600 Subject: [PATCH 9/9] CALLF and JUMPF rules validation updates (#7787) * Check JUMPF stack Rule 2 in EIP-6206 requires us to check stack prior to JUMPF Signed-off-by: Danno Ferrin * CALLF rule 4 rollback Rule 4 is about return stack, not operand stack Signed-off-by: Danno Ferrin --------- Signed-off-by: Danno Ferrin --- .../hyperledger/besu/evm/operation/CallFOperation.java | 3 +-- .../hyperledger/besu/evm/operation/JumpFOperation.java | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/evm/src/main/java/org/hyperledger/besu/evm/operation/CallFOperation.java b/evm/src/main/java/org/hyperledger/besu/evm/operation/CallFOperation.java index e1eb96f035..65b14fe295 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/operation/CallFOperation.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/operation/CallFOperation.java @@ -54,8 +54,7 @@ public class CallFOperation extends AbstractOperation { int section = code.readBigEndianU16(pc + 1); CodeSection info = code.getCodeSection(section); int operandStackSize = frame.stackSize(); - if (operandStackSize >= 1024 - || operandStackSize > 1024 - info.getMaxStackHeight() + info.getInputs()) { + if (operandStackSize > 1024 - info.getMaxStackHeight() + info.getInputs()) { return callfStackOverflow; } frame.getReturnStack().push(new ReturnStack.ReturnStackItem(frame.getSection(), pc + 2)); diff --git a/evm/src/main/java/org/hyperledger/besu/evm/operation/JumpFOperation.java b/evm/src/main/java/org/hyperledger/besu/evm/operation/JumpFOperation.java index c76caa9667..bda66546d5 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/operation/JumpFOperation.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/operation/JumpFOperation.java @@ -16,6 +16,7 @@ package org.hyperledger.besu.evm.operation; import org.hyperledger.besu.evm.Code; import org.hyperledger.besu.evm.EVM; +import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.gascalculator.GasCalculator; @@ -28,6 +29,9 @@ public class JumpFOperation extends AbstractOperation { /** The Jump F success operation result. */ static final OperationResult jumpfSuccess = new OperationResult(5, null); + static final OperationResult jumpfStackOverflow = + new OperationResult(5, ExceptionalHaltReason.TOO_MANY_STACK_ITEMS); + /** * Instantiates a new Jump F operation. * @@ -46,6 +50,10 @@ public class JumpFOperation extends AbstractOperation { int pc = frame.getPC(); int section = code.readBigEndianU16(pc + 1); var info = code.getCodeSection(section); + int operandStackSize = frame.stackSize(); + if (operandStackSize > 1024 - info.getMaxStackHeight() + info.getInputs()) { + return jumpfStackOverflow; + } frame.setPC(info.getEntryPoint() - 1); // will be +1ed at end of operations loop frame.setSection(section); return jumpfSuccess;