From 81ed42f8cd42c217fb01b2c4edeb513f180c0e2f Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 2 Jun 2023 11:08:41 +1000 Subject: [PATCH] Fixed gossipMaxSize and maxChunkSize to use bellatrix derivitives and be in presets properly. (#7217) Signed-off-by: Paul Harris --- .../config/DelegatingSpecConfigBellatrix.java | 10 +++++++ .../teku/spec/config/SpecConfigBellatrix.java | 4 +++ .../spec/config/SpecConfigBellatrixImpl.java | 26 +++++++++++++++++-- .../teku/spec/config/SpecConfigPhase0.java | 6 ++++- .../spec/config/builder/BellatrixBuilder.java | 19 +++++++++++++- .../teku/spec/config/configs/mainnet.yaml | 4 --- .../teku/spec/config/configs/minimal.yaml | 4 --- .../spec/config/presets/gnosis/bellatrix.yaml | 6 ++--- .../spec/config/presets/gnosis/phase0.yaml | 10 ++++++- .../config/presets/mainnet/bellatrix.yaml | 6 ++--- .../spec/config/presets/mainnet/phase0.yaml | 10 ++++++- .../config/presets/minimal/bellatrix.yaml | 6 ++--- .../spec/config/presets/minimal/phase0.yaml | 10 ++++++- .../spec/config/presets/swift/bellatrix.yaml | 6 ++--- .../spec/config/presets/swift/phase0.yaml | 10 ++++++- .../spec/config/SpecConfigBellatrixTest.java | 3 ++- .../standard/presets/mainnet/bellatrix.yaml | 6 ++--- .../standard/presets/mainnet/phase0.yaml | 10 ++++++- .../standard/presets/minimal/bellatrix.yaml | 6 ++--- .../standard/presets/minimal/phase0.yaml | 10 ++++++- .../standard/presets/swift/bellatrix.yaml | 6 ++--- .../config/standard/presets/swift/phase0.yaml | 10 ++++++- .../eth2/Eth2P2PNetworkBuilder.java | 5 +++- .../GossipForkSubscriptionsBellatrix.java | 8 ++++++ .../GossipForkSubscriptionsCapella.java | 4 +-- .../GossipForkSubscriptionsDeneb.java | 4 +-- .../GossipForkSubscriptionsPhase0.java | 24 ++++++++--------- .../BlobSidecarsByRootMessageHandlerTest.java | 6 +++-- 28 files changed, 176 insertions(+), 63 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigBellatrix.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigBellatrix.java index f0df2744c42..0bc8e98cdd2 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigBellatrix.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigBellatrix.java @@ -97,4 +97,14 @@ public UInt256 getTerminalTotalDifficulty() { public int getSafeSlotsToImportOptimistically() { return specConfigBellatrix.getSafeSlotsToImportOptimistically(); } + + @Override + public int getGossipMaxSizeBellatrix() { + return specConfigBellatrix.getGossipMaxSizeBellatrix(); + } + + @Override + public int getMaxChunkSizeBellatrix() { + return specConfigBellatrix.getMaxChunkSizeBellatrix(); + } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBellatrix.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBellatrix.java index 70cbda5c1ef..093cd35d335 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBellatrix.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBellatrix.java @@ -59,4 +59,8 @@ static SpecConfigBellatrix required(SpecConfig specConfig) { UInt256 getTerminalTotalDifficulty(); int getSafeSlotsToImportOptimistically(); + + int getGossipMaxSizeBellatrix(); + + int getMaxChunkSizeBellatrix(); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBellatrixImpl.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBellatrixImpl.java index 394f7ebc487..8d39251faca 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBellatrixImpl.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBellatrixImpl.java @@ -42,6 +42,10 @@ public class SpecConfigBellatrixImpl extends DelegatingSpecConfigAltair // Optimistic Sync private final int safeSlotsToImportOptimistically; + // network + private final int gossipMaxSizeBellatrix; + private final int maxChunkSizeBellatrix; + public SpecConfigBellatrixImpl( final SpecConfigAltair specConfig, final Bytes4 bellatrixForkVersion, @@ -56,7 +60,9 @@ public SpecConfigBellatrixImpl( final UInt256 terminalTotalDifficulty, final Bytes32 terminalBlockHash, final UInt64 terminalBlockHashActivationEpoch, - final int safeSlotsToImportOptimistically) { + final int safeSlotsToImportOptimistically, + final int gossipMaxSizeBellatrix, + final int maxChunkSizeBellatrix) { super(specConfig); this.bellatrixForkVersion = bellatrixForkVersion; this.bellatrixForkEpoch = bellatrixForkEpoch; @@ -71,6 +77,8 @@ public SpecConfigBellatrixImpl( this.terminalBlockHash = terminalBlockHash; this.terminalBlockHashActivationEpoch = terminalBlockHashActivationEpoch; this.safeSlotsToImportOptimistically = safeSlotsToImportOptimistically; + this.gossipMaxSizeBellatrix = gossipMaxSizeBellatrix; + this.maxChunkSizeBellatrix = maxChunkSizeBellatrix; } public static SpecConfigBellatrix required(final SpecConfig specConfig) { @@ -148,6 +156,16 @@ public int getSafeSlotsToImportOptimistically() { return safeSlotsToImportOptimistically; } + @Override + public int getGossipMaxSizeBellatrix() { + return gossipMaxSizeBellatrix; + } + + @Override + public int getMaxChunkSizeBellatrix() { + return maxChunkSizeBellatrix; + } + @Override public Optional toVersionBellatrix() { return Optional.of(this); @@ -169,6 +187,8 @@ public boolean equals(final Object o) { && maxTransactionsPerPayload == that.maxTransactionsPerPayload && bytesPerLogsBloom == that.bytesPerLogsBloom && maxExtraDataBytes == that.maxExtraDataBytes + && gossipMaxSizeBellatrix == that.gossipMaxSizeBellatrix + && maxChunkSizeBellatrix == that.maxChunkSizeBellatrix && Objects.equals(bellatrixForkVersion, that.bellatrixForkVersion) && Objects.equals(bellatrixForkEpoch, that.bellatrixForkEpoch) && Objects.equals( @@ -193,6 +213,8 @@ public int hashCode() { maxExtraDataBytes, terminalTotalDifficulty, terminalBlockHash, - terminalBlockHashActivationEpoch); + terminalBlockHashActivationEpoch, + gossipMaxSizeBellatrix, + maxChunkSizeBellatrix); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigPhase0.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigPhase0.java index a8db413c0f3..1748a84d35e 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigPhase0.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigPhase0.java @@ -549,6 +549,8 @@ public boolean equals(final Object o) { && proposerScoreBoost == that.proposerScoreBoost && depositChainId == that.depositChainId && depositNetworkId == that.depositNetworkId + && gossipMaxSize == that.gossipMaxSize + && maxChunkSize == that.maxChunkSize && Objects.equals(eth1FollowDistance, that.eth1FollowDistance) && Objects.equals(minGenesisTime, that.minGenesisTime) && Objects.equals(hysteresisQuotient, that.hysteresisQuotient) @@ -621,6 +623,8 @@ public int hashCode() { depositChainId, depositNetworkId, depositContractAddress, - progressiveBalancesMode); + progressiveBalancesMode, + gossipMaxSize, + maxChunkSize); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/builder/BellatrixBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/builder/BellatrixBuilder.java index af192fb86b6..e6c63bb20f7 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/builder/BellatrixBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/builder/BellatrixBuilder.java @@ -48,6 +48,9 @@ public class BellatrixBuilder implements ForkConfigBuilder