diff --git a/.circleci/config.yml b/.circleci/config.yml index a964f4d3be..45aa3beb28 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ orbs: executors: besu_executor_med: # 2cpu, 4G ram docker: - - image: cimg/openjdk:17.0 + - image: cimg/openjdk:21.0 resource_class: medium working_directory: ~/project environment: @@ -24,7 +24,7 @@ executors: besu_executor_xl: # 8cpu, 16G ram docker: - - image: cimg/openjdk:17.0 + - image: cimg/openjdk:21.0 resource_class: xlarge working_directory: ~/project environment: diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 38a4272bdc..161d5d6da2 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -34,7 +34,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: Install required packages run: sudo apt-get install -y xmlstarlet - name: setup gradle diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0a50ec57c2..e7a13e92d4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -33,7 +33,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: 'temurin' - java-version: 17 + java-version: 21 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@2f93e4319b2f04a2efc38fa7f78bd681bc3f7b2f diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 66537919f9..b9bb3d9597 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -17,7 +17,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -67,7 +67,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -106,7 +106,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 8a60d09017..171ddeb85e 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -29,7 +29,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: diff --git a/.github/workflows/pre-review.yml b/.github/workflows/pre-review.yml index ce7d0e7c13..0a5b3edf91 100644 --- a/.github/workflows/pre-review.yml +++ b/.github/workflows/pre-review.yml @@ -45,7 +45,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: Setup Gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -65,7 +65,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: Setup Gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -93,7 +93,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: Install required packages run: sudo apt-get install -y xmlstarlet - name: Setup Gradle diff --git a/.github/workflows/reference-tests.yml b/.github/workflows/reference-tests.yml index 84123b226d..4e458e057e 100644 --- a/.github/workflows/reference-tests.yml +++ b/.github/workflows/reference-tests.yml @@ -34,8 +34,8 @@ jobs: - name: Set up Java uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: - distribution: adopt-openj9 - java-version: 17 + distribution: semeru # IBM Semeru with OpenJ9 + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd34bb1239..496691293d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,11 +19,11 @@ jobs: steps: - name: checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - name: Set up JDK 17 + - name: Set up Java uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: - distribution: 'temurin' - java-version: '17' + distribution: temurin + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -60,8 +60,8 @@ jobs: - name: Set up Java uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: - distribution: adopt - java-version: 17 + distribution: temurin + java-version: 21 - name: Download zip uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe with: @@ -108,11 +108,11 @@ jobs: steps: - name: checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - name: Set up JDK 17 + - name: Set up Java uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: - distribution: 'temurin' - java-version: '17' + distribution: temurin + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -132,7 +132,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -174,7 +174,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -214,7 +214,7 @@ jobs: uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: distribution: temurin - java-version: 17 + java-version: 21 - name: setup gradle uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 with: @@ -248,8 +248,8 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: - distribution: 'temurin' # See 'Supported distributions' for available options - java-version: '17' + distribution: temurin + java-version: 21 cache: gradle - name: login to ${{ env.registry }} uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9f70e69917..7549656d22 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -17,11 +17,11 @@ jobs: steps: - name: checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - name: Set up JDK 17 + - name: Set up Java uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: - distribution: 'temurin' - java-version: '17' + distribution: temurin + java-version: 21 - name: Cache SonarCloud packages uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 49d4319130..666712e450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Next Release ### Breaking Changes +- Java 21 has been enforced as minimum version to build and run Besu. ### Additions and Improvements - Add two counters to DefaultBlockchain in order to be able to calculate TPS and Mgas/s [#7105](https://github.com/hyperledger/besu/pull/7105) diff --git a/besu/src/main/java/org/hyperledger/besu/services/BlockchainServiceImpl.java b/besu/src/main/java/org/hyperledger/besu/services/BlockchainServiceImpl.java index 5005e5f7cc..d9e5dbb9ef 100644 --- a/besu/src/main/java/org/hyperledger/besu/services/BlockchainServiceImpl.java +++ b/besu/src/main/java/org/hyperledger/besu/services/BlockchainServiceImpl.java @@ -42,6 +42,9 @@ public class BlockchainServiceImpl implements BlockchainService { private ProtocolSchedule protocolSchedule; private MutableBlockchain blockchain; + /** Instantiates a new Blockchain service implementation. */ + public BlockchainServiceImpl() {} + /** * Instantiates a new Blockchain service. * diff --git a/build.gradle b/build.gradle index 74c06e8fe3..905e8b2c8a 100644 --- a/build.gradle +++ b/build.gradle @@ -47,8 +47,8 @@ sonarqube { project.tasks["sonarqube"].dependsOn "jacocoRootReport" -if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) { - throw new GradleException("Java 17 or later is required to build Besu.\n" + +if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) { + throw new GradleException("Java 21 or later is required to build Besu.\n" + " Detected version ${JavaVersion.current()}") } @@ -125,7 +125,7 @@ allprojects { version = calculateVersion() jacoco { - toolVersion = '0.8.8' + toolVersion = '0.8.11' if (project.tasks.findByName('referenceTests')) { applyTo referenceTests } @@ -144,8 +144,8 @@ allprojects { tasks.build { dependsOn 'javadoc' } - sourceCompatibility = 17 - targetCompatibility = 17 + sourceCompatibility = 21 + targetCompatibility = 21 repositories { maven { diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncAlgSpec.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncAlgSpec.java index 56e3324b7f..bd5a9e7ec9 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncAlgSpec.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncAlgSpec.java @@ -189,7 +189,7 @@ public class BackwardSyncAlgSpec { completionCaptor.getValue().onInitialSyncCompleted(); - voidCompletableFuture.get(500, TimeUnit.MILLISECONDS); + voidCompletableFuture.get(800, TimeUnit.MILLISECONDS); assertThat(voidCompletableFuture).isCompleted(); verify(context.getSyncState()).unsubscribeTTDReached(88L); diff --git a/ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPInput.java b/ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPInput.java index fba43e2a1c..b31184ab5e 100644 --- a/ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPInput.java +++ b/ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPInput.java @@ -50,8 +50,7 @@ import org.apache.tuweni.units.bigints.UInt64; * word, a method like {@link #readLongScalar()} does not expect an encoded value of exactly 8 bytes * (by opposition to {@link #readLong}), but rather one that is "up to" 8 bytes. * - * @see BytesValueRLPInput for a {@link RLPInput} that decode an RLP encoded value stored in a - * {@link Bytes}. + * @see BytesValueRLPInput */ public interface RLPInput { diff --git a/evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java b/evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java index 9b6f4884c6..7ac0b4aaf4 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java @@ -1427,6 +1427,9 @@ public class MessageFrame { private Optional> versionedHashes = Optional.empty(); + /** Instantiates a new Builder. */ + public Builder() {} + /** * The "parent" message frame. When present some fields will be populated from the parent and * ignored if passed in via builder diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 55df990331..253868aa36 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -4746,41 +4746,41 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + - - - + + + - - + + @@ -5637,6 +5637,14 @@ + + + + + + + + @@ -5645,6 +5653,14 @@ + + + + + + + + diff --git a/services/tasks/src/main/java/org/hyperledger/besu/services/tasks/InMemoryTaskQueue.java b/services/tasks/src/main/java/org/hyperledger/besu/services/tasks/InMemoryTaskQueue.java index 0d743cac24..fa125be738 100644 --- a/services/tasks/src/main/java/org/hyperledger/besu/services/tasks/InMemoryTaskQueue.java +++ b/services/tasks/src/main/java/org/hyperledger/besu/services/tasks/InMemoryTaskQueue.java @@ -32,6 +32,9 @@ public class InMemoryTaskQueue implements TaskCollection { private final Set> unfinishedOutstandingTasks = new HashSet<>(); private final AtomicBoolean closed = new AtomicBoolean(false); + /** Default constructor. */ + public InMemoryTaskQueue() {} + @Override public synchronized void add(final T taskData) { assertNotClosed(); diff --git a/util/src/main/java/org/hyperledger/besu/util/EndianUtils.java b/util/src/main/java/org/hyperledger/besu/util/EndianUtils.java index 025eeea7ab..b80d27216a 100644 --- a/util/src/main/java/org/hyperledger/besu/util/EndianUtils.java +++ b/util/src/main/java/org/hyperledger/besu/util/EndianUtils.java @@ -18,6 +18,7 @@ package org.hyperledger.besu.util; public class EndianUtils { // next two methods adopted from: // https://github.com/bcgit/bc-java/blob/master/core/src/main/java/org/bouncycastle/util/Pack.java + private EndianUtils() {} /** * Long to big endian. diff --git a/util/src/main/java/org/hyperledger/besu/util/FutureUtils.java b/util/src/main/java/org/hyperledger/besu/util/FutureUtils.java index c75d97ee31..ea82306528 100644 --- a/util/src/main/java/org/hyperledger/besu/util/FutureUtils.java +++ b/util/src/main/java/org/hyperledger/besu/util/FutureUtils.java @@ -25,6 +25,8 @@ import java.util.function.Supplier; /** The Future utils. */ public class FutureUtils { + private FutureUtils() {} + /** * Returns a new CompletionStage that, when the provided stage completes exceptionally, is * executed with the provided stage's exception as the argument to the supplied function. diff --git a/util/src/main/java/org/hyperledger/besu/util/log/LogUtil.java b/util/src/main/java/org/hyperledger/besu/util/log/LogUtil.java index 794acaea64..9c570613f6 100644 --- a/util/src/main/java/org/hyperledger/besu/util/log/LogUtil.java +++ b/util/src/main/java/org/hyperledger/besu/util/log/LogUtil.java @@ -28,6 +28,8 @@ public class LogUtil { static final String BESU_NAMESPACE = "org.hyperledger.besu"; static final int MAX_SUMMARY_DEPTH = 20; + private LogUtil() {} + /** * Throttles logging to a given logger. * diff --git a/util/src/main/java/org/hyperledger/besu/util/platform/PlatformDetector.java b/util/src/main/java/org/hyperledger/besu/util/platform/PlatformDetector.java index 1367c72106..ece589bb1a 100644 --- a/util/src/main/java/org/hyperledger/besu/util/platform/PlatformDetector.java +++ b/util/src/main/java/org/hyperledger/besu/util/platform/PlatformDetector.java @@ -43,6 +43,8 @@ public class PlatformDetector { private static String _glibc; private static String _jemalloc; + private PlatformDetector() {} + /** * Gets OS type. *