extend REST config with more spec constants (#2962)

So far, the REST config response did not include all spec constants.
The spec for `/eth/v1/config/spec` defines that the response should
include constants for all hard forks known by the beacon node. This
patch extends the corresponding response to include more constants.
This commit is contained in:
Etan Kissling 2021-11-02 19:23:31 +01:00 committed by GitHub
parent 233d756518
commit 1943258c66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 238 additions and 106 deletions

View File

@ -10,12 +10,12 @@ import
stew/[results, base10],
chronicles,
nimcrypto/utils as ncrutils,
./rest_utils,
../beacon_node, ../networking/eth2_network,
../consensus_object_pools/[blockchain_dag, exit_pool, spec_cache],
../validators/validator_duties,
../spec/[eth2_merkleization, forks, network],
../spec/datatypes/[phase0, altair],
./rest_utils
../spec/datatypes/[phase0, altair]
export rest_utils

View File

@ -22,30 +22,19 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
cachedConfigSpec =
RestApiResponse.prepareJsonResponse(
(
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/configs/mainnet/phase0.yaml
CONFIG_NAME:
const_preset,
PRESET_BASE:
node.dag.cfg.PRESET_BASE,
ALTAIR_FORK_EPOCH:
Base10.toString(uint64(node.dag.cfg.ALTAIR_FORK_EPOCH)),
ALTAIR_FORK_VERSION:
"0x" & $node.dag.cfg.ALTAIR_FORK_VERSION,
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/presets/mainnet/phase0.yaml
MAX_COMMITTEES_PER_SLOT:
Base10.toString(MAX_COMMITTEES_PER_SLOT),
TARGET_COMMITTEE_SIZE:
Base10.toString(TARGET_COMMITTEE_SIZE),
MAX_VALIDATORS_PER_COMMITTEE:
Base10.toString(MAX_VALIDATORS_PER_COMMITTEE),
MIN_PER_EPOCH_CHURN_LIMIT:
Base10.toString(node.dag.cfg.MIN_PER_EPOCH_CHURN_LIMIT),
CHURN_LIMIT_QUOTIENT:
Base10.toString(node.dag.cfg.CHURN_LIMIT_QUOTIENT),
SHUFFLE_ROUND_COUNT:
Base10.toString(SHUFFLE_ROUND_COUNT),
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT:
Base10.toString(node.dag.cfg.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT),
MIN_GENESIS_TIME:
Base10.toString(node.dag.cfg.MIN_GENESIS_TIME),
HYSTERESIS_QUOTIENT:
Base10.toString(HYSTERESIS_QUOTIENT),
HYSTERESIS_DOWNWARD_MULTIPLIER:
@ -54,40 +43,12 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
Base10.toString(HYSTERESIS_UPWARD_MULTIPLIER),
SAFE_SLOTS_TO_UPDATE_JUSTIFIED:
Base10.toString(SAFE_SLOTS_TO_UPDATE_JUSTIFIED),
ETH1_FOLLOW_DISTANCE:
Base10.toString(node.dag.cfg.ETH1_FOLLOW_DISTANCE),
TARGET_AGGREGATORS_PER_COMMITTEE:
Base10.toString(TARGET_AGGREGATORS_PER_COMMITTEE),
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE:
Base10.toString(uint64(TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE)),
RANDOM_SUBNETS_PER_VALIDATOR:
Base10.toString(RANDOM_SUBNETS_PER_VALIDATOR),
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION:
Base10.toString(EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION),
SECONDS_PER_ETH1_BLOCK:
Base10.toString(node.dag.cfg.SECONDS_PER_ETH1_BLOCK),
DEPOSIT_CHAIN_ID:
Base10.toString(uint64(node.dag.cfg.DEPOSIT_CHAIN_ID)),
DEPOSIT_NETWORK_ID:
Base10.toString(uint64(node.dag.cfg.DEPOSIT_NETWORK_ID)),
DEPOSIT_CONTRACT_ADDRESS:
$node.dag.cfg.DEPOSIT_CONTRACT_ADDRESS,
MIN_DEPOSIT_AMOUNT:
Base10.toString(MIN_DEPOSIT_AMOUNT),
MAX_EFFECTIVE_BALANCE:
Base10.toString(MAX_EFFECTIVE_BALANCE),
EJECTION_BALANCE:
Base10.toString(node.dag.cfg.EJECTION_BALANCE),
EFFECTIVE_BALANCE_INCREMENT:
Base10.toString(EFFECTIVE_BALANCE_INCREMENT),
GENESIS_FORK_VERSION:
"0x" & $node.dag.cfg.GENESIS_FORK_VERSION,
BLS_WITHDRAWAL_PREFIX:
"0x" & ncrutils.toHex([BLS_WITHDRAWAL_PREFIX]),
GENESIS_DELAY:
Base10.toString(node.dag.cfg.GENESIS_DELAY),
SECONDS_PER_SLOT:
Base10.toString(uint64(SECONDS_PER_SLOT)),
MIN_ATTESTATION_INCLUSION_DELAY:
Base10.toString(MIN_ATTESTATION_INCLUSION_DELAY),
SLOTS_PER_EPOCH:
@ -100,22 +61,12 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
Base10.toString(EPOCHS_PER_ETH1_VOTING_PERIOD),
SLOTS_PER_HISTORICAL_ROOT:
Base10.toString(SLOTS_PER_HISTORICAL_ROOT),
SYNC_COMMITTEE_SIZE:
Base10.toString(uint64(SYNC_COMMITTEE_SIZE)),
SYNC_COMMITTEE_SUBNET_COUNT:
Base10.toString(uint64(SYNC_COMMITTEE_SUBNET_COUNT)),
MIN_VALIDATOR_WITHDRAWABILITY_DELAY:
Base10.toString(node.dag.cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY),
SHARD_COMMITTEE_PERIOD:
Base10.toString(node.dag.cfg.SHARD_COMMITTEE_PERIOD),
MIN_EPOCHS_TO_INACTIVITY_PENALTY:
Base10.toString(MIN_EPOCHS_TO_INACTIVITY_PENALTY),
EPOCHS_PER_HISTORICAL_VECTOR:
Base10.toString(EPOCHS_PER_HISTORICAL_VECTOR),
EPOCHS_PER_SLASHINGS_VECTOR:
Base10.toString(EPOCHS_PER_SLASHINGS_VECTOR),
EPOCHS_PER_SYNC_COMMITTEE_PERIOD:
Base10.toString(EPOCHS_PER_SYNC_COMMITTEE_PERIOD),
HISTORICAL_ROOTS_LIMIT:
Base10.toString(HISTORICAL_ROOTS_LIMIT),
VALIDATOR_REGISTRY_LIMIT:
@ -128,22 +79,10 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
Base10.toString(PROPOSER_REWARD_QUOTIENT),
INACTIVITY_PENALTY_QUOTIENT:
Base10.toString(INACTIVITY_PENALTY_QUOTIENT),
INACTIVITY_PENALTY_QUOTIENT_ALTAIR:
Base10.toString(INACTIVITY_PENALTY_QUOTIENT_ALTAIR),
INACTIVITY_SCORE_BIAS:
Base10.toString(node.dag.cfg.INACTIVITY_SCORE_BIAS),
INACTIVITY_SCORE_RECOVERY_RATE:
Base10.toString(node.dag.cfg.INACTIVITY_SCORE_RECOVERY_RATE),
MIN_SLASHING_PENALTY_QUOTIENT:
Base10.toString(MIN_SLASHING_PENALTY_QUOTIENT),
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR:
Base10.toString(MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR),
MIN_SYNC_COMMITTEE_PARTICIPANTS:
Base10.toString(uint64(MIN_SYNC_COMMITTEE_PARTICIPANTS)),
PROPORTIONAL_SLASHING_MULTIPLIER:
Base10.toString(PROPORTIONAL_SLASHING_MULTIPLIER),
PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR:
Base10.toString(PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR),
MAX_PROPOSER_SLASHINGS:
Base10.toString(MAX_PROPOSER_SLASHINGS),
MAX_ATTESTER_SLASHINGS:
@ -154,6 +93,87 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
Base10.toString(MAX_DEPOSITS),
MAX_VOLUNTARY_EXITS:
Base10.toString(MAX_VOLUNTARY_EXITS),
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/presets/mainnet/altair.yaml
INACTIVITY_PENALTY_QUOTIENT_ALTAIR:
Base10.toString(INACTIVITY_PENALTY_QUOTIENT_ALTAIR),
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR:
Base10.toString(MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR),
PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR:
Base10.toString(PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR),
SYNC_COMMITTEE_SIZE:
Base10.toString(uint64(SYNC_COMMITTEE_SIZE)),
EPOCHS_PER_SYNC_COMMITTEE_PERIOD:
Base10.toString(EPOCHS_PER_SYNC_COMMITTEE_PERIOD),
MIN_SYNC_COMMITTEE_PARTICIPANTS:
Base10.toString(uint64(MIN_SYNC_COMMITTEE_PARTICIPANTS)),
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/configs/mainnet.yaml
PRESET_BASE:
node.dag.cfg.PRESET_BASE,
TERMINAL_TOTAL_DIFFICULTY:
toString(node.dag.cfg.TERMINAL_TOTAL_DIFFICULTY),
TERMINAL_BLOCK_HASH:
$node.dag.cfg.TERMINAL_BLOCK_HASH,
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT:
Base10.toString(node.dag.cfg.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT),
MIN_GENESIS_TIME:
Base10.toString(node.dag.cfg.MIN_GENESIS_TIME),
GENESIS_FORK_VERSION:
"0x" & $node.dag.cfg.GENESIS_FORK_VERSION,
GENESIS_DELAY:
Base10.toString(node.dag.cfg.GENESIS_DELAY),
ALTAIR_FORK_VERSION:
"0x" & $node.dag.cfg.ALTAIR_FORK_VERSION,
ALTAIR_FORK_EPOCH:
Base10.toString(uint64(node.dag.cfg.ALTAIR_FORK_EPOCH)),
MERGE_FORK_VERSION:
"0x" & $node.dag.cfg.MERGE_FORK_VERSION,
MERGE_FORK_EPOCH:
Base10.toString(uint64(node.dag.cfg.MERGE_FORK_EPOCH)),
SHARDING_FORK_VERSION:
"0x" & $node.dag.cfg.SHARDING_FORK_VERSION,
SHARDING_FORK_EPOCH:
Base10.toString(uint64(node.dag.cfg.SHARDING_FORK_EPOCH)),
SECONDS_PER_SLOT:
Base10.toString(SECONDS_PER_SLOT),
SECONDS_PER_ETH1_BLOCK:
Base10.toString(node.dag.cfg.SECONDS_PER_ETH1_BLOCK),
MIN_VALIDATOR_WITHDRAWABILITY_DELAY:
Base10.toString(node.dag.cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY),
SHARD_COMMITTEE_PERIOD:
Base10.toString(node.dag.cfg.SHARD_COMMITTEE_PERIOD),
ETH1_FOLLOW_DISTANCE:
Base10.toString(node.dag.cfg.ETH1_FOLLOW_DISTANCE),
INACTIVITY_SCORE_BIAS:
Base10.toString(node.dag.cfg.INACTIVITY_SCORE_BIAS),
INACTIVITY_SCORE_RECOVERY_RATE:
Base10.toString(node.dag.cfg.INACTIVITY_SCORE_RECOVERY_RATE),
EJECTION_BALANCE:
Base10.toString(node.dag.cfg.EJECTION_BALANCE),
MIN_PER_EPOCH_CHURN_LIMIT:
Base10.toString(node.dag.cfg.MIN_PER_EPOCH_CHURN_LIMIT),
CHURN_LIMIT_QUOTIENT:
Base10.toString(node.dag.cfg.CHURN_LIMIT_QUOTIENT),
DEPOSIT_CHAIN_ID:
Base10.toString(node.dag.cfg.DEPOSIT_CHAIN_ID),
DEPOSIT_NETWORK_ID:
Base10.toString(node.dag.cfg.DEPOSIT_NETWORK_ID),
DEPOSIT_CONTRACT_ADDRESS:
$node.dag.cfg.DEPOSIT_CONTRACT_ADDRESS,
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#constants
# GENESIS_SLOT
# GENESIS_EPOCH
# FAR_FUTURE_EPOCH
# BASE_REWARDS_PER_EPOCH
# DEPOSIT_CONTRACT_TREE_DEPTH
# JUSTIFICATION_BITS_LENGTH
# ENDIANNESS
BLS_WITHDRAWAL_PREFIX:
"0x" & ncrutils.toHex([BLS_WITHDRAWAL_PREFIX]),
ETH1_ADDRESS_WITHDRAWAL_PREFIX:
"0x" & ncrutils.toHex([ETH1_ADDRESS_WITHDRAWAL_PREFIX]),
DOMAIN_BEACON_PROPOSER:
"0x" & ncrutils.toHex(
uint32(DOMAIN_BEACON_PROPOSER).toBytesLE()),
@ -175,15 +195,52 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
DOMAIN_AGGREGATE_AND_PROOF:
"0x" & ncrutils.toHex(
uint32(DOMAIN_AGGREGATE_AND_PROOF).toBytesLE()),
DOMAIN_CONTRIBUTION_AND_PROOF:
"0x" & ncrutils.toHex(
uint32(DOMAIN_CONTRIBUTION_AND_PROOF).toBytesLE()),
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/beacon-chain.md#constants
TIMELY_SOURCE_FLAG_INDEX:
"0x" & ncrutils.toHex([byte(TIMELY_SOURCE_FLAG_INDEX)]),
TIMELY_TARGET_FLAG_INDEX:
"0x" & ncrutils.toHex([byte(TIMELY_TARGET_FLAG_INDEX)]),
TIMELY_HEAD_FLAG_INDEX:
"0x" & ncrutils.toHex([byte(TIMELY_HEAD_FLAG_INDEX)]),
TIMELY_SOURCE_WEIGHT:
Base10.toString(uint64(TIMELY_SOURCE_WEIGHT)),
TIMELY_TARGET_WEIGHT:
Base10.toString(uint64(TIMELY_TARGET_WEIGHT)),
TIMELY_HEAD_WEIGHT:
Base10.toString(uint64(TIMELY_HEAD_WEIGHT)),
SYNC_REWARD_WEIGHT:
Base10.toString(uint64(SYNC_REWARD_WEIGHT)),
PROPOSER_WEIGHT:
Base10.toString(uint64(PROPOSER_WEIGHT)),
WEIGHT_DENOMINATOR:
Base10.toString(uint64(WEIGHT_DENOMINATOR)),
DOMAIN_SYNC_COMMITTEE:
"0x" & ncrutils.toHex(
uint32(DOMAIN_SYNC_COMMITTEE).toBytesLE()),
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF:
"0x" & ncrutils.toHex(
uint32(DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF).toBytesLE())
uint32(DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF).toBytesLE()),
DOMAIN_CONTRIBUTION_AND_PROOF:
"0x" & ncrutils.toHex(
uint32(DOMAIN_CONTRIBUTION_AND_PROOF).toBytesLE()),
# PARTICIPATION_FLAG_WEIGHTS
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/validator.md#constants
TARGET_AGGREGATORS_PER_COMMITTEE:
Base10.toString(TARGET_AGGREGATORS_PER_COMMITTEE),
RANDOM_SUBNETS_PER_VALIDATOR:
Base10.toString(RANDOM_SUBNETS_PER_VALIDATOR),
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION:
Base10.toString(EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION),
ATTESTATION_SUBNET_COUNT:
Base10.toString(uint64(ATTESTATION_SUBNET_COUNT)),
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/validator.md#constants
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE:
Base10.toString(uint64(TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE)),
SYNC_COMMITTEE_SUBNET_COUNT:
Base10.toString(uint64(SYNC_COMMITTEE_SUBNET_COUNT)),
)
)
cachedDepositContract =

View File

@ -31,6 +31,9 @@ proc installConfigApiHandlers*(rpcServer: RpcServer, node: BeaconNode) {.
rpcServer.rpc("get_v1_config_spec") do () -> JsonNode:
return %*{
# Note: This is intentionally only returning v1.0 config values.
# Please use the REST API /eth/v1/config/spec to retrieve the full config.
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/configs/mainnet/phase0.yaml
"MAX_COMMITTEES_PER_SLOT": $MAX_COMMITTEES_PER_SLOT,
"TARGET_COMMITTEE_SIZE": $TARGET_COMMITTEE_SIZE,
"MAX_VALIDATORS_PER_COMMITTEE": $MAX_VALIDATORS_PER_COMMITTEE,

View File

@ -17,6 +17,9 @@ export
results, peerid, common, serialization, json_serialization, options, net, sets,
eth2_ssz_serialization, rest_types
from web3/ethtypes import BlockHash
export ethtypes.BlockHash
Json.createFlavor RestJson
const
@ -330,6 +333,20 @@ proc readValue*(reader: var JsonReader[RestJson], value: var uint64) {.
else:
reader.raiseUnexpectedValue($res.error())
## UInt256
proc writeValue*(w: var JsonWriter[RestJson], value: UInt256) {.
raises: [IOError, Defect].} =
writeValue(w, toString(value))
proc readValue*(reader: var JsonReader[RestJson], value: var UInt256) {.
raises: [IOError, SerializationError, Defect].} =
let svalue = reader.readValue(string)
try:
value = parse(svalue, UInt256, 10)
except ValueError:
raiseUnexpectedValue(reader,
"UInt256 value should be a valid decimal string")
## byte
proc writeValue*(w: var JsonWriter[RestJson], value: byte) {.
raises: [IOError, Defect].} =
@ -521,6 +538,19 @@ proc writeValue*(writer: var JsonWriter[RestJson], value: BitArray) {.
raises: [IOError, Defect].} =
writeValue(writer, hexOriginal(value.bytes))
## BlockHash
proc readValue*(reader: var JsonReader[RestJson], value: var BlockHash) {.
raises: [IOError, SerializationError, Defect].} =
try:
hexToByteArray(reader.readValue(string), distinctBase(value))
except ValueError:
raiseUnexpectedValue(reader,
"BlockHash value should be a valid hex string")
proc writeValue*(writer: var JsonWriter[RestJson], value: BlockHash) {.
raises: [IOError, Defect].} =
writeValue(writer, hexOriginal(distinctBase(value)))
## Eth2Digest
proc readValue*(reader: var JsonReader[RestJson], value: var Eth2Digest) {.
raises: [IOError, SerializationError, Defect].} =

View File

@ -15,7 +15,7 @@
import
std/[json, typetraits],
stew/base10,
stew/base10, web3/ethtypes,
".."/forks,
".."/datatypes/[phase0, altair]
@ -229,72 +229,90 @@ type
metadata*: RestMetadata
RestSpec* = object
# https://github.com/ethereum/consensus-specs/blob/v1.0.1/configs/mainnet/phase0.yaml
CONFIG_NAME*: string
PRESET_BASE*: string
ALTAIR_FORK_EPOCH*: Epoch
ALTAIR_FORK_VERSION*: Version
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/presets/mainnet/phase0.yaml
MAX_COMMITTEES_PER_SLOT*: uint64
TARGET_COMMITTEE_SIZE*: uint64
MAX_VALIDATORS_PER_COMMITTEE*: uint64
MIN_PER_EPOCH_CHURN_LIMIT*: uint64
CHURN_LIMIT_QUOTIENT*: uint64
SHUFFLE_ROUND_COUNT*: uint64
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT*: uint64
MIN_GENESIS_TIME*: uint64
HYSTERESIS_QUOTIENT*: uint64
HYSTERESIS_DOWNWARD_MULTIPLIER*: uint64
HYSTERESIS_UPWARD_MULTIPLIER*: uint64
SAFE_SLOTS_TO_UPDATE_JUSTIFIED*: uint64
ETH1_FOLLOW_DISTANCE*: uint64
TARGET_AGGREGATORS_PER_COMMITTEE*: uint64
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE*: uint64
RANDOM_SUBNETS_PER_VALIDATOR*: uint64
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION*: uint64
SECONDS_PER_ETH1_BLOCK*: uint64
DEPOSIT_CHAIN_ID*: uint64
DEPOSIT_NETWORK_ID*: uint64
DEPOSIT_CONTRACT_ADDRESS*: Eth1Address
MIN_DEPOSIT_AMOUNT*: uint64
MAX_EFFECTIVE_BALANCE*: uint64
EJECTION_BALANCE*: uint64
EFFECTIVE_BALANCE_INCREMENT*: uint64
GENESIS_FORK_VERSION*: Version
BLS_WITHDRAWAL_PREFIX*: byte
GENESIS_DELAY*: uint64
SECONDS_PER_SLOT*: uint64
MIN_ATTESTATION_INCLUSION_DELAY*: uint64
SLOTS_PER_EPOCH*: uint64
MIN_SEED_LOOKAHEAD*: uint64
MAX_SEED_LOOKAHEAD*: uint64
EPOCHS_PER_ETH1_VOTING_PERIOD*: uint64
SLOTS_PER_HISTORICAL_ROOT*: uint64
SYNC_COMMITTEE_SIZE*: uint64
SYNC_COMMITTEE_SUBNET_COUNT*: uint64
MIN_VALIDATOR_WITHDRAWABILITY_DELAY*: uint64
SHARD_COMMITTEE_PERIOD*: uint64
MIN_EPOCHS_TO_INACTIVITY_PENALTY*: uint64
EPOCHS_PER_HISTORICAL_VECTOR*: uint64
EPOCHS_PER_SLASHINGS_VECTOR*: uint64
EPOCHS_PER_SYNC_COMMITTEE_PERIOD*: uint64
HISTORICAL_ROOTS_LIMIT*: uint64
VALIDATOR_REGISTRY_LIMIT*: uint64
BASE_REWARD_FACTOR*: uint64
WHISTLEBLOWER_REWARD_QUOTIENT*: uint64
PROPOSER_REWARD_QUOTIENT*: uint64
INACTIVITY_PENALTY_QUOTIENT*: uint64
INACTIVITY_PENALTY_QUOTIENT_ALTAIR*: uint64
INACTIVITY_SCORE_BIAS*: uint64
INACTIVITY_SCORE_RECOVERY_RATE*: uint64
MIN_SLASHING_PENALTY_QUOTIENT*: uint64
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR*: uint64
MIN_SYNC_COMMITTEE_PARTICIPANTS*: uint64
PROPORTIONAL_SLASHING_MULTIPLIER*: uint64
PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR*: uint64
MAX_PROPOSER_SLASHINGS*: uint64
MAX_ATTESTER_SLASHINGS*: uint64
MAX_ATTESTATIONS*: uint64
MAX_DEPOSITS*: uint64
MAX_VOLUNTARY_EXITS*: uint64
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/presets/mainnet/altair.yaml
INACTIVITY_PENALTY_QUOTIENT_ALTAIR*: uint64
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR*: uint64
PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR*: uint64
SYNC_COMMITTEE_SIZE*: uint64
EPOCHS_PER_SYNC_COMMITTEE_PERIOD*: uint64
MIN_SYNC_COMMITTEE_PARTICIPANTS*: uint64
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/configs/mainnet.yaml
PRESET_BASE*: string
TERMINAL_TOTAL_DIFFICULTY*: UInt256
TERMINAL_BLOCK_HASH*: BlockHash
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT*: uint64
MIN_GENESIS_TIME*: uint64
GENESIS_FORK_VERSION*: Version
GENESIS_DELAY*: uint64
ALTAIR_FORK_VERSION*: Version
ALTAIR_FORK_EPOCH*: uint64
MERGE_FORK_VERSION*: Version
MERGE_FORK_EPOCH*: uint64
SHARDING_FORK_VERSION*: Version
SHARDING_FORK_EPOCH*: uint64
SECONDS_PER_SLOT*: uint64
SECONDS_PER_ETH1_BLOCK*: uint64
MIN_VALIDATOR_WITHDRAWABILITY_DELAY*: uint64
SHARD_COMMITTEE_PERIOD*: uint64
ETH1_FOLLOW_DISTANCE*: uint64
INACTIVITY_SCORE_BIAS*: uint64
INACTIVITY_SCORE_RECOVERY_RATE*: uint64
EJECTION_BALANCE*: uint64
MIN_PER_EPOCH_CHURN_LIMIT*: uint64
CHURN_LIMIT_QUOTIENT*: uint64
DEPOSIT_CHAIN_ID*: uint64
DEPOSIT_NETWORK_ID*: uint64
DEPOSIT_CONTRACT_ADDRESS*: Eth1Address
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#constants
# GENESIS_SLOT
# GENESIS_EPOCH
# FAR_FUTURE_EPOCH
# BASE_REWARDS_PER_EPOCH
# DEPOSIT_CONTRACT_TREE_DEPTH
# JUSTIFICATION_BITS_LENGTH
# ENDIANNESS
BLS_WITHDRAWAL_PREFIX*: byte
ETH1_ADDRESS_WITHDRAWAL_PREFIX*: byte
DOMAIN_BEACON_PROPOSER*: DomainType
DOMAIN_BEACON_ATTESTER*: DomainType
DOMAIN_RANDAO*: DomainType
@ -302,9 +320,31 @@ type
DOMAIN_VOLUNTARY_EXIT*: DomainType
DOMAIN_SELECTION_PROOF*: DomainType
DOMAIN_AGGREGATE_AND_PROOF*: DomainType
DOMAIN_CONTRIBUTION_AND_PROOF*: DomainType
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/beacon-chain.md#constants
TIMELY_SOURCE_FLAG_INDEX*: byte
TIMELY_TARGET_FLAG_INDEX*: byte
TIMELY_HEAD_FLAG_INDEX*: byte
TIMELY_SOURCE_WEIGHT*: uint64
TIMELY_TARGET_WEIGHT*: uint64
TIMELY_HEAD_WEIGHT*: uint64
SYNC_REWARD_WEIGHT*: uint64
PROPOSER_WEIGHT*: uint64
WEIGHT_DENOMINATOR*: uint64
DOMAIN_SYNC_COMMITTEE*: DomainType
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF*: DomainType
DOMAIN_CONTRIBUTION_AND_PROOF*: DomainType
# PARTICIPATION_FLAG_WEIGHTS
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/validator.md#constants
TARGET_AGGREGATORS_PER_COMMITTEE*: uint64
RANDOM_SUBNETS_PER_VALIDATOR*: uint64
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION*: uint64
ATTESTATION_SUBNET_COUNT*: uint64
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/validator.md#constants
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE*: uint64
SYNC_COMMITTEE_SUBNET_COUNT*: uint64
# The `RestSpec` is a dynamic dictionary that includes version-specific spec
# constants. New versions may introduce new constants, and remove old ones.

View File

@ -15,7 +15,9 @@ export
toBytesBE
const
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#withdrawal-prefixes
BLS_WITHDRAWAL_PREFIX*: byte = 0
ETH1_ADDRESS_WITHDRAWAL_PREFIX*: byte = 1
# Constants from `validator.md` not covered by config/presets in the spec
TARGET_AGGREGATORS_PER_COMMITTEE*: uint64 = 16
@ -29,7 +31,7 @@ type
Eth1Address* = ethtypes.Address
RuntimeConfig* = object
## https://github.com/ethereum/consensus-specs/tree/v1.1.1/configs
## https://github.com/ethereum/consensus-specs/tree/v1.1.3/configs
PRESET_BASE*: string

View File

@ -2670,7 +2670,7 @@
"response": {
"status": {"operator": "equals", "value": "200"},
"headers": [{"key": "Content-Type", "value": "application/json", "operator": "equals"}],
"body": [{"operator": "jstructcmps", "start": ["data"], "value": {"CONFIG_NAME":"","PRESET_BASE":"","ALTAIR_FORK_EPOCH":"","ALTAIR_FORK_VERSION":"","MAX_COMMITTEES_PER_SLOT":"","TARGET_COMMITTEE_SIZE":"","MAX_VALIDATORS_PER_COMMITTEE":"","MIN_PER_EPOCH_CHURN_LIMIT":"","CHURN_LIMIT_QUOTIENT":"","SHUFFLE_ROUND_COUNT":"","MIN_GENESIS_ACTIVE_VALIDATOR_COUNT":"","MIN_GENESIS_TIME":"","HYSTERESIS_QUOTIENT":"","HYSTERESIS_DOWNWARD_MULTIPLIER":"","HYSTERESIS_UPWARD_MULTIPLIER":"","SAFE_SLOTS_TO_UPDATE_JUSTIFIED":"","ETH1_FOLLOW_DISTANCE":"","TARGET_AGGREGATORS_PER_COMMITTEE":"","TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE":"","RANDOM_SUBNETS_PER_VALIDATOR":"","EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION":"","SECONDS_PER_ETH1_BLOCK":"","DEPOSIT_CHAIN_ID":"","DEPOSIT_NETWORK_ID":"","DEPOSIT_CONTRACT_ADDRESS":"","MIN_DEPOSIT_AMOUNT":"","MAX_EFFECTIVE_BALANCE":"","EJECTION_BALANCE":"","EFFECTIVE_BALANCE_INCREMENT":"","GENESIS_FORK_VERSION":"","BLS_WITHDRAWAL_PREFIX":"","GENESIS_DELAY":"","SECONDS_PER_SLOT":"","MIN_ATTESTATION_INCLUSION_DELAY":"","SLOTS_PER_EPOCH":"","MIN_SEED_LOOKAHEAD":"","MAX_SEED_LOOKAHEAD":"","EPOCHS_PER_ETH1_VOTING_PERIOD":"","SLOTS_PER_HISTORICAL_ROOT":"","SYNC_COMMITTEE_SIZE":"","SYNC_COMMITTEE_SUBNET_COUNT":"","MIN_VALIDATOR_WITHDRAWABILITY_DELAY":"","SHARD_COMMITTEE_PERIOD":"","MIN_EPOCHS_TO_INACTIVITY_PENALTY":"","EPOCHS_PER_HISTORICAL_VECTOR":"","EPOCHS_PER_SLASHINGS_VECTOR":"","EPOCHS_PER_SYNC_COMMITTEE_PERIOD":"","HISTORICAL_ROOTS_LIMIT":"","VALIDATOR_REGISTRY_LIMIT":"","BASE_REWARD_FACTOR":"","WHISTLEBLOWER_REWARD_QUOTIENT":"","PROPOSER_REWARD_QUOTIENT":"","INACTIVITY_PENALTY_QUOTIENT":"","INACTIVITY_PENALTY_QUOTIENT_ALTAIR":"","INACTIVITY_SCORE_BIAS":"","INACTIVITY_SCORE_RECOVERY_RATE":"","MIN_SLASHING_PENALTY_QUOTIENT":"","MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR":"","MIN_SYNC_COMMITTEE_PARTICIPANTS":"","PROPORTIONAL_SLASHING_MULTIPLIER":"","PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR":"","MAX_PROPOSER_SLASHINGS":"","MAX_ATTESTER_SLASHINGS":"","MAX_ATTESTATIONS":"","MAX_DEPOSITS":"","MAX_VOLUNTARY_EXITS":"","DOMAIN_BEACON_PROPOSER":"","DOMAIN_BEACON_ATTESTER":"","DOMAIN_RANDAO":"","DOMAIN_DEPOSIT":"","DOMAIN_VOLUNTARY_EXIT":"","DOMAIN_SELECTION_PROOF":"","DOMAIN_AGGREGATE_AND_PROOF":"","DOMAIN_CONTRIBUTION_AND_PROOF":"","DOMAIN_SYNC_COMMITTEE":"","DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF":""}}]
"body": [{"operator": "jstructcmps", "start": ["data"], "value": {"CONFIG_NAME":"","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":"","PRESET_BASE":"","TERMINAL_TOTAL_DIFFICULTY":"","TERMINAL_BLOCK_HASH":"","MIN_GENESIS_ACTIVE_VALIDATOR_COUNT":"","MIN_GENESIS_TIME":"","GENESIS_FORK_VERSION":"","GENESIS_DELAY":"","ALTAIR_FORK_VERSION":"","ALTAIR_FORK_EPOCH":"","MERGE_FORK_VERSION":"","MERGE_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":"","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":""}}]
}
},
{