Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions beacon_chain/spec/datatypes/constants.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{.push raises: [], gcsafe.}

import chronos/timer
import chronos/timer, ./constants_raw

type
Slot* = distinct uint64
Expand All @@ -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 ## \
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions beacon_chain/spec/datatypes/constants_raw.nim
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions beacon_chain/spec/network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 14 additions & 5 deletions beacon_chain/spec/presets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,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
MIN_SLOT_DURATION* = seconds(1)
Expand Down
Loading