feat!: Java 21 for build and runtime (#7177)

* build: Update jacoco version to 0.8.11
* build: Enforce Java 21 and above check for build
* CI: Use Java 21 in Github CI workflows
* CI: Use Java 21 in circleci workflows
* build: Update gradle verification metadata for jacoco 0.8.11
* refactor: Fix javadoc related warnings which are applicable to Java 21
* fix(test): BackwardSyncAlgSpec slightly increase timeout to pass it in CI

---------

Signed-off-by: Usman Saleem <usman@usmans.info>
pull/7187/head
Usman Saleem 6 months ago committed by GitHub
parent 4fa2592b97
commit 2d59f4dd7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      .circleci/config.yml
  2. 2
      .github/workflows/acceptance-tests.yml
  3. 2
      .github/workflows/codeql.yml
  4. 6
      .github/workflows/develop.yml
  5. 2
      .github/workflows/integration-tests.yml
  6. 6
      .github/workflows/pre-review.yml
  7. 4
      .github/workflows/reference-tests.yml
  8. 26
      .github/workflows/release.yml
  9. 6
      .github/workflows/sonarcloud.yml
  10. 1
      CHANGELOG.md
  11. 3
      besu/src/main/java/org/hyperledger/besu/services/BlockchainServiceImpl.java
  12. 10
      build.gradle
  13. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncAlgSpec.java
  14. 3
      ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPInput.java
  15. 3
      evm/src/main/java/org/hyperledger/besu/evm/frame/MessageFrame.java
  16. 62
      gradle/verification-metadata.xml
  17. 3
      services/tasks/src/main/java/org/hyperledger/besu/services/tasks/InMemoryTaskQueue.java
  18. 1
      util/src/main/java/org/hyperledger/besu/util/EndianUtils.java
  19. 2
      util/src/main/java/org/hyperledger/besu/util/FutureUtils.java
  20. 2
      util/src/main/java/org/hyperledger/besu/util/log/LogUtil.java
  21. 2
      util/src/main/java/org/hyperledger/besu/util/platform/PlatformDetector.java

@ -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:

@ -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

@ -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

@ -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:

@ -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:

@ -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

@ -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:

@ -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

@ -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:

@ -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)

@ -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.
*

@ -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 {

@ -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);

@ -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 {

@ -1427,6 +1427,9 @@ public class MessageFrame {
private Optional<List<VersionedHash>> 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

@ -4746,41 +4746,41 @@
<sha256 value="f1c00e59fb8e446f0710bdc1719e61952f27c1614ae478452c2f0011035322ae" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.agent" version="0.8.8">
<artifact name="org.jacoco.agent-0.8.8.jar">
<sha256 value="072ecbd496896623899a696fff12c01c1615f737616d2792e6d0e10cdf8a610d" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.agent" version="0.8.11">
<artifact name="org.jacoco.agent-0.8.11.jar">
<sha256 value="d3ed85dea78a9ed55846a7738e3a0ca15c702c661ee4bc8cbfe02a8b9f4a99c0" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.agent-0.8.8.pom">
<sha256 value="7dd13c80aff315032983357c650a887d6fdb4c8a8870b207bb4802c49809e7b4" origin="Generated by Gradle"/>
<artifact name="org.jacoco.agent-0.8.11.pom">
<sha256 value="16e05e9f49621b87c53e69350140f3c46d42d966c67a933bdf4b063a2b1c8fc5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.ant" version="0.8.8">
<artifact name="org.jacoco.ant-0.8.8.jar">
<sha256 value="02e33bd2c48dc0be67c2fea84d43beececfd400da6797c58153253d4c30aca15" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.ant" version="0.8.11">
<artifact name="org.jacoco.ant-0.8.11.jar">
<sha256 value="81d7eb8890d9be30a939612c295603541063529cdd03a53265aba74474b70b7c" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.ant-0.8.8.pom">
<sha256 value="fafff75819609030f4626509313c0861428c2c26c8d36e9a8938334a04478909" origin="Generated by Gradle"/>
<artifact name="org.jacoco.ant-0.8.11.pom">
<sha256 value="7ed103d959d0cee7babfb1307fa6e451b1696ffd3527061553b550de55201d85" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.build" version="0.8.8">
<artifact name="org.jacoco.build-0.8.8.pom">
<sha256 value="f4ce0b1285fd24fc6c772f42857298315904dde8fd5677267a0fad5ff9ce2aef" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.build" version="0.8.11">
<artifact name="org.jacoco.build-0.8.11.pom">
<sha256 value="5b84b15cf2eef3e59eb91bc22784833100b09df9911e3319030c3bc648bd8b0b" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.core" version="0.8.8">
<artifact name="org.jacoco.core-0.8.8.jar">
<sha256 value="474c782f809d88924713dfdbf0acb79d330f904be576484803463d0465611643" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.core" version="0.8.11">
<artifact name="org.jacoco.core-0.8.11.jar">
<sha256 value="fcd188c688473fc8dcc0c6caaf355e7b389502243527c33b9597a3ec28791f47" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.core-0.8.8.pom">
<sha256 value="f5fab5a48df823b83c0ea35026032368cc9b81800efb257cc7a5928298fee225" origin="Generated by Gradle"/>
<artifact name="org.jacoco.core-0.8.11.pom">
<sha256 value="bb6135f10a36349cb84a5600fd8cf73fc1296a135b2f14adcd83de8cf24cabb1" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.report" version="0.8.8">
<artifact name="org.jacoco.report-0.8.8.jar">
<sha256 value="2c129110f3e3fcaa1f8179578ea3894586199cb0826be5c7790278084c9622a9" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.report" version="0.8.11">
<artifact name="org.jacoco.report-0.8.11.jar">
<sha256 value="8393295ae24680ed10cad8333907040f928b871332491581ca5bc784e2cb4fbe" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.report-0.8.8.pom">
<sha256 value="5213af2916bb2690be871917d82a0f9c2ba1e88b796a59343fc03df8ae138716" origin="Generated by Gradle"/>
<artifact name="org.jacoco.report-0.8.11.pom">
<sha256 value="8e3b734779d5e3fd683ec015413d52f961984c50cb9045fda2b23bff5eb42381" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.java-websocket" name="Java-WebSocket" version="1.5.3">
@ -5637,6 +5637,14 @@
<sha256 value="02824e839f2a2f0e72959fdd30b4897240f05afc43de42d7ba0b18437601c070" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-commons" version="9.6">
<artifact name="asm-commons-9.6.jar">
<sha256 value="7aefd0d5c0901701c69f7513feda765fb6be33af2ce7aa17c5781fc87657c511" origin="Generated by Gradle"/>
</artifact>
<artifact name="asm-commons-9.6.pom">
<sha256 value="a98ae4895334baf8ff86bd66516210dbd9a03f1a6e15e47dda82afcf6b53d77c" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-tree" version="9.2">
<artifact name="asm-tree-9.2.jar">
<sha256 value="aabf9bd23091a4ebfc109c1f3ee7cf3e4b89f6ba2d3f51c5243f16b3cffae011" origin="Generated by Gradle"/>
@ -5645,6 +5653,14 @@
<sha256 value="f61f3ebea5520ddf19f452b03c426c7231bdd8a81d7ac28765cb5271225ac378" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-tree" version="9.6">
<artifact name="asm-tree-9.6.jar">
<sha256 value="c43ecf17b539c777e15da7b5b86553b377e2d39a683de6285567d5283888e7ef" origin="Generated by Gradle"/>
</artifact>
<artifact name="asm-tree-9.6.pom">
<sha256 value="1bcb481d7fc16b955bb60ca07c8cfa2424bcee78bdc405bba31c7d6f5dc2d113" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-util" version="9.2">
<artifact name="asm-util-9.2.jar">
<sha256 value="ff5b3cd331ae8a9a804768280da98f50f424fef23dd3c788bb320e08c94ee598" origin="Generated by Gradle"/>

@ -32,6 +32,9 @@ public class InMemoryTaskQueue<T> implements TaskCollection<T> {
private final Set<InMemoryTask<T>> unfinishedOutstandingTasks = new HashSet<>();
private final AtomicBoolean closed = new AtomicBoolean(false);
/** Default constructor. */
public InMemoryTaskQueue() {}
@Override
public synchronized void add(final T taskData) {
assertNotClosed();

@ -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.

@ -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.

@ -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.
*

@ -43,6 +43,8 @@ public class PlatformDetector {
private static String _glibc;
private static String _jemalloc;
private PlatformDetector() {}
/**
* Gets OS type.
*

Loading…
Cancel
Save