Skip to content

Commit

Permalink
enable ILs duties based on fork
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi committed Feb 14, 2025
1 parent 97acbb7 commit 38f3e27
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -76,9 +78,17 @@ public static Spec create(final SpecConfigAndParent<? extends SpecConfig> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 38f3e27

Please sign in to comment.