2020-11-27 22:16:13 +00:00
|
|
|
# beacon_chain
|
2024-01-06 14:26:56 +00:00
|
|
|
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
2020-11-27 22:16:13 +00:00
|
|
|
# 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.
|
|
|
|
|
2023-01-20 14:14:37 +00:00
|
|
|
{.push raises: [].}
|
2020-11-27 22:16:13 +00:00
|
|
|
|
2019-12-10 19:49:42 +00:00
|
|
|
import
|
2022-09-19 09:07:46 +00:00
|
|
|
std/[strutils, parseutils, tables, typetraits],
|
2023-11-09 20:41:17 +00:00
|
|
|
chronos/timer,
|
2023-12-12 15:15:00 +00:00
|
|
|
stew/[byteutils], stint, web3/primitives as web3types,
|
2022-09-19 09:07:46 +00:00
|
|
|
./datatypes/constants
|
|
|
|
|
|
|
|
export constants
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
|
2023-12-12 15:15:00 +00:00
|
|
|
export stint, web3types.toHex, web3types.`==`
|
2022-09-17 05:30:07 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
const
|
2024-01-20 11:19:47 +00:00
|
|
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#withdrawal-prefixes
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
BLS_WITHDRAWAL_PREFIX*: byte = 0
|
2021-11-02 18:23:31 +00:00
|
|
|
ETH1_ADDRESS_WITHDRAWAL_PREFIX*: byte = 1
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
|
|
|
|
# Constants from `validator.md` not covered by config/presets in the spec
|
|
|
|
TARGET_AGGREGATORS_PER_COMMITTEE*: uint64 = 16
|
2023-09-14 12:37:35 +00:00
|
|
|
|
|
|
|
# Not used anywhere; only for network preset checking
|
2023-09-11 16:03:34 +00:00
|
|
|
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: uint64 = 256
|
2023-11-09 20:41:17 +00:00
|
|
|
TTFB_TIMEOUT* = 5'u64
|
|
|
|
MESSAGE_DOMAIN_INVALID_SNAPPY*: array[4, byte] = [0x00, 0x00, 0x00, 0x00]
|
|
|
|
MESSAGE_DOMAIN_VALID_SNAPPY*: array[4, byte] = [0x01, 0x00, 0x00, 0x00]
|
2019-12-10 19:49:42 +00:00
|
|
|
|
|
|
|
type
|
2020-07-07 23:02:14 +00:00
|
|
|
Version* = distinct array[4, byte]
|
2023-12-12 15:15:00 +00:00
|
|
|
Eth1Address* = web3types.Address
|
2020-07-07 23:02:14 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
RuntimeConfig* = object
|
2023-11-09 20:41:17 +00:00
|
|
|
## https://github.com/ethereum/consensus-specs/tree/v1.4.0-beta.4/configs
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
PRESET_BASE*: string
|
2022-01-07 10:13:19 +00:00
|
|
|
CONFIG_NAME*: string
|
|
|
|
|
2021-10-07 21:08:12 +00:00
|
|
|
# Transition
|
|
|
|
TERMINAL_TOTAL_DIFFICULTY*: UInt256
|
2023-05-01 09:45:39 +00:00
|
|
|
TERMINAL_BLOCK_HASH*: BlockHash
|
2023-11-09 20:41:17 +00:00
|
|
|
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH*: Epoch # Not actively used, but part of the spec
|
2021-10-07 21:08:12 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
# Genesis
|
2020-07-07 23:02:14 +00:00
|
|
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT*: uint64
|
|
|
|
MIN_GENESIS_TIME*: uint64
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
GENESIS_FORK_VERSION*: Version
|
|
|
|
GENESIS_DELAY*: uint64
|
|
|
|
|
2022-05-06 07:51:28 +00:00
|
|
|
# Forking
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
ALTAIR_FORK_VERSION*: Version
|
|
|
|
ALTAIR_FORK_EPOCH*: Epoch
|
2022-01-20 08:30:33 +00:00
|
|
|
BELLATRIX_FORK_VERSION*: Version
|
2022-02-02 13:06:55 +00:00
|
|
|
BELLATRIX_FORK_EPOCH*: Epoch
|
2022-06-03 14:42:40 +00:00
|
|
|
CAPELLA_FORK_VERSION*: Version
|
|
|
|
CAPELLA_FORK_EPOCH*: Epoch
|
2023-02-15 14:44:09 +00:00
|
|
|
DENEB_FORK_VERSION*: Version
|
|
|
|
DENEB_FORK_EPOCH*: Epoch
|
2024-02-24 05:08:22 +00:00
|
|
|
ELECTRA_FORK_VERSION*: Version
|
|
|
|
ELECTRA_FORK_EPOCH*: Epoch
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
|
2022-05-06 07:51:28 +00:00
|
|
|
# Time parameters
|
2021-07-16 10:02:27 +00:00
|
|
|
# TODO SECONDS_PER_SLOT*: uint64
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
SECONDS_PER_ETH1_BLOCK*: uint64
|
|
|
|
MIN_VALIDATOR_WITHDRAWABILITY_DELAY*: uint64
|
|
|
|
SHARD_COMMITTEE_PERIOD*: uint64
|
2020-08-06 09:08:54 +00:00
|
|
|
ETH1_FOLLOW_DISTANCE*: uint64
|
2020-07-07 23:02:14 +00:00
|
|
|
|
2022-05-06 07:51:28 +00:00
|
|
|
# Validator cycle
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
INACTIVITY_SCORE_BIAS*: uint64
|
|
|
|
INACTIVITY_SCORE_RECOVERY_RATE*: uint64
|
|
|
|
EJECTION_BALANCE*: uint64
|
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT*: uint64
|
|
|
|
CHURN_LIMIT_QUOTIENT*: uint64
|
2023-09-20 11:39:56 +00:00
|
|
|
MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT*: uint64
|
2024-04-24 12:28:47 +00:00
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA*: uint64
|
|
|
|
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT*: uint64
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
|
2022-05-06 07:51:28 +00:00
|
|
|
# Fork choice
|
|
|
|
# TODO PROPOSER_SCORE_BOOST*: uint64
|
2023-11-09 20:41:17 +00:00
|
|
|
# TODO REORG_HEAD_WEIGHT_THRESHOLD*: uint64
|
|
|
|
# TODO REORG_PARENT_WEIGHT_THRESHOLD*: uint64
|
|
|
|
# TODO REORG_MAX_EPOCHS_SINCE_FINALIZATION*: uint64
|
2022-05-06 07:51:28 +00:00
|
|
|
|
|
|
|
# Deposit contract
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
DEPOSIT_CHAIN_ID*: uint64
|
|
|
|
DEPOSIT_NETWORK_ID*: uint64
|
|
|
|
DEPOSIT_CONTRACT_ADDRESS*: Eth1Address
|
|
|
|
|
2023-11-09 20:41:17 +00:00
|
|
|
# Networking
|
|
|
|
# TODO GOSSIP_MAX_SIZE*: uint64
|
|
|
|
# TODO MAX_REQUEST_BLOCKS*: uint64
|
|
|
|
# TODO EPOCHS_PER_SUBNET_SUBSCRIPTION*: uint64
|
2023-11-10 15:04:55 +00:00
|
|
|
MIN_EPOCHS_FOR_BLOCK_REQUESTS*: uint64
|
2023-11-09 20:41:17 +00:00
|
|
|
# TODO MAX_CHUNK_SIZE*: uint64
|
|
|
|
# TODO TTFB_TIMEOUT*: uint64
|
|
|
|
# TODO RESP_TIMEOUT*: uint64
|
|
|
|
# TODO ATTESTATION_PROPAGATION_SLOT_RANGE*: uint64
|
|
|
|
# TODO MAXIMUM_GOSSIP_CLOCK_DISPARITY*: uint64
|
|
|
|
# TODO MESSAGE_DOMAIN_INVALID_SNAPPY*: array[4, byte]
|
|
|
|
# TODO MESSAGE_DOMAIN_VALID_SNAPPY*: array[4, byte]
|
|
|
|
# TODO SUBNETS_PER_NODE*: uint64
|
|
|
|
# TODO ATTESTATION_SUBNET_COUNT*: uint64
|
|
|
|
# TODO ATTESTATION_SUBNET_EXTRA_BITS*: uint64
|
|
|
|
# TODO ATTESTATION_SUBNET_PREFIX_BITS*: uint64
|
|
|
|
|
|
|
|
# Deneb
|
|
|
|
# TODO MAX_REQUEST_BLOCKS_DENEB*: uint64
|
|
|
|
# TODO MAX_REQUEST_BLOB_SIDECARS*: uint64
|
|
|
|
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS*: uint64
|
|
|
|
# TODO BLOB_SIDECAR_SUBNET_COUNT*: uint64
|
2023-09-08 05:53:27 +00:00
|
|
|
|
2020-07-07 23:02:14 +00:00
|
|
|
PresetFile* = object
|
2022-03-24 21:44:34 +00:00
|
|
|
values*: Table[string, string]
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
missingValues*: seq[string]
|
2020-07-07 23:02:14 +00:00
|
|
|
|
|
|
|
PresetFileError* = object of CatchableError
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
PresetIncompatibleError* = object of CatchableError
|
2020-07-07 23:02:14 +00:00
|
|
|
|
2019-12-10 19:49:42 +00:00
|
|
|
const
|
2020-07-07 23:02:14 +00:00
|
|
|
const_preset* {.strdefine.} = "mainnet"
|
|
|
|
|
2022-09-19 09:07:46 +00:00
|
|
|
# No-longer used values from legacy config files
|
|
|
|
ignoredValues = [
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
"TRANSITION_TOTAL_DIFFICULTY", # Name that appears in some altair alphas, obsolete, remove when no more testnets
|
2022-05-06 07:51:28 +00:00
|
|
|
"MIN_ANCHOR_POW_BLOCK_DIFFICULTY", # Name that appears in some altair alphas, obsolete, remove when no more testnets
|
2023-06-30 05:23:15 +00:00
|
|
|
"RANDOM_SUBNETS_PER_VALIDATOR", # Removed in consensus-specs v1.4.0
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
when const_preset == "mainnet":
|
|
|
|
import ./presets/mainnet
|
|
|
|
export mainnet
|
|
|
|
|
|
|
|
# TODO Move this to RuntimeConfig
|
|
|
|
const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 12
|
|
|
|
|
2022-12-01 11:25:21 +00:00
|
|
|
# The default run-time config specifies the default configuration values
|
|
|
|
# that will be used if a particular run-time config is missing specific
|
|
|
|
# confugration values (which will be then taken from this config object).
|
|
|
|
# It mostly matches the mainnet config with the exception of few properties
|
|
|
|
# such as `CONFIG_NAME`, `TERMINAL_TOTAL_DIFFICULTY`, `*_FORK_EPOCH`, etc
|
|
|
|
# which must be effectively overriden in all network (including mainnet).
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
const defaultRuntimeConfig* = RuntimeConfig(
|
2022-05-06 07:51:28 +00:00
|
|
|
# Mainnet config
|
|
|
|
|
|
|
|
# Extends the mainnet preset
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
PRESET_BASE: "mainnet",
|
|
|
|
|
2022-05-06 07:51:28 +00:00
|
|
|
# Free-form short name of the network that this configuration applies to - known
|
|
|
|
# canonical network names include:
|
|
|
|
# * 'mainnet' - there can be only one
|
2022-06-16 14:11:26 +00:00
|
|
|
# * 'sepolia' - testnet
|
2023-09-08 05:53:27 +00:00
|
|
|
# * 'holesky' - testnet
|
2022-05-06 07:51:28 +00:00
|
|
|
# Must match the regex: [a-z0-9\-]
|
2022-12-01 11:25:21 +00:00
|
|
|
CONFIG_NAME: "",
|
2022-05-06 07:51:28 +00:00
|
|
|
|
2021-10-07 21:08:12 +00:00
|
|
|
# Transition
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# TBD, 2**256-2**10 is a placeholder
|
|
|
|
TERMINAL_TOTAL_DIFFICULTY:
|
|
|
|
u256"115792089237316195423570985008687907853269984665640564039457584007913129638912",
|
2022-05-06 07:51:28 +00:00
|
|
|
# By default, don't use these params
|
2021-10-07 21:08:12 +00:00
|
|
|
TERMINAL_BLOCK_HASH: BlockHash.fromHex(
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"),
|
2022-05-06 07:51:28 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
# Genesis
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# `2**14` (= 16,384)
|
|
|
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384,
|
|
|
|
# Dec 1, 2020, 12pm UTC
|
|
|
|
MIN_GENESIS_TIME: 1606824000,
|
|
|
|
# Mainnet initial fork version, recommend altering for testnets
|
|
|
|
GENESIS_FORK_VERSION: Version [byte 0x00, 0x00, 0x00, 0x00],
|
|
|
|
# 604800 seconds (7 days)
|
|
|
|
GENESIS_DELAY: 604800,
|
|
|
|
|
|
|
|
# Forking
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Some forks are disabled for now:
|
|
|
|
# - These may be re-assigned to another fork-version later
|
|
|
|
# - Temporarily set to max uint64 value: 2**64 - 1
|
|
|
|
|
|
|
|
# Altair
|
|
|
|
ALTAIR_FORK_VERSION: Version [byte 0x01, 0x00, 0x00, 0x00],
|
2022-12-01 11:25:21 +00:00
|
|
|
ALTAIR_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
2022-05-06 07:51:28 +00:00
|
|
|
# Bellatrix
|
2022-01-20 08:30:33 +00:00
|
|
|
BELLATRIX_FORK_VERSION: Version [byte 0x02, 0x00, 0x00, 0x00],
|
2022-12-01 11:25:21 +00:00
|
|
|
BELLATRIX_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
2022-06-03 14:42:40 +00:00
|
|
|
# Capella
|
|
|
|
CAPELLA_FORK_VERSION: Version [byte 0x03, 0x00, 0x00, 0x00],
|
2022-12-01 11:25:21 +00:00
|
|
|
CAPELLA_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
2023-02-15 14:44:09 +00:00
|
|
|
# Deneb
|
|
|
|
DENEB_FORK_VERSION: Version [byte 0x04, 0x00, 0x00, 0x00],
|
|
|
|
DENEB_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
2024-02-24 05:08:22 +00:00
|
|
|
# Electra
|
|
|
|
ELECTRA_FORK_VERSION: Version [byte 0x05, 0x00, 0x00, 0x00],
|
|
|
|
ELECTRA_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
|
|
|
|
# Time parameters
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# 12 seconds
|
|
|
|
# TODO SECONDS_PER_SLOT: 12,
|
|
|
|
# 14 (estimate from Eth1 mainnet)
|
|
|
|
SECONDS_PER_ETH1_BLOCK: 14,
|
|
|
|
# 2**8 (= 256) epochs ~27 hours
|
|
|
|
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256,
|
|
|
|
# 2**8 (= 256) epochs ~27 hours
|
|
|
|
SHARD_COMMITTEE_PERIOD: 256,
|
|
|
|
# 2**11 (= 2,048) Eth1 blocks ~8 hours
|
|
|
|
ETH1_FOLLOW_DISTANCE: 2048,
|
|
|
|
|
|
|
|
|
|
|
|
# Validator cycle
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# 2**2 (= 4)
|
|
|
|
INACTIVITY_SCORE_BIAS: 4,
|
|
|
|
# 2**4 (= 16)
|
|
|
|
INACTIVITY_SCORE_RECOVERY_RATE: 16,
|
|
|
|
# 2**4 * 10**9 (= 16,000,000,000) Gwei
|
|
|
|
EJECTION_BALANCE: 16000000000'u64,
|
|
|
|
# 2**2 (= 4)
|
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT: 4,
|
|
|
|
# 2**16 (= 65,536)
|
|
|
|
CHURN_LIMIT_QUOTIENT: 65536,
|
2023-09-20 11:39:56 +00:00
|
|
|
# [New in Deneb:EIP7514] 2**3 (= 8)
|
|
|
|
MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 8,
|
2024-04-24 12:28:47 +00:00
|
|
|
# [New in Electra:EIP7251] 2**7 * 10**9 (= 128,000,000,000)
|
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000'u64,
|
|
|
|
# [New in Electra:EIP7251] 2**8 * 10**9 (= 256,000,000,000)
|
|
|
|
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000'u64,
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
|
|
|
|
# Deposit contract
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Ethereum PoW Mainnet
|
|
|
|
DEPOSIT_CHAIN_ID: 1,
|
|
|
|
DEPOSIT_NETWORK_ID: 1,
|
2023-11-09 20:41:17 +00:00
|
|
|
DEPOSIT_CONTRACT_ADDRESS: default(Eth1Address),
|
|
|
|
|
|
|
|
# Networking
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# `10 * 2**20` (= 10485760, 10 MiB)
|
|
|
|
# TODO GOSSIP_MAX_SIZE: 10485760,
|
|
|
|
# `2**10` (= 1024)
|
|
|
|
# TODO MAX_REQUEST_BLOCKS: 1024,
|
|
|
|
# `2**8` (= 256)
|
|
|
|
# TODO EPOCHS_PER_SUBNET_SUBSCRIPTION: 256,
|
|
|
|
# `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 33024, ~5 months)
|
2023-11-10 15:04:55 +00:00
|
|
|
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024,
|
2023-11-09 20:41:17 +00:00
|
|
|
# `10 * 2**20` (=10485760, 10 MiB)
|
|
|
|
# TODO MAX_CHUNK_SIZE: 10485760,
|
|
|
|
# 5s
|
|
|
|
# TODO TTFB_TIMEOUT: 5,
|
|
|
|
# 10s
|
|
|
|
# TODO RESP_TIMEOUT: 10,
|
|
|
|
# TODO ATTESTATION_PROPAGATION_SLOT_RANGE: 32,
|
|
|
|
# 500ms
|
|
|
|
# TODO MAXIMUM_GOSSIP_CLOCK_DISPARITY: 500,
|
|
|
|
# TODO MESSAGE_DOMAIN_INVALID_SNAPPY: [byte 0x00, 0x00, 0x00, 0x00],
|
|
|
|
# TODO MESSAGE_DOMAIN_VALID_SNAPPY: [byte 0x01, 0x00, 0x00, 0x00],
|
|
|
|
# 2 subnets per node
|
|
|
|
# TODO SUBNETS_PER_NODE: 2,
|
|
|
|
# 2**8 (= 64)
|
|
|
|
# TODO ATTESTATION_SUBNET_COUNT: 64,
|
|
|
|
# TODO ATTESTATION_SUBNET_EXTRA_BITS: 0,
|
|
|
|
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
|
|
|
|
# TODO ATTESTATION_SUBNET_PREFIX_BITS: 6,
|
|
|
|
|
|
|
|
# Deneb
|
|
|
|
# `2**7` (=128)
|
|
|
|
# TODO MAX_REQUEST_BLOCKS_DENEB: 128,
|
|
|
|
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
|
|
|
|
# TODO MAX_REQUEST_BLOB_SIDECARS: 768,
|
|
|
|
# `2**12` (= 4096 epochs, ~18 days)
|
|
|
|
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096,
|
|
|
|
# `6`
|
|
|
|
# TODO BLOB_SIDECAR_SUBNET_COUNT: 6,
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
)
|
|
|
|
|
2023-01-12 17:58:42 +00:00
|
|
|
elif const_preset == "gnosis":
|
|
|
|
import ./presets/gnosis
|
|
|
|
export gnosis
|
|
|
|
|
|
|
|
# TODO Move this to RuntimeConfig
|
|
|
|
const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 5
|
|
|
|
|
|
|
|
# The default run-time config specifies the default configuration values
|
|
|
|
# that will be used if a particular run-time config is missing specific
|
|
|
|
# confugration values (which will be then taken from this config object).
|
|
|
|
# It mostly matches the gnosis config with the exception of few properties
|
|
|
|
# such as `CONFIG_NAME`, `TERMINAL_TOTAL_DIFFICULTY`, `*_FORK_EPOCH`, etc
|
|
|
|
# which must be effectively overriden in all network (including mainnet).
|
|
|
|
const defaultRuntimeConfig* = RuntimeConfig(
|
|
|
|
# Mainnet config
|
|
|
|
|
|
|
|
# Extends the mainnet preset
|
|
|
|
PRESET_BASE: "gnosis",
|
|
|
|
|
|
|
|
# Free-form short name of the network that this configuration applies to - known
|
|
|
|
# canonical network names include:
|
|
|
|
# * 'mainnet' - there can be only one
|
|
|
|
# * 'sepolia' - testnet
|
2023-09-08 05:53:27 +00:00
|
|
|
# * 'holesky' - testnet
|
2023-01-12 17:58:42 +00:00
|
|
|
# Must match the regex: [a-z0-9\-]
|
|
|
|
CONFIG_NAME: "",
|
|
|
|
|
|
|
|
# Transition
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# TBD, 2**256-2**10 is a placeholder
|
|
|
|
TERMINAL_TOTAL_DIFFICULTY:
|
|
|
|
u256"115792089237316195423570985008687907853269984665640564039457584007913129638912",
|
|
|
|
# By default, don't use these params
|
|
|
|
TERMINAL_BLOCK_HASH: BlockHash.fromHex(
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"),
|
|
|
|
|
|
|
|
# Genesis
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# `2**14` (= 16,384)
|
|
|
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 4096,
|
|
|
|
# Dec 1, 2020, 12pm UTC
|
|
|
|
MIN_GENESIS_TIME: 1638968400,
|
|
|
|
# Mainnet initial fork version, recommend altering for testnets
|
|
|
|
GENESIS_FORK_VERSION: Version [byte 0x00, 0x00, 0x00, 0x64],
|
|
|
|
# 604800 seconds (7 days)
|
|
|
|
GENESIS_DELAY: 604800,
|
|
|
|
|
|
|
|
# Forking
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Some forks are disabled for now:
|
|
|
|
# - These may be re-assigned to another fork-version later
|
|
|
|
# - Temporarily set to max uint64 value: 2**64 - 1
|
|
|
|
|
|
|
|
# Altair
|
|
|
|
ALTAIR_FORK_VERSION: Version [byte 0x01, 0x00, 0x00, 0x64],
|
|
|
|
ALTAIR_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
|
|
|
# Bellatrix
|
|
|
|
BELLATRIX_FORK_VERSION: Version [byte 0x02, 0x00, 0x00, 0x64],
|
|
|
|
BELLATRIX_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
|
|
|
# Capella
|
|
|
|
CAPELLA_FORK_VERSION: Version [byte 0x03, 0x00, 0x00, 0x64],
|
|
|
|
CAPELLA_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
2023-02-15 14:44:09 +00:00
|
|
|
# Deneb
|
|
|
|
DENEB_FORK_VERSION: Version [byte 0x04, 0x00, 0x00, 0x64],
|
|
|
|
DENEB_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
2024-02-24 05:08:22 +00:00
|
|
|
# Electra
|
|
|
|
ELECTRA_FORK_VERSION: Version [byte 0x05, 0x00, 0x00, 0x64],
|
|
|
|
ELECTRA_FORK_EPOCH: FAR_FUTURE_EPOCH,
|
2023-02-15 14:44:09 +00:00
|
|
|
|
2023-01-12 17:58:42 +00:00
|
|
|
|
|
|
|
# Time parameters
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# 12 seconds
|
|
|
|
# TODO SECONDS_PER_SLOT: 12,
|
|
|
|
# 14 (estimate from Eth1 mainnet)
|
|
|
|
SECONDS_PER_ETH1_BLOCK: 5,
|
|
|
|
# 2**8 (= 256) epochs ~27 hours
|
|
|
|
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256,
|
|
|
|
# 2**8 (= 256) epochs ~27 hours
|
|
|
|
SHARD_COMMITTEE_PERIOD: 256,
|
|
|
|
# 2**11 (= 2,048) Eth1 blocks ~8 hours
|
|
|
|
ETH1_FOLLOW_DISTANCE: 2048,
|
|
|
|
|
|
|
|
|
|
|
|
# Validator cycle
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# 2**2 (= 4)
|
|
|
|
INACTIVITY_SCORE_BIAS: 4,
|
|
|
|
# 2**4 (= 16)
|
|
|
|
INACTIVITY_SCORE_RECOVERY_RATE: 16,
|
|
|
|
# 2**4 * 10**9 (= 16,000,000,000) Gwei
|
|
|
|
EJECTION_BALANCE: 16000000000'u64,
|
|
|
|
# 2**2 (= 4)
|
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT: 4,
|
|
|
|
# 2**16 (= 65,536)
|
|
|
|
CHURN_LIMIT_QUOTIENT: 4096,
|
2023-09-20 11:39:56 +00:00
|
|
|
# [New in Deneb:EIP7514] 2**3 (= 8)
|
|
|
|
MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 8,
|
2024-04-24 12:28:47 +00:00
|
|
|
# [New in Electra:EIP7251] 2**7 * 10**9 (= 128,000,000,000) (copied from EF mainnet)
|
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000'u64,
|
|
|
|
# [New in Electra:EIP7251] 2**8 * 10**9 (= 256,000,000,000) (copied from EF mainnet)
|
|
|
|
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000'u64,
|
2023-01-12 17:58:42 +00:00
|
|
|
|
|
|
|
# Deposit contract
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Gnosis PoW Mainnet
|
|
|
|
DEPOSIT_CHAIN_ID: 100,
|
|
|
|
DEPOSIT_NETWORK_ID: 100,
|
2023-11-09 20:41:17 +00:00
|
|
|
DEPOSIT_CONTRACT_ADDRESS: default(Eth1Address),
|
|
|
|
|
|
|
|
# Networking
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# `10 * 2**20` (= 10485760, 10 MiB)
|
|
|
|
# TODO GOSSIP_MAX_SIZE: 10485760,
|
|
|
|
# `2**10` (= 1024)
|
|
|
|
# TODO MAX_REQUEST_BLOCKS: 1024,
|
|
|
|
# `2**8` (= 256)
|
|
|
|
# TODO EPOCHS_PER_SUBNET_SUBSCRIPTION: 256,
|
|
|
|
# `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 33024, ~5 months)
|
2023-11-10 15:04:55 +00:00
|
|
|
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024,
|
2023-11-09 20:41:17 +00:00
|
|
|
# `10 * 2**20` (=10485760, 10 MiB)
|
|
|
|
# TODO MAX_CHUNK_SIZE: 10485760,
|
|
|
|
# 5s
|
|
|
|
# TODO TTFB_TIMEOUT: 5,
|
|
|
|
# 10s
|
|
|
|
# TODO RESP_TIMEOUT: 10,
|
|
|
|
# TODO ATTESTATION_PROPAGATION_SLOT_RANGE: 32,
|
|
|
|
# 500ms
|
|
|
|
# TODO MAXIMUM_GOSSIP_CLOCK_DISPARITY: 500,
|
|
|
|
# TODO MESSAGE_DOMAIN_INVALID_SNAPPY: [byte 0x00, 0x00, 0x00, 0x00],
|
|
|
|
# TODO MESSAGE_DOMAIN_VALID_SNAPPY: [byte 0x01, 0x00, 0x00, 0x00],
|
|
|
|
# 2 subnets per node
|
|
|
|
# TODO SUBNETS_PER_NODE: 2,
|
|
|
|
# 2**8 (= 64)
|
|
|
|
# TODO ATTESTATION_SUBNET_COUNT: 64,
|
|
|
|
# TODO ATTESTATION_SUBNET_EXTRA_BITS: 0,
|
|
|
|
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
|
|
|
|
# TODO ATTESTATION_SUBNET_PREFIX_BITS: 6,
|
|
|
|
|
|
|
|
# Deneb
|
|
|
|
# `2**7` (=128)
|
|
|
|
# TODO MAX_REQUEST_BLOCKS_DENEB: 128,
|
|
|
|
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
|
|
|
|
# TODO MAX_REQUEST_BLOB_SIDECARS: 768,
|
|
|
|
# `2**12` (= 4096 epochs, ~18 days)
|
|
|
|
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 16384,
|
|
|
|
# `6`
|
|
|
|
# TODO BLOB_SIDECAR_SUBNET_COUNT: 6,
|
2023-01-12 17:58:42 +00:00
|
|
|
)
|
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
elif const_preset == "minimal":
|
|
|
|
import ./presets/minimal
|
|
|
|
export minimal
|
|
|
|
|
|
|
|
const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 6
|
|
|
|
|
2023-12-05 02:34:45 +00:00
|
|
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/configs/minimal.yaml
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
const defaultRuntimeConfig* = RuntimeConfig(
|
|
|
|
# Minimal config
|
|
|
|
|
|
|
|
# Extends the minimal preset
|
|
|
|
PRESET_BASE: "minimal",
|
|
|
|
|
2022-05-06 07:51:28 +00:00
|
|
|
# Free-form short name of the network that this configuration applies to - known
|
|
|
|
# canonical network names include:
|
|
|
|
# * 'mainnet' - there can be only one
|
2022-06-16 14:11:26 +00:00
|
|
|
# * 'sepolia' - testnet
|
2023-09-08 05:53:27 +00:00
|
|
|
# * 'holesky' - testnet
|
2022-05-06 07:51:28 +00:00
|
|
|
# Must match the regex: [a-z0-9\-]
|
|
|
|
CONFIG_NAME: "minimal",
|
|
|
|
|
2021-10-07 21:08:12 +00:00
|
|
|
# Transition
|
|
|
|
# ---------------------------------------------------------------
|
2023-05-09 18:16:49 +00:00
|
|
|
# 2**256-2**10 for testing minimal network
|
2021-10-07 21:08:12 +00:00
|
|
|
TERMINAL_TOTAL_DIFFICULTY:
|
|
|
|
u256"115792089237316195423570985008687907853269984665640564039457584007913129638912",
|
2022-05-06 07:51:28 +00:00
|
|
|
# By default, don't use these params
|
2021-10-07 21:08:12 +00:00
|
|
|
TERMINAL_BLOCK_HASH: BlockHash.fromHex(
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"),
|
2022-05-06 07:51:28 +00:00
|
|
|
|
2021-10-07 21:08:12 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
# Genesis
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# [customized]
|
|
|
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 64,
|
|
|
|
# Jan 3, 2020
|
|
|
|
MIN_GENESIS_TIME: 1578009600,
|
|
|
|
# Highest byte set to 0x01 to avoid collisions with mainnet versioning
|
|
|
|
GENESIS_FORK_VERSION: Version [byte 0x00, 0x00, 0x00, 0x01],
|
|
|
|
# [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis
|
|
|
|
GENESIS_DELAY: 300,
|
|
|
|
|
|
|
|
|
|
|
|
# Forking
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Values provided for illustrative purposes.
|
|
|
|
# Individual tests/testnets may set different values.
|
|
|
|
|
|
|
|
# Altair
|
|
|
|
ALTAIR_FORK_VERSION: Version [byte 0x01, 0x00, 0x00, 0x01],
|
|
|
|
ALTAIR_FORK_EPOCH: Epoch(uint64.high),
|
2022-05-06 07:51:28 +00:00
|
|
|
# Bellatrix
|
2022-01-20 08:30:33 +00:00
|
|
|
BELLATRIX_FORK_VERSION: Version [byte 0x02, 0x00, 0x00, 0x01],
|
2022-02-02 13:06:55 +00:00
|
|
|
BELLATRIX_FORK_EPOCH: Epoch(uint64.high),
|
2022-06-03 14:42:40 +00:00
|
|
|
# Capella
|
|
|
|
CAPELLA_FORK_VERSION: Version [byte 0x03, 0x00, 0x00, 0x01],
|
|
|
|
CAPELLA_FORK_EPOCH: Epoch(uint64.high),
|
2023-02-15 14:44:09 +00:00
|
|
|
# Deneb
|
|
|
|
DENEB_FORK_VERSION: Version [byte 0x04, 0x00, 0x00, 0x01],
|
|
|
|
DENEB_FORK_EPOCH: Epoch(uint64.high),
|
2024-02-24 05:08:22 +00:00
|
|
|
# Electra
|
|
|
|
ELECTRA_FORK_VERSION: Version [byte 0x05, 0x00, 0x00, 0x01],
|
|
|
|
ELECTRA_FORK_EPOCH: Epoch(uint64.high),
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Time parameters
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# [customized] Faster for testing purposes
|
|
|
|
# TODO SECONDS_PER_SLOT: 6,
|
|
|
|
# 14 (estimate from Eth1 mainnet)
|
|
|
|
SECONDS_PER_ETH1_BLOCK: 14,
|
|
|
|
# 2**8 (= 256) epochs
|
|
|
|
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256,
|
|
|
|
# [customized] higher frequency of committee turnover and faster time to acceptable voluntary exit
|
|
|
|
SHARD_COMMITTEE_PERIOD: 64,
|
|
|
|
# [customized] process deposits more quickly, but insecure
|
|
|
|
ETH1_FOLLOW_DISTANCE: 16,
|
|
|
|
|
|
|
|
|
|
|
|
# Validator cycle
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# 2**2 (= 4)
|
|
|
|
INACTIVITY_SCORE_BIAS: 4,
|
|
|
|
# 2**4 (= 16)
|
|
|
|
INACTIVITY_SCORE_RECOVERY_RATE: 16,
|
|
|
|
# 2**4 * 10**9 (= 16,000,000,000) Gwei
|
|
|
|
EJECTION_BALANCE: 16000000000'u64,
|
2023-09-20 11:39:56 +00:00
|
|
|
# [customized] more easily demonstrate the difference between this value and the activation churn limit
|
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT: 2,
|
2021-09-10 17:35:14 +00:00
|
|
|
# [customized] scale queue churn at much lower validator counts for testing
|
|
|
|
CHURN_LIMIT_QUOTIENT: 32,
|
2023-09-20 11:39:56 +00:00
|
|
|
# [New in Deneb:EIP7514] [customized]
|
|
|
|
MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 4,
|
2024-04-24 12:28:47 +00:00
|
|
|
# [New in Electra:EIP7251] 2**6 * 10**9 (= 64,000,000,000)
|
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000'u64,
|
|
|
|
# [New in Electra:EIP7251] 2**7 * 10**9 (= 128,000,000,000)
|
|
|
|
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 128000000000'u64,
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Deposit contract
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Ethereum Goerli testnet
|
|
|
|
DEPOSIT_CHAIN_ID: 5,
|
|
|
|
DEPOSIT_NETWORK_ID: 5,
|
|
|
|
# Configured on a per testnet basis
|
2023-11-09 20:41:17 +00:00
|
|
|
DEPOSIT_CONTRACT_ADDRESS: default(Eth1Address),
|
|
|
|
|
|
|
|
# Networking
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# `10 * 2**20` (= 10485760, 10 MiB)
|
|
|
|
# TODO GOSSIP_MAX_SIZE: 10485760,
|
|
|
|
# `2**10` (= 1024)
|
|
|
|
# TODO MAX_REQUEST_BLOCKS: 1024,
|
|
|
|
# `2**8` (= 256)
|
|
|
|
# TODO EPOCHS_PER_SUBNET_SUBSCRIPTION: 256,
|
|
|
|
# [customized] `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 272)
|
2023-11-10 15:04:55 +00:00
|
|
|
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 272,
|
2023-11-09 20:41:17 +00:00
|
|
|
# `10 * 2**20` (=10485760, 10 MiB)
|
|
|
|
# TODO MAX_CHUNK_SIZE: 10485760,
|
|
|
|
# 5s
|
|
|
|
# TODO TTFB_TIMEOUT: 5,
|
|
|
|
# 10s
|
|
|
|
# TODO RESP_TIMEOUT: 10,
|
|
|
|
# TODO ATTESTATION_PROPAGATION_SLOT_RANGE: 32,
|
|
|
|
# 500ms
|
|
|
|
# TODO MAXIMUM_GOSSIP_CLOCK_DISPARITY: 500,
|
|
|
|
# TODO MESSAGE_DOMAIN_INVALID_SNAPPY: [byte 0x00, 0x00, 0x00, 0x00],
|
|
|
|
# TODO MESSAGE_DOMAIN_VALID_SNAPPY: [byte 0x01, 0x00, 0x00, 0x00],
|
|
|
|
# 2 subnets per node
|
|
|
|
# TODO SUBNETS_PER_NODE: 2,
|
|
|
|
# 2**8 (= 64)
|
|
|
|
# TODO ATTESTATION_SUBNET_COUNT: 64,
|
|
|
|
# TODO ATTESTATION_SUBNET_EXTRA_BITS: 0,
|
|
|
|
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
|
|
|
|
# TODO ATTESTATION_SUBNET_PREFIX_BITS: 6,
|
|
|
|
|
|
|
|
# Deneb
|
|
|
|
# `2**7` (=128)
|
|
|
|
# TODO MAX_REQUEST_BLOCKS_DENEB: 128,
|
|
|
|
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
|
|
|
|
# TODO MAX_REQUEST_BLOB_SIDECARS: 768,
|
|
|
|
# `2**12` (= 4096 epochs, ~18 days)
|
|
|
|
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096,
|
|
|
|
# `6`
|
|
|
|
# TODO BLOB_SIDECAR_SUBNET_COUNT: 6,
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
else:
|
2024-01-16 00:58:07 +00:00
|
|
|
{.error: "Only mainnet, gnosis, and minimal presets supported".}
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
# macro createConstantsFromPreset*(path: static string): untyped =
|
|
|
|
# result = newStmtList()
|
|
|
|
|
|
|
|
# let preset = try: readPresetFile(path)
|
|
|
|
# except CatchableError as err:
|
2022-02-16 22:24:44 +00:00
|
|
|
# error err.msg # TODO: This should be marked as noreturn
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
# return
|
|
|
|
|
|
|
|
# for name, value in preset.values:
|
|
|
|
# let
|
|
|
|
# typ = getType(name)
|
|
|
|
# value = if typ in ["int64", "uint64", "byte"]: typ & "(" & value & ")"
|
|
|
|
# else: "parse(" & typ & ", \"" & value & "\")"
|
|
|
|
# try:
|
|
|
|
# result.add parseStmt("const $1* {.intdefine.} = $2" % [$name, value])
|
|
|
|
# except ValueError:
|
|
|
|
# doAssert false, "All values in the presets are printable"
|
|
|
|
|
|
|
|
# if preset.missingValues.card > 0:
|
|
|
|
# warning "Missing constants in preset: " & $preset.missingValues
|
|
|
|
|
|
|
|
# createConstantsFromPreset const_preset
|
|
|
|
|
2021-11-30 01:14:31 +00:00
|
|
|
const SLOTS_PER_SYNC_COMMITTEE_PERIOD* =
|
|
|
|
SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
|
|
|
|
2023-11-09 20:41:17 +00:00
|
|
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#configuration
|
2023-11-10 15:04:55 +00:00
|
|
|
func safeMinEpochsForBlockRequests*(cfg: RuntimeConfig): uint64 =
|
2023-11-09 20:41:17 +00:00
|
|
|
cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY + cfg.CHURN_LIMIT_QUOTIENT div 2
|
|
|
|
|
2023-08-25 09:29:07 +00:00
|
|
|
func parse(T: type uint64, input: string): T {.raises: [ValueError].} =
|
2020-07-07 23:02:14 +00:00
|
|
|
var res: BiggestUInt
|
2020-07-03 19:29:23 +00:00
|
|
|
if input.len > 2 and input[0] == '0' and input[1] == 'x':
|
2020-07-07 23:02:14 +00:00
|
|
|
if parseHex(input, res) != input.len:
|
|
|
|
raise newException(ValueError, "The constant value should be a valid hex integer")
|
2020-07-03 19:29:23 +00:00
|
|
|
else:
|
2020-07-07 23:02:14 +00:00
|
|
|
if parseBiggestUInt(input, res) != input.len:
|
|
|
|
raise newException(ValueError, "The constant value should be a valid unsigned integer")
|
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
uint64(res)
|
2020-07-03 19:29:23 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
template parse(T: type byte, input: string): T =
|
2020-07-03 19:29:23 +00:00
|
|
|
byte parse(uint64, input)
|
|
|
|
|
2023-11-09 20:41:17 +00:00
|
|
|
func parse(T: type array[4, byte], input: string): T
|
|
|
|
{.raises: [ValueError].} =
|
|
|
|
hexToByteArray(input, 4)
|
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
func parse(T: type Version, input: string): T
|
2023-08-25 09:29:07 +00:00
|
|
|
{.raises: [ValueError].} =
|
2022-01-08 20:06:34 +00:00
|
|
|
Version hexToByteArray(input, 4)
|
2020-07-03 19:29:23 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
template parse(T: type Slot, input: string): T =
|
2020-07-03 19:29:23 +00:00
|
|
|
Slot parse(uint64, input)
|
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
template parse(T: type Epoch, input: string): T =
|
|
|
|
Epoch parse(uint64, input)
|
2020-07-03 19:29:23 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
template parse(T: type string, input: string): T =
|
|
|
|
input.strip(chars = {'"', '\''})
|
2020-07-07 23:02:14 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
template parse(T: type Eth1Address, input: string): T =
|
|
|
|
Eth1Address.fromHex(input)
|
2019-12-10 19:49:42 +00:00
|
|
|
|
2021-10-07 21:08:12 +00:00
|
|
|
template parse(T: type BlockHash, input: string): T =
|
|
|
|
BlockHash.fromHex(input)
|
|
|
|
|
|
|
|
template parse(T: type UInt256, input: string): T =
|
|
|
|
parse(input, UInt256, 10)
|
|
|
|
|
2022-09-19 09:07:46 +00:00
|
|
|
func parse(T: type DomainType, input: string): T
|
2023-08-25 09:29:07 +00:00
|
|
|
{.raises: [ValueError].} =
|
2022-09-19 09:07:46 +00:00
|
|
|
DomainType hexToByteArray(input, 4)
|
|
|
|
|
2023-07-19 07:48:39 +00:00
|
|
|
proc readRuntimeConfig*(
|
2023-06-14 19:48:50 +00:00
|
|
|
fileContent: string, path: string): (RuntimeConfig, seq[string]) {.
|
2023-09-22 21:45:24 +00:00
|
|
|
raises: [PresetFileError, PresetIncompatibleError].} =
|
2019-12-10 19:49:42 +00:00
|
|
|
var
|
|
|
|
lineNum = 0
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
cfg = defaultRuntimeConfig
|
2020-07-03 19:29:23 +00:00
|
|
|
|
|
|
|
template lineinfo: string =
|
2020-07-07 23:02:14 +00:00
|
|
|
try: "$1($2) " % [path, $lineNum]
|
|
|
|
except ValueError: path
|
2020-07-03 19:29:23 +00:00
|
|
|
|
|
|
|
template fail(msg) =
|
2020-07-07 23:02:14 +00:00
|
|
|
raise newException(PresetFileError, lineinfo() & msg)
|
2019-12-10 19:49:42 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
var names: seq[string]
|
|
|
|
for name, field in cfg.fieldPairs():
|
|
|
|
names.add name
|
|
|
|
|
|
|
|
var values: Table[string, string]
|
2023-06-14 19:48:50 +00:00
|
|
|
for line in splitLines(fileContent):
|
2019-12-10 19:49:42 +00:00
|
|
|
inc lineNum
|
|
|
|
if line.len == 0 or line[0] == '#': continue
|
2021-09-28 22:48:08 +00:00
|
|
|
# remove any trailing comments
|
|
|
|
let line = line.split("#")[0]
|
2022-02-20 20:13:06 +00:00
|
|
|
let lineParts = line.split(":")
|
2020-07-03 19:29:23 +00:00
|
|
|
if lineParts.len != 2:
|
|
|
|
fail "Invalid syntax: A preset file should include only assignments in the form 'ConstName: Value'"
|
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
if lineParts[0] in ignoredValues: continue
|
2020-07-03 19:29:23 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
values[lineParts[0]] = lineParts[1].strip
|
2020-07-07 23:02:14 +00:00
|
|
|
|
2022-09-19 09:07:46 +00:00
|
|
|
# Certain config keys are baked into the binary at compile-time
|
|
|
|
# and cannot be overridden via config.
|
2023-11-10 15:04:55 +00:00
|
|
|
template checkCompatibility(
|
|
|
|
constValue: untyped, name: string, operator: untyped = `==`): untyped =
|
2023-11-09 20:41:17 +00:00
|
|
|
if values.hasKey(name):
|
2023-11-10 15:04:55 +00:00
|
|
|
const opDesc = astToStr(operator)
|
2023-11-09 20:41:17 +00:00
|
|
|
try:
|
|
|
|
let value = parse(typeof(constValue), values[name])
|
|
|
|
when constValue is distinct:
|
2023-11-10 15:04:55 +00:00
|
|
|
if not operator(distinctBase(value), distinctBase(constValue)):
|
2023-11-09 20:41:17 +00:00
|
|
|
raise (ref PresetFileError)(msg:
|
|
|
|
"Cannot override config" &
|
2023-11-10 15:04:55 +00:00
|
|
|
" (required: " & name & opDesc & $distinctBase(constValue) &
|
2023-11-09 20:41:17 +00:00
|
|
|
" - config: " & name & "=" & values[name] & ")")
|
|
|
|
else:
|
2023-11-10 15:04:55 +00:00
|
|
|
if not operator(value, constValue):
|
2023-11-09 20:41:17 +00:00
|
|
|
raise (ref PresetFileError)(msg:
|
|
|
|
"Cannot override config" &
|
2023-11-10 15:04:55 +00:00
|
|
|
" (required: " & name & opDesc & $constValue &
|
2023-11-09 20:41:17 +00:00
|
|
|
" - config: " & name & "=" & values[name] & ")")
|
|
|
|
values.del name
|
|
|
|
except ValueError:
|
|
|
|
raise (ref PresetFileError)(msg: "Unable to parse " & name)
|
|
|
|
|
2023-11-10 15:04:55 +00:00
|
|
|
template checkCompatibility(
|
|
|
|
constValue: untyped, operator: untyped = `==`): untyped =
|
2022-09-19 09:07:46 +00:00
|
|
|
block:
|
|
|
|
const name = astToStr(constValue)
|
2023-11-10 15:04:55 +00:00
|
|
|
checkCompatibility(constValue, name, operator)
|
2022-09-19 09:07:46 +00:00
|
|
|
|
|
|
|
checkCompatibility SECONDS_PER_SLOT
|
|
|
|
|
|
|
|
checkCompatibility BLS_WITHDRAWAL_PREFIX
|
|
|
|
|
|
|
|
checkCompatibility MAX_COMMITTEES_PER_SLOT
|
|
|
|
checkCompatibility TARGET_COMMITTEE_SIZE
|
|
|
|
checkCompatibility MAX_VALIDATORS_PER_COMMITTEE
|
|
|
|
checkCompatibility SHUFFLE_ROUND_COUNT
|
|
|
|
checkCompatibility HYSTERESIS_QUOTIENT
|
|
|
|
checkCompatibility HYSTERESIS_DOWNWARD_MULTIPLIER
|
|
|
|
checkCompatibility HYSTERESIS_UPWARD_MULTIPLIER
|
|
|
|
checkCompatibility MIN_DEPOSIT_AMOUNT
|
|
|
|
checkCompatibility MAX_EFFECTIVE_BALANCE
|
|
|
|
checkCompatibility EFFECTIVE_BALANCE_INCREMENT
|
|
|
|
checkCompatibility MIN_ATTESTATION_INCLUSION_DELAY
|
|
|
|
checkCompatibility SLOTS_PER_EPOCH
|
|
|
|
checkCompatibility MIN_SEED_LOOKAHEAD
|
|
|
|
checkCompatibility MAX_SEED_LOOKAHEAD
|
|
|
|
checkCompatibility EPOCHS_PER_ETH1_VOTING_PERIOD
|
|
|
|
checkCompatibility SLOTS_PER_HISTORICAL_ROOT
|
|
|
|
checkCompatibility MIN_EPOCHS_TO_INACTIVITY_PENALTY
|
|
|
|
checkCompatibility EPOCHS_PER_HISTORICAL_VECTOR
|
|
|
|
checkCompatibility EPOCHS_PER_SLASHINGS_VECTOR
|
|
|
|
checkCompatibility HISTORICAL_ROOTS_LIMIT
|
|
|
|
checkCompatibility VALIDATOR_REGISTRY_LIMIT
|
|
|
|
checkCompatibility BASE_REWARD_FACTOR
|
|
|
|
checkCompatibility WHISTLEBLOWER_REWARD_QUOTIENT
|
|
|
|
checkCompatibility PROPOSER_REWARD_QUOTIENT
|
|
|
|
checkCompatibility INACTIVITY_PENALTY_QUOTIENT
|
|
|
|
checkCompatibility MIN_SLASHING_PENALTY_QUOTIENT
|
|
|
|
checkCompatibility PROPORTIONAL_SLASHING_MULTIPLIER
|
|
|
|
checkCompatibility MAX_PROPOSER_SLASHINGS
|
|
|
|
checkCompatibility MAX_ATTESTER_SLASHINGS
|
|
|
|
checkCompatibility MAX_ATTESTATIONS
|
|
|
|
checkCompatibility MAX_DEPOSITS
|
|
|
|
checkCompatibility MAX_VOLUNTARY_EXITS
|
|
|
|
|
|
|
|
checkCompatibility TARGET_AGGREGATORS_PER_COMMITTEE
|
|
|
|
checkCompatibility EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION
|
|
|
|
|
|
|
|
checkCompatibility DOMAIN_BEACON_PROPOSER
|
|
|
|
checkCompatibility DOMAIN_BEACON_ATTESTER
|
|
|
|
checkCompatibility DOMAIN_RANDAO
|
|
|
|
checkCompatibility DOMAIN_DEPOSIT
|
|
|
|
checkCompatibility DOMAIN_VOLUNTARY_EXIT
|
|
|
|
checkCompatibility DOMAIN_SELECTION_PROOF
|
|
|
|
checkCompatibility DOMAIN_AGGREGATE_AND_PROOF
|
|
|
|
checkCompatibility DOMAIN_SYNC_COMMITTEE
|
|
|
|
checkCompatibility DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF
|
|
|
|
checkCompatibility DOMAIN_CONTRIBUTION_AND_PROOF
|
|
|
|
|
2023-08-12 03:10:12 +00:00
|
|
|
checkCompatibility GOSSIP_MAX_SIZE
|
|
|
|
checkCompatibility MAX_REQUEST_BLOCKS
|
|
|
|
checkCompatibility EPOCHS_PER_SUBNET_SUBSCRIPTION
|
|
|
|
checkCompatibility MAX_CHUNK_SIZE
|
2023-11-09 20:41:17 +00:00
|
|
|
checkCompatibility TTFB_TIMEOUT
|
|
|
|
checkCompatibility RESP_TIMEOUT
|
|
|
|
checkCompatibility ATTESTATION_PROPAGATION_SLOT_RANGE
|
|
|
|
checkCompatibility MAXIMUM_GOSSIP_CLOCK_DISPARITY.milliseconds.uint64,
|
|
|
|
"MAXIMUM_GOSSIP_CLOCK_DISPARITY"
|
|
|
|
checkCompatibility MESSAGE_DOMAIN_INVALID_SNAPPY
|
|
|
|
checkCompatibility MESSAGE_DOMAIN_VALID_SNAPPY
|
2023-08-12 03:10:12 +00:00
|
|
|
checkCompatibility SUBNETS_PER_NODE
|
2023-11-09 20:41:17 +00:00
|
|
|
checkCompatibility ATTESTATION_SUBNET_COUNT
|
2023-08-21 19:58:51 +00:00
|
|
|
checkCompatibility ATTESTATION_SUBNET_EXTRA_BITS
|
|
|
|
checkCompatibility ATTESTATION_SUBNET_PREFIX_BITS
|
2023-11-09 20:41:17 +00:00
|
|
|
|
2023-09-14 12:37:35 +00:00
|
|
|
checkCompatibility MAX_REQUEST_BLOCKS_DENEB
|
2023-11-09 20:41:17 +00:00
|
|
|
checkCompatibility MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK,
|
|
|
|
"MAX_REQUEST_BLOB_SIDECARS"
|
|
|
|
checkCompatibility BLOB_SIDECAR_SUBNET_COUNT
|
2023-08-12 03:10:12 +00:00
|
|
|
|
2024-08-21 12:25:19 +00:00
|
|
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.5/specs/phase0/fork-choice.md#configuration
|
2022-09-19 09:07:46 +00:00
|
|
|
# Isn't being used as a preset in the usual way: at any time, there's one correct value
|
|
|
|
checkCompatibility PROPOSER_SCORE_BOOST
|
2023-11-09 20:41:17 +00:00
|
|
|
checkCompatibility REORG_HEAD_WEIGHT_THRESHOLD
|
|
|
|
checkCompatibility REORG_PARENT_WEIGHT_THRESHOLD
|
|
|
|
checkCompatibility REORG_MAX_EPOCHS_SINCE_FINALIZATION
|
2022-09-19 09:07:46 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
for name, field in cfg.fieldPairs():
|
|
|
|
if name in values:
|
2020-07-13 14:44:58 +00:00
|
|
|
try:
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
field = parse(typeof(field), values[name])
|
2022-09-19 09:07:46 +00:00
|
|
|
values.del name
|
2020-07-13 14:44:58 +00:00
|
|
|
except ValueError:
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
raise (ref PresetFileError)(msg: "Unable to parse " & name)
|
2020-07-07 23:02:14 +00:00
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
if cfg.PRESET_BASE != const_preset:
|
|
|
|
raise (ref PresetIncompatibleError)(
|
|
|
|
msg: "Config not compatible with binary, compile with -d:const_preset=" & cfg.PRESET_BASE)
|
2019-12-10 19:49:42 +00:00
|
|
|
|
2023-11-09 20:41:17 +00:00
|
|
|
# Requires initialized `cfg`
|
2023-11-10 15:04:55 +00:00
|
|
|
checkCompatibility cfg.safeMinEpochsForBlockRequests(),
|
|
|
|
"MIN_EPOCHS_FOR_BLOCK_REQUESTS", `>=`
|
2023-11-09 20:41:17 +00:00
|
|
|
|
2022-09-19 09:07:46 +00:00
|
|
|
var unknowns: seq[string]
|
|
|
|
for name in values.keys:
|
|
|
|
unknowns.add name
|
|
|
|
|
Implement split preset/config support (#2710)
* Implement split preset/config support
This is the initial bulk refactor to introduce runtime config values in
a number of places, somewhat replacing the existing mechanism of loading
network metadata.
It still needs more work, this is the initial refactor that introduces
runtime configuration in some of the places that need it.
The PR changes the way presets and constants work, to match the spec. In
particular, a "preset" now refers to the compile-time configuration
while a "cfg" or "RuntimeConfig" is the dynamic part.
A single binary can support either mainnet or minimal, but not both.
Support for other presets has been removed completely (can be readded,
in case there's need).
There's a number of outstanding tasks:
* `SECONDS_PER_SLOT` still needs fixing
* loading custom runtime configs needs redoing
* checking constants against YAML file
* yeerongpilly support
`build/nimbus_beacon_node --network=yeerongpilly --discv5:no --log-level=DEBUG`
* load fork epoch from config
* fix fork digest sent in status
* nicer error string for request failures
* fix tools
* one more
* fixup
* fixup
* fixup
* use "standard" network definition folder in local testnet
Files are loaded from their standard locations, including genesis etc,
to conform to the format used in the `eth2-networks` repo.
* fix launch scripts, allow unknown config values
* fix base config of rest test
* cleanups
* bundle mainnet config using common loader
* fix spec links and names
* only include supported preset in binary
* drop yeerongpilly, add altair-devnet-0, support boot_enr.yaml
2021-07-12 13:01:38 +00:00
|
|
|
(cfg, unknowns)
|
2022-01-07 10:13:19 +00:00
|
|
|
|
2023-06-14 19:48:50 +00:00
|
|
|
proc readRuntimeConfig*(
|
|
|
|
path: string): (RuntimeConfig, seq[string]) {.
|
2023-08-25 09:29:07 +00:00
|
|
|
raises: [IOError, PresetFileError, PresetIncompatibleError].} =
|
2023-06-14 19:48:50 +00:00
|
|
|
readRuntimeConfig(readFile(path), path)
|
|
|
|
|
2022-01-07 10:13:19 +00:00
|
|
|
template name*(cfg: RuntimeConfig): string =
|
|
|
|
if cfg.CONFIG_NAME.len() > 0:
|
|
|
|
cfg.CONFIG_NAME
|
|
|
|
else:
|
|
|
|
const_preset
|
2022-06-27 11:24:38 +00:00
|
|
|
|
2022-06-28 20:52:29 +00:00
|
|
|
func defaultLightClientDataMaxPeriods*(cfg: RuntimeConfig): uint64 =
|
2022-06-27 11:24:38 +00:00
|
|
|
const epochsPerPeriod = EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
|
|
|
let maxEpochs = cfg.MIN_EPOCHS_FOR_BLOCK_REQUESTS
|
|
|
|
(maxEpochs + epochsPerPeriod - 1) div epochsPerPeriod
|