From 4e8a774eaaa942b9a96b7c92f06812c85525ab0b Mon Sep 17 00:00:00 2001 From: Mehdi AOUADI Date: Fri, 14 Feb 2025 19:25:20 +0100 Subject: [PATCH] enable ILs duties based on fork --- .../teku/test/acceptance/dsl/Node.java | 1 + docker/jdk21/Dockerfile | 4 +- .../tech/pegasys/teku/spec/SpecFactory.java | 12 +++++- .../client/ValidatorClientService.java | 39 +++++++++++-------- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/acceptance-tests/src/testFixtures/java/tech/pegasys/teku/test/acceptance/dsl/Node.java b/acceptance-tests/src/testFixtures/java/tech/pegasys/teku/test/acceptance/dsl/Node.java index 91894cc5e16..b5aa94d8860 100644 --- a/acceptance-tests/src/testFixtures/java/tech/pegasys/teku/test/acceptance/dsl/Node.java +++ b/acceptance-tests/src/testFixtures/java/tech/pegasys/teku/test/acceptance/dsl/Node.java @@ -86,6 +86,7 @@ protected Node(final Network network, final String dockerImage, final Logger log getClass().getSimpleName().toLowerCase(Locale.US) + NODE_UNIQUIFIER.incrementAndGet(); this.container = new NodeContainer(dockerImage) + .withEnv("JAVA_OPTS", "-XX:UseSVE=0") .withImagePullPolicy(PullPolicy.defaultPolicy()) .withNetwork(network) .withNetworkAliases(nodeAlias) diff --git a/docker/jdk21/Dockerfile b/docker/jdk21/Dockerfile index 996efa66fcf..a2b0a8af5dc 100644 --- a/docker/jdk21/Dockerfile +++ b/docker/jdk21/Dockerfile @@ -1,7 +1,7 @@ FROM eclipse-temurin:21 as jre-build # Create a custom Java runtime -RUN JAVA_TOOL_OPTIONS="-Djdk.lang.Process.launchMechanism=vfork" $JAVA_HOME/bin/jlink \ +RUN JAVA_TOOL_OPTIONS="-Djdk.lang.Process.launchMechanism=vfork -XX:UseSVE=0" $JAVA_HOME/bin/jlink \ --add-modules ALL-MODULE-PATH \ --strip-debug \ --no-man-pages \ @@ -39,7 +39,7 @@ 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}" - +ENV TEKU_OPTS -XX:UseSVE=0 # List Exposed Ports # Metrics, Rest API, LibP2P, Discv5 EXPOSE 8008 5051 9000 9000/udp diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java index 5a32aae7313..923dbde9d04 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/SpecFactory.java @@ -17,6 +17,7 @@ import static tech.pegasys.teku.spec.SpecMilestone.BELLATRIX; import static tech.pegasys.teku.spec.SpecMilestone.CAPELLA; import static tech.pegasys.teku.spec.SpecMilestone.DENEB; +import static tech.pegasys.teku.spec.SpecMilestone.EIP7805; import static tech.pegasys.teku.spec.SpecMilestone.ELECTRA; import static tech.pegasys.teku.spec.SpecMilestone.PHASE0; import static tech.pegasys.teku.spec.config.SpecConfig.FAR_FUTURE_EPOCH; @@ -29,6 +30,7 @@ import tech.pegasys.teku.spec.config.SpecConfigBellatrix; import tech.pegasys.teku.spec.config.SpecConfigCapella; import tech.pegasys.teku.spec.config.SpecConfigDeneb; +import tech.pegasys.teku.spec.config.SpecConfigEip7805; import tech.pegasys.teku.spec.config.SpecConfigElectra; import tech.pegasys.teku.spec.config.SpecConfigLoader; import tech.pegasys.teku.spec.config.builder.SpecConfigBuilder; @@ -76,9 +78,17 @@ public static Spec create(final SpecConfigAndParent config .toVersionElectra() .map(SpecConfigElectra::getElectraForkEpoch) .orElse(FAR_FUTURE_EPOCH); + final UInt64 eip7805ForkEpoch = + config + .specConfig() + .toVersionEip7805() + .map(SpecConfigEip7805::getEip7805ForkEpoch) + .orElse(FAR_FUTURE_EPOCH); final SpecMilestone highestMilestoneSupported; - if (!electraForkEpoch.equals(FAR_FUTURE_EPOCH)) { + if (!eip7805ForkEpoch.equals(FAR_FUTURE_EPOCH)) { + highestMilestoneSupported = EIP7805; + } else if (!electraForkEpoch.equals(FAR_FUTURE_EPOCH)) { highestMilestoneSupported = ELECTRA; } else if (!denebForkEpoch.equals(FAR_FUTURE_EPOCH)) { highestMilestoneSupported = DENEB; diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java index 914bbf98f8c..7548c9686cb 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java @@ -466,8 +466,7 @@ private void scheduleValidatorsDuties( new InclusionListDutyFactory(validatorApiChannel); final BeaconCommitteeSubscriptions beaconCommitteeSubscriptions = new BeaconCommitteeSubscriptions(validatorApiChannel); - final InclusionListCommitteeSubscriptions inclusionListCommitteeSubscriptions = - new InclusionListCommitteeSubscriptions(); + final boolean dvtSelectionsEndpointEnabled = config.getValidatorConfig().isDvtSelectionsEndpointEnabled(); final DutyLoader attestationDutyLoader = @@ -498,24 +497,9 @@ private void scheduleValidatorsDuties( validatorDutyMetrics::performDutyWithMetrics), validators, validatorIndexProvider)); - final DutyLoader inclusionListDutyLoader = - new RetryingDutyLoader<>( - asyncRunner, - new InclusionListDutyLoader( - validatorApiChannel, - dependentRoot -> - new SlotBasedScheduledDuties<>( - inclusionListDutyFactory, - dependentRoot, - validatorDutyMetrics::performDutyWithMetrics), - validators, - validatorIndexProvider, - inclusionListCommitteeSubscriptions)); validatorTimingChannels.add(new BlockDutyScheduler(metricsSystem, blockDutyLoader, spec)); validatorTimingChannels.add( new AttestationDutyScheduler(metricsSystem, attestationDutyLoader, spec)); - validatorTimingChannels.add( - new InclusionListDutyScheduler(metricsSystem, inclusionListDutyLoader, spec)); validatorTimingChannels.add(validatorLoader.getSlashingProtectionLogger()); if (spec.isMilestoneSupported(SpecMilestone.ALTAIR)) { @@ -546,6 +530,27 @@ private void scheduleValidatorsDuties( }); validatorRegistrator.ifPresent(validatorTimingChannels::add); } + + if (spec.isMilestoneSupported(SpecMilestone.EIP7805)) { + final InclusionListCommitteeSubscriptions inclusionListCommitteeSubscriptions = + new InclusionListCommitteeSubscriptions(); + final DutyLoader inclusionListDutyLoader = + new RetryingDutyLoader<>( + asyncRunner, + new InclusionListDutyLoader( + validatorApiChannel, + dependentRoot -> + new SlotBasedScheduledDuties<>( + inclusionListDutyFactory, + dependentRoot, + validatorDutyMetrics::performDutyWithMetrics), + validators, + validatorIndexProvider, + inclusionListCommitteeSubscriptions)); + validatorTimingChannels.add( + new InclusionListDutyScheduler(metricsSystem, inclusionListDutyLoader, spec)); + } + addValidatorCountMetric(metricsSystem, validators); final ValidatorStatusLogger validatorStatusLogger = new ValidatorStatusLogger(validators); validatorStatusProvider.subscribeValidatorStatusesUpdates(