initial Capella support in RuntimeConfig (#3698)
This commit is contained in:
parent
ea113fc420
commit
faf4d4a001
|
@ -668,7 +668,8 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
|
|||
# TODO move fork version sanity checking elsewhere?
|
||||
let forkVersions =
|
||||
[cfg.GENESIS_FORK_VERSION, cfg.ALTAIR_FORK_VERSION,
|
||||
cfg.BELLATRIX_FORK_VERSION, cfg.SHARDING_FORK_VERSION]
|
||||
cfg.BELLATRIX_FORK_VERSION, cfg.CAPELLA_FORK_VERSION,
|
||||
cfg.SHARDING_FORK_VERSION]
|
||||
for i in 0 ..< forkVersions.len:
|
||||
for j in i+1 ..< forkVersions.len:
|
||||
doAssert forkVersions[i] != forkVersions[j]
|
||||
|
@ -683,7 +684,8 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
|
|||
firstForkEpoch in [GENESIS_EPOCH, FAR_FUTURE_EPOCH]
|
||||
|
||||
assertForkEpochOrder(cfg.ALTAIR_FORK_EPOCH, cfg.BELLATRIX_FORK_EPOCH)
|
||||
assertForkEpochorder(cfg.BELLATRIX_FORK_EPOCH, cfg.SHARDING_FORK_EPOCH)
|
||||
assertForkEpochOrder(cfg.BELLATRIX_FORK_EPOCH, cfg.CAPELLA_FORK_EPOCH)
|
||||
assertForkEpochOrder(cfg.CAPELLA_FORK_EPOCH, cfg.SHARDING_FORK_EPOCH)
|
||||
|
||||
doAssert updateFlags in [{}, {verifyFinalization}],
|
||||
"Other flags not supported in ChainDAG"
|
||||
|
|
|
@ -123,7 +123,7 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
|||
MAX_EXTRA_DATA_BYTES:
|
||||
Base10.toString(uint64(MAX_EXTRA_DATA_BYTES)),
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.10/configs/mainnet.yaml
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/configs/mainnet.yaml
|
||||
PRESET_BASE:
|
||||
cfg.PRESET_BASE,
|
||||
CONFIG_NAME:
|
||||
|
@ -150,6 +150,10 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
|||
"0x" & $cfg.BELLATRIX_FORK_VERSION,
|
||||
BELLATRIX_FORK_EPOCH:
|
||||
Base10.toString(uint64(cfg.BELLATRIX_FORK_EPOCH)),
|
||||
CAPELLA_FORK_VERSION:
|
||||
"0x" & $cfg.CAPELLA_FORK_VERSION,
|
||||
CAPELLA_FORK_EPOCH:
|
||||
Base10.toString(uint64(cfg.CAPELLA_FORK_EPOCH)),
|
||||
SHARDING_FORK_VERSION:
|
||||
"0x" & $cfg.SHARDING_FORK_VERSION,
|
||||
SHARDING_FORK_EPOCH:
|
||||
|
|
|
@ -297,7 +297,7 @@ type
|
|||
BYTES_PER_LOGS_BLOOM*: uint64
|
||||
MAX_EXTRA_DATA_BYTES*: uint64
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.10/configs/mainnet.yaml
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/configs/mainnet.yaml
|
||||
PRESET_BASE*: string
|
||||
CONFIG_NAME*: string
|
||||
TERMINAL_TOTAL_DIFFICULTY*: UInt256
|
||||
|
@ -311,6 +311,8 @@ type
|
|||
ALTAIR_FORK_EPOCH*: uint64
|
||||
BELLATRIX_FORK_VERSION*: Version
|
||||
BELLATRIX_FORK_EPOCH*: uint64
|
||||
CAPELLA_FORK_VERSION*: Version
|
||||
CAPELLA_FORK_EPOCH*: uint64
|
||||
SHARDING_FORK_VERSION*: Version
|
||||
SHARDING_FORK_EPOCH*: uint64
|
||||
SECONDS_PER_SLOT*: uint64
|
||||
|
|
|
@ -162,6 +162,7 @@ type
|
|||
phase0*: ForkDigest
|
||||
altair*: ForkDigest
|
||||
bellatrix*: ForkDigest
|
||||
capella*: ForkDigest
|
||||
sharding*: ForkDigest
|
||||
|
||||
template toFork*[T: phase0.BeaconState | phase0.HashedBeaconState](
|
||||
|
@ -604,6 +605,8 @@ func init*(T: type ForkDigests,
|
|||
compute_fork_digest(cfg.ALTAIR_FORK_VERSION, genesis_validators_root),
|
||||
bellatrix:
|
||||
compute_fork_digest(cfg.BELLATRIX_FORK_VERSION, genesis_validators_root),
|
||||
capella:
|
||||
compute_fork_digest(cfg.CAPELLA_FORK_VERSION, genesis_validators_root),
|
||||
sharding:
|
||||
compute_fork_digest(cfg.SHARDING_FORK_VERSION, genesis_validators_root),
|
||||
)
|
||||
|
|
|
@ -49,6 +49,8 @@ type
|
|||
ALTAIR_FORK_EPOCH*: Epoch
|
||||
BELLATRIX_FORK_VERSION*: Version
|
||||
BELLATRIX_FORK_EPOCH*: Epoch
|
||||
CAPELLA_FORK_VERSION*: Version
|
||||
CAPELLA_FORK_EPOCH*: Epoch
|
||||
SHARDING_FORK_VERSION*: Version
|
||||
SHARDING_FORK_EPOCH*: Epoch
|
||||
|
||||
|
@ -148,6 +150,9 @@ const
|
|||
|
||||
"TRANSITION_TOTAL_DIFFICULTY", # Name that appears in some altair alphas, obsolete, remove when no more testnets
|
||||
"MIN_ANCHOR_POW_BLOCK_DIFFICULTY", # Name that appears in some altair alphas, obsolete, remove when no more testnets
|
||||
|
||||
"TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH", # Never pervasively implemented, still under discussion
|
||||
"PROPOSER_SCORE_BOOST", # Isn't being used as a preset in the usual way: at any time, there's one correct value
|
||||
]
|
||||
|
||||
when const_preset == "mainnet":
|
||||
|
@ -157,7 +162,7 @@ when const_preset == "mainnet":
|
|||
# TODO Move this to RuntimeConfig
|
||||
const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 12
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.10/configs/mainnet.yaml
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/configs/mainnet.yaml
|
||||
# TODO Read these from yaml file
|
||||
const defaultRuntimeConfig* = RuntimeConfig(
|
||||
# Mainnet config
|
||||
|
@ -209,8 +214,11 @@ when const_preset == "mainnet":
|
|||
# Bellatrix
|
||||
BELLATRIX_FORK_VERSION: Version [byte 0x02, 0x00, 0x00, 0x00],
|
||||
BELLATRIX_FORK_EPOCH: Epoch(uint64.high),
|
||||
# Capella
|
||||
CAPELLA_FORK_VERSION: Version [byte 0x03, 0x00, 0x00, 0x00],
|
||||
CAPELLA_FORK_EPOCH: Epoch(uint64.high),
|
||||
# Sharding
|
||||
SHARDING_FORK_VERSION: Version [byte 0x03, 0x00, 0x00, 0x00],
|
||||
SHARDING_FORK_VERSION: Version [byte 0x04, 0x00, 0x00, 0x00],
|
||||
SHARDING_FORK_EPOCH: Epoch(uint64.high),
|
||||
|
||||
|
||||
|
@ -242,11 +250,6 @@ when const_preset == "mainnet":
|
|||
CHURN_LIMIT_QUOTIENT: 65536,
|
||||
|
||||
|
||||
# Fork choice
|
||||
# ---------------------------------------------------------------
|
||||
# 70%
|
||||
# TODO PROPOSER_SCORE_BOOST: 70,
|
||||
|
||||
# Deposit contract
|
||||
# ---------------------------------------------------------------
|
||||
# Ethereum PoW Mainnet
|
||||
|
@ -261,7 +264,7 @@ elif const_preset == "minimal":
|
|||
|
||||
const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 6
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.10/configs/minimal.yaml
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/configs/minimal.yaml
|
||||
const defaultRuntimeConfig* = RuntimeConfig(
|
||||
# Minimal config
|
||||
|
||||
|
@ -311,8 +314,11 @@ elif const_preset == "minimal":
|
|||
# Bellatrix
|
||||
BELLATRIX_FORK_VERSION: Version [byte 0x02, 0x00, 0x00, 0x01],
|
||||
BELLATRIX_FORK_EPOCH: Epoch(uint64.high),
|
||||
# Capella
|
||||
CAPELLA_FORK_VERSION: Version [byte 0x03, 0x00, 0x00, 0x01],
|
||||
CAPELLA_FORK_EPOCH: Epoch(uint64.high),
|
||||
# Sharding
|
||||
SHARDING_FORK_VERSION: Version [byte 0x03, 0x00, 0x00, 0x01],
|
||||
SHARDING_FORK_VERSION: Version [byte 0x04, 0x00, 0x00, 0x01],
|
||||
SHARDING_FORK_EPOCH: Epoch(uint64.high),
|
||||
|
||||
|
||||
|
@ -344,12 +350,6 @@ elif const_preset == "minimal":
|
|||
CHURN_LIMIT_QUOTIENT: 32,
|
||||
|
||||
|
||||
# Fork choice
|
||||
# ---------------------------------------------------------------
|
||||
# 70%
|
||||
# TODO PROPOSER_SCORE_BOOST: 70,
|
||||
|
||||
|
||||
# Deposit contract
|
||||
# ---------------------------------------------------------------
|
||||
# Ethereum Goerli testnet
|
||||
|
|
|
@ -2646,7 +2646,7 @@
|
|||
"response": {
|
||||
"status": {"operator": "equals", "value": "200"},
|
||||
"headers": [{"key": "Content-Type", "value": "application/json", "operator": "equals"}],
|
||||
"body": [{"operator": "jstructcmps", "start": ["data"], "value": {"MAX_COMMITTEES_PER_SLOT":"","TARGET_COMMITTEE_SIZE":"","MAX_VALIDATORS_PER_COMMITTEE":"","SHUFFLE_ROUND_COUNT":"","HYSTERESIS_QUOTIENT":"","HYSTERESIS_DOWNWARD_MULTIPLIER":"","HYSTERESIS_UPWARD_MULTIPLIER":"","SAFE_SLOTS_TO_UPDATE_JUSTIFIED":"","MIN_DEPOSIT_AMOUNT":"","MAX_EFFECTIVE_BALANCE":"","EFFECTIVE_BALANCE_INCREMENT":"","MIN_ATTESTATION_INCLUSION_DELAY":"","SLOTS_PER_EPOCH":"","MIN_SEED_LOOKAHEAD":"","MAX_SEED_LOOKAHEAD":"","EPOCHS_PER_ETH1_VOTING_PERIOD":"","SLOTS_PER_HISTORICAL_ROOT":"","MIN_EPOCHS_TO_INACTIVITY_PENALTY":"","EPOCHS_PER_HISTORICAL_VECTOR":"","EPOCHS_PER_SLASHINGS_VECTOR":"","HISTORICAL_ROOTS_LIMIT":"","VALIDATOR_REGISTRY_LIMIT":"","BASE_REWARD_FACTOR":"","WHISTLEBLOWER_REWARD_QUOTIENT":"","PROPOSER_REWARD_QUOTIENT":"","INACTIVITY_PENALTY_QUOTIENT":"","MIN_SLASHING_PENALTY_QUOTIENT":"","PROPORTIONAL_SLASHING_MULTIPLIER":"","MAX_PROPOSER_SLASHINGS":"","MAX_ATTESTER_SLASHINGS":"","MAX_ATTESTATIONS":"","MAX_DEPOSITS":"","MAX_VOLUNTARY_EXITS":"","INACTIVITY_PENALTY_QUOTIENT_ALTAIR":"","MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR":"","PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR":"","SYNC_COMMITTEE_SIZE":"","EPOCHS_PER_SYNC_COMMITTEE_PERIOD":"","MIN_SYNC_COMMITTEE_PARTICIPANTS":"","UPDATE_TIMEOUT":"","INACTIVITY_PENALTY_QUOTIENT_BELLATRIX":"","MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX":"","PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX":"","MAX_BYTES_PER_TRANSACTION":"","MAX_TRANSACTIONS_PER_PAYLOAD":"","BYTES_PER_LOGS_BLOOM":"","MAX_EXTRA_DATA_BYTES":"","PRESET_BASE":"","CONFIG_NAME":"","TERMINAL_TOTAL_DIFFICULTY":"","TERMINAL_BLOCK_HASH":"","TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH":"","MIN_GENESIS_ACTIVE_VALIDATOR_COUNT":"","MIN_GENESIS_TIME":"","GENESIS_FORK_VERSION":"","GENESIS_DELAY":"","ALTAIR_FORK_VERSION":"","ALTAIR_FORK_EPOCH":"","BELLATRIX_FORK_VERSION":"","BELLATRIX_FORK_EPOCH":"","SHARDING_FORK_VERSION":"","SHARDING_FORK_EPOCH":"","SECONDS_PER_SLOT":"","SECONDS_PER_ETH1_BLOCK":"","MIN_VALIDATOR_WITHDRAWABILITY_DELAY":"","SHARD_COMMITTEE_PERIOD":"","ETH1_FOLLOW_DISTANCE":"","INACTIVITY_SCORE_BIAS":"","INACTIVITY_SCORE_RECOVERY_RATE":"","EJECTION_BALANCE":"","MIN_PER_EPOCH_CHURN_LIMIT":"","CHURN_LIMIT_QUOTIENT":"","PROPOSER_SCORE_BOOST":"","DEPOSIT_CHAIN_ID":"","DEPOSIT_NETWORK_ID":"","DEPOSIT_CONTRACT_ADDRESS":"","BLS_WITHDRAWAL_PREFIX":"","ETH1_ADDRESS_WITHDRAWAL_PREFIX":"","DOMAIN_BEACON_PROPOSER":"","DOMAIN_BEACON_ATTESTER":"","DOMAIN_RANDAO":"","DOMAIN_DEPOSIT":"","DOMAIN_VOLUNTARY_EXIT":"","DOMAIN_SELECTION_PROOF":"","DOMAIN_AGGREGATE_AND_PROOF":"","TIMELY_SOURCE_FLAG_INDEX":"","TIMELY_TARGET_FLAG_INDEX":"","TIMELY_HEAD_FLAG_INDEX":"","TIMELY_SOURCE_WEIGHT":"","TIMELY_TARGET_WEIGHT":"","TIMELY_HEAD_WEIGHT":"","SYNC_REWARD_WEIGHT":"","PROPOSER_WEIGHT":"","WEIGHT_DENOMINATOR":"","DOMAIN_SYNC_COMMITTEE":"","DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF":"","DOMAIN_CONTRIBUTION_AND_PROOF":"","TARGET_AGGREGATORS_PER_COMMITTEE":"","RANDOM_SUBNETS_PER_VALIDATOR":"","EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION":"","ATTESTATION_SUBNET_COUNT":"","TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE":"","SYNC_COMMITTEE_SUBNET_COUNT":""}}]
|
||||
"body": [{"operator": "jstructcmps", "start": ["data"], "value": {"MAX_COMMITTEES_PER_SLOT":"","TARGET_COMMITTEE_SIZE":"","MAX_VALIDATORS_PER_COMMITTEE":"","SHUFFLE_ROUND_COUNT":"","HYSTERESIS_QUOTIENT":"","HYSTERESIS_DOWNWARD_MULTIPLIER":"","HYSTERESIS_UPWARD_MULTIPLIER":"","SAFE_SLOTS_TO_UPDATE_JUSTIFIED":"","MIN_DEPOSIT_AMOUNT":"","MAX_EFFECTIVE_BALANCE":"","EFFECTIVE_BALANCE_INCREMENT":"","MIN_ATTESTATION_INCLUSION_DELAY":"","SLOTS_PER_EPOCH":"","MIN_SEED_LOOKAHEAD":"","MAX_SEED_LOOKAHEAD":"","EPOCHS_PER_ETH1_VOTING_PERIOD":"","SLOTS_PER_HISTORICAL_ROOT":"","MIN_EPOCHS_TO_INACTIVITY_PENALTY":"","EPOCHS_PER_HISTORICAL_VECTOR":"","EPOCHS_PER_SLASHINGS_VECTOR":"","HISTORICAL_ROOTS_LIMIT":"","VALIDATOR_REGISTRY_LIMIT":"","BASE_REWARD_FACTOR":"","WHISTLEBLOWER_REWARD_QUOTIENT":"","PROPOSER_REWARD_QUOTIENT":"","INACTIVITY_PENALTY_QUOTIENT":"","MIN_SLASHING_PENALTY_QUOTIENT":"","PROPORTIONAL_SLASHING_MULTIPLIER":"","MAX_PROPOSER_SLASHINGS":"","MAX_ATTESTER_SLASHINGS":"","MAX_ATTESTATIONS":"","MAX_DEPOSITS":"","MAX_VOLUNTARY_EXITS":"","INACTIVITY_PENALTY_QUOTIENT_ALTAIR":"","MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR":"","PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR":"","SYNC_COMMITTEE_SIZE":"","EPOCHS_PER_SYNC_COMMITTEE_PERIOD":"","MIN_SYNC_COMMITTEE_PARTICIPANTS":"","UPDATE_TIMEOUT":"","INACTIVITY_PENALTY_QUOTIENT_BELLATRIX":"","MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX":"","PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX":"","MAX_BYTES_PER_TRANSACTION":"","MAX_TRANSACTIONS_PER_PAYLOAD":"","BYTES_PER_LOGS_BLOOM":"","MAX_EXTRA_DATA_BYTES":"","PRESET_BASE":"","CONFIG_NAME":"","TERMINAL_TOTAL_DIFFICULTY":"","TERMINAL_BLOCK_HASH":"","TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH":"","MIN_GENESIS_ACTIVE_VALIDATOR_COUNT":"","MIN_GENESIS_TIME":"","GENESIS_FORK_VERSION":"","GENESIS_DELAY":"","ALTAIR_FORK_VERSION":"","ALTAIR_FORK_EPOCH":"","BELLATRIX_FORK_VERSION":"","BELLATRIX_FORK_EPOCH":"","CAPELLA_FORK_VERSION":"","CAPELLA_FORK_EPOCH":"","SHARDING_FORK_VERSION":"","SHARDING_FORK_EPOCH":"","SECONDS_PER_SLOT":"","SECONDS_PER_ETH1_BLOCK":"","MIN_VALIDATOR_WITHDRAWABILITY_DELAY":"","SHARD_COMMITTEE_PERIOD":"","ETH1_FOLLOW_DISTANCE":"","INACTIVITY_SCORE_BIAS":"","INACTIVITY_SCORE_RECOVERY_RATE":"","EJECTION_BALANCE":"","MIN_PER_EPOCH_CHURN_LIMIT":"","CHURN_LIMIT_QUOTIENT":"","PROPOSER_SCORE_BOOST":"","DEPOSIT_CHAIN_ID":"","DEPOSIT_NETWORK_ID":"","DEPOSIT_CONTRACT_ADDRESS":"","BLS_WITHDRAWAL_PREFIX":"","ETH1_ADDRESS_WITHDRAWAL_PREFIX":"","DOMAIN_BEACON_PROPOSER":"","DOMAIN_BEACON_ATTESTER":"","DOMAIN_RANDAO":"","DOMAIN_DEPOSIT":"","DOMAIN_VOLUNTARY_EXIT":"","DOMAIN_SELECTION_PROOF":"","DOMAIN_AGGREGATE_AND_PROOF":"","TIMELY_SOURCE_FLAG_INDEX":"","TIMELY_TARGET_FLAG_INDEX":"","TIMELY_HEAD_FLAG_INDEX":"","TIMELY_SOURCE_WEIGHT":"","TIMELY_TARGET_WEIGHT":"","TIMELY_HEAD_WEIGHT":"","SYNC_REWARD_WEIGHT":"","PROPOSER_WEIGHT":"","WEIGHT_DENOMINATOR":"","DOMAIN_SYNC_COMMITTEE":"","DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF":"","DOMAIN_CONTRIBUTION_AND_PROOF":"","TARGET_AGGREGATORS_PER_COMMITTEE":"","RANDOM_SUBNETS_PER_VALIDATOR":"","EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION":"","ATTESTATION_SUBNET_COUNT":"","TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE":"","SYNC_COMMITTEE_SUBNET_COUNT":""}}]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue