From 9d5ea69ac398a3ba14c2e5a8816f72c6bab6274e Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 25 Nov 2024 15:07:46 +0000 Subject: [PATCH] Change to constant --- .../pegasys/teku/networks/test-constants.yaml | 3 +- .../spec/config/DelegatingSpecConfig.java | 15 --------- .../spec/config/NetworkingSpecConfig.java | 8 ----- .../teku/spec/config/SpecConfigPhase0.java | 32 +------------------ .../teku/spec/config/SpecConfigReader.java | 4 ++- .../config/builder/SpecConfigBuilder.java | 24 -------------- .../teku/spec/constants/NetworkConstants.java | 3 ++ .../teku/spec/config/configs/chiado.yaml | 1 - .../teku/spec/config/configs/ephemery.yaml | 1 - .../teku/spec/config/configs/gnosis.yaml | 1 - .../teku/spec/config/configs/holesky.yaml | 1 - .../teku/spec/config/configs/less-swift.yaml | 1 - .../teku/spec/config/configs/lukso.yaml | 1 - .../teku/spec/config/configs/mainnet.yaml | 1 - .../teku/spec/config/configs/minimal.yaml | 1 - .../teku/spec/config/configs/sepolia.yaml | 1 - .../teku/spec/config/configs/swift.yaml | 1 - .../config/invalid/missingAltairField.yaml | 3 +- .../spec/config/invalid/unknownField.yaml | 3 +- .../spec/config/standard/with-overrides.yaml | 3 +- .../eth2/peers/Eth2PeerManager.java | 7 ++-- .../p2p/libp2p/LibP2PNetworkBuilder.java | 3 +- .../teku/cli/subcommand/test-spec.yaml | 3 +- .../pegasys/teku/cli/options/constants.yaml | 3 +- .../teku/cli/subcommand/deneb_config.yaml | 1 - 25 files changed, 18 insertions(+), 107 deletions(-) diff --git a/ethereum/networks/src/test/resources/tech/pegasys/teku/networks/test-constants.yaml b/ethereum/networks/src/test/resources/tech/pegasys/teku/networks/test-constants.yaml index 6aab2696a57..17f311def58 100644 --- a/ethereum/networks/src/test/resources/tech/pegasys/teku/networks/test-constants.yaml +++ b/ethereum/networks/src/test/resources/tech/pegasys/teku/networks/test-constants.yaml @@ -180,5 +180,4 @@ SUBNETS_PER_NODE: 2 ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS -ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 \ No newline at end of file +ATTESTATION_SUBNET_PREFIX_BITS: 6 \ No newline at end of file diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfig.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfig.java index 2829a5d0575..403dae93aba 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfig.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfig.java @@ -327,16 +327,6 @@ public int getMaxChunkSize() { return specConfig.getMaxChunkSize(); } - @Override - public int getTtfbTimeout() { - return specConfig.getTtfbTimeout(); - } - - @Override - public int getRespTimeout() { - return specConfig.getRespTimeout(); - } - @Override public int getAttestationPropagationSlotRange() { return specConfig.getAttestationPropagationSlotRange(); @@ -392,11 +382,6 @@ public int getAttestationSubnetPrefixBits() { return specConfig.getAttestationSubnetPrefixBits(); } - @Override - public int getMaxConcurrentRequests() { - return specConfig.getMaxConcurrentRequests(); - } - @Override public int getProposerScoreBoost() { return specConfig.getProposerScoreBoost(); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/NetworkingSpecConfig.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/NetworkingSpecConfig.java index f368253c989..a41f0d5f920 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/NetworkingSpecConfig.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/NetworkingSpecConfig.java @@ -27,12 +27,6 @@ public interface NetworkingSpecConfig { int getMinEpochsForBlockRequests(); - // in seconds - int getTtfbTimeout(); - - // in seconds - int getRespTimeout(); - int getAttestationPropagationSlotRange(); // in millis @@ -54,8 +48,6 @@ public interface NetworkingSpecConfig { // int(ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS) int getAttestationSubnetPrefixBits(); - int getMaxConcurrentRequests(); - default NetworkingSpecConfig getNetworkingConfig() { return this; } 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 57f19ccc2bb..52654dfdd29 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 @@ -107,8 +107,6 @@ public class SpecConfigPhase0 implements SpecConfig { private final int maxRequestBlocks; private final int epochsPerSubnetSubscription; private final int minEpochsForBlockRequests; - private final int ttfbTimeout; - private final int respTimeout; private final int attestationPropagationSlotRange; private final int maximumGossipClockDisparity; private final Bytes4 messageDomainInvalidSnappy; @@ -117,7 +115,6 @@ public class SpecConfigPhase0 implements SpecConfig { private final int attestationSubnetCount; private final int attestationSubnetExtraBits; private final int attestationSubnetPrefixBits; - private final int maxConcurrentRequests; private final int reorgMaxEpochsSinceFinalization; private final int reorgHeadWeightThreshold; private final int reorgParentWeightThreshold; @@ -180,8 +177,6 @@ public SpecConfigPhase0( final int maxRequestBlocks, final int epochsPerSubnetSubscription, final int minEpochsForBlockRequests, - final int ttfbTimeout, - final int respTimeout, final int attestationPropagationSlotRange, final int maximumGossipClockDisparity, final Bytes4 messageDomainInvalidSnappy, @@ -190,7 +185,6 @@ public SpecConfigPhase0( final int attestationSubnetCount, final int attestationSubnetExtraBits, final int attestationSubnetPrefixBits, - final int maxConcurrentRequests, final int reorgMaxEpochsSinceFinalization, final int reorgHeadWeightThreshold, final int reorgParentWeightThreshold, @@ -251,8 +245,6 @@ public SpecConfigPhase0( this.maxRequestBlocks = maxRequestBlocks; this.epochsPerSubnetSubscription = epochsPerSubnetSubscription; this.minEpochsForBlockRequests = minEpochsForBlockRequests; - this.ttfbTimeout = ttfbTimeout; - this.respTimeout = respTimeout; this.attestationPropagationSlotRange = attestationPropagationSlotRange; this.maximumGossipClockDisparity = maximumGossipClockDisparity; this.messageDomainInvalidSnappy = messageDomainInvalidSnappy; @@ -261,7 +253,6 @@ public SpecConfigPhase0( this.attestationSubnetCount = attestationSubnetCount; this.attestationSubnetExtraBits = attestationSubnetExtraBits; this.attestationSubnetPrefixBits = attestationSubnetPrefixBits; - this.maxConcurrentRequests = maxConcurrentRequests; this.reorgMaxEpochsSinceFinalization = reorgMaxEpochsSinceFinalization; this.reorgHeadWeightThreshold = reorgHeadWeightThreshold; this.reorgParentWeightThreshold = reorgParentWeightThreshold; @@ -588,16 +579,6 @@ public int getMinEpochsForBlockRequests() { return minEpochsForBlockRequests; } - @Override - public int getTtfbTimeout() { - return ttfbTimeout; - } - - @Override - public int getRespTimeout() { - return respTimeout; - } - @Override public int getAttestationPropagationSlotRange() { return attestationPropagationSlotRange; @@ -638,11 +619,6 @@ public int getAttestationSubnetPrefixBits() { return attestationSubnetPrefixBits; } - @Override - public int getMaxConcurrentRequests() { - return maxConcurrentRequests; - } - @Override public SpecMilestone getMilestone() { return SpecMilestone.PHASE0; @@ -699,9 +675,6 @@ public boolean equals(final Object o) { && attestationSubnetCount == that.attestationSubnetCount && attestationSubnetExtraBits == that.attestationSubnetExtraBits && attestationSubnetPrefixBits == that.attestationSubnetPrefixBits - && maxConcurrentRequests == that.maxConcurrentRequests - && ttfbTimeout == that.ttfbTimeout - && respTimeout == that.respTimeout && attestationPropagationSlotRange == that.attestationPropagationSlotRange && maximumGossipClockDisparity == that.maximumGossipClockDisparity && Objects.equals(eth1FollowDistance, that.eth1FollowDistance) @@ -781,8 +754,6 @@ public int hashCode() { maxChunkSize, maxRequestBlocks, epochsPerSubnetSubscription, - ttfbTimeout, - respTimeout, attestationPropagationSlotRange, maximumGossipClockDisparity, messageDomainInvalidSnappy, @@ -790,7 +761,6 @@ public int hashCode() { subnetsPerNode, attestationSubnetCount, attestationSubnetExtraBits, - attestationSubnetPrefixBits, - maxConcurrentRequests); + attestationSubnetPrefixBits); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigReader.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigReader.java index f48941998bd..eae0fbe2d56 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigReader.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigReader.java @@ -70,7 +70,9 @@ public class SpecConfigReader { "TRANSITION_TOTAL_DIFFICULTY", // Deprecated fields "GOSSIP_MAX_SIZE_BELLATRIX", - "MAX_CHUNK_SIZE_BELLATRIX"); + "MAX_CHUNK_SIZE_BELLATRIX", + "TTFB_TIMEOUT", + "RESP_TIMEOUT"); private static final ImmutableSet CONSTANT_KEYS = ImmutableSet.of( // Phase0 constants which may exist in legacy config files, but should now be ignored diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/builder/SpecConfigBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/builder/SpecConfigBuilder.java index 2a0ce2ded10..e731ec925fe 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/builder/SpecConfigBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/builder/SpecConfigBuilder.java @@ -112,8 +112,6 @@ public class SpecConfigBuilder { private Integer maxChunkSize; private Integer maxRequestBlocks; private Integer epochsPerSubnetSubscription; - private Integer ttfbTimeout; - private Integer respTimeout; private Integer attestationPropagationSlotRange; private Integer maximumGossipClockDisparity; private Bytes4 messageDomainInvalidSnappy; @@ -123,7 +121,6 @@ public class SpecConfigBuilder { private Integer attestationSubnetCount; private Integer attestationSubnetExtraBits; private Integer attestationSubnetPrefixBits; - private Integer maxConcurrentRequests; // added after Phase0, so add default values, or will be compatibility issue private Integer reorgMaxEpochsSinceFinalization = 2; @@ -206,8 +203,6 @@ public SpecConfigAndParent build() { maxRequestBlocks, epochsPerSubnetSubscription, minEpochsForBlockRequests, - ttfbTimeout, - respTimeout, attestationPropagationSlotRange, maximumGossipClockDisparity, messageDomainInvalidSnappy, @@ -216,7 +211,6 @@ public SpecConfigAndParent build() { attestationSubnetCount, attestationSubnetExtraBits, attestationSubnetPrefixBits, - maxConcurrentRequests, reorgMaxEpochsSinceFinalization, reorgHeadWeightThreshold, reorgParentWeightThreshold, @@ -281,8 +275,6 @@ private Map getValidationMap() { constants.put("maxRequestBlocks", maxRequestBlocks); constants.put("epochsPerSubnetSubscription", epochsPerSubnetSubscription); constants.put("minEpochsForBlockRequests", minEpochsForBlockRequests); - constants.put("ttfbTimeout", ttfbTimeout); - constants.put("respTimeout", respTimeout); constants.put("attestationPropagationSlotRange", attestationPropagationSlotRange); constants.put("maximumGossipClockDisparity", maximumGossipClockDisparity); constants.put("messageDomainInvalidSnappy", messageDomainInvalidSnappy); @@ -291,7 +283,6 @@ private Map getValidationMap() { constants.put("attestationSubnetCount", attestationSubnetCount); constants.put("attestationSubnetExtraBits", attestationSubnetExtraBits); constants.put("attestationSubnetPrefixBits", attestationSubnetPrefixBits); - constants.put("maxConcurrentRequests", maxConcurrentRequests); constants.put("reorgMaxEpochsSinceFinalization", reorgMaxEpochsSinceFinalization); constants.put("reorgHeadWeightThreshold", reorgHeadWeightThreshold); constants.put("reorgParentWeightThreshold", reorgParentWeightThreshold); @@ -654,16 +645,6 @@ public SpecConfigBuilder minEpochsForBlockRequests(final Integer minEpochsForBlo return this; } - public SpecConfigBuilder ttfbTimeout(final Integer ttfbTimeout) { - this.ttfbTimeout = ttfbTimeout; - return this; - } - - public SpecConfigBuilder respTimeout(final Integer respTimeout) { - this.respTimeout = respTimeout; - return this; - } - public SpecConfigBuilder attestationPropagationSlotRange( final Integer attestationPropagationSlotRange) { this.attestationPropagationSlotRange = attestationPropagationSlotRange; @@ -705,11 +686,6 @@ public SpecConfigBuilder attestationSubnetPrefixBits(final Integer attestationSu return this; } - public SpecConfigBuilder maxConcurrentRequests(final Integer maxConcurrentRequests) { - this.maxConcurrentRequests = maxConcurrentRequests; - return this; - } - public SpecConfigBuilder reorgMaxEpochsSinceFinalization( final Integer reorgMaxEpochsSinceFinalization) { this.reorgMaxEpochsSinceFinalization = reorgMaxEpochsSinceFinalization; diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/constants/NetworkConstants.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/constants/NetworkConstants.java index 2bbbf82f076..ff7e0c1d390 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/constants/NetworkConstants.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/constants/NetworkConstants.java @@ -20,4 +20,7 @@ public class NetworkConstants { public static final int DEFAULT_SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY = 128; public static final int NODE_ID_BITS = 256; + + // https://github.com/ethereum/consensus-specs/pull/3767 + public static final int MAX_CONCURRENT_REQUESTS = 2; } diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/chiado.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/chiado.yaml index 835d2466e03..fda0da2f5b4 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/chiado.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/chiado.yaml @@ -124,7 +124,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/ephemery.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/ephemery.yaml index 17143689714..8df5977f605 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/ephemery.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/ephemery.yaml @@ -113,7 +113,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/gnosis.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/gnosis.yaml index 55ae909669d..42b99807212 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/gnosis.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/gnosis.yaml @@ -123,7 +123,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/holesky.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/holesky.yaml index 6d341cc89ea..58f913a4f54 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/holesky.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/holesky.yaml @@ -115,7 +115,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/less-swift.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/less-swift.yaml index b1da9260e40..63cb669375b 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/less-swift.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/less-swift.yaml @@ -126,7 +126,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/lukso.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/lukso.yaml index a5a59f6a46c..578d711cccc 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/lukso.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/lukso.yaml @@ -145,7 +145,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/mainnet.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/mainnet.yaml index dd3e6916467..18ca69b53e4 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/mainnet.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/mainnet.yaml @@ -132,7 +132,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/minimal.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/minimal.yaml index a9baad975e4..f3386e056f3 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/minimal.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/minimal.yaml @@ -132,7 +132,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/sepolia.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/sepolia.yaml index 5e254daccc7..f4eac63a5b5 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/sepolia.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/sepolia.yaml @@ -108,7 +108,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/swift.yaml b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/swift.yaml index 4b3f6f4d156..72afef1833e 100644 --- a/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/swift.yaml +++ b/ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/configs/swift.yaml @@ -127,7 +127,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128) diff --git a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/missingAltairField.yaml b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/missingAltairField.yaml index 181137fdd77..5db3829279c 100644 --- a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/missingAltairField.yaml +++ b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/missingAltairField.yaml @@ -235,5 +235,4 @@ SUBNETS_PER_NODE: 2 ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS -ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 \ No newline at end of file +ATTESTATION_SUBNET_PREFIX_BITS: 6 \ No newline at end of file diff --git a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/unknownField.yaml b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/unknownField.yaml index d987056e62b..108fe0dca71 100644 --- a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/unknownField.yaml +++ b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/invalid/unknownField.yaml @@ -280,5 +280,4 @@ SUBNETS_PER_NODE: 2 ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS -ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 \ No newline at end of file +ATTESTATION_SUBNET_PREFIX_BITS: 6 \ No newline at end of file diff --git a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/with-overrides.yaml b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/with-overrides.yaml index 976d9fcc4d6..58a6cc93411 100644 --- a/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/with-overrides.yaml +++ b/ethereum/spec/src/test/resources/tech/pegasys/teku/spec/config/standard/with-overrides.yaml @@ -106,5 +106,4 @@ SUBNETS_PER_NODE: 2 ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS -ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 \ No newline at end of file +ATTESTATION_SUBNET_PREFIX_BITS: 6 \ No newline at end of file diff --git a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/peers/Eth2PeerManager.java b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/peers/Eth2PeerManager.java index afa52355653..88e57f491a7 100644 --- a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/peers/Eth2PeerManager.java +++ b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/peers/Eth2PeerManager.java @@ -41,7 +41,6 @@ import tech.pegasys.teku.networking.p2p.peer.Peer; import tech.pegasys.teku.networking.p2p.peer.PeerConnectedSubscriber; import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.config.SpecConfig; import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.MetadataMessage; import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.MetadataMessageSchema; import tech.pegasys.teku.spec.datastructures.state.Checkpoint; @@ -51,6 +50,8 @@ public class Eth2PeerManager implements PeerLookup, PeerHandler { private static final Logger LOG = LogManager.getLogger(); + private static final Duration STATUS_RECEIVED_TIMEOUT = Duration.ofSeconds(10); + private final AsyncRunner asyncRunner; private final RecentChainData recentChainData; private final Eth2PeerFactory eth2PeerFactory; @@ -66,7 +67,6 @@ public class Eth2PeerManager implements PeerLookup, PeerHandler { private final int eth2RpcOutstandingPingThreshold; private final Duration eth2StatusUpdateInterval; - private final SpecConfig specConfig; Eth2PeerManager( final Spec spec, @@ -99,7 +99,6 @@ public class Eth2PeerManager implements PeerLookup, PeerHandler { this.eth2RpcPingInterval = eth2RpcPingInterval; this.eth2RpcOutstandingPingThreshold = eth2RpcOutstandingPingThreshold; this.eth2StatusUpdateInterval = eth2StatusUpdateInterval; - this.specConfig = spec.getGenesisSpecConfig(); } public static Eth2PeerManager create( @@ -237,7 +236,7 @@ private void ensureStatusReceived(final Eth2Peer peer) { .ifExceptionGetsHereRaiseABug(); } }, - Duration.ofSeconds(specConfig.getRespTimeout())) + STATUS_RECEIVED_TIMEOUT) .finish( () -> {}, error -> { diff --git a/networking/p2p/src/main/java/tech/pegasys/teku/networking/p2p/libp2p/LibP2PNetworkBuilder.java b/networking/p2p/src/main/java/tech/pegasys/teku/networking/p2p/libp2p/LibP2PNetworkBuilder.java index 3de2acd2675..733f92be5d2 100644 --- a/networking/p2p/src/main/java/tech/pegasys/teku/networking/p2p/libp2p/LibP2PNetworkBuilder.java +++ b/networking/p2p/src/main/java/tech/pegasys/teku/networking/p2p/libp2p/LibP2PNetworkBuilder.java @@ -15,6 +15,7 @@ import static tech.pegasys.teku.networking.p2p.libp2p.LibP2PNetwork.REMOTE_OPEN_STREAMS_RATE_LIMIT; import static tech.pegasys.teku.networking.p2p.libp2p.LibP2PNetwork.REMOTE_PARALLEL_OPEN_STREAMS_COUNT_LIMIT; +import static tech.pegasys.teku.spec.constants.NetworkConstants.MAX_CONCURRENT_REQUESTS; import com.google.common.base.Preconditions; import identify.pb.IdentifyOuterClass; @@ -153,7 +154,7 @@ public P2PNetwork build() { protected List> createRpcHandlers() { return rpcMethods.stream() - .map(m -> new RpcHandler<>(asyncRunner, m, networkingSpecConfig.getMaxConcurrentRequests())) + .map(m -> new RpcHandler<>(asyncRunner, m, MAX_CONCURRENT_REQUESTS)) .toList(); } diff --git a/teku/src/integration-test/resources/tech/pegasys/teku/cli/subcommand/test-spec.yaml b/teku/src/integration-test/resources/tech/pegasys/teku/cli/subcommand/test-spec.yaml index 7db048bc9b4..0c17d3c4486 100644 --- a/teku/src/integration-test/resources/tech/pegasys/teku/cli/subcommand/test-spec.yaml +++ b/teku/src/integration-test/resources/tech/pegasys/teku/cli/subcommand/test-spec.yaml @@ -107,5 +107,4 @@ SUBNETS_PER_NODE: 2 ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS -ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 \ No newline at end of file +ATTESTATION_SUBNET_PREFIX_BITS: 6 \ No newline at end of file diff --git a/teku/src/test/resources/tech/pegasys/teku/cli/options/constants.yaml b/teku/src/test/resources/tech/pegasys/teku/cli/options/constants.yaml index 917ed1d29ee..f2402b8c7c8 100644 --- a/teku/src/test/resources/tech/pegasys/teku/cli/options/constants.yaml +++ b/teku/src/test/resources/tech/pegasys/teku/cli/options/constants.yaml @@ -180,5 +180,4 @@ SUBNETS_PER_NODE: 2 ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS -ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 \ No newline at end of file +ATTESTATION_SUBNET_PREFIX_BITS: 6 \ No newline at end of file diff --git a/teku/src/test/resources/tech/pegasys/teku/cli/subcommand/deneb_config.yaml b/teku/src/test/resources/tech/pegasys/teku/cli/subcommand/deneb_config.yaml index 7c3778ed516..9a15730dcdc 100644 --- a/teku/src/test/resources/tech/pegasys/teku/cli/subcommand/deneb_config.yaml +++ b/teku/src/test/resources/tech/pegasys/teku/cli/subcommand/deneb_config.yaml @@ -129,7 +129,6 @@ ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_EXTRA_BITS: 0 # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS ATTESTATION_SUBNET_PREFIX_BITS: 6 -MAX_CONCURRENT_REQUESTS: 2 # Deneb # `2**7` (=128)