From 5f0e107344adf2ed714a91eacbf2c31ddeedf8a7 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 11:24:32 +0100 Subject: [PATCH 01/13] Migrate Teku to Java 21 --- .circleci/config.yml | 8 +-- CHANGELOG.md | 3 +- README.md | 4 +- .../multipeer/batches/SyncSourceBatch.java | 7 +-- .../sync/forward/singlepeer/PeerSync.java | 3 +- build.gradle | 6 +- docker/jdk17/Dockerfile | 63 ------------------- gradle/versions.gradle | 4 +- .../ssz/tree/SszNodeTemplate.java | 3 +- 9 files changed, 17 insertions(+), 84 deletions(-) delete mode 100644 docker/jdk17/Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 849de0613c0..cba28f58129 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ orbs: executors: small_executor: docker: - - image: cimg/openjdk:17.0.7 + - image: cimg/openjdk:21.0.2 auth: &docker-auth # Don't panic, throw away account to avoid Docker rate limits when downloading. # Second reason we're doing this is so that forked PRs from external contributors works ie env vars aren't visible to forked PRs from within contexts @@ -27,7 +27,7 @@ executors: medium_executor: docker: - - image: cimg/openjdk:17.0.7 + - image: cimg/openjdk:21.0.2 auth: <<: *docker-auth resource_class: medium @@ -39,7 +39,7 @@ executors: medium_plus_executor: docker: - - image: cimg/openjdk:17.0.7 + - image: cimg/openjdk:21.0.2 auth: <<: *docker-auth resource_class: "medium+" @@ -50,7 +50,7 @@ executors: large_executor: docker: - - image: cimg/openjdk:17.0.7 + - image: cimg/openjdk:21.0.2 auth: <<: *docker-auth resource_class: large diff --git a/CHANGELOG.md b/CHANGELOG.md index f934322ed10..11b39e2d575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,13 +9,12 @@ ### Breaking Changes - Updated counter metrics to incorporate the suffix `_total`. If you are using a custom dashboard to monitor Teku metrics, you might need to update the metrics manually when breaking changes are introduced. For more information, see [Update metrics](../../how-to/monitor/update-metrics.md). +- Java 21+ is required to be installed to run Teku. Refer to https://docs.teku.consensys.io/get-started/install for the updated instructions. ### Additions and Improvements - Added a state pruner that can limit the number of finalized states stored when running an archive node. - - Updated bootnodes for Sepolia network. - Implemented [GetBlockAttestationV2](https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Beacon/getBlockAttestationsV2) (adding support for Electra attestations) - - Updated a number of parameters to reduce issues when using `p2p-subscribe-all-subnets-enabled`. If you have adjusted queue sizes manually when using all-subnets, please refer to details below. Manual settings will still override these defaults. - When `p2p-subscribe-all-subnets-enabled`, `p2p-peer-lower-bound` now defaults to 60 (previously 64), and `p2p-peer-upper-bound` now defaults to 80 (previously 100). - When `p2p-subscribe-all-subnets-enabled`, (`Xnetwork-async-p2p-max-queue`, `Xnetwork-async-beaconchain-max-queue`, `Xp2p-batch-verify-signatures-queue-capacity`) now default to 40_000 (previously 10_000) diff --git a/README.md b/README.md index b31606f2f0d..6da942c6995 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Release notifications are available via: ### Install Prerequisites -* Java 17+ +* Java 21+ -Note: Official builds of Teku are performed with Java 17. +Note: Official builds of Teku are performed with Java 21. Building on a more recent version of Java is supported, but the resulting build will not work on earlier versions of Java. diff --git a/beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/multipeer/batches/SyncSourceBatch.java b/beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/multipeer/batches/SyncSourceBatch.java index 250d5b44077..bb68f5c50a9 100644 --- a/beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/multipeer/batches/SyncSourceBatch.java +++ b/beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/multipeer/batches/SyncSourceBatch.java @@ -103,12 +103,12 @@ public UInt64 getCount() { @Override public Optional getFirstBlock() { - return blocks.isEmpty() ? Optional.empty() : Optional.of(blocks.get(0)); + return blocks.isEmpty() ? Optional.empty() : Optional.of(blocks.getFirst()); } @Override public Optional getLastBlock() { - return blocks.isEmpty() ? Optional.empty() : Optional.of(blocks.get(blocks.size() - 1)); + return blocks.isEmpty() ? Optional.empty() : Optional.of(blocks.getLast()); } @Override @@ -327,8 +327,7 @@ private void onRequestComplete( blobSidecarsByBlockRoot.putAll(newBlobSidecarsByBlockRoot); } - if (newBlocks.isEmpty() - || newBlocks.get(newBlocks.size() - 1).getSlot().equals(getLastSlot())) { + if (newBlocks.isEmpty() || newBlocks.getLast().getSlot().equals(getLastSlot())) { complete = true; } } diff --git a/beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/singlepeer/PeerSync.java b/beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/singlepeer/PeerSync.java index 03f99e8a4d0..93c9a577a21 100644 --- a/beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/singlepeer/PeerSync.java +++ b/beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/singlepeer/PeerSync.java @@ -250,8 +250,7 @@ private SafeFuture executeSync( private PeerSyncResult handleFailedRequestToPeer( final Eth2Peer peer, final PeerStatus peerStatus, final Throwable err) { final Throwable rootException = Throwables.getRootCause(err); - if (rootException instanceof FailedBlockImportException) { - final FailedBlockImportException importException = (FailedBlockImportException) rootException; + if (rootException instanceof FailedBlockImportException importException) { final FailureReason reason = importException.getResult().getFailureReason(); final SignedBeaconBlock block = importException.getBlock(); diff --git a/build.gradle b/build.gradle index 01cf74b88a9..8356b8319b4 100644 --- a/build.gradle +++ b/build.gradle @@ -143,8 +143,8 @@ allprojects { jar.preserveFileTimestamps = false } - sourceCompatibility = '17' - targetCompatibility = '17' + sourceCompatibility = '21' + targetCompatibility = '21' repositories { mavenLocal() @@ -541,7 +541,7 @@ tasks.register("dockerDistUntar") { } def dockerImage = "consensys/teku" -def dockerJdkVariants = [ "jdk21", "jdk17" ] +def dockerJdkVariants = [ "jdk21" ] def dockerBuildDir = "build/docker-teku/" def executableAndArg = System.getProperty('os.name').toLowerCase().contains('windows') ? ["cmd", "/c"] : ["sh", "-c"] diff --git a/docker/jdk17/Dockerfile b/docker/jdk17/Dockerfile deleted file mode 100644 index be3214a95ca..00000000000 --- a/docker/jdk17/Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -FROM eclipse-temurin:17 as jre-build - -# Create a custom Java runtime -RUN JAVA_TOOL_OPTIONS="-Djdk.lang.Process.launchMechanism=vfork" $JAVA_HOME/bin/jlink \ - --add-modules ALL-MODULE-PATH \ - --strip-debug \ - --no-man-pages \ - --no-header-files \ - --compress=2 \ - --output /javaruntime - -FROM ubuntu:24.04 -ENV JAVA_HOME=/opt/java/openjdk -ENV PATH "${JAVA_HOME}/bin:${PATH}" -COPY --from=jre-build /javaruntime $JAVA_HOME - -RUN apt-get -y update && apt-get -y upgrade && apt-get -y install curl libc-bin libc6 adduser && \ - # Clean apt cache - apt-get clean && \ - rm -rf /var/cache/apt/archives/* && \ - rm -rf /var/lib/apt/lists/* - -# Ubuntu 23.10 and above comes with an "ubuntu" user with uid 1000. We need 1000 for teku. -RUN userdel ubuntu 2>/dev/null || true && rm -rf /home/ubuntu && \ - adduser --uid 1000 --disabled-password --gecos "" --home /opt/teku teku && \ - chown teku:teku /opt/teku && \ - chmod 0755 /opt/teku - -USER teku -WORKDIR /opt/teku - -# copy application (with libraries inside) -COPY --chown=teku:teku teku /opt/teku/ - -# Default to UTF-8 locale -ENV LANG C.UTF-8 - -ENV TEKU_REST_API_INTERFACE="0.0.0.0" -ENV TEKU_VALIDATOR_API_INTERFACE="0.0.0.0" -ENV TEKU_METRICS_INTERFACE="0.0.0.0" -ENV PATH "/opt/teku/bin:${PATH}" - -# List Exposed Ports -# Metrics, Rest API, LibP2P, Discv5 -EXPOSE 8008 5051 9000 9000/udp - -# specify default command -ENTRYPOINT ["/opt/teku/bin/teku"] - - -# Build-time metadata as defined at http://label-schema.org -ARG BUILD_DATE -ARG VCS_REF -ARG VERSION -LABEL org.label-schema.build-date=$BUILD_DATE \ - org.label-schema.name="Teku" \ - org.label-schema.description="Ethereum Consensus Client" \ - org.label-schema.url="https://docs.teku.consensys.io/" \ - org.label-schema.vcs-ref=$VCS_REF \ - org.label-schema.vcs-url="https://github.com/Consensys/teku.git" \ - org.label-schema.vendor="Consensys" \ - org.label-schema.version=$VERSION \ - org.label-schema.schema-version="1.0" diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 80a993328e5..f05464e50f2 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -139,12 +139,12 @@ dependencyManagement { dependency 'io.prometheus:simpleclient:0.16.0' - dependencySet(group: 'org.hyperledger.besu.internal', version: '24.5.2') { + dependencySet(group: 'org.hyperledger.besu.internal', version: '24.7.0') { entry('metrics-core') entry('core') entry('config') } - dependencySet(group: 'org.hyperledger.besu', version: '24.5.2') { + dependencySet(group: 'org.hyperledger.besu', version: '24.7.0') { entry('besu-datatypes') entry('evm') entry('plugin-api') diff --git a/infrastructure/ssz/src/main/java/tech/pegasys/teku/infrastructure/ssz/tree/SszNodeTemplate.java b/infrastructure/ssz/src/main/java/tech/pegasys/teku/infrastructure/ssz/tree/SszNodeTemplate.java index 6060135fa8d..d6ad2e65010 100644 --- a/infrastructure/ssz/src/main/java/tech/pegasys/teku/infrastructure/ssz/tree/SszNodeTemplate.java +++ b/infrastructure/ssz/src/main/java/tech/pegasys/teku/infrastructure/ssz/tree/SszNodeTemplate.java @@ -184,8 +184,7 @@ private static T binaryTraverse( final long gIndex, final TreeNode node, final BinaryVisitor visitor) { if (node instanceof LeafNode) { return visitor.visitLeaf(gIndex, (LeafNode) node); - } else if (node instanceof BranchNode) { - BranchNode branchNode = (BranchNode) node; + } else if (node instanceof BranchNode branchNode) { return visitor.visitBranch( gIndex, branchNode, From 532699f67c2d7aa37f6561add17dd416fc7e1e5b Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 11:41:06 +0100 Subject: [PATCH 02/13] try to fix assemble --- .../pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java index 2428d3f224c..0672ad74b4d 100644 --- a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java +++ b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java @@ -74,7 +74,7 @@ public T randomData(final SszSchema schema) { return randomDataStream(schema).findFirst().orElseThrow(); } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "PatternMatchingInstanceof"}) public Stream randomDataStream(final SszSchema schema) { if (schema instanceof AbstractSszPrimitiveSchema) { if (schema.equals(SszPrimitiveSchemas.NONE_SCHEMA)) { From 438815658cfe4bbd8da3057b88a2b528139edea3 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 11:45:13 +0100 Subject: [PATCH 03/13] Upgrade codeql java version from 17 to 21 --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4055110ac43..22a7cd32594 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: adopt - java-version: 17 + java-version: 21 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL From ef99627e4ade7698791776e5baff62aa44e7dc51 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 11:56:38 +0100 Subject: [PATCH 04/13] fix one more --- .../teku/infrastructure/ssz/RandomSszDataGenerator.java | 6 ++---- .../tech/pegasys/teku/infrastructure/ssz/SszDataAssert.java | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java index 0672ad74b4d..a5252163439 100644 --- a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java +++ b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java @@ -74,7 +74,7 @@ public T randomData(final SszSchema schema) { return randomDataStream(schema).findFirst().orElseThrow(); } - @SuppressWarnings({"unchecked", "PatternMatchingInstanceof"}) + @SuppressWarnings("unchecked") public Stream randomDataStream(final SszSchema schema) { if (schema instanceof AbstractSszPrimitiveSchema) { if (schema.equals(SszPrimitiveSchemas.NONE_SCHEMA)) { @@ -94,9 +94,7 @@ public Stream randomDataStream(final SszSchema schema) } else { throw new IllegalArgumentException("Unknown primitive schema: " + schema); } - } else if (schema instanceof AbstractSszContainerSchema) { - AbstractSszContainerSchema containerSchema = - (AbstractSszContainerSchema) schema; + } else if (schema instanceof AbstractSszContainerSchema containerSchema) { return Stream.generate( () -> { List children = diff --git a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/SszDataAssert.java b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/SszDataAssert.java index 32f5f82032e..96e8bf2e98e 100644 --- a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/SszDataAssert.java +++ b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/SszDataAssert.java @@ -123,8 +123,7 @@ private static List compareByGetters(final SszData actual, final SszData + ", actual: " + actual.getSchema()); } - if (actual instanceof SszComposite) { - SszComposite c1 = (SszComposite) actual; + if (actual instanceof SszComposite c1) { SszComposite c2 = (SszComposite) expected; if (c1.size() != c2.size()) { return List.of( From 982cf1d4c3e1d37e6a08ea59a775e47eecd5bfbc Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 11:58:52 +0100 Subject: [PATCH 05/13] more stuff --- .../teku/infrastructure/ssz/RandomSszDataGenerator.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java index a5252163439..02d87211ba3 100644 --- a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java +++ b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/RandomSszDataGenerator.java @@ -122,10 +122,9 @@ public Stream randomDataStream(final SszSchema schema) SszCollection ret = collectionSchema.createFromElements(children); return (T) ret; }); - } else if (schema instanceof SszUnionSchema) { + } else if (schema instanceof SszUnionSchema unionSchema) { return Stream.generate( () -> { - SszUnionSchema unionSchema = (SszUnionSchema) schema; int selector = random.nextInt(unionSchema.getTypesCount()); return (T) unionSchema.createFromValue( From 418a61c5c47bc935fa0b072be44ad0dcdd0504b0 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 12:05:24 +0100 Subject: [PATCH 06/13] assemble --- .../tech/pegasys/teku/infrastructure/ssz/SszTestUtils.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/SszTestUtils.java b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/SszTestUtils.java index 43b42835312..88595a5b376 100644 --- a/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/SszTestUtils.java +++ b/infrastructure/ssz/src/testFixtures/java/tech/pegasys/teku/infrastructure/ssz/SszTestUtils.java @@ -17,7 +17,6 @@ import it.unimi.dsi.fastutil.ints.IntList; import java.util.List; import java.util.function.Consumer; -import java.util.stream.Collectors; import java.util.stream.IntStream; import tech.pegasys.teku.infrastructure.ssz.collections.SszBitlist; import tech.pegasys.teku.infrastructure.ssz.schema.SszContainerSchema; @@ -38,7 +37,7 @@ public static IntList getVectorLengths(final SszContainerSchema sszContainerS } public static SszBitlist not(final SszBitlist bitlist) { - List notList = bitlist.stream().map(b -> !b.get()).collect(Collectors.toList()); + List notList = bitlist.stream().map(b -> !b.get()).toList(); int[] notBitIndices = IntStream.range(0, notList.size()).filter(notList::get).toArray(); return bitlist.getSchema().ofBits(bitlist.size(), notBitIndices); } @@ -55,8 +54,7 @@ private static void dumpBinaryTreeRec( final String prefix, final boolean printCommit, final Consumer linesConsumer) { - if (node instanceof LeafNode) { - LeafNode leafNode = (LeafNode) node; + if (node instanceof LeafNode leafNode) { linesConsumer.accept(prefix + leafNode); } else { BranchNode branchNode = (BranchNode) node; From 3e410f3d0aee0dc4a44470b1a2b46b0ca1049d95 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 12:54:50 +0100 Subject: [PATCH 07/13] assemble --- .../pegasys/teku/infrastructure/ssz/schema/TreeNodeAssert.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/infrastructure/ssz/src/test/java/tech/pegasys/teku/infrastructure/ssz/schema/TreeNodeAssert.java b/infrastructure/ssz/src/test/java/tech/pegasys/teku/infrastructure/ssz/schema/TreeNodeAssert.java index 48806158419..7ed33dbc2f9 100644 --- a/infrastructure/ssz/src/test/java/tech/pegasys/teku/infrastructure/ssz/schema/TreeNodeAssert.java +++ b/infrastructure/ssz/src/test/java/tech/pegasys/teku/infrastructure/ssz/schema/TreeNodeAssert.java @@ -91,8 +91,7 @@ private void assertTreeEqual(final TreeNode actual, final TreeNode expected, fin assertThat(actual.hashTreeRoot()) .describedAs("zero branch node root at gIndex %s", gIndex) .isEqualTo(expected.hashTreeRoot()); - } else if (actual instanceof BranchNode) { - final BranchNode actualBranch = (BranchNode) actual; + } else if (actual instanceof BranchNode actualBranch) { final BranchNode expectedBranch = (BranchNode) expected; assertTreeEqual( actualBranch.left(), expectedBranch.left(), GIndexUtil.gIdxLeftGIndex(gIndex)); From f3046852b5586658029bae18178372216469fc68 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 13:11:26 +0100 Subject: [PATCH 08/13] assemble --- .../forkChoiceTests/ForkChoiceIntegrationTest.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fork-choice-tests/src/integration-test/java/tech/pegasys/teku/forkChoiceTests/ForkChoiceIntegrationTest.java b/fork-choice-tests/src/integration-test/java/tech/pegasys/teku/forkChoiceTests/ForkChoiceIntegrationTest.java index 26f9b27e0e4..ec9cb09f9ce 100644 --- a/fork-choice-tests/src/integration-test/java/tech/pegasys/teku/forkChoiceTests/ForkChoiceIntegrationTest.java +++ b/fork-choice-tests/src/integration-test/java/tech/pegasys/teku/forkChoiceTests/ForkChoiceIntegrationTest.java @@ -145,10 +145,7 @@ private static Object extractTestStep( } private static ForkChoiceTestStep getStepKind(final Map ss) { - return ss.keySet().stream() - .map(ForkChoiceTestStep::valueOf) - .collect(Collectors.toList()) - .get(0); + return ss.keySet().stream().map(ForkChoiceTestStep::valueOf).toList().get(0); } private static T resolvePart( @@ -156,8 +153,7 @@ private static T resolvePart( final SszSchema type, final File testFile, final Object value) { - if (value instanceof String) { - String path = (String) value; + if (value instanceof String path) { if (path.endsWith(".yaml") || path.endsWith(".ssz")) { Path partPath = Paths.get(testFile.getParentFile().getParent(), "cache", path); try { @@ -225,9 +221,9 @@ void runForkChoiceTests( if (!processAttestation(forkChoice, (Attestation) step)) { attestationBuffer.add((Attestation) step); } - } else if (step instanceof Map) { + } else if (step instanceof Map rawChecks) { @SuppressWarnings("unchecked") - Map checks = (Map) step; + Map checks = (Map) rawChecks; for (Map.Entry e : checks.entrySet()) { String check = e.getKey(); switch (check) { From 3055315c3e540f61de3603f6432289ab7a1685a3 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 13:33:53 +0100 Subject: [PATCH 09/13] fix stuff --- .../ssz_generic/SszGenericContainerTestExecutor.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_generic/SszGenericContainerTestExecutor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_generic/SszGenericContainerTestExecutor.java index 579df7d30b4..15c4eef8cae 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_generic/SszGenericContainerTestExecutor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_generic/SszGenericContainerTestExecutor.java @@ -13,7 +13,6 @@ package tech.pegasys.teku.reference.phase0.ssz_generic; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import java.io.IOException; @@ -70,7 +69,7 @@ protected SszSchema getSchema(final TestDefinition testDefinition) { case "VarTestStruct" -> new VarTestStructSchema(); case "FixedTestStruct" -> new FixedTestStructSchema(); case "ComplexTestStruct" -> // Not implemented yet - new ComplexTestStructSchema(); + new ComplexTestStructSchema(); default -> throw new UnsupportedOperationException("Unsupported container type: " + type); }; } @@ -100,9 +99,8 @@ private String format(final Object value) { return ((SszByteList) value).sszSerialize().toHexString(); } else if (value instanceof SszBitvector) { return ((SszBitvector) value).sszSerialize().toHexString(); - } else if (value instanceof SszCollection) { - final SszCollection list = (SszCollection) value; - return list.stream().map(this::format).collect(toList()).toString(); + } else if (value instanceof final SszCollection list) { + return list.stream().map(this::format).toList().toString(); } else if (value instanceof SszContainer) { return formatSszContainer((SszContainer) value).toString(); } else { From 78f0f5609a3d3bdf113abf8be4bf254860abb68f Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 13:37:27 +0100 Subject: [PATCH 10/13] fix assemble --- .../phase0/ssz_generic/SszGenericContainerTestExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_generic/SszGenericContainerTestExecutor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_generic/SszGenericContainerTestExecutor.java index 15c4eef8cae..22e7dcb176b 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_generic/SszGenericContainerTestExecutor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/phase0/ssz_generic/SszGenericContainerTestExecutor.java @@ -69,7 +69,7 @@ protected SszSchema getSchema(final TestDefinition testDefinition) { case "VarTestStruct" -> new VarTestStructSchema(); case "FixedTestStruct" -> new FixedTestStructSchema(); case "ComplexTestStruct" -> // Not implemented yet - new ComplexTestStructSchema(); + new ComplexTestStructSchema(); default -> throw new UnsupportedOperationException("Unsupported container type: " + type); }; } From 049ab283b3e65dd24dd9b4361bee4e23fda9a488 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 13:57:13 +0100 Subject: [PATCH 11/13] try stuff --- .circleci/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index cba28f58129..c0ffbab9823 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,6 +83,14 @@ executors: <<: *docker-auth commands: + install_java_21: + description: "Install Java 21" + steps: + - run: + name: "Install Java 21" + command: | + sudo apt update + sudo apt install -y openjdk-21-jdk prepare: description: "Prepare" steps: @@ -331,6 +339,7 @@ jobs: parallelism: 5 executor: machine_executor_amd64 steps: + - install_java_21 - prepare - attach_workspace: at: ~/project @@ -449,6 +458,7 @@ jobs: publishDockerArm64: executor: machine_executor_arm64 steps: + - install_java_21 - prepare - attach_workspace: at: ~/project From 918c7280b1cbda8307002f2a54200dea661d4cf6 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 14:06:32 +0100 Subject: [PATCH 12/13] fix --- .circleci/config.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c0ffbab9823..dca9c43eaa7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,6 +91,13 @@ commands: command: | sudo apt update sudo apt install -y openjdk-21-jdk + if [ "$(uname -m)" = "aarch64" ]; then + sudo update-alternatives --set java /usr/lib/jvm/java-21-openjdk-arm64/bin/java + sudo update-alternatives --set javac /usr/lib/jvm/java-21-openjdk-arm64/bin/javac + else + sudo update-alternatives --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java + sudo update-alternatives --set javac /usr/lib/jvm/java-21-openjdk-amd64/bin/javac + fi prepare: description: "Prepare" steps: From a091929620376df8066f9955c77ce5056a10d3e7 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 22 Jul 2024 14:09:39 +0100 Subject: [PATCH 13/13] stuff --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dca9c43eaa7..a56fbc1f3a7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,12 +92,12 @@ commands: sudo apt update sudo apt install -y openjdk-21-jdk if [ "$(uname -m)" = "aarch64" ]; then - sudo update-alternatives --set java /usr/lib/jvm/java-21-openjdk-arm64/bin/java - sudo update-alternatives --set javac /usr/lib/jvm/java-21-openjdk-arm64/bin/javac + ARCH="arm64" else - sudo update-alternatives --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java - sudo update-alternatives --set javac /usr/lib/jvm/java-21-openjdk-amd64/bin/javac + ARCH="amd64" fi + sudo update-alternatives --set java /usr/lib/jvm/java-21-openjdk-$ARCH/bin/java + sudo update-alternatives --set javac /usr/lib/jvm/java-21-openjdk-$ARCH/bin/javac prepare: description: "Prepare" steps: