Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROTOTYPE] epbs-eip7732 #8497

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
24ca064
epbs-eip7732 boilerplate begin
tbenr Aug 2, 2024
a378731
Config/presets boilerplate
StefanBratanov Aug 12, 2024
7816cd2
Add new containers
StefanBratanov Aug 13, 2024
9d8798d
More new containers
StefanBratanov Aug 14, 2024
ffdf9f6
Mostly modified containers
StefanBratanov Aug 14, 2024
4aebb5a
small hack
StefanBratanov Aug 14, 2024
06fdf37
Last part of modified containers
StefanBratanov Aug 14, 2024
457e75d
fix assemble
StefanBratanov Aug 14, 2024
dbd76c0
fix extension
StefanBratanov Aug 14, 2024
cf41e3a
Helper functions draft
StefanBratanov Aug 15, 2024
6238c48
Implement the signature verification
StefanBratanov Aug 15, 2024
1c835d1
Modified verify_blob_sidecar_inclusion_proof
StefanBratanov Aug 19, 2024
7f4d480
gossip fork subscriptions for eip-7732
StefanBratanov Aug 19, 2024
c915b2e
add gossip managers
StefanBratanov Aug 20, 2024
3ec994d
new P2P req/resp
StefanBratanov Aug 20, 2024
1a2ee29
add MAX_REQUEST_PAYLOADS to constants
StefanBratanov Aug 20, 2024
d55c590
Add block processing
StefanBratanov Aug 27, 2024
8f71dfb
support task expiration in RepeatingTaskScheduler
tbenr Aug 27, 2024
c95741b
Modified is_merge_transition_complete
StefanBratanov Aug 28, 2024
aae2712
fix beaconstate schemas
tbenr Aug 28, 2024
9aa0d9b
Implement execution payload processing
StefanBratanov Aug 28, 2024
04fba6a
slot anatomy change: event rescheduling and related changes
tbenr Aug 28, 2024
867b382
Add ExecutionPayloadHeaderValidator
StefanBratanov Aug 30, 2024
6ca9ca1
Add Payload Attestation Duty in VC
tbenr Aug 30, 2024
962da74
Add PayloadAttestationData local signing
tbenr Sep 2, 2024
428472d
Add PayloadAttestationManager and ExecutionPayloadManager
StefanBratanov Sep 2, 2024
daccee1
Remove Slot from payloadAttestation signing.
tbenr Sep 2, 2024
b35a992
PayloadAttestationPool and ExecutionPayloadHeaderPool
StefanBratanov Sep 3, 2024
a2751cd
use bit vector for payload attestation aggregation bits
mehdi-aouadi Sep 3, 2024
fc0ccf1
Add PayloadTimeliness calculation and PayloadAttestationData creation
tbenr Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@
import tech.pegasys.teku.spec.datastructures.execution.FallbackData;
import tech.pegasys.teku.spec.datastructures.execution.FallbackReason;
import tech.pegasys.teku.spec.datastructures.execution.GetPayloadResponse;
import tech.pegasys.teku.spec.datastructures.execution.SignedExecutionPayloadHeader;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;
import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing;
import tech.pegasys.teku.spec.datastructures.operations.Deposit;
import tech.pegasys.teku.spec.datastructures.operations.PayloadAttestation;
import tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing;
import tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange;
import tech.pegasys.teku.spec.datastructures.operations.SignedVoluntaryExit;
Expand Down Expand Up @@ -1296,6 +1298,18 @@ public BeaconBlockBodyBuilder blobKzgCommitments(
return this;
}

@Override
public BeaconBlockBodyBuilder signedExecutionPayloadHeader(
final SignedExecutionPayloadHeader signedExecutionPayloadHeader) {
return this;
}

@Override
public BeaconBlockBodyBuilder payloadAttestations(
final SszList<PayloadAttestation> payloadAttestations) {
return this;
}

@Override
public BeaconBlockBody build() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public BeaconBlock getBlindedBlock(
block.getParentRoot(),
block.getStateRoot(),
getBlindedBlockBodyElectra(block.getBody()));
case EIP7732 -> throw new UnsupportedOperationException("TODO");
};
}

Expand Down Expand Up @@ -167,6 +168,7 @@ public BeaconBlock getBeaconBlock(
block.getParentRoot(),
block.getStateRoot(),
getBeaconBlockBodyElectra(block.getBody()));
case EIP7732 -> throw new UnsupportedOperationException("TODO");
};
}

Expand Down Expand Up @@ -243,6 +245,7 @@ public BeaconState getBeaconState(
case CAPELLA -> new BeaconStateCapella(state);
case DENEB -> new BeaconStateDeneb(state);
case ELECTRA -> new BeaconStateElectra(state);
case EIP7732 -> throw new UnsupportedOperationException("TODO");
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public SignedBeaconBlock parseBlock(final JsonProvider jsonProvider, final Strin
case CAPELLA -> mapper.treeToValue(jsonNode, SignedBeaconBlockCapella.class);
case DENEB -> mapper.treeToValue(jsonNode, SignedBeaconBlockDeneb.class);
case ELECTRA -> mapper.treeToValue(jsonNode, SignedBeaconBlockElectra.class);
case EIP7732 -> throw new UnsupportedOperationException("TODO");
};
}

Expand All @@ -194,6 +195,7 @@ public SignedBeaconBlock parseBlindedBlock(
case CAPELLA -> mapper.treeToValue(jsonNode, SignedBlindedBeaconBlockCapella.class);
case DENEB -> mapper.treeToValue(jsonNode, SignedBlindedBeaconBlockDeneb.class);
case ELECTRA -> mapper.treeToValue(jsonNode, SignedBlindedBeaconBlockElectra.class);
case EIP7732 -> throw new UnsupportedOperationException("TODO");
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public enum Version {
bellatrix,
capella,
deneb,
electra;
electra,
eip7732;

public static Version fromMilestone(final SpecMilestone milestone) {
return switch (milestone) {
Expand All @@ -32,6 +33,7 @@ public static Version fromMilestone(final SpecMilestone milestone) {
case CAPELLA -> capella;
case DENEB -> deneb;
case ELECTRA -> electra;
case EIP7732 -> eip7732;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void shouldConvertToInternalObject(final SpecContext ctx) {
case CAPELLA -> new BeaconStateCapella(beaconStateInternal);
case DENEB -> new BeaconStateDeneb(beaconStateInternal);
case ELECTRA -> new BeaconStateElectra(beaconStateInternal);
case EIP7732 -> throw new UnsupportedOperationException("TODO");
};

assertThat(beaconState.asInternalBeaconState(spec)).isEqualTo(beaconStateInternal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public MilestoneBasedEngineJsonRpcMethodsResolver(
.forEach(
milestone -> {
switch (milestone) {
case PHASE0:
case ALTAIR:
case PHASE0, ALTAIR:
break;
case BELLATRIX:
methodsByMilestone.put(milestone, bellatrixSupportedMethods());
Expand All @@ -76,6 +75,9 @@ public MilestoneBasedEngineJsonRpcMethodsResolver(
case ELECTRA:
methodsByMilestone.put(milestone, electraSupportedMethods());
break;
case EIP7732:
// TODO: implement
break;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class Eth2NetworkConfiguration {
private final Optional<UInt64> capellaForkEpoch;
private final Optional<UInt64> denebForkEpoch;
private final Optional<UInt64> electraForkEpoch;
private final Optional<UInt64> eip7732ForkEpoch;
private final Eth1Address eth1DepositContractAddress;
private final Optional<UInt64> eth1DepositContractDeployBlock;
private final Optional<String> trustedSetup;
Expand Down Expand Up @@ -121,6 +122,7 @@ private Eth2NetworkConfiguration(
final Optional<UInt64> capellaForkEpoch,
final Optional<UInt64> denebForkEpoch,
final Optional<UInt64> electraForkEpoch,
final Optional<UInt64> eip7732ForkEpoch,
final Optional<Bytes32> terminalBlockHashOverride,
final Optional<UInt256> totalTerminalDifficultyOverride,
final Optional<UInt64> terminalBlockHashEpochOverride,
Expand All @@ -143,6 +145,7 @@ private Eth2NetworkConfiguration(
this.capellaForkEpoch = capellaForkEpoch;
this.denebForkEpoch = denebForkEpoch;
this.electraForkEpoch = electraForkEpoch;
this.eip7732ForkEpoch = eip7732ForkEpoch;
this.eth1DepositContractAddress =
eth1DepositContractAddress == null
? spec.getGenesisSpecConfig().getDepositContractAddress()
Expand Down Expand Up @@ -230,6 +233,7 @@ public Optional<UInt64> getForkEpoch(final SpecMilestone specMilestone) {
case CAPELLA -> capellaForkEpoch;
case DENEB -> denebForkEpoch;
case ELECTRA -> electraForkEpoch;
case EIP7732 -> eip7732ForkEpoch;
default -> Optional.empty();
};
}
Expand Down Expand Up @@ -310,6 +314,7 @@ public boolean equals(final Object o) {
&& Objects.equals(capellaForkEpoch, that.capellaForkEpoch)
&& Objects.equals(denebForkEpoch, that.denebForkEpoch)
&& Objects.equals(electraForkEpoch, that.electraForkEpoch)
&& Objects.equals(eip7732ForkEpoch, that.eip7732ForkEpoch)
&& Objects.equals(eth1DepositContractAddress, that.eth1DepositContractAddress)
&& Objects.equals(eth1DepositContractDeployBlock, that.eth1DepositContractDeployBlock)
&& Objects.equals(trustedSetup, that.trustedSetup)
Expand All @@ -334,6 +339,7 @@ public int hashCode() {
capellaForkEpoch,
denebForkEpoch,
electraForkEpoch,
eip7732ForkEpoch,
eth1DepositContractAddress,
eth1DepositContractDeployBlock,
trustedSetup,
Expand Down Expand Up @@ -374,6 +380,7 @@ public static class Builder {
private Optional<UInt64> capellaForkEpoch = Optional.empty();
private Optional<UInt64> denebForkEpoch = Optional.empty();
private Optional<UInt64> electraForkEpoch = Optional.empty();
private Optional<UInt64> eip7732ForkEpoch = Optional.empty();
private Optional<Bytes32> terminalBlockHashOverride = Optional.empty();
private Optional<UInt256> totalTerminalDifficultyOverride = Optional.empty();
private Optional<UInt64> terminalBlockHashEpochOverride = Optional.empty();
Expand Down Expand Up @@ -427,6 +434,9 @@ public Eth2NetworkConfiguration build() {
builder.electraBuilder(
electraBuilder ->
electraForkEpoch.ifPresent(electraBuilder::electraForkEpoch));
builder.eip7732Builder(
eip7732Builder ->
eip7732ForkEpoch.ifPresent(eip7732Builder::eip7732ForkEpoch));
});
}
if (spec.getForkSchedule().getSupportedMilestones().contains(SpecMilestone.DENEB)
Expand Down Expand Up @@ -459,6 +469,7 @@ public Eth2NetworkConfiguration build() {
capellaForkEpoch,
denebForkEpoch,
electraForkEpoch,
eip7732ForkEpoch,
terminalBlockHashOverride,
totalTerminalDifficultyOverride,
terminalBlockHashEpochOverride,
Expand Down Expand Up @@ -670,6 +681,11 @@ public Builder electraForkEpoch(final UInt64 electraForkEpoch) {
return this;
}

public Builder eip7732ForkEpoch(final UInt64 eip7732ForkEpoch) {
this.eip7732ForkEpoch = Optional.of(eip7732ForkEpoch);
return this;
}

public Builder safeSlotsToImportOptimistically(final int safeSlotsToImportOptimistically) {
if (safeSlotsToImportOptimistically < 0) {
throw new InvalidConfigurationException(
Expand Down
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.EIP7732;
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 @@ -28,6 +29,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.SpecConfigEip7732;
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 @@ -63,9 +65,16 @@ public static Spec create(final SpecConfig config) {
.toVersionElectra()
.map(SpecConfigElectra::getElectraForkEpoch)
.orElse(FAR_FUTURE_EPOCH);
final UInt64 eip7732ForkEpoch =
config
.toVersionEip7732()
.map(SpecConfigEip7732::getEip7732ForkEpoch)
.orElse(FAR_FUTURE_EPOCH);
final SpecMilestone highestMilestoneSupported;

if (!electraForkEpoch.equals(FAR_FUTURE_EPOCH)) {
if (!eip7732ForkEpoch.equals(FAR_FUTURE_EPOCH)) {
highestMilestoneSupported = EIP7732;
} 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 @@ -26,6 +26,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.SpecConfigEip7732;
import tech.pegasys.teku.spec.config.SpecConfigElectra;

public enum SpecMilestone {
Expand All @@ -34,7 +35,8 @@ public enum SpecMilestone {
BELLATRIX,
CAPELLA,
DENEB,
ELECTRA;
ELECTRA,
EIP7732;

/**
* Returns true if this milestone is at or after the supplied milestone ({@code other})
Expand Down Expand Up @@ -114,13 +116,15 @@ static Optional<Bytes4> getForkVersion(
case CAPELLA -> specConfig.toVersionCapella().map(SpecConfigCapella::getCapellaForkVersion);
case DENEB -> specConfig.toVersionDeneb().map(SpecConfigDeneb::getDenebForkVersion);
case ELECTRA -> specConfig.toVersionElectra().map(SpecConfigElectra::getElectraForkVersion);
case EIP7732 -> specConfig.toVersionEip7732().map(SpecConfigEip7732::getEip7732ForkVersion);
};
}

static Optional<UInt64> getForkEpoch(final SpecConfig specConfig, final SpecMilestone milestone) {
return switch (milestone) {
case PHASE0 ->
// Phase0 can only ever start at epoch 0 - no non-zero slot is valid. However, another fork
// Phase0 can only ever start at epoch 0 - no non-zero slot is valid. However, another
// fork
// may also be configured to start at epoch 0, effectively overriding phase0
Optional.of(UInt64.ZERO);
case ALTAIR -> specConfig.toVersionAltair().map(SpecConfigAltair::getAltairForkEpoch);
Expand All @@ -130,6 +134,7 @@ static Optional<UInt64> getForkEpoch(final SpecConfig specConfig, final SpecMile
case CAPELLA -> specConfig.toVersionCapella().map(SpecConfigCapella::getCapellaForkEpoch);
case DENEB -> specConfig.toVersionDeneb().map(SpecConfigDeneb::getDenebForkEpoch);
case ELECTRA -> specConfig.toVersionElectra().map(SpecConfigElectra::getElectraForkEpoch);
case EIP7732 -> specConfig.toVersionEip7732().map(SpecConfigEip7732::getEip7732ForkEpoch);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@
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.SpecConfigEip7732;
import tech.pegasys.teku.spec.config.SpecConfigElectra;
import tech.pegasys.teku.spec.logic.DelegatingSpecLogic;
import tech.pegasys.teku.spec.logic.SpecLogic;
import tech.pegasys.teku.spec.logic.versions.altair.SpecLogicAltair;
import tech.pegasys.teku.spec.logic.versions.bellatrix.SpecLogicBellatrix;
import tech.pegasys.teku.spec.logic.versions.capella.SpecLogicCapella;
import tech.pegasys.teku.spec.logic.versions.deneb.SpecLogicDeneb;
import tech.pegasys.teku.spec.logic.versions.eip7732.SpecLogicEip7732;
import tech.pegasys.teku.spec.logic.versions.electra.SpecLogicElectra;
import tech.pegasys.teku.spec.logic.versions.phase0.SpecLogicPhase0;
import tech.pegasys.teku.spec.schemas.SchemaDefinitions;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsAltair;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsBellatrix;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsCapella;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsDeneb;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsEip7732;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsPhase0;

Expand Down Expand Up @@ -63,6 +66,7 @@ public static Optional<SpecVersion> create(
case CAPELLA -> specConfig.toVersionCapella().map(SpecVersion::createCapella);
case DENEB -> specConfig.toVersionDeneb().map(SpecVersion::createDeneb);
case ELECTRA -> specConfig.toVersionElectra().map(SpecVersion::createElectra);
case EIP7732 -> specConfig.toVersionEip7732().map(SpecVersion::createEip7732);
};
}

Expand Down Expand Up @@ -108,6 +112,13 @@ static SpecVersion createElectra(final SpecConfigElectra specConfig) {
return new SpecVersion(SpecMilestone.ELECTRA, specConfig, schemaDefinitions, specLogic);
}

static SpecVersion createEip7732(final SpecConfigEip7732 specConfig) {
final SchemaDefinitionsEip7732 schemaDefinitions = new SchemaDefinitionsEip7732(specConfig);
final SpecLogicEip7732 specLogic =
SpecLogicEip7732.create(specConfig, schemaDefinitions, SYSTEM_TIME_PROVIDER);
return new SpecVersion(SpecMilestone.EIP7732, specConfig, schemaDefinitions, specLogic);
}

public SpecMilestone getMilestone() {
return milestone;
}
Expand Down
Loading