diff --git a/beacon_chain/spec/datatypes/constants.nim b/beacon_chain/spec/datatypes/constants.nim index 6c47d43e10..9cdfc20c22 100644 --- a/beacon_chain/spec/datatypes/constants.nim +++ b/beacon_chain/spec/datatypes/constants.nim @@ -7,7 +7,7 @@ {.push raises: [], gcsafe.} -import chronos/timer +import chronos/timer, ./constants_raw type Slot* = distinct uint64 @@ -24,8 +24,8 @@ const NODE_ID_BITS* = 256 # https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.0/specs/phase0/p2p-interface.md#configuration - EPOCHS_PER_SUBNET_SUBSCRIPTION* = 256'u64 - SUBNETS_PER_NODE* = 2'u64 + EPOCHS_PER_SUBNET_SUBSCRIPTION* {.intdefine.}: uint64 = 256'u64 # hoodiUZH + SUBNETS_PER_NODE* {.intdefine.}: uint64 = 2'u64 # hoodiUZH ATTESTATION_SUBNET_COUNT*: uint64 = 64 ATTESTATION_SUBNET_EXTRA_BITS* = 0'u64 ATTESTATION_SUBNET_PREFIX_BITS* = 6'u64 ## \ @@ -67,10 +67,9 @@ const REORG_PARENT_WEIGHT_THRESHOLD*: uint64 = 160 # https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#configuration - MAX_REQUEST_BLOCKS* = 1024'u64 - RESP_TIMEOUT* = 10'u64 + MAX_REQUEST_BLOCKS* {.intdefine.}: uint64 = 1024'u64 # hoodiUZH ATTESTATION_PROPAGATION_SLOT_RANGE*: uint64 = 32 - MAXIMUM_GOSSIP_CLOCK_DISPARITY* = 500.millis + MAXIMUM_GOSSIP_CLOCK_DISPARITY* = MAXIMUM_GOSSIP_CLOCK_DISPARITY.int64.millis # https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/phase0/p2p-interface.md#configuration MAX_PAYLOAD_SIZE* = 10'u64 * 1024 * 1024 # bytes diff --git a/beacon_chain/spec/datatypes/constants_raw.nim b/beacon_chain/spec/datatypes/constants_raw.nim new file mode 100644 index 0000000000..89692762d1 --- /dev/null +++ b/beacon_chain/spec/datatypes/constants_raw.nim @@ -0,0 +1,11 @@ +# beacon_chain +# Copyright (c) 2025 Status Research & Development GmbH +# Licensed and distributed under either of +# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). +# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). +# at your option. This file may not be copied, modified, or distributed except according to those terms. + +{.push raises: [].} + +const + MAXIMUM_GOSSIP_CLOCK_DISPARITY* {.intdefine.}: uint64 = 500 # hoodiUZH diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index 7dda9c1b2c..2d84f6ec0f 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -26,12 +26,12 @@ const topicAggregateAndProofsSuffix = "beacon_aggregate_and_proof/ssz_snappy" topicBlsToExecutionChangeSuffix = "bls_to_execution_change/ssz_snappy" topicExecutionPayloadBidSuffix = "execution_payload_bid/ssz_snappy" - topicExecutionPayloadSuffix = "execution_payload/ssz_snappy" + topicExecutionPayloadSuffix = "execution_payload/ssz_snappy" topicPayloadAttestationMessageSuffix = "payload_attestation_message/ssz_snappy" const - # The spec now includes this as a bare uint64 as `RESP_TIMEOUT` - RESP_TIMEOUT_DUR* = RESP_TIMEOUT.int64.seconds + # https://github.com/ethereum/consensus-specs/pull/4532 + RESP_TIMEOUT_DUR* = 10.seconds # https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.9/specs/altair/light-client/p2p-interface.md#configuration MAX_REQUEST_LIGHT_CLIENT_UPDATES* = 128 diff --git a/beacon_chain/spec/presets.nim b/beacon_chain/spec/presets.nim index b56d6eff43..9cd33c5124 100644 --- a/beacon_chain/spec/presets.nim +++ b/beacon_chain/spec/presets.nim @@ -743,11 +743,20 @@ elif const_preset == "minimal": else: {.error: "Only mainnet, gnosis, and minimal presets supported".} -const IsMainnetSupported*: bool = - const_preset == "mainnet" - -const IsGnosisSupported*: bool = - const_preset == "gnosis" +const + AreConstantsDefault: bool = + MAX_REQUEST_BLOCKS == 1024 and + EPOCHS_PER_SUBNET_SUBSCRIPTION == 256 and + MAXIMUM_GOSSIP_CLOCK_DISPARITY.milliseconds.uint64 == 500 and + SUBNETS_PER_NODE == 2 + + IsMainnetSupported*: bool = + const_preset == "mainnet" and + AreConstantsDefault + + IsGnosisSupported*: bool = + const_preset == "gnosis" and + AreConstantsDefault const SLOTS_PER_SYNC_COMMITTEE_PERIOD* = SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD