Skip to content

Commit

Permalink
Fix EIP7594 activation bugs and delegating SpecConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
zilm13 committed Nov 24, 2024
1 parent 9c4a9c4 commit c106053
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Optional<SpecConfigElectra> toVersionElectra() {

@Override
public Optional<Eip7594> getOptionalEip7594Config() {
return eip7594;
return specConfigElectra.getOptionalEip7594Config().or(() -> eip7594);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.SpecFeature;
import tech.pegasys.teku.spec.config.features.Eip7594;
import tech.pegasys.teku.spec.datastructures.blobs.versions.eip7594.DataColumnSidecar;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock;
Expand Down Expand Up @@ -171,9 +171,8 @@ public SafeFuture<List<UInt64>> checkDataAvailability(
}

private boolean isEIP7594(final BeaconBlock block) {
return spec.atSlot(block.getSlot())
.getMilestone()
.isGreaterThanOrEqualTo(SpecMilestone.ELECTRA);
return spec.isFeatureActivatedAtEpoch(
SpecFeature.EIP7594, spec.computeEpochAtSlot(block.getSlot()));
}

private boolean hasBlobs(final BeaconBlock block) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
import tech.pegasys.teku.services.executionlayer.ExecutionLayerBlockManagerFactory;
import tech.pegasys.teku.services.timer.TimerService;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.SpecFeature;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.features.Eip7594;
import tech.pegasys.teku.spec.datastructures.attestation.ValidatableAttestation;
Expand Down Expand Up @@ -654,7 +655,7 @@ protected void initBlobSidecarManager() {
}

private void initDasSamplerManager() {
if (spec.isMilestoneSupported(SpecMilestone.ELECTRA)) {
if (spec.isFeatureScheduled(SpecFeature.EIP7594)) {
LOG.info("Activated DAS Sampler Manager for EIP7594");
this.dasSamplerManager = new DasSamplerManager(() -> dataAvailabilitySampler, kzg, spec);
} else {
Expand All @@ -664,7 +665,7 @@ private void initDasSamplerManager() {
}

protected void initDataColumnSidecarManager() {
if (spec.isMilestoneSupported(SpecMilestone.ELECTRA)) {
if (spec.isFeatureScheduled(SpecFeature.EIP7594)) {
final DataColumnSidecarGossipValidator dataColumnSidecarGossipValidator =
DataColumnSidecarGossipValidator.create(
spec,
Expand All @@ -685,9 +686,10 @@ protected void initDataColumnSidecarManager() {
}

protected void initDasCustody() {
if (!spec.isMilestoneSupported(SpecMilestone.ELECTRA)) {
if (!spec.isFeatureScheduled(SpecFeature.EIP7594)) {
return;
}
LOG.info("Activating DAS Custody for EIP7594");
Eip7594 configEip7594 = Eip7594.required(spec.forMilestone(SpecMilestone.ELECTRA).getConfig());
MinCustodyPeriodSlotCalculator minCustodyPeriodSlotCalculator =
MinCustodyPeriodSlotCalculator.createFromSpec(spec);
Expand Down Expand Up @@ -1141,7 +1143,7 @@ protected void initSubnetSubscriber() {
}

protected void initDataColumnSidecarSubnetBackboneSubscriber() {
if (!spec.isMilestoneSupported(SpecMilestone.ELECTRA)) {
if (!spec.isFeatureScheduled(SpecFeature.EIP7594)) {
return;
}
LOG.debug("BeaconChainController.initDataColumnSidecarSubnetBackboneSubscriber");
Expand Down Expand Up @@ -1209,7 +1211,7 @@ public void initValidatorApiHandler() {
blobSidecarGossipChannel = BlobSidecarGossipChannel.NOOP;
}
final DataColumnSidecarGossipChannel dataColumnSidecarGossipChannel;
if (spec.isMilestoneSupported(SpecMilestone.ELECTRA)) {
if (spec.isFeatureScheduled(SpecFeature.EIP7594)) {
dataColumnSidecarGossipChannel =
eventChannels.getPublisher(DataColumnSidecarGossipChannel.class);
} else {
Expand Down

0 comments on commit c106053

Please sign in to comment.