Skip to content

Commit

Permalink
Remove warning for terminal block hash and epoch network defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
zilm13 committed Jan 8, 2025
1 parent c12b91e commit 68989d4
Showing 1 changed file with 52 additions and 22 deletions.
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

0 comments on commit 68989d4

Please sign in to comment.