Skip to content

Commit

Permalink
fix acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi committed Jan 9, 2025
1 parent ab070e9 commit 2b14fb4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ private static TekuNodeConfigBuilder createTekuNodeBuilderForMilestone(
tekuNodeConfigBuilder.withDenebEpoch(UInt64.ZERO);
tekuNodeConfigBuilder.withElectraEpoch(UInt64.ZERO);
break;
case EIP7805:
tekuNodeConfigBuilder.withCapellaEpoch(UInt64.ZERO);
tekuNodeConfigBuilder.withDenebEpoch(UInt64.ZERO);
tekuNodeConfigBuilder.withElectraEpoch(UInt64.ZERO);
tekuNodeConfigBuilder.withEip(UInt64.ZERO);
break;
default:
// Test will reach this whenever a new milestone is added and isn't mapped on the switch.
// This is a way to force us to always remember to validate that a new milestone can start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ public TekuNodeConfigBuilder withElectraEpoch(final UInt64 electraForkEpoch) {
return this;
}

public TekuNodeConfigBuilder withEip7805Epoch(final UInt64 eip7805ForkEpoch) {
mustBe(NodeType.BEACON_NODE);
LOG.debug("Xnetwork-eip7805-fork-epoch={}", eip7805ForkEpoch);
configMap.put("Xnetwork-eip7805-fork-epoch", eip7805ForkEpoch.toString());
specConfigModifier =
specConfigModifier.andThen(
specConfigBuilder ->
specConfigBuilder.eip7805Builder(
eip7805Builder -> eip7805Builder.eip7805ForkEpoch(eip7805ForkEpoch)));
return this;
}

public TekuNodeConfigBuilder withTrustedSetupFromClasspath(final String trustedSetup)
throws Exception {
mustBe(NodeType.BEACON_NODE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class Eth2NetworkConfiguration {
private final Optional<UInt64> capellaForkEpoch;
private final Optional<UInt64> denebForkEpoch;
private final Optional<UInt64> electraForkEpoch;
private final Optional<UInt64> eip7805ForkEpoch;
private final Eth1Address eth1DepositContractAddress;
private final Optional<UInt64> eth1DepositContractDeployBlock;
private final Optional<String> trustedSetup;
Expand Down Expand Up @@ -122,6 +123,7 @@ private Eth2NetworkConfiguration(
final Optional<UInt64> capellaForkEpoch,
final Optional<UInt64> denebForkEpoch,
final Optional<UInt64> electraForkEpoch,
final Optional<UInt64> eip7805ForkEpoch,
final Optional<Bytes32> terminalBlockHashOverride,
final Optional<UInt256> totalTerminalDifficultyOverride,
final Optional<UInt64> terminalBlockHashEpochOverride,
Expand All @@ -144,6 +146,7 @@ private Eth2NetworkConfiguration(
this.capellaForkEpoch = capellaForkEpoch;
this.denebForkEpoch = denebForkEpoch;
this.electraForkEpoch = electraForkEpoch;
this.eip7805ForkEpoch = eip7805ForkEpoch;
this.eth1DepositContractAddress =
eth1DepositContractAddress == null
? spec.getGenesisSpecConfig().getDepositContractAddress()
Expand Down Expand Up @@ -231,6 +234,7 @@ public Optional<UInt64> getForkEpoch(final SpecMilestone specMilestone) {
case CAPELLA -> capellaForkEpoch;
case DENEB -> denebForkEpoch;
case ELECTRA -> electraForkEpoch;
case EIP7805 -> eip7805ForkEpoch;
default -> Optional.empty();
};
}
Expand Down Expand Up @@ -311,6 +315,7 @@ public boolean equals(final Object o) {
&& Objects.equals(capellaForkEpoch, that.capellaForkEpoch)
&& Objects.equals(denebForkEpoch, that.denebForkEpoch)
&& Objects.equals(electraForkEpoch, that.electraForkEpoch)
&& Objects.equals(eip7805ForkEpoch, that.eip7805ForkEpoch)
&& Objects.equals(eth1DepositContractAddress, that.eth1DepositContractAddress)
&& Objects.equals(eth1DepositContractDeployBlock, that.eth1DepositContractDeployBlock)
&& Objects.equals(trustedSetup, that.trustedSetup)
Expand All @@ -335,6 +340,7 @@ public int hashCode() {
capellaForkEpoch,
denebForkEpoch,
electraForkEpoch,
eip7805ForkEpoch,
eth1DepositContractAddress,
eth1DepositContractDeployBlock,
trustedSetup,
Expand Down Expand Up @@ -375,6 +381,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> eip7805ForkEpoch = Optional.empty();
private Optional<Bytes32> terminalBlockHashOverride = Optional.empty();
private Optional<UInt256> totalTerminalDifficultyOverride = Optional.empty();
private Optional<UInt64> terminalBlockHashEpochOverride = Optional.empty();
Expand Down Expand Up @@ -439,7 +446,7 @@ public Eth2NetworkConfiguration build() {
electraForkEpoch.ifPresent(electraBuilder::electraForkEpoch));
builder.eip7805Builder(
eip7805Builder ->
electraForkEpoch.ifPresent(eip7805Builder::eip7805ForkEpoch));
eip7805ForkEpoch.ifPresent(eip7805Builder::eip7805ForkEpoch));
});
}
if (spec.getForkSchedule().getSupportedMilestones().contains(SpecMilestone.DENEB)
Expand Down Expand Up @@ -472,6 +479,7 @@ public Eth2NetworkConfiguration build() {
capellaForkEpoch,
denebForkEpoch,
electraForkEpoch,
eip7805ForkEpoch,
terminalBlockHashOverride,
totalTerminalDifficultyOverride,
terminalBlockHashEpochOverride,
Expand Down Expand Up @@ -683,6 +691,11 @@ public Builder electraForkEpoch(final UInt64 electraForkEpoch) {
return this;
}

public Builder eip7805ForkEpoch(final UInt64 eip7805ForkEpoch) {
this.eip7805ForkEpoch = Optional.of(eip7805ForkEpoch);
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 @@ -245,7 +245,7 @@ public static Spec createMainnetElectra() {
public static Spec createMainnetEip7805() {
final SpecConfigAndParent<? extends SpecConfig> specConfig =
getEip7805SpecConfig(Eth2Network.MAINNET);
return create(specConfig, SpecMilestone.ELECTRA);
return create(specConfig, SpecMilestone.EIP7805);
}

public static Spec createPhase0(final SpecConfigAndParent<? extends SpecConfig> config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ public class Eth2NetworkOptions {
arity = "1")
private UInt64 electraForkEpoch;

@Option(
names = {"--Xnetwork-eip7805-fork-epoch"},
hidden = true,
paramLabel = "<epoch>",
description = "Override the eip7805 fork activation epoch.",
arity = "1")
private UInt64 eip7805ForkEpoch;

@Option(
names = {"--Xnetwork-total-terminal-difficulty-override"},
hidden = true,
Expand Down Expand Up @@ -331,6 +339,9 @@ private void configureEth2Network(final Eth2NetworkConfiguration.Builder builder
if (electraForkEpoch != null) {
builder.electraForkEpoch(electraForkEpoch);
}
if (eip7805ForkEpoch != null) {
builder.eip7805ForkEpoch(eip7805ForkEpoch);
}
if (totalTerminalDifficultyOverride != null) {
builder.totalTerminalDifficultyOverride(totalTerminalDifficultyOverride);
}
Expand Down

0 comments on commit 2b14fb4

Please sign in to comment.