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

Hardcode Bellatrix Terminal Blocks for all known networks #8943

Merged
merged 8 commits into from
Jan 9, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ private Builder reset() {
eth1DepositContractAddress = null;
eth1DepositContractDeployBlock = Optional.empty();
trustedSetup = Optional.empty();
terminalBlockHashOverride = Optional.empty();
terminalBlockHashEpochOverride = Optional.empty();
totalTerminalDifficultyOverride = Optional.empty();
return this;
}

Expand Down Expand Up @@ -802,7 +805,11 @@ public Builder applyMainnetNetworkDefaults() {

// Nimbus
"enr:-LK4QA8FfhaAjlb_BXsXxSfiysR7R52Nhi9JBt4F8SPssu8hdE1BXQQEtVDC3qStCW60LSO7hEsVHv5zm8_6Vnjhcn0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhAN4aBKJc2VjcDI1NmsxoQJerDhsJ-KxZ8sHySMOCmTO6sHM3iCFQ6VMvLTe948MyYN0Y3CCI4yDdWRwgiOM",
"enr:-LK4QKWrXTpV9T78hNG6s8AM6IO4XH9kFT91uZtFg1GcsJ6dKovDOr1jtAAFPnS2lvNltkOGA9k29BUN7lFh_sjuc9QBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhANAdd-Jc2VjcDI1NmsxoQLQa6ai7y9PMN5hpLe5HmiJSlYzMuzP7ZhwRiwHvqNXdoN0Y3CCI4yDdWRwgiOM");
"enr:-LK4QKWrXTpV9T78hNG6s8AM6IO4XH9kFT91uZtFg1GcsJ6dKovDOr1jtAAFPnS2lvNltkOGA9k29BUN7lFh_sjuc9QBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhANAdd-Jc2VjcDI1NmsxoQLQa6ai7y9PMN5hpLe5HmiJSlYzMuzP7ZhwRiwHvqNXdoN0Y3CCI4yDdWRwgiOM")
.terminalBlockHashEpochOverride(UInt64.valueOf(146875))
.terminalBlockHashOverride(
Bytes32.fromHexString(
"0x55b11b918355b1ef9c5db810302ebad0bf2544255b530cdce90674d5887bb286"));
}

private Builder applySepoliaNetworkDefaults() {
Expand All @@ -827,7 +834,11 @@ private Builder applySepoliaNetworkDefaults() {
// Another bootnode
"enr:-L64QC9Hhov4DhQ7mRukTOz4_jHm4DHlGL726NWH4ojH1wFgEwSin_6H95Gs6nW2fktTWbPachHJ6rUFu0iJNgA0SB2CARqHYXR0bmV0c4j__________4RldGgykDb6UBOQAABx__________-CaWSCdjSCaXCEA-2vzolzZWNwMjU2azGhA17lsUg60R776rauYMdrAz383UUgESoaHEzMkvm4K6k6iHN5bmNuZXRzD4N0Y3CCIyiDdWRwgiMo",
// Lodestart bootnode
"enr:-KG4QJejf8KVtMeAPWFhN_P0c4efuwu1pZHELTveiXUeim6nKYcYcMIQpGxxdgT2Xp9h-M5pr9gn2NbbwEAtxzu50Y8BgmlkgnY0gmlwhEEVkQCDaXA2kCoBBPnAEJg4AAAAAAAAAAGJc2VjcDI1NmsxoQLEh_eVvk07AQABvLkTGBQTrrIOQkzouMgSBtNHIRUxOIN1ZHCCIyiEdWRwNoIjKA");
"enr:-KG4QJejf8KVtMeAPWFhN_P0c4efuwu1pZHELTveiXUeim6nKYcYcMIQpGxxdgT2Xp9h-M5pr9gn2NbbwEAtxzu50Y8BgmlkgnY0gmlwhEEVkQCDaXA2kCoBBPnAEJg4AAAAAAAAAAGJc2VjcDI1NmsxoQLEh_eVvk07AQABvLkTGBQTrrIOQkzouMgSBtNHIRUxOIN1ZHCCIyiEdWRwNoIjKA")
.terminalBlockHashEpochOverride(UInt64.valueOf(3599))
.terminalBlockHashOverride(
Bytes32.fromHexString(
"0xd07cce9785d39c0dd2409b7d8e69d6bff26a69a0fa5308ac781c63ffe2a37bc1"));
}

private Builder applyLuksoNetworkDefaults() {
Expand Down Expand Up @@ -860,7 +871,11 @@ public Builder applyGnosisNetworkDefaults() {
"enr:-Ly4QCD5D99p36WafgTSxB6kY7D2V1ca71C49J4VWI2c8UZCCPYBvNRWiv0-HxOcbpuUdwPVhyWQCYm1yq2ZH0ukCbQBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpCCS-QxAgAAZP__________gmlkgnY0gmlwhI1eYVSJc2VjcDI1NmsxoQJJMSV8iSZ8zvkgbi8cjIGEUVJeekLqT0LQha_co-siT4hzeW5jbmV0cwCDdGNwgiMog3VkcIIjKA",
"enr:-KK4QKXJq1QOVWuJAGige4uaT8LRPQGCVRf3lH3pxjaVScMRUfFW1eiiaz8RwOAYvw33D4EX-uASGJ5QVqVCqwccxa-Bi4RldGgykCGm-DYDAABk__________-CaWSCdjSCaXCEM0QnzolzZWNwMjU2azGhAhNvrRkpuK4MWTf3WqiOXSOePL8Zc-wKVpZ9FQx_BDadg3RjcIIjKIN1ZHCCIyg",
"enr:-LO4QO87Rn2ejN3SZdXkx7kv8m11EZ3KWWqoIN5oXwQ7iXR9CVGd1dmSyWxOL1PGsdIqeMf66OZj4QGEJckSi6okCdWBpIdhdHRuZXRziAAAAABgAAAAhGV0aDKQPr_UhAQAAGT__________4JpZIJ2NIJpcIQj0iX1iXNlY3AyNTZrMaEDd-_eqFlWWJrUfEp8RhKT9NxdYaZoLHvsp3bbejPyOoeDdGNwgiMog3VkcIIjKA",
"enr:-LK4QIJUAxX9uNgW4ACkq8AixjnSTcs9sClbEtWRq9F8Uy9OEExsr4ecpBTYpxX66cMk6pUHejCSX3wZkK2pOCCHWHEBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpA-v9SEBAAAZP__________gmlkgnY0gmlwhCPSnDuJc2VjcDI1NmsxoQNuaAjFE-ANkH3pbeBdPiEIwjR5kxFuKaBWxHkqFuPz5IN0Y3CCIyiDdWRwgiMo");
"enr:-LK4QIJUAxX9uNgW4ACkq8AixjnSTcs9sClbEtWRq9F8Uy9OEExsr4ecpBTYpxX66cMk6pUHejCSX3wZkK2pOCCHWHEBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpA-v9SEBAAAZP__________gmlkgnY0gmlwhCPSnDuJc2VjcDI1NmsxoQNuaAjFE-ANkH3pbeBdPiEIwjR5kxFuKaBWxHkqFuPz5IN0Y3CCIyiDdWRwgiMo")
.terminalBlockHashEpochOverride(UInt64.valueOf(394147))
.terminalBlockHashOverride(
Bytes32.fromHexString(
"0xf5cff68065ac6014bb7c9aa731d4d4084de0994f807ac1df3856308b3c9b2b48"));
}

public Builder applyChiadoNetworkDefaults() {
Expand Down Expand Up @@ -891,7 +906,11 @@ public Builder applyChiadoNetworkDefaults() {
// GnosisDAO Bootnode: 35.206.174.92
"enr:-KG4QF7z4LUdMfgwvh-fS-MDv_1hPSUCqGfyOWGLNJuoBHKFAMSHz8geQn8v3qDDbuSQKud3WIAjKqR4gqJoLBUEJ08ZhGV0aDKQDc1ElgAAAG___________4JpZIJ2NIJpcIQjzq5ciXNlY3AyNTZrMaECt7YO363pV54d3QdgnluL5kxzhCR_k0yM9C-G6bqMGoKDdGNwgiMog3VkcIIjKA",
// GnosisDAO Bootnode: 35.210.126.23
"enr:-LK4QCUTEmZrT1AgCKdyVgwnHL5J0VSoxsyjruAtwo-owBTBVEOyAnQRVNXlcW5aL-ycntk5oHDrKCR-DXZAlUAKpjEBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpCdM7Z1BAAAb___________gmlkgnY0gmlwhCPSfheJc2VjcDI1NmsxoQNpdf8U9pzsU9m6Hzgd1rmTI-On-QImJnkZBGqDp4org4N0Y3CCIyiDdWRwgiMo");
"enr:-LK4QCUTEmZrT1AgCKdyVgwnHL5J0VSoxsyjruAtwo-owBTBVEOyAnQRVNXlcW5aL-ycntk5oHDrKCR-DXZAlUAKpjEBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpCdM7Z1BAAAb___________gmlkgnY0gmlwhCPSfheJc2VjcDI1NmsxoQNpdf8U9pzsU9m6Hzgd1rmTI-On-QImJnkZBGqDp4org4N0Y3CCIyiDdWRwgiMo")
.terminalBlockHashEpochOverride(UInt64.valueOf(27263))
.terminalBlockHashOverride(
Bytes32.fromHexString(
"0x39f44fc16dc964e8d2d1637b99e12992be4a4f766a66658da730e20e511ced64"));
}

private Builder applyHoleskyNetworkDefaults() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import static tech.pegasys.teku.infrastructure.async.SafeFuture.completedFuture;

Expand Down Expand Up @@ -97,6 +98,8 @@ void shouldBeValidWhenTerminalBlockHashMatchesInActivationEpoch() {
.getBellatrixTransitionHelpers()
.orElseThrow()
.validateMergeBlock(executionLayer, payload, blockSlot);
// Verify EL is never called if hash is configured and matches
verifyNoMoreInteractions(executionLayer);
assertPayloadResultStatus(result, ExecutionPayloadStatus.VALID);
}

Expand Down
74 changes: 52 additions & 22 deletions teku/src/main/java/tech/pegasys/teku/AbstractNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import tech.pegasys.teku.infrastructure.logging.StartupLogConfig;
import tech.pegasys.teku.infrastructure.metrics.MetricsEndpoint;
import tech.pegasys.teku.infrastructure.version.VersionProvider;
import tech.pegasys.teku.networks.Eth2NetworkConfiguration;
import tech.pegasys.teku.service.serviceutils.ServiceConfig;
import tech.pegasys.teku.service.serviceutils.layout.DataDirLayout;
import tech.pegasys.teku.services.ServiceController;
Expand Down Expand Up @@ -133,28 +134,7 @@ private void reportOverrides(final TekuConfiguration tekuConfig) {
.ifPresent(forkEpoch -> STATUS_LOG.warnForkEpochChanged(specMilestone.name(), forkEpoch));
}

tekuConfig
.eth2NetworkConfiguration()
.getTotalTerminalDifficultyOverride()
.ifPresent(
ttdo ->
STATUS_LOG.warnBellatrixParameterChanged(
"TERMINAL_TOTAL_DIFFICULTY", ttdo.toString()));

tekuConfig
.eth2NetworkConfiguration()
.getTerminalBlockHashOverride()
.ifPresent(
tbho ->
STATUS_LOG.warnBellatrixParameterChanged("TERMINAL_BLOCK_HASH", tbho.toString()));

tekuConfig
.eth2NetworkConfiguration()
.getTerminalBlockHashEpochOverride()
.ifPresent(
tbheo ->
STATUS_LOG.warnBellatrixParameterChanged(
"TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH", tbheo.toString()));
reportBellatrixMergeOverrides(tekuConfig);

// Deneb's epochsStoreBlobs warning, which is not actually a full override
final Optional<SpecVersion> specVersionDeneb =
Expand All @@ -175,6 +155,56 @@ private void reportOverrides(final TekuConfiguration tekuConfig) {
});
}

private void reportBellatrixMergeOverrides(final TekuConfiguration tekuConfig) {
tekuConfig
.eth2NetworkConfiguration()
.getTotalTerminalDifficultyOverride()
.ifPresent(
ttdo ->
STATUS_LOG.warnBellatrixParameterChanged(
"TERMINAL_TOTAL_DIFFICULTY", ttdo.toString()));

final Optional<Eth2Network> maybeEth2Network =
tekuConfig.eth2NetworkConfiguration().getEth2Network();

final boolean reportTerminalBlockHashOverride;
final boolean reportTerminalBlockHashEpochOverride;
if (maybeEth2Network.isEmpty()) {
reportTerminalBlockHashOverride = true;
reportTerminalBlockHashEpochOverride = true;
} else {
final Eth2NetworkConfiguration defaultConfiguration =
Eth2NetworkConfiguration.builder().applyNetworkDefaults(maybeEth2Network.get()).build();
reportTerminalBlockHashOverride =
!defaultConfiguration
.getTerminalBlockHashOverride()
.equals(tekuConfig.eth2NetworkConfiguration().getTerminalBlockHashOverride());
reportTerminalBlockHashEpochOverride =
!defaultConfiguration
.getTerminalBlockHashEpochOverride()
.equals(tekuConfig.eth2NetworkConfiguration().getTerminalBlockHashEpochOverride());
}

if (reportTerminalBlockHashOverride) {
tekuConfig
.eth2NetworkConfiguration()
.getTerminalBlockHashOverride()
.ifPresent(
tbho ->
STATUS_LOG.warnBellatrixParameterChanged("TERMINAL_BLOCK_HASH", tbho.toString()));
}

if (reportTerminalBlockHashEpochOverride) {
tekuConfig
.eth2NetworkConfiguration()
.getTerminalBlockHashEpochOverride()
.ifPresent(
tbheo ->
STATUS_LOG.warnBellatrixParameterChanged(
"TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH", tbheo.toString()));
}
}

@Override
public abstract ServiceController getServiceController();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ void shouldUseAlwaysSendPayloadAttributesIfSpecified() {
}

@Test
void shouldMergeTransitionsOverrideBeEmptyByDefault() {
void shouldMergeTransitionsOverrideContainsMainnetTransitionByDefault() {
final TekuConfiguration config = getTekuConfigurationFromArguments();
assertThat(config.eth2NetworkConfiguration().getTotalTerminalDifficultyOverride())
.isEqualTo(Optional.empty());
assertThat(config.eth2NetworkConfiguration().getTerminalBlockHashOverride())
.isEqualTo(Optional.empty());
.contains(
Bytes32.fromHexString(
"0x55b11b918355b1ef9c5db810302ebad0bf2544255b530cdce90674d5887bb286"));
assertThat(config.eth2NetworkConfiguration().getTerminalBlockHashEpochOverride())
.isEqualTo(Optional.empty());
.contains(UInt64.valueOf(146875));
}

@Test
Expand Down
Loading