automated consensus spec URL updating to v1.5.0-alpha.3 (#6364)
This commit is contained in:
parent
0fab9682a6
commit
88fa8b17ea
|
@ -130,7 +130,7 @@ type
|
||||||
current_sync_committee*: SyncCommittee # [New in Altair]
|
current_sync_committee*: SyncCommittee # [New in Altair]
|
||||||
next_sync_committee*: SyncCommittee # [New in Altair]
|
next_sync_committee*: SyncCommittee # [New in Altair]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#beaconstate
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
# Memory-representation-equivalent to a Bellatrix BeaconState for in-place SSZ
|
# Memory-representation-equivalent to a Bellatrix BeaconState for in-place SSZ
|
||||||
# reading and writing
|
# reading and writing
|
||||||
BellatrixBeaconStateNoImmutableValidators* = object
|
BellatrixBeaconStateNoImmutableValidators* = object
|
||||||
|
|
|
@ -27,7 +27,7 @@ type
|
||||||
## which blocks are valid - in particular, blocks are not valid if they
|
## which blocks are valid - in particular, blocks are not valid if they
|
||||||
## come from the future as seen from the local clock.
|
## come from the future as seen from the local clock.
|
||||||
##
|
##
|
||||||
## https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/fork-choice.md#fork-choice
|
## https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/fork-choice.md#fork-choice
|
||||||
##
|
##
|
||||||
# TODO consider NTP and network-adjusted timestamps as outlined here:
|
# TODO consider NTP and network-adjusted timestamps as outlined here:
|
||||||
# https://ethresear.ch/t/network-adjusted-timestamps/4187
|
# https://ethresear.ch/t/network-adjusted-timestamps/4187
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ proc getBeaconHead*(
|
||||||
pool.dag.loadExecutionBlockHash(pool.dag.finalizedHead.blck)
|
pool.dag.loadExecutionBlockHash(pool.dag.finalizedHead.blck)
|
||||||
.get(ZERO_HASH)
|
.get(ZERO_HASH)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/fork_choice/safe-block.md#get_safe_execution_payload_hash
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/fork_choice/safe-block.md#get_safe_execution_payload_hash
|
||||||
safeBlockRoot = pool.forkChoice.get_safe_beacon_block_root()
|
safeBlockRoot = pool.forkChoice.get_safe_beacon_block_root()
|
||||||
safeBlock = pool.dag.getBlockRef(safeBlockRoot)
|
safeBlock = pool.dag.getBlockRef(safeBlockRoot)
|
||||||
safeExecutionBlockHash =
|
safeExecutionBlockHash =
|
||||||
|
|
|
@ -1178,7 +1178,7 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
|
||||||
# should have `previous_version` set to `current_version` while
|
# should have `previous_version` set to `current_version` while
|
||||||
# this doesn't happen to be the case in network that go through
|
# this doesn't happen to be the case in network that go through
|
||||||
# regular hard-fork upgrades. See for example:
|
# regular hard-fork upgrades. See for example:
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#testing
|
||||||
if stateFork.current_version != configFork.current_version:
|
if stateFork.current_version != configFork.current_version:
|
||||||
error "State from database does not match network, check --network parameter",
|
error "State from database does not match network, check --network parameter",
|
||||||
tail = dag.tail, headRef, stateFork, configFork
|
tail = dag.tail, headRef, stateFork, configFork
|
||||||
|
@ -1972,7 +1972,7 @@ proc pruneBlocksDAG(dag: ChainDAGRef) =
|
||||||
prunedHeads = hlen - dag.heads.len,
|
prunedHeads = hlen - dag.heads.len,
|
||||||
dagPruneDur = Moment.now() - startTick
|
dagPruneDur = Moment.now() - startTick
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/sync/optimistic.md#helpers
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/sync/optimistic.md#helpers
|
||||||
func is_optimistic*(dag: ChainDAGRef, bid: BlockId): bool =
|
func is_optimistic*(dag: ChainDAGRef, bid: BlockId): bool =
|
||||||
let blck =
|
let blck =
|
||||||
if bid.slot <= dag.finalizedHead.slot:
|
if bid.slot <= dag.finalizedHead.slot:
|
||||||
|
|
|
@ -349,7 +349,7 @@ proc produceSyncAggregate*(
|
||||||
|
|
||||||
proc isEpochLeadTime*(
|
proc isEpochLeadTime*(
|
||||||
pool: SyncCommitteeMsgPool, epochsToSyncPeriod: uint64): bool =
|
pool: SyncCommitteeMsgPool, epochsToSyncPeriod: uint64): bool =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#sync-committee-subnet-stability
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#sync-committee-subnet-stability
|
||||||
# This ensures a uniform distribution without requiring additional state:
|
# This ensures a uniform distribution without requiring additional state:
|
||||||
# (1/4) = 1/4, 4 slots out
|
# (1/4) = 1/4, 4 slots out
|
||||||
# (3/4) * (1/3) = 1/4, 3 slots out
|
# (3/4) * (1/3) = 1/4, 3 slots out
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
|
||||||
|
|
||||||
# Merkle tree helpers
|
# Merkle tree helpers
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -113,7 +113,7 @@ proc update_justified(
|
||||||
self.update_justified(dag, blck, justified.epoch)
|
self.update_justified(dag, blck, justified.epoch)
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/fork-choice.md#update_checkpoints
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/fork-choice.md#update_checkpoints
|
||||||
proc update_checkpoints(
|
proc update_checkpoints(
|
||||||
self: var Checkpoints, dag: ChainDAGRef,
|
self: var Checkpoints, dag: ChainDAGRef,
|
||||||
checkpoints: FinalityCheckpoints): FcResult[void] =
|
checkpoints: FinalityCheckpoints): FcResult[void] =
|
||||||
|
@ -377,7 +377,7 @@ proc get_head*(self: var ForkChoice,
|
||||||
self.checkpoints.justified.balances,
|
self.checkpoints.justified.balances,
|
||||||
self.checkpoints.proposer_boost_root)
|
self.checkpoints.proposer_boost_root)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/fork_choice/safe-block.md#get_safe_beacon_block_root
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/fork_choice/safe-block.md#get_safe_beacon_block_root
|
||||||
func get_safe_beacon_block_root*(self: ForkChoice): Eth2Digest =
|
func get_safe_beacon_block_root*(self: ForkChoice): Eth2Digest =
|
||||||
# Use most recent justified block as a stopgap
|
# Use most recent justified block as a stopgap
|
||||||
self.checkpoints.justified.checkpoint.root
|
self.checkpoints.justified.checkpoint.root
|
||||||
|
|
|
@ -838,7 +838,7 @@ proc processBlock(
|
||||||
# - MUST NOT optimistically import the block.
|
# - MUST NOT optimistically import the block.
|
||||||
# - MUST NOT apply the block to the fork choice store.
|
# - MUST NOT apply the block to the fork choice store.
|
||||||
# - MAY queue the block for later processing.
|
# - MAY queue the block for later processing.
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/sync/optimistic.md#execution-engine-errors
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/sync/optimistic.md#execution-engine-errors
|
||||||
await sleepAsync(chronos.seconds(1))
|
await sleepAsync(chronos.seconds(1))
|
||||||
self[].enqueueBlock(
|
self[].enqueueBlock(
|
||||||
entry.src, entry.blck, entry.blobs, entry.resfut, entry.maybeFinalized,
|
entry.src, entry.blck, entry.blobs, entry.resfut, entry.maybeFinalized,
|
||||||
|
|
|
@ -302,7 +302,7 @@ template validateBeaconBlockBellatrix(
|
||||||
#
|
#
|
||||||
# `is_merge_transition_complete(state)` tests for
|
# `is_merge_transition_complete(state)` tests for
|
||||||
# `state.latest_execution_payload_header != ExecutionPayloadHeader()`, while
|
# `state.latest_execution_payload_header != ExecutionPayloadHeader()`, while
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#block-processing
|
||||||
# shows that `state.latest_execution_payload_header` being default or not is
|
# shows that `state.latest_execution_payload_header` being default or not is
|
||||||
# exactly equivalent to whether that block's execution payload is default or
|
# exactly equivalent to whether that block's execution payload is default or
|
||||||
# not, so test cached block information rather than reconstructing a state.
|
# not, so test cached block information rather than reconstructing a state.
|
||||||
|
@ -1181,7 +1181,7 @@ proc validateAggregate*(
|
||||||
|
|
||||||
ok((attesting_indices, sig))
|
ok((attesting_indices, sig))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/p2p-interface.md#bls_to_execution_change
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/p2p-interface.md#bls_to_execution_change
|
||||||
proc validateBlsToExecutionChange*(
|
proc validateBlsToExecutionChange*(
|
||||||
pool: ValidatorChangePool, batchCrypto: ref BatchCrypto,
|
pool: ValidatorChangePool, batchCrypto: ref BatchCrypto,
|
||||||
signed_address_change: SignedBLSToExecutionChange,
|
signed_address_change: SignedBLSToExecutionChange,
|
||||||
|
|
|
@ -94,7 +94,7 @@ typedef struct ETHConsensusConfig ETHConsensusConfig;
|
||||||
* based on the given `config.yaml` file content - If successful.
|
* based on the given `config.yaml` file content - If successful.
|
||||||
* @return `NULL` - If the given `config.yaml` is malformed or incompatible.
|
* @return `NULL` - If the given `config.yaml` is malformed or incompatible.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/configs/README.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/configs/README.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
ETHConsensusConfig *ETHConsensusConfigCreateFromYaml(const char *configFileContent);
|
ETHConsensusConfig *ETHConsensusConfigCreateFromYaml(const char *configFileContent);
|
||||||
|
@ -151,9 +151,9 @@ typedef struct ETHBeaconState ETHBeaconState;
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/configs/README.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/configs/README.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
ETHBeaconState *ETHBeaconStateCreateFromSsz(
|
ETHBeaconState *ETHBeaconStateCreateFromSsz(
|
||||||
|
@ -325,8 +325,8 @@ typedef struct ETHLightClientStore ETHLightClientStore;
|
||||||
*
|
*
|
||||||
* @see https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Beacon/getLightClientBootstrap
|
* @see https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Beacon/getLightClientBootstrap
|
||||||
* @see https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Events/eventstream
|
* @see https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Events/eventstream
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/light-client.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/light-client.md
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/weak-subjectivity.md#weak-subjectivity-period
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/weak-subjectivity.md#weak-subjectivity-period
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
ETHLightClientStore *ETHLightClientStoreCreateFromBootstrap(
|
ETHLightClientStore *ETHLightClientStoreCreateFromBootstrap(
|
||||||
|
@ -597,8 +597,8 @@ const ETHLightClientHeader *ETHLightClientStoreGetFinalizedHeader(
|
||||||
*
|
*
|
||||||
* @return Whether or not the next sync committee is currently known.
|
* @return Whether or not the next sync committee is currently known.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/light-client.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/light-client.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
bool ETHLightClientStoreIsNextSyncCommitteeKnown(const ETHLightClientStore *store);
|
bool ETHLightClientStoreIsNextSyncCommitteeKnown(const ETHLightClientStore *store);
|
||||||
|
|
|
@ -78,7 +78,7 @@ proc ETHConsensusConfigCreateFromYaml(
|
||||||
## * `NULL` - If the given `config.yaml` is malformed or incompatible.
|
## * `NULL` - If the given `config.yaml` is malformed or incompatible.
|
||||||
##
|
##
|
||||||
## See:
|
## See:
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/configs/README.md
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/configs/README.md
|
||||||
let cfg = RuntimeConfig.new()
|
let cfg = RuntimeConfig.new()
|
||||||
try:
|
try:
|
||||||
cfg[] = readRuntimeConfig($configFileContent, "config.yaml")[0]
|
cfg[] = readRuntimeConfig($configFileContent, "config.yaml")[0]
|
||||||
|
@ -144,9 +144,9 @@ proc ETHBeaconStateCreateFromSsz(
|
||||||
## See:
|
## See:
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#beaconstate
|
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#beaconstate
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#beaconstate
|
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#beaconstate
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#beaconstate
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#beaconstate
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#beaconstate
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/configs/README.md
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/configs/README.md
|
||||||
let
|
let
|
||||||
consensusFork = ConsensusFork.decodeString($consensusVersion).valueOr:
|
consensusFork = ConsensusFork.decodeString($consensusVersion).valueOr:
|
||||||
return nil
|
return nil
|
||||||
|
@ -329,8 +329,8 @@ proc ETHLightClientStoreCreateFromBootstrap(
|
||||||
## See:
|
## See:
|
||||||
## * https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Beacon/getLightClientBootstrap
|
## * https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Beacon/getLightClientBootstrap
|
||||||
## * https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Events/eventstream
|
## * https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.4.1#/Events/eventstream
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/light-client.md
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/light-client.md
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/weak-subjectivity.md#weak-subjectivity-period
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/weak-subjectivity.md#weak-subjectivity-period
|
||||||
let
|
let
|
||||||
mediaType = MediaType.init($mediaType)
|
mediaType = MediaType.init($mediaType)
|
||||||
consensusFork = ConsensusFork.decodeString($consensusVersion).valueOr:
|
consensusFork = ConsensusFork.decodeString($consensusVersion).valueOr:
|
||||||
|
@ -755,8 +755,8 @@ func ETHLightClientStoreIsNextSyncCommitteeKnown(
|
||||||
## * Whether or not the next sync committee is currently known.
|
## * Whether or not the next sync committee is currently known.
|
||||||
##
|
##
|
||||||
## See:
|
## See:
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/light-client.md
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/light-client.md
|
||||||
store[].is_next_sync_committee_known
|
store[].is_next_sync_committee_known
|
||||||
|
|
||||||
func ETHLightClientStoreGetOptimisticHeader(
|
func ETHLightClientStoreGetOptimisticHeader(
|
||||||
|
@ -796,7 +796,7 @@ func ETHLightClientStoreGetSafetyThreshold(
|
||||||
## * Light client store safety threshold.
|
## * Light client store safety threshold.
|
||||||
##
|
##
|
||||||
## See:
|
## See:
|
||||||
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/sync-protocol.md#get_safety_threshold
|
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/sync-protocol.md#get_safety_threshold
|
||||||
store[].get_safety_threshold.cint
|
store[].get_safety_threshold.cint
|
||||||
|
|
||||||
proc ETHLightClientHeaderCreateCopy(
|
proc ETHLightClientHeaderCreateCopy(
|
||||||
|
|
|
@ -2533,7 +2533,7 @@ proc updateStabilitySubnetMetadata*(node: Eth2Node, attnets: AttnetBits) =
|
||||||
debug "Stability subnets changed; updated ENR attnets", attnets
|
debug "Stability subnets changed; updated ENR attnets", attnets
|
||||||
|
|
||||||
proc updateSyncnetsMetadata*(node: Eth2Node, syncnets: SyncnetBits) =
|
proc updateSyncnetsMetadata*(node: Eth2Node, syncnets: SyncnetBits) =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#sync-committee-subnet-stability
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#sync-committee-subnet-stability
|
||||||
if node.metadata.syncnets == syncnets:
|
if node.metadata.syncnets == syncnets:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -1862,7 +1862,7 @@ proc installMessageValidators(node: BeaconNode) =
|
||||||
MsgSource.gossip, msg)))
|
MsgSource.gossip, msg)))
|
||||||
|
|
||||||
when consensusFork >= ConsensusFork.Capella:
|
when consensusFork >= ConsensusFork.Capella:
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/p2p-interface.md#bls_to_execution_change
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/p2p-interface.md#bls_to_execution_change
|
||||||
node.network.addAsyncValidator(
|
node.network.addAsyncValidator(
|
||||||
getBlsToExecutionChangeTopic(digest), proc (
|
getBlsToExecutionChangeTopic(digest), proc (
|
||||||
msg: SignedBLSToExecutionChange
|
msg: SignedBLSToExecutionChange
|
||||||
|
|
|
@ -90,7 +90,7 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
MAX_VOLUNTARY_EXITS:
|
MAX_VOLUNTARY_EXITS:
|
||||||
Base10.toString(MAX_VOLUNTARY_EXITS),
|
Base10.toString(MAX_VOLUNTARY_EXITS),
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/mainnet/altair.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/mainnet/altair.yaml
|
||||||
INACTIVITY_PENALTY_QUOTIENT_ALTAIR:
|
INACTIVITY_PENALTY_QUOTIENT_ALTAIR:
|
||||||
Base10.toString(INACTIVITY_PENALTY_QUOTIENT_ALTAIR),
|
Base10.toString(INACTIVITY_PENALTY_QUOTIENT_ALTAIR),
|
||||||
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR:
|
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR:
|
||||||
|
@ -106,7 +106,7 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
UPDATE_TIMEOUT:
|
UPDATE_TIMEOUT:
|
||||||
Base10.toString(UPDATE_TIMEOUT),
|
Base10.toString(UPDATE_TIMEOUT),
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/mainnet/bellatrix.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/mainnet/bellatrix.yaml
|
||||||
INACTIVITY_PENALTY_QUOTIENT_BELLATRIX:
|
INACTIVITY_PENALTY_QUOTIENT_BELLATRIX:
|
||||||
Base10.toString(INACTIVITY_PENALTY_QUOTIENT_BELLATRIX),
|
Base10.toString(INACTIVITY_PENALTY_QUOTIENT_BELLATRIX),
|
||||||
MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX:
|
MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX:
|
||||||
|
@ -122,7 +122,7 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
MAX_EXTRA_DATA_BYTES:
|
MAX_EXTRA_DATA_BYTES:
|
||||||
Base10.toString(uint64(MAX_EXTRA_DATA_BYTES)),
|
Base10.toString(uint64(MAX_EXTRA_DATA_BYTES)),
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/mainnet/capella.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/mainnet/capella.yaml
|
||||||
MAX_BLS_TO_EXECUTION_CHANGES:
|
MAX_BLS_TO_EXECUTION_CHANGES:
|
||||||
Base10.toString(uint64(MAX_BLS_TO_EXECUTION_CHANGES)),
|
Base10.toString(uint64(MAX_BLS_TO_EXECUTION_CHANGES)),
|
||||||
MAX_WITHDRAWALS_PER_PAYLOAD:
|
MAX_WITHDRAWALS_PER_PAYLOAD:
|
||||||
|
@ -130,7 +130,7 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP:
|
MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP:
|
||||||
Base10.toString(uint64(MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP)),
|
Base10.toString(uint64(MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP)),
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/mainnet/deneb.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/mainnet/deneb.yaml
|
||||||
FIELD_ELEMENTS_PER_BLOB:
|
FIELD_ELEMENTS_PER_BLOB:
|
||||||
Base10.toString(deneb_preset.FIELD_ELEMENTS_PER_BLOB),
|
Base10.toString(deneb_preset.FIELD_ELEMENTS_PER_BLOB),
|
||||||
MAX_BLOB_COMMITMENTS_PER_BLOCK:
|
MAX_BLOB_COMMITMENTS_PER_BLOCK:
|
||||||
|
|
|
@ -43,7 +43,7 @@ const
|
||||||
GENESIS_SLOT* = Slot(0)
|
GENESIS_SLOT* = Slot(0)
|
||||||
GENESIS_EPOCH* = Epoch(0) # compute_epoch_at_slot(GENESIS_SLOT)
|
GENESIS_EPOCH* = Epoch(0) # compute_epoch_at_slot(GENESIS_SLOT)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/fork-choice.md#constant
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/fork-choice.md#constant
|
||||||
INTERVALS_PER_SLOT* = 3
|
INTERVALS_PER_SLOT* = 3
|
||||||
|
|
||||||
FAR_FUTURE_BEACON_TIME* = BeaconTime(ns_since_genesis: int64.high())
|
FAR_FUTURE_BEACON_TIME* = BeaconTime(ns_since_genesis: int64.high())
|
||||||
|
@ -139,16 +139,16 @@ const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/validator.md#broadcast-aggregate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/validator.md#broadcast-aggregate
|
||||||
aggregateSlotOffset* = TimeDiff(nanoseconds:
|
aggregateSlotOffset* = TimeDiff(nanoseconds:
|
||||||
NANOSECONDS_PER_SLOT.int64 * 2 div INTERVALS_PER_SLOT)
|
NANOSECONDS_PER_SLOT.int64 * 2 div INTERVALS_PER_SLOT)
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#prepare-sync-committee-message
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#prepare-sync-committee-message
|
||||||
syncCommitteeMessageSlotOffset* = TimeDiff(nanoseconds:
|
syncCommitteeMessageSlotOffset* = TimeDiff(nanoseconds:
|
||||||
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#broadcast-sync-committee-contribution
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#broadcast-sync-committee-contribution
|
||||||
syncContributionSlotOffset* = TimeDiff(nanoseconds:
|
syncContributionSlotOffset* = TimeDiff(nanoseconds:
|
||||||
NANOSECONDS_PER_SLOT.int64 * 2 div INTERVALS_PER_SLOT)
|
NANOSECONDS_PER_SLOT.int64 * 2 div INTERVALS_PER_SLOT)
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/p2p-interface.md#sync-committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/p2p-interface.md#sync-committee
|
||||||
lightClientFinalityUpdateSlotOffset* = TimeDiff(nanoseconds:
|
lightClientFinalityUpdateSlotOffset* = TimeDiff(nanoseconds:
|
||||||
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/p2p-interface.md#sync-committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/p2p-interface.md#sync-committee
|
||||||
lightClientOptimisticUpdateSlotOffset* = TimeDiff(nanoseconds:
|
lightClientOptimisticUpdateSlotOffset* = TimeDiff(nanoseconds:
|
||||||
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ func epoch*(slot: Slot): Epoch = # aka compute_epoch_at_slot
|
||||||
if slot == FAR_FUTURE_SLOT: FAR_FUTURE_EPOCH
|
if slot == FAR_FUTURE_SLOT: FAR_FUTURE_EPOCH
|
||||||
else: Epoch(slot div SLOTS_PER_EPOCH)
|
else: Epoch(slot div SLOTS_PER_EPOCH)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/fork-choice.md#compute_slots_since_epoch_start
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/fork-choice.md#compute_slots_since_epoch_start
|
||||||
func since_epoch_start*(slot: Slot): uint64 = # aka compute_slots_since_epoch_start
|
func since_epoch_start*(slot: Slot): uint64 = # aka compute_slots_since_epoch_start
|
||||||
## How many slots since the beginning of the epoch (`[0..SLOTS_PER_EPOCH-1]`)
|
## How many slots since the beginning of the epoch (`[0..SLOTS_PER_EPOCH-1]`)
|
||||||
(slot mod SLOTS_PER_EPOCH)
|
(slot mod SLOTS_PER_EPOCH)
|
||||||
|
@ -216,7 +216,7 @@ iterator slots*(epoch: Epoch): Slot =
|
||||||
for slot in start_slot ..< start_slot + SLOTS_PER_EPOCH:
|
for slot in start_slot ..< start_slot + SLOTS_PER_EPOCH:
|
||||||
yield slot
|
yield slot
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#sync-committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#sync-committee
|
||||||
template sync_committee_period*(epoch: Epoch): SyncCommitteePeriod =
|
template sync_committee_period*(epoch: Epoch): SyncCommitteePeriod =
|
||||||
if epoch == FAR_FUTURE_EPOCH: FAR_FUTURE_PERIOD
|
if epoch == FAR_FUTURE_EPOCH: FAR_FUTURE_PERIOD
|
||||||
else: SyncCommitteePeriod(epoch div EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
else: SyncCommitteePeriod(epoch div EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
||||||
|
|
|
@ -301,7 +301,7 @@ from ./datatypes/deneb import BeaconState
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.0/specs/electra/beacon-chain.md#updated-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.0/specs/electra/beacon-chain.md#updated-slash_validator
|
||||||
func get_slashing_penalty*(
|
func get_slashing_penalty*(
|
||||||
state: ForkyBeaconState, validator_effective_balance: Gwei): Gwei =
|
state: ForkyBeaconState, validator_effective_balance: Gwei): Gwei =
|
||||||
|
@ -319,7 +319,7 @@ func get_slashing_penalty*(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
func get_whistleblower_reward*(
|
func get_whistleblower_reward*(
|
||||||
state: phase0.BeaconState | altair.BeaconState | bellatrix.BeaconState |
|
state: phase0.BeaconState | altair.BeaconState | bellatrix.BeaconState |
|
||||||
capella.BeaconState | deneb.BeaconState,
|
capella.BeaconState | deneb.BeaconState,
|
||||||
|
@ -333,7 +333,7 @@ func get_whistleblower_reward*(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
func get_proposer_reward(state: ForkyBeaconState, whistleblower_reward: Gwei): Gwei =
|
func get_proposer_reward(state: ForkyBeaconState, whistleblower_reward: Gwei): Gwei =
|
||||||
when state is phase0.BeaconState:
|
when state is phase0.BeaconState:
|
||||||
whistleblower_reward div PROPOSER_REWARD_QUOTIENT
|
whistleblower_reward div PROPOSER_REWARD_QUOTIENT
|
||||||
|
@ -346,7 +346,7 @@ func get_proposer_reward(state: ForkyBeaconState, whistleblower_reward: Gwei): G
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
proc slash_validator*(
|
proc slash_validator*(
|
||||||
cfg: RuntimeConfig, state: var ForkyBeaconState,
|
cfg: RuntimeConfig, state: var ForkyBeaconState,
|
||||||
slashed_index: ValidatorIndex, pre_exit_queue_info: ExitQueueInfo,
|
slashed_index: ValidatorIndex, pre_exit_queue_info: ExitQueueInfo,
|
||||||
|
@ -419,7 +419,7 @@ func get_initial_beacon_block*(state: altair.HashedBeaconState):
|
||||||
altair.TrustedSignedBeaconBlock(
|
altair.TrustedSignedBeaconBlock(
|
||||||
message: message, root: hash_tree_root(message))
|
message: message, root: hash_tree_root(message))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#testing
|
||||||
func get_initial_beacon_block*(state: bellatrix.HashedBeaconState):
|
func get_initial_beacon_block*(state: bellatrix.HashedBeaconState):
|
||||||
bellatrix.TrustedSignedBeaconBlock =
|
bellatrix.TrustedSignedBeaconBlock =
|
||||||
# The genesis block is implicitly trusted
|
# The genesis block is implicitly trusted
|
||||||
|
@ -431,7 +431,7 @@ func get_initial_beacon_block*(state: bellatrix.HashedBeaconState):
|
||||||
bellatrix.TrustedSignedBeaconBlock(
|
bellatrix.TrustedSignedBeaconBlock(
|
||||||
message: message, root: hash_tree_root(message))
|
message: message, root: hash_tree_root(message))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#testing
|
||||||
func get_initial_beacon_block*(state: capella.HashedBeaconState):
|
func get_initial_beacon_block*(state: capella.HashedBeaconState):
|
||||||
capella.TrustedSignedBeaconBlock =
|
capella.TrustedSignedBeaconBlock =
|
||||||
# The genesis block is implicitly trusted
|
# The genesis block is implicitly trusted
|
||||||
|
@ -1188,7 +1188,7 @@ func has_execution_withdrawal_credential*(validator: Validator): bool =
|
||||||
has_compounding_withdrawal_credential(validator) or
|
has_compounding_withdrawal_credential(validator) or
|
||||||
has_eth1_withdrawal_credential(validator)
|
has_eth1_withdrawal_credential(validator)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#is_fully_withdrawable_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#is_fully_withdrawable_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/electra/beacon-chain.md#updated-is_fully_withdrawable_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/electra/beacon-chain.md#updated-is_fully_withdrawable_validator
|
||||||
func is_fully_withdrawable_validator(
|
func is_fully_withdrawable_validator(
|
||||||
fork: static ConsensusFork, validator: Validator, balance: Gwei,
|
fork: static ConsensusFork, validator: Validator, balance: Gwei,
|
||||||
|
@ -1506,8 +1506,8 @@ proc initialize_hashed_beacon_state_from_eth1*(
|
||||||
cfg, eth1_block_hash, eth1_timestamp, deposits, flags))
|
cfg, eth1_block_hash, eth1_timestamp, deposits, flags))
|
||||||
result.root = hash_tree_root(result.data)
|
result.root = hash_tree_root(result.data)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#testing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#testing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#testing
|
||||||
proc initialize_beacon_state_from_eth1*(
|
proc initialize_beacon_state_from_eth1*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
|
|
|
@ -51,7 +51,7 @@ const
|
||||||
PARTICIPATION_FLAG_WEIGHTS*: array[TimelyFlag, uint64] =
|
PARTICIPATION_FLAG_WEIGHTS*: array[TimelyFlag, uint64] =
|
||||||
[uint64 TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_WEIGHT]
|
[uint64 TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_WEIGHT]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#misc
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#misc
|
||||||
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 16
|
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 16
|
||||||
SYNC_COMMITTEE_SUBNET_COUNT* = 4
|
SYNC_COMMITTEE_SUBNET_COUNT* = 4
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ const
|
||||||
# The first member (`genesis_time`) is 32, subsequent members +1 each.
|
# The first member (`genesis_time`) is 32, subsequent members +1 each.
|
||||||
# If there are ever more than 32 members in `BeaconState`, indices change!
|
# If there are ever more than 32 members in `BeaconState`, indices change!
|
||||||
# `FINALIZED_ROOT_GINDEX` is one layer deeper, i.e., `52 * 2 + 1`.
|
# `FINALIZED_ROOT_GINDEX` is one layer deeper, i.e., `52 * 2 + 1`.
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/ssz/merkle-proofs.md
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/ssz/merkle-proofs.md
|
||||||
FINALIZED_ROOT_GINDEX* = 105.GeneralizedIndex # finalized_checkpoint > root
|
FINALIZED_ROOT_GINDEX* = 105.GeneralizedIndex # finalized_checkpoint > root
|
||||||
CURRENT_SYNC_COMMITTEE_GINDEX* = 54.GeneralizedIndex # current_sync_committee
|
CURRENT_SYNC_COMMITTEE_GINDEX* = 54.GeneralizedIndex # current_sync_committee
|
||||||
NEXT_SYNC_COMMITTEE_GINDEX* = 55.GeneralizedIndex # next_sync_committee
|
NEXT_SYNC_COMMITTEE_GINDEX* = 55.GeneralizedIndex # next_sync_committee
|
||||||
|
@ -98,7 +98,7 @@ type
|
||||||
pubkeys*: HashArray[Limit SYNC_COMMITTEE_SIZE, ValidatorPubKey]
|
pubkeys*: HashArray[Limit SYNC_COMMITTEE_SIZE, ValidatorPubKey]
|
||||||
aggregate_pubkey*: ValidatorPubKey
|
aggregate_pubkey*: ValidatorPubKey
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#synccommitteemessage
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#synccommitteemessage
|
||||||
SyncCommitteeMessage* = object
|
SyncCommitteeMessage* = object
|
||||||
slot*: Slot
|
slot*: Slot
|
||||||
## Slot to which this contribution pertains
|
## Slot to which this contribution pertains
|
||||||
|
@ -112,7 +112,7 @@ type
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
## Signature by the validator over the block root of `slot`
|
## Signature by the validator over the block root of `slot`
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#synccommitteecontribution
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#synccommitteecontribution
|
||||||
SyncCommitteeAggregationBits* =
|
SyncCommitteeAggregationBits* =
|
||||||
BitArray[SYNC_SUBCOMMITTEE_SIZE]
|
BitArray[SYNC_SUBCOMMITTEE_SIZE]
|
||||||
|
|
||||||
|
@ -134,18 +134,18 @@ type
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
## Signature by the validator(s) over the block root of `slot`
|
## Signature by the validator(s) over the block root of `slot`
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#contributionandproof
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#contributionandproof
|
||||||
ContributionAndProof* = object
|
ContributionAndProof* = object
|
||||||
aggregator_index*: uint64 # `ValidatorIndex` after validation
|
aggregator_index*: uint64 # `ValidatorIndex` after validation
|
||||||
contribution*: SyncCommitteeContribution
|
contribution*: SyncCommitteeContribution
|
||||||
selection_proof*: ValidatorSig
|
selection_proof*: ValidatorSig
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#signedcontributionandproof
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#signedcontributionandproof
|
||||||
SignedContributionAndProof* = object
|
SignedContributionAndProof* = object
|
||||||
message*: ContributionAndProof
|
message*: ContributionAndProof
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#syncaggregatorselectiondata
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#syncaggregatorselectiondata
|
||||||
SyncAggregatorSelectionData* = object
|
SyncAggregatorSelectionData* = object
|
||||||
slot*: Slot
|
slot*: Slot
|
||||||
subcommittee_index*: uint64 # `SyncSubcommitteeIndex` after validation
|
subcommittee_index*: uint64 # `SyncSubcommitteeIndex` after validation
|
||||||
|
@ -161,7 +161,7 @@ type
|
||||||
NextSyncCommitteeBranch* =
|
NextSyncCommitteeBranch* =
|
||||||
array[log2trunc(NEXT_SYNC_COMMITTEE_GINDEX), Eth2Digest]
|
array[log2trunc(NEXT_SYNC_COMMITTEE_GINDEX), Eth2Digest]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/sync-protocol.md#lightclientheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/sync-protocol.md#lightclientheader
|
||||||
LightClientHeader* = object
|
LightClientHeader* = object
|
||||||
beacon*: BeaconBlockHeader
|
beacon*: BeaconBlockHeader
|
||||||
## Beacon block header
|
## Beacon block header
|
||||||
|
@ -665,7 +665,7 @@ chronicles.formatIt SyncCommitteeContribution: shortLog(it)
|
||||||
chronicles.formatIt ContributionAndProof: shortLog(it)
|
chronicles.formatIt ContributionAndProof: shortLog(it)
|
||||||
chronicles.formatIt SignedContributionAndProof: shortLog(it)
|
chronicles.formatIt SignedContributionAndProof: shortLog(it)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/sync-protocol.md#is_valid_light_client_header
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/sync-protocol.md#is_valid_light_client_header
|
||||||
func is_valid_light_client_header*(
|
func is_valid_light_client_header*(
|
||||||
header: LightClientHeader, cfg: RuntimeConfig): bool =
|
header: LightClientHeader, cfg: RuntimeConfig): bool =
|
||||||
true
|
true
|
||||||
|
|
|
@ -400,7 +400,7 @@ type
|
||||||
sync_committees*: Table[SyncCommitteePeriod, SyncCommitteeCache]
|
sync_committees*: Table[SyncCommitteePeriod, SyncCommitteeCache]
|
||||||
|
|
||||||
# This matches the mutable state of the Solidity deposit contract
|
# This matches the mutable state of the Solidity deposit contract
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/solidity_deposit_contract/deposit_contract.sol
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/solidity_deposit_contract/deposit_contract.sol
|
||||||
DepositContractState* = object
|
DepositContractState* = object
|
||||||
branch*: array[DEPOSIT_CONTRACT_TREE_DEPTH, Eth2Digest]
|
branch*: array[DEPOSIT_CONTRACT_TREE_DEPTH, Eth2Digest]
|
||||||
deposit_count*: array[32, byte] # Uint256
|
deposit_count*: array[32, byte] # Uint256
|
||||||
|
|
|
@ -35,7 +35,7 @@ const
|
||||||
NEWPAYLOAD_TIMEOUT* = 8.seconds
|
NEWPAYLOAD_TIMEOUT* = 8.seconds
|
||||||
|
|
||||||
type
|
type
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#custom-types
|
||||||
Transaction* = List[byte, Limit MAX_BYTES_PER_TRANSACTION]
|
Transaction* = List[byte, Limit MAX_BYTES_PER_TRANSACTION]
|
||||||
|
|
||||||
ExecutionAddress* = object
|
ExecutionAddress* = object
|
||||||
|
@ -44,7 +44,7 @@ type
|
||||||
BloomLogs* = object
|
BloomLogs* = object
|
||||||
data*: array[BYTES_PER_LOGS_BLOOM, byte]
|
data*: array[BYTES_PER_LOGS_BLOOM, byte]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#executionpayload
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#executionpayload
|
||||||
ExecutionPayload* = object
|
ExecutionPayload* = object
|
||||||
# Execution block header fields
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
|
@ -72,7 +72,7 @@ type
|
||||||
executionPayload*: ExecutionPayload
|
executionPayload*: ExecutionPayload
|
||||||
blockValue*: Wei
|
blockValue*: Wei
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#executionpayloadheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#executionpayloadheader
|
||||||
ExecutionPayloadHeader* = object
|
ExecutionPayloadHeader* = object
|
||||||
# Execution block header fields
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
|
@ -96,13 +96,13 @@ type
|
||||||
ExecutePayload* = proc(
|
ExecutePayload* = proc(
|
||||||
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [].}
|
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [].}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/fork-choice.md#powblock
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/fork-choice.md#powblock
|
||||||
PowBlock* = object
|
PowBlock* = object
|
||||||
block_hash*: Eth2Digest
|
block_hash*: Eth2Digest
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
total_difficulty*: Eth2Digest # uint256
|
total_difficulty*: Eth2Digest # uint256
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#beaconstate
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
BeaconState* = object
|
BeaconState* = object
|
||||||
# Versioning
|
# Versioning
|
||||||
genesis_time*: uint64
|
genesis_time*: uint64
|
||||||
|
@ -227,7 +227,7 @@ type
|
||||||
state_root*: Eth2Digest
|
state_root*: Eth2Digest
|
||||||
body*: TrustedBeaconBlockBody
|
body*: TrustedBeaconBlockBody
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#beaconblockbody
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#beaconblockbody
|
||||||
BeaconBlockBody* = object
|
BeaconBlockBody* = object
|
||||||
randao_reveal*: ValidatorSig
|
randao_reveal*: ValidatorSig
|
||||||
eth1_data*: Eth1Data
|
eth1_data*: Eth1Data
|
||||||
|
|
|
@ -32,7 +32,7 @@ const
|
||||||
# This index is rooted in `BeaconBlockBody`.
|
# This index is rooted in `BeaconBlockBody`.
|
||||||
# The first member (`randao_reveal`) is 16, subsequent members +1 each.
|
# The first member (`randao_reveal`) is 16, subsequent members +1 each.
|
||||||
# If there are ever more than 16 members in `BeaconBlockBody`, indices change!
|
# If there are ever more than 16 members in `BeaconBlockBody`, indices change!
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/ssz/merkle-proofs.md
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/ssz/merkle-proofs.md
|
||||||
EXECUTION_PAYLOAD_GINDEX* = 25.GeneralizedIndex # execution_payload
|
EXECUTION_PAYLOAD_GINDEX* = 25.GeneralizedIndex # execution_payload
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -52,12 +52,12 @@ type
|
||||||
from_bls_pubkey*: ValidatorPubKey
|
from_bls_pubkey*: ValidatorPubKey
|
||||||
to_execution_address*: ExecutionAddress
|
to_execution_address*: ExecutionAddress
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#signedblstoexecutionchange
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#signedblstoexecutionchange
|
||||||
SignedBLSToExecutionChange* = object
|
SignedBLSToExecutionChange* = object
|
||||||
message*: BLSToExecutionChange
|
message*: BLSToExecutionChange
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#historicalsummary
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#historicalsummary
|
||||||
HistoricalSummary* = object
|
HistoricalSummary* = object
|
||||||
# `HistoricalSummary` matches the components of the phase0
|
# `HistoricalSummary` matches the components of the phase0
|
||||||
# `HistoricalBatch` making the two hash_tree_root-compatible.
|
# `HistoricalBatch` making the two hash_tree_root-compatible.
|
||||||
|
@ -684,13 +684,13 @@ func is_valid_light_client_header*(
|
||||||
get_subtree_index(EXECUTION_PAYLOAD_GINDEX),
|
get_subtree_index(EXECUTION_PAYLOAD_GINDEX),
|
||||||
header.beacon.body_root)
|
header.beacon.body_root)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_header_to_capella*(
|
func upgrade_lc_header_to_capella*(
|
||||||
pre: altair.LightClientHeader): LightClientHeader =
|
pre: altair.LightClientHeader): LightClientHeader =
|
||||||
LightClientHeader(
|
LightClientHeader(
|
||||||
beacon: pre.beacon)
|
beacon: pre.beacon)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_bootstrap_to_capella*(
|
func upgrade_lc_bootstrap_to_capella*(
|
||||||
pre: altair.LightClientBootstrap): LightClientBootstrap =
|
pre: altair.LightClientBootstrap): LightClientBootstrap =
|
||||||
LightClientBootstrap(
|
LightClientBootstrap(
|
||||||
|
@ -698,7 +698,7 @@ func upgrade_lc_bootstrap_to_capella*(
|
||||||
current_sync_committee: pre.current_sync_committee,
|
current_sync_committee: pre.current_sync_committee,
|
||||||
current_sync_committee_branch: pre.current_sync_committee_branch)
|
current_sync_committee_branch: pre.current_sync_committee_branch)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_update_to_capella*(
|
func upgrade_lc_update_to_capella*(
|
||||||
pre: altair.LightClientUpdate): LightClientUpdate =
|
pre: altair.LightClientUpdate): LightClientUpdate =
|
||||||
LightClientUpdate(
|
LightClientUpdate(
|
||||||
|
@ -710,7 +710,7 @@ func upgrade_lc_update_to_capella*(
|
||||||
sync_aggregate: pre.sync_aggregate,
|
sync_aggregate: pre.sync_aggregate,
|
||||||
signature_slot: pre.signature_slot)
|
signature_slot: pre.signature_slot)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_finality_update_to_capella*(
|
func upgrade_lc_finality_update_to_capella*(
|
||||||
pre: altair.LightClientFinalityUpdate): LightClientFinalityUpdate =
|
pre: altair.LightClientFinalityUpdate): LightClientFinalityUpdate =
|
||||||
LightClientFinalityUpdate(
|
LightClientFinalityUpdate(
|
||||||
|
@ -720,7 +720,7 @@ func upgrade_lc_finality_update_to_capella*(
|
||||||
sync_aggregate: pre.sync_aggregate,
|
sync_aggregate: pre.sync_aggregate,
|
||||||
signature_slot: pre.signature_slot)
|
signature_slot: pre.signature_slot)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_optimistic_update_to_capella*(
|
func upgrade_lc_optimistic_update_to_capella*(
|
||||||
pre: altair.LightClientOptimisticUpdate): LightClientOptimisticUpdate =
|
pre: altair.LightClientOptimisticUpdate): LightClientOptimisticUpdate =
|
||||||
LightClientOptimisticUpdate(
|
LightClientOptimisticUpdate(
|
||||||
|
@ -771,7 +771,7 @@ chronicles.formatIt LightClientUpdate: shortLog(it)
|
||||||
chronicles.formatIt LightClientFinalityUpdate: shortLog(it)
|
chronicles.formatIt LightClientFinalityUpdate: shortLog(it)
|
||||||
chronicles.formatIt LightClientOptimisticUpdate: shortLog(it)
|
chronicles.formatIt LightClientOptimisticUpdate: shortLog(it)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/light-client/fork.md#upgrading-the-store
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/light-client/fork.md#upgrading-the-store
|
||||||
func upgrade_lc_store_to_capella*(
|
func upgrade_lc_store_to_capella*(
|
||||||
pre: altair.LightClientStore): LightClientStore =
|
pre: altair.LightClientStore): LightClientStore =
|
||||||
let best_valid_update =
|
let best_valid_update =
|
||||||
|
|
|
@ -55,7 +55,7 @@ const
|
||||||
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF* = DomainType([byte 0x08, 0x00, 0x00, 0x00])
|
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF* = DomainType([byte 0x08, 0x00, 0x00, 0x00])
|
||||||
DOMAIN_CONTRIBUTION_AND_PROOF* = DomainType([byte 0x09, 0x00, 0x00, 0x00])
|
DOMAIN_CONTRIBUTION_AND_PROOF* = DomainType([byte 0x09, 0x00, 0x00, 0x00])
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#domain-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#domain-types
|
||||||
DOMAIN_BLS_TO_EXECUTION_CHANGE* = DomainType([byte 0x0a, 0x00, 0x00, 0x00])
|
DOMAIN_BLS_TO_EXECUTION_CHANGE* = DomainType([byte 0x0a, 0x00, 0x00, 0x00])
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/82133085a1295e93394ebdf71df8f2f6e0962588/specs/electra/beacon-chain.md#domains
|
# https://github.com/ethereum/consensus-specs/blob/82133085a1295e93394ebdf71df8f2f6e0962588/specs/electra/beacon-chain.md#domains
|
||||||
|
|
|
@ -606,7 +606,7 @@ func kzg_commitment_inclusion_proof_gindex*(
|
||||||
# This index is rooted in `BeaconBlockBody`.
|
# This index is rooted in `BeaconBlockBody`.
|
||||||
# The first member (`randao_reveal`) is 16, subsequent members +1 each.
|
# The first member (`randao_reveal`) is 16, subsequent members +1 each.
|
||||||
# If there are ever more than 16 members in `BeaconBlockBody`, indices change!
|
# If there are ever more than 16 members in `BeaconBlockBody`, indices change!
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/ssz/merkle-proofs.md
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/ssz/merkle-proofs.md
|
||||||
const
|
const
|
||||||
# blob_kzg_commitments
|
# blob_kzg_commitments
|
||||||
BLOB_KZG_COMMITMENTS_GINDEX =
|
BLOB_KZG_COMMITMENTS_GINDEX =
|
||||||
|
@ -677,7 +677,7 @@ func is_valid_light_client_header*(
|
||||||
get_subtree_index(EXECUTION_PAYLOAD_GINDEX),
|
get_subtree_index(EXECUTION_PAYLOAD_GINDEX),
|
||||||
header.beacon.body_root)
|
header.beacon.body_root)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_header_to_deneb*(
|
func upgrade_lc_header_to_deneb*(
|
||||||
pre: capella.LightClientHeader): LightClientHeader =
|
pre: capella.LightClientHeader): LightClientHeader =
|
||||||
LightClientHeader(
|
LightClientHeader(
|
||||||
|
@ -702,7 +702,7 @@ func upgrade_lc_header_to_deneb*(
|
||||||
excess_blob_gas: 0), # [New in Deneb:EIP4844]
|
excess_blob_gas: 0), # [New in Deneb:EIP4844]
|
||||||
execution_branch: pre.execution_branch)
|
execution_branch: pre.execution_branch)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_bootstrap_to_deneb*(
|
func upgrade_lc_bootstrap_to_deneb*(
|
||||||
pre: capella.LightClientBootstrap): LightClientBootstrap =
|
pre: capella.LightClientBootstrap): LightClientBootstrap =
|
||||||
LightClientBootstrap(
|
LightClientBootstrap(
|
||||||
|
@ -710,7 +710,7 @@ func upgrade_lc_bootstrap_to_deneb*(
|
||||||
current_sync_committee: pre.current_sync_committee,
|
current_sync_committee: pre.current_sync_committee,
|
||||||
current_sync_committee_branch: pre.current_sync_committee_branch)
|
current_sync_committee_branch: pre.current_sync_committee_branch)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_update_to_deneb*(
|
func upgrade_lc_update_to_deneb*(
|
||||||
pre: capella.LightClientUpdate): LightClientUpdate =
|
pre: capella.LightClientUpdate): LightClientUpdate =
|
||||||
LightClientUpdate(
|
LightClientUpdate(
|
||||||
|
@ -722,7 +722,7 @@ func upgrade_lc_update_to_deneb*(
|
||||||
sync_aggregate: pre.sync_aggregate,
|
sync_aggregate: pre.sync_aggregate,
|
||||||
signature_slot: pre.signature_slot)
|
signature_slot: pre.signature_slot)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_finality_update_to_deneb*(
|
func upgrade_lc_finality_update_to_deneb*(
|
||||||
pre: capella.LightClientFinalityUpdate): LightClientFinalityUpdate =
|
pre: capella.LightClientFinalityUpdate): LightClientFinalityUpdate =
|
||||||
LightClientFinalityUpdate(
|
LightClientFinalityUpdate(
|
||||||
|
@ -732,7 +732,7 @@ func upgrade_lc_finality_update_to_deneb*(
|
||||||
sync_aggregate: pre.sync_aggregate,
|
sync_aggregate: pre.sync_aggregate,
|
||||||
signature_slot: pre.signature_slot)
|
signature_slot: pre.signature_slot)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
|
||||||
func upgrade_lc_optimistic_update_to_deneb*(
|
func upgrade_lc_optimistic_update_to_deneb*(
|
||||||
pre: capella.LightClientOptimisticUpdate): LightClientOptimisticUpdate =
|
pre: capella.LightClientOptimisticUpdate): LightClientOptimisticUpdate =
|
||||||
LightClientOptimisticUpdate(
|
LightClientOptimisticUpdate(
|
||||||
|
@ -783,7 +783,7 @@ chronicles.formatIt LightClientUpdate: shortLog(it)
|
||||||
chronicles.formatIt LightClientFinalityUpdate: shortLog(it)
|
chronicles.formatIt LightClientFinalityUpdate: shortLog(it)
|
||||||
chronicles.formatIt LightClientOptimisticUpdate: shortLog(it)
|
chronicles.formatIt LightClientOptimisticUpdate: shortLog(it)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/deneb/light-client/fork.md#upgrading-the-store
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/deneb/light-client/fork.md#upgrading-the-store
|
||||||
func upgrade_lc_store_to_deneb*(
|
func upgrade_lc_store_to_deneb*(
|
||||||
pre: capella.LightClientStore): LightClientStore =
|
pre: capella.LightClientStore): LightClientStore =
|
||||||
let best_valid_update =
|
let best_valid_update =
|
||||||
|
|
|
@ -43,7 +43,7 @@ const
|
||||||
# The first member (`genesis_time`) is 64, subsequent members +1 each.
|
# The first member (`genesis_time`) is 64, subsequent members +1 each.
|
||||||
# If there are ever more than 64 members in `BeaconState`, indices change!
|
# If there are ever more than 64 members in `BeaconState`, indices change!
|
||||||
# `FINALIZED_ROOT_GINDEX` is one layer deeper, i.e., `84 * 2 + 1`.
|
# `FINALIZED_ROOT_GINDEX` is one layer deeper, i.e., `84 * 2 + 1`.
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/ssz/merkle-proofs.md
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/ssz/merkle-proofs.md
|
||||||
FINALIZED_ROOT_GINDEX = 169.GeneralizedIndex # finalized_checkpoint > root
|
FINALIZED_ROOT_GINDEX = 169.GeneralizedIndex # finalized_checkpoint > root
|
||||||
CURRENT_SYNC_COMMITTEE_GINDEX = 86.GeneralizedIndex # current_sync_committee
|
CURRENT_SYNC_COMMITTEE_GINDEX = 86.GeneralizedIndex # current_sync_committee
|
||||||
NEXT_SYNC_COMMITTEE_GINDEX = 87.GeneralizedIndex # next_sync_committee
|
NEXT_SYNC_COMMITTEE_GINDEX = 87.GeneralizedIndex # next_sync_committee
|
||||||
|
|
|
@ -292,7 +292,7 @@ type
|
||||||
|
|
||||||
RestWithdrawalPrefix* = distinct array[1, byte]
|
RestWithdrawalPrefix* = distinct array[1, byte]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#executionpayload
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#executionpayload
|
||||||
RestExecutionPayload* = object
|
RestExecutionPayload* = object
|
||||||
# Execution block header fields
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
|
|
|
@ -25,7 +25,7 @@ import
|
||||||
export
|
export
|
||||||
eth2_merkleization, forks, rlp, ssz_codec
|
eth2_merkleization, forks, rlp, ssz_codec
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/weak-subjectivity.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/weak-subjectivity.md#constants
|
||||||
const ETH_TO_GWEI = 1_000_000_000.Gwei
|
const ETH_TO_GWEI = 1_000_000_000.Gwei
|
||||||
|
|
||||||
func toEther*(gwei: Gwei): Ether =
|
func toEther*(gwei: Gwei): Ether =
|
||||||
|
@ -271,7 +271,7 @@ template is_finality_update*(update: SomeForkyLightClientUpdate): bool =
|
||||||
else:
|
else:
|
||||||
false
|
false
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
||||||
template is_next_sync_committee_known*(store: ForkyLightClientStore): bool =
|
template is_next_sync_committee_known*(store: ForkyLightClientStore): bool =
|
||||||
store.next_sync_committee !=
|
store.next_sync_committee !=
|
||||||
static(default(typeof(store.next_sync_committee)))
|
static(default(typeof(store.next_sync_committee)))
|
||||||
|
@ -384,7 +384,7 @@ func contextEpoch*(bootstrap: ForkyLightClientBootstrap): Epoch =
|
||||||
func contextEpoch*(update: SomeForkyLightClientUpdate): Epoch =
|
func contextEpoch*(update: SomeForkyLightClientUpdate): Epoch =
|
||||||
update.attested_header.beacon.slot.epoch
|
update.attested_header.beacon.slot.epoch
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#is_merge_transition_complete
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#is_merge_transition_complete
|
||||||
func is_merge_transition_complete*(
|
func is_merge_transition_complete*(
|
||||||
state: bellatrix.BeaconState | capella.BeaconState | deneb.BeaconState |
|
state: bellatrix.BeaconState | capella.BeaconState | deneb.BeaconState |
|
||||||
electra.BeaconState): bool =
|
electra.BeaconState): bool =
|
||||||
|
@ -392,7 +392,7 @@ func is_merge_transition_complete*(
|
||||||
default(typeof(state.latest_execution_payload_header))
|
default(typeof(state.latest_execution_payload_header))
|
||||||
state.latest_execution_payload_header != defaultExecutionPayloadHeader
|
state.latest_execution_payload_header != defaultExecutionPayloadHeader
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/sync/optimistic.md#helpers
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/sync/optimistic.md#helpers
|
||||||
func is_execution_block*(blck: SomeForkyBeaconBlock): bool =
|
func is_execution_block*(blck: SomeForkyBeaconBlock): bool =
|
||||||
when typeof(blck).kind >= ConsensusFork.Bellatrix:
|
when typeof(blck).kind >= ConsensusFork.Bellatrix:
|
||||||
const defaultExecutionPayload =
|
const defaultExecutionPayload =
|
||||||
|
@ -401,7 +401,7 @@ func is_execution_block*(blck: SomeForkyBeaconBlock): bool =
|
||||||
else:
|
else:
|
||||||
false
|
false
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#is_merge_transition_block
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#is_merge_transition_block
|
||||||
func is_merge_transition_block(
|
func is_merge_transition_block(
|
||||||
state: bellatrix.BeaconState | capella.BeaconState | deneb.BeaconState |
|
state: bellatrix.BeaconState | capella.BeaconState | deneb.BeaconState |
|
||||||
electra.BeaconState,
|
electra.BeaconState,
|
||||||
|
@ -417,7 +417,7 @@ func is_merge_transition_block(
|
||||||
not is_merge_transition_complete(state) and
|
not is_merge_transition_complete(state) and
|
||||||
body.execution_payload != defaultExecutionPayload
|
body.execution_payload != defaultExecutionPayload
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#is_execution_enabled
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#is_execution_enabled
|
||||||
func is_execution_enabled*(
|
func is_execution_enabled*(
|
||||||
state: bellatrix.BeaconState | capella.BeaconState | deneb.BeaconState |
|
state: bellatrix.BeaconState | capella.BeaconState | deneb.BeaconState |
|
||||||
electra.BeaconState,
|
electra.BeaconState,
|
||||||
|
@ -431,7 +431,7 @@ func is_execution_enabled*(
|
||||||
electra.SigVerifiedBeaconBlockBody): bool =
|
electra.SigVerifiedBeaconBlockBody): bool =
|
||||||
is_merge_transition_block(state, body) or is_merge_transition_complete(state)
|
is_merge_transition_block(state, body) or is_merge_transition_complete(state)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#compute_timestamp_at_slot
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#compute_timestamp_at_slot
|
||||||
func compute_timestamp_at_slot*(state: ForkyBeaconState, slot: Slot): uint64 =
|
func compute_timestamp_at_slot*(state: ForkyBeaconState, slot: Slot): uint64 =
|
||||||
# Note: This function is unsafe with respect to overflows and underflows.
|
# Note: This function is unsafe with respect to overflows and underflows.
|
||||||
let slots_since_genesis = slot - GENESIS_SLOT
|
let slots_since_genesis = slot - GENESIS_SLOT
|
||||||
|
|
|
@ -1386,7 +1386,7 @@ func makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest =
|
||||||
bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8
|
bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8
|
||||||
bytes
|
bytes
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/deposit-contract.md#withdrawal-credentials
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/deposit-contract.md#withdrawal-credentials
|
||||||
func makeWithdrawalCredentials*(k: CookedPubKey): Eth2Digest =
|
func makeWithdrawalCredentials*(k: CookedPubKey): Eth2Digest =
|
||||||
makeWithdrawalCredentials(k.toPubKey())
|
makeWithdrawalCredentials(k.toPubKey())
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ export base
|
||||||
|
|
||||||
const
|
const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#topics-and-messages
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/p2p-interface.md#topics-and-messages
|
||||||
topicBeaconBlocksSuffix* = "beacon_block/ssz_snappy"
|
topicBeaconBlocksSuffix* = "beacon_block/ssz_snappy"
|
||||||
topicVoluntaryExitsSuffix* = "voluntary_exit/ssz_snappy"
|
topicVoluntaryExitsSuffix* = "voluntary_exit/ssz_snappy"
|
||||||
topicProposerSlashingsSuffix* = "proposer_slashing/ssz_snappy"
|
topicProposerSlashingsSuffix* = "proposer_slashing/ssz_snappy"
|
||||||
|
@ -63,7 +63,7 @@ func getAttesterSlashingsTopic*(forkDigest: ForkDigest): string =
|
||||||
func getAggregateAndProofsTopic*(forkDigest: ForkDigest): string =
|
func getAggregateAndProofsTopic*(forkDigest: ForkDigest): string =
|
||||||
eth2Prefix(forkDigest) & topicAggregateAndProofsSuffix
|
eth2Prefix(forkDigest) & topicAggregateAndProofsSuffix
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/p2p-interface.md#topics-and-messages
|
||||||
func getBlsToExecutionChangeTopic*(forkDigest: ForkDigest): string =
|
func getBlsToExecutionChangeTopic*(forkDigest: ForkDigest): string =
|
||||||
eth2Prefix(forkDigest) & topicBlsToExecutionChangeSuffix
|
eth2Prefix(forkDigest) & topicBlsToExecutionChangeSuffix
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ func getTargetGossipState*(
|
||||||
targetForks
|
targetForks
|
||||||
|
|
||||||
func nearSyncCommitteePeriod*(epoch: Epoch): Opt[uint64] =
|
func nearSyncCommitteePeriod*(epoch: Epoch): Opt[uint64] =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#sync-committee-subnet-stability
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#sync-committee-subnet-stability
|
||||||
if epoch.is_sync_committee_period():
|
if epoch.is_sync_committee_period():
|
||||||
return Opt.some 0'u64
|
return Opt.some 0'u64
|
||||||
let epochsBefore =
|
let epochsBefore =
|
||||||
|
@ -216,7 +216,7 @@ func getSyncSubnets*(
|
||||||
if not nodeHasPubkey(pubkey):
|
if not nodeHasPubkey(pubkey):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#broadcast-sync-committee-message
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#broadcast-sync-committee-message
|
||||||
# The first quarter of the pubkeys map to subnet 0, the second quarter to
|
# The first quarter of the pubkeys map to subnet 0, the second quarter to
|
||||||
# subnet 1, the third quarter to subnet 2 and the final quarter to subnet
|
# subnet 1, the third quarter to subnet 2 and the final quarter to subnet
|
||||||
# 3.
|
# 3.
|
||||||
|
|
|
@ -787,7 +787,7 @@ proc readRuntimeConfig*(
|
||||||
"MAX_REQUEST_BLOB_SIDECARS"
|
"MAX_REQUEST_BLOB_SIDECARS"
|
||||||
checkCompatibility BLOB_SIDECAR_SUBNET_COUNT
|
checkCompatibility BLOB_SIDECAR_SUBNET_COUNT
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/fork-choice.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/fork-choice.md#configuration
|
||||||
# Isn't being used as a preset in the usual way: at any time, there's one correct value
|
# Isn't being used as a preset in the usual way: at any time, there's one correct value
|
||||||
checkCompatibility PROPOSER_SCORE_BOOST
|
checkCompatibility PROPOSER_SCORE_BOOST
|
||||||
checkCompatibility REORG_HEAD_WEIGHT_THRESHOLD
|
checkCompatibility REORG_HEAD_WEIGHT_THRESHOLD
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# Mainnet preset - Altair
|
# Mainnet preset - Altair
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/mainnet/altair.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/mainnet/altair.yaml
|
||||||
const
|
const
|
||||||
# Updated penalty values
|
# Updated penalty values
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# Mainnet preset - Bellatrix
|
# Mainnet preset - Bellatrix
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/mainnet/bellatrix.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/mainnet/bellatrix.yaml
|
||||||
const
|
const
|
||||||
# Updated penalty values
|
# Updated penalty values
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# Mainnet preset - Capella
|
# Mainnet preset - Capella
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/mainnet/capella.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/mainnet/capella.yaml
|
||||||
const
|
const
|
||||||
# Max operations per block
|
# Max operations per block
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# Mainnet preset - Deneb
|
# Mainnet preset - Deneb
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/mainnet/deneb.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/mainnet/deneb.yaml
|
||||||
const
|
const
|
||||||
# `uint64(4096)`
|
# `uint64(4096)`
|
||||||
FIELD_ELEMENTS_PER_BLOB*: uint64 = 4096
|
FIELD_ELEMENTS_PER_BLOB*: uint64 = 4096
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# Minimal preset - Altair
|
# Minimal preset - Altair
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/minimal/altair.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/minimal/altair.yaml
|
||||||
const
|
const
|
||||||
# Updated penalty values
|
# Updated penalty values
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# Minimal preset - Bellatrix
|
# Minimal preset - Bellatrix
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/minimal/bellatrix.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/minimal/bellatrix.yaml
|
||||||
const
|
const
|
||||||
# Updated penalty values
|
# Updated penalty values
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# Minimal preset - Capella
|
# Minimal preset - Capella
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/minimal/capella.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/minimal/capella.yaml
|
||||||
const
|
const
|
||||||
# Max operations per block
|
# Max operations per block
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
# Minimal preset - Deneb
|
# Minimal preset - Deneb
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/presets/minimal/deneb.yaml
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/presets/minimal/deneb.yaml
|
||||||
const
|
const
|
||||||
# `uint64(4096)`
|
# `uint64(4096)`
|
||||||
FIELD_ELEMENTS_PER_BLOB*: uint64 = 4096
|
FIELD_ELEMENTS_PER_BLOB*: uint64 = 4096
|
||||||
|
|
|
@ -269,7 +269,7 @@ proc verify_voluntary_exit_signature*(
|
||||||
|
|
||||||
blsVerify(pubkey, signing_root.data, signature)
|
blsVerify(pubkey, signing_root.data, signature)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#prepare-sync-committee-message
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#prepare-sync-committee-message
|
||||||
func compute_sync_committee_message_signing_root*(
|
func compute_sync_committee_message_signing_root*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
slot: Slot, beacon_block_root: Eth2Digest): Eth2Digest =
|
slot: Slot, beacon_block_root: Eth2Digest): Eth2Digest =
|
||||||
|
@ -304,7 +304,7 @@ proc verify_sync_committee_signature*(
|
||||||
|
|
||||||
blsFastAggregateVerify(pubkeys, signing_root.data, signature)
|
blsFastAggregateVerify(pubkeys, signing_root.data, signature)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#aggregation-selection
|
||||||
func compute_sync_committee_selection_proof_signing_root*(
|
func compute_sync_committee_selection_proof_signing_root*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
slot: Slot, subcommittee_index: SyncSubcommitteeIndex): Eth2Digest =
|
slot: Slot, subcommittee_index: SyncSubcommitteeIndex): Eth2Digest =
|
||||||
|
@ -335,7 +335,7 @@ proc verify_sync_committee_selection_proof*(
|
||||||
|
|
||||||
blsVerify(pubkey, signing_root.data, signature)
|
blsVerify(pubkey, signing_root.data, signature)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#signature
|
||||||
func compute_contribution_and_proof_signing_root*(
|
func compute_contribution_and_proof_signing_root*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
msg: ContributionAndProof): Eth2Digest =
|
msg: ContributionAndProof): Eth2Digest =
|
||||||
|
@ -353,7 +353,7 @@ proc get_contribution_and_proof_signature*(
|
||||||
|
|
||||||
blsSign(privkey, signing_root.data)
|
blsSign(privkey, signing_root.data)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#aggregation-selection
|
||||||
func is_sync_committee_aggregator*(signature: ValidatorSig): bool =
|
func is_sync_committee_aggregator*(signature: ValidatorSig): bool =
|
||||||
let
|
let
|
||||||
signatureDigest = eth2digest(signature.blob)
|
signatureDigest = eth2digest(signature.blob)
|
||||||
|
@ -393,7 +393,7 @@ proc verify_builder_signature*(
|
||||||
let signing_root = compute_builder_signing_root(fork, msg)
|
let signing_root = compute_builder_signing_root(fork, msg)
|
||||||
blsVerify(pubkey, signing_root.data, signature)
|
blsVerify(pubkey, signing_root.data, signature)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#new-process_bls_to_execution_change
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#new-process_bls_to_execution_change
|
||||||
func compute_bls_to_execution_change_signing_root*(
|
func compute_bls_to_execution_change_signing_root*(
|
||||||
genesisFork: Fork, genesis_validators_root: Eth2Digest,
|
genesisFork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
msg: BLSToExecutionChange): Eth2Digest =
|
msg: BLSToExecutionChange): Eth2Digest =
|
||||||
|
|
|
@ -385,7 +385,7 @@ func partialBeaconBlock*(
|
||||||
when consensusFork >= ConsensusFork.Altair:
|
when consensusFork >= ConsensusFork.Altair:
|
||||||
res.body.sync_aggregate = sync_aggregate
|
res.body.sync_aggregate = sync_aggregate
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/validator.md#block-proposal
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/validator.md#block-proposal
|
||||||
when consensusFork >= ConsensusFork.Bellatrix:
|
when consensusFork >= ConsensusFork.Bellatrix:
|
||||||
res.body.execution_payload = execution_payload.executionPayload
|
res.body.execution_payload = execution_payload.executionPayload
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
# State transition - block processing, as described in
|
# State transition - block processing, as described in
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/deneb/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/deneb/beacon-chain.md#block-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.1/specs/electra/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.1/specs/electra/beacon-chain.md#block-processing
|
||||||
#
|
#
|
||||||
|
@ -1023,7 +1023,7 @@ proc process_execution_payload*(
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#new-process_withdrawals
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#new-process_withdrawals
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/electra/beacon-chain.md#updated-process_withdrawals
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/electra/beacon-chain.md#updated-process_withdrawals
|
||||||
func process_withdrawals*(
|
func process_withdrawals*(
|
||||||
state: var (capella.BeaconState | deneb.BeaconState | electra.BeaconState),
|
state: var (capella.BeaconState | deneb.BeaconState | electra.BeaconState),
|
||||||
|
@ -1146,7 +1146,7 @@ proc process_block*(
|
||||||
|
|
||||||
ok(operations_rewards)
|
ok(operations_rewards)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#block-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#block-processing
|
||||||
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
|
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
|
||||||
type SomeBellatrixBlock =
|
type SomeBellatrixBlock =
|
||||||
bellatrix.BeaconBlock | bellatrix.SigVerifiedBeaconBlock | bellatrix.TrustedBeaconBlock
|
bellatrix.BeaconBlock | bellatrix.SigVerifiedBeaconBlock | bellatrix.TrustedBeaconBlock
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
# State transition - epoch processing, as described in
|
# State transition - epoch processing, as described in
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#epoch-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#epoch-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#epoch-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#epoch-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#epoch-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#epoch-processing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#epoch-processing
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#epoch-processing
|
||||||
#
|
#
|
||||||
# The entry point is `process_epoch`, which is at the bottom of this file.
|
# The entry point is `process_epoch`, which is at the bottom of this file.
|
||||||
|
@ -701,7 +701,7 @@ func get_active_increments*(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#get_flag_index_deltas
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#get_flag_index_deltas
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
||||||
# Combines get_flag_index_deltas() and get_inactivity_penalty_deltas()
|
# Combines get_flag_index_deltas() and get_inactivity_penalty_deltas()
|
||||||
template get_flag_and_inactivity_delta(
|
template get_flag_and_inactivity_delta(
|
||||||
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
|
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
|
||||||
|
@ -961,7 +961,7 @@ func process_registry_updates*(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func get_adjusted_total_slashing_balance*(
|
func get_adjusted_total_slashing_balance*(
|
||||||
state: ForkyBeaconState, total_balance: Gwei): Gwei =
|
state: ForkyBeaconState, total_balance: Gwei): Gwei =
|
||||||
const multiplier =
|
const multiplier =
|
||||||
|
@ -980,14 +980,14 @@ func get_adjusted_total_slashing_balance*(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool =
|
func slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool =
|
||||||
validator.slashed and
|
validator.slashed and
|
||||||
epoch + EPOCHS_PER_SLASHINGS_VECTOR div 2 == validator.withdrawable_epoch
|
epoch + EPOCHS_PER_SLASHINGS_VECTOR div 2 == validator.withdrawable_epoch
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func get_slashing_penalty*(validator: Validator,
|
func get_slashing_penalty*(validator: Validator,
|
||||||
adjusted_total_slashing_balance,
|
adjusted_total_slashing_balance,
|
||||||
total_balance: Gwei): Gwei =
|
total_balance: Gwei): Gwei =
|
||||||
|
@ -999,7 +999,7 @@ func get_slashing_penalty*(validator: Validator,
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.7/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/bellatrix/beacon-chain.md#slashings
|
||||||
func process_slashings*(state: var ForkyBeaconState, total_balance: Gwei) =
|
func process_slashings*(state: var ForkyBeaconState, total_balance: Gwei) =
|
||||||
let
|
let
|
||||||
epoch = get_current_epoch(state)
|
epoch = get_current_epoch(state)
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
import
|
import
|
||||||
./datatypes/base, ./beaconstate, ./forks, ./helpers
|
./datatypes/base, ./beaconstate, ./forks, ./helpers
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/weak-subjectivity.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/weak-subjectivity.md#configuration
|
||||||
const SAFETY_DECAY* = 10'u64
|
const SAFETY_DECAY* = 10'u64
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/weak-subjectivity.md#compute_weak_subjectivity_period
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/weak-subjectivity.md#compute_weak_subjectivity_period
|
||||||
func compute_weak_subjectivity_period(
|
func compute_weak_subjectivity_period(
|
||||||
cfg: RuntimeConfig, state: ForkyBeaconState): uint64 =
|
cfg: RuntimeConfig, state: ForkyBeaconState): uint64 =
|
||||||
## Returns the weak subjectivity period for the current ``state``.
|
## Returns the weak subjectivity period for the current ``state``.
|
||||||
|
@ -49,7 +49,7 @@ func compute_weak_subjectivity_period(
|
||||||
|
|
||||||
ws_period
|
ws_period
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/weak-subjectivity.md#is_within_weak_subjectivity_period
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/weak-subjectivity.md#is_within_weak_subjectivity_period
|
||||||
func is_within_weak_subjectivity_period*(cfg: RuntimeConfig, current_slot: Slot,
|
func is_within_weak_subjectivity_period*(cfg: RuntimeConfig, current_slot: Slot,
|
||||||
ws_state: ForkedHashedBeaconState,
|
ws_state: ForkedHashedBeaconState,
|
||||||
ws_checkpoint: Checkpoint): bool =
|
ws_checkpoint: Checkpoint): bool =
|
||||||
|
|
|
@ -328,7 +328,7 @@ template query[E](
|
||||||
): Future[bool].Raising([CancelledError]) =
|
): Future[bool].Raising([CancelledError]) =
|
||||||
self.query(e, Nothing())
|
self.query(e, Nothing())
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/light-client.md#light-client-sync-process
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/light-client.md#light-client-sync-process
|
||||||
proc loop(self: LightClientManager) {.async: (raises: [CancelledError]).} =
|
proc loop(self: LightClientManager) {.async: (raises: [CancelledError]).} =
|
||||||
var nextSyncTaskTime = self.getBeaconTime()
|
var nextSyncTaskTime = self.getBeaconTime()
|
||||||
while true:
|
while true:
|
||||||
|
|
|
@ -90,7 +90,7 @@ p2pProtocol LightClientSync(version = 1,
|
||||||
|
|
||||||
debug "LC bootstrap request done", peer, blockRoot
|
debug "LC bootstrap request done", peer, blockRoot
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/p2p-interface.md#lightclientupdatesbyrange
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/p2p-interface.md#lightclientupdatesbyrange
|
||||||
proc lightClientUpdatesByRange(
|
proc lightClientUpdatesByRange(
|
||||||
peer: Peer,
|
peer: Peer,
|
||||||
startPeriod: SyncCommitteePeriod,
|
startPeriod: SyncCommitteePeriod,
|
||||||
|
|
|
@ -171,7 +171,7 @@ proc doTrustedNodeSync*(
|
||||||
let stateId =
|
let stateId =
|
||||||
case syncTarget.kind
|
case syncTarget.kind
|
||||||
of TrustedNodeSyncKind.TrustedBlockRoot:
|
of TrustedNodeSyncKind.TrustedBlockRoot:
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/light-client.md#light-client-sync-process
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/light-client.md#light-client-sync-process
|
||||||
const lcDataFork = LightClientDataFork.high
|
const lcDataFork = LightClientDataFork.high
|
||||||
var bestViableCheckpoint: Opt[tuple[slot: Slot, state_root: Eth2Digest]]
|
var bestViableCheckpoint: Opt[tuple[slot: Slot, state_root: Eth2Digest]]
|
||||||
func trackBestViableCheckpoint(store: lcDataFork.LightClientStore) =
|
func trackBestViableCheckpoint(store: lcDataFork.LightClientStore) =
|
||||||
|
|
|
@ -1965,7 +1965,7 @@ proc handleValidatorDuties*(node: BeaconNode, lastSlot, slot: Slot) {.async: (ra
|
||||||
updateValidatorMetrics(node) # the important stuff is done, update the vanity numbers
|
updateValidatorMetrics(node) # the important stuff is done, update the vanity numbers
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/validator.md#broadcast-aggregate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/validator.md#broadcast-aggregate
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#broadcast-sync-committee-contribution
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#broadcast-sync-committee-contribution
|
||||||
# Wait 2 / 3 of the slot time to allow messages to propagate, then collect
|
# Wait 2 / 3 of the slot time to allow messages to propagate, then collect
|
||||||
# the result in aggregates
|
# the result in aggregates
|
||||||
static:
|
static:
|
||||||
|
|
|
@ -767,7 +767,7 @@ proc getAggregateAndProofSignature*(v: AttachedValidator,
|
||||||
fork, genesis_validators_root, aggregate_and_proof)
|
fork, genesis_validators_root, aggregate_and_proof)
|
||||||
await v.signData(request)
|
await v.signData(request)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#prepare-sync-committee-message
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#prepare-sync-committee-message
|
||||||
proc getSyncCommitteeMessage*(v: AttachedValidator,
|
proc getSyncCommitteeMessage*(v: AttachedValidator,
|
||||||
fork: Fork,
|
fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest,
|
genesis_validators_root: Eth2Digest,
|
||||||
|
@ -798,7 +798,7 @@ proc getSyncCommitteeMessage*(v: AttachedValidator,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#aggregation-selection
|
||||||
proc getSyncCommitteeSelectionProof*(v: AttachedValidator, fork: Fork,
|
proc getSyncCommitteeSelectionProof*(v: AttachedValidator, fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest,
|
genesis_validators_root: Eth2Digest,
|
||||||
slot: Slot,
|
slot: Slot,
|
||||||
|
@ -818,7 +818,7 @@ proc getSyncCommitteeSelectionProof*(v: AttachedValidator, fork: Fork,
|
||||||
)
|
)
|
||||||
await v.signData(request)
|
await v.signData(request)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/validator.md#broadcast-sync-committee-contribution
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/validator.md#broadcast-sync-committee-contribution
|
||||||
proc getContributionAndProofSignature*(v: AttachedValidator, fork: Fork,
|
proc getContributionAndProofSignature*(v: AttachedValidator, fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest,
|
genesis_validators_root: Eth2Digest,
|
||||||
contribution_and_proof: ContributionAndProof
|
contribution_and_proof: ContributionAndProof
|
||||||
|
|
|
@ -104,7 +104,7 @@ The following sections explain how to do this for certain EL clients.
|
||||||
## Running the light client
|
## Running the light client
|
||||||
|
|
||||||
The light client starts syncing from a trusted block.
|
The light client starts syncing from a trusted block.
|
||||||
This trusted block should be somewhat recent ([~1-2 weeks](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/phase0/weak-subjectivity.md)) and needs to be configured each time when starting the light client.
|
This trusted block should be somewhat recent ([~1-2 weeks](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/phase0/weak-subjectivity.md)) and needs to be configured each time when starting the light client.
|
||||||
|
|
||||||
### 1. Obtaining a trusted block root
|
### 1. Obtaining a trusted block root
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ INF 2022-11-21 18:04:03.982+01:00 New LC optimistic header opt
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
The [light client protocol](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/altair/light-client/sync-protocol.md) depends on consensus layer (CL) full nodes to serve additional data.
|
The [light client protocol](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/altair/light-client/sync-protocol.md) depends on consensus layer (CL) full nodes to serve additional data.
|
||||||
As this is a new protocol, not all implementations are supporting it yet.
|
As this is a new protocol, not all implementations are supporting it yet.
|
||||||
Therefore, it may take several minutes to discover supporting peers, during which no log messages may be produced.
|
Therefore, it may take several minutes to discover supporting peers, during which no log messages may be produced.
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ If you are already using a threshold signing setup (e.g. based on Vouch and Dirk
|
||||||
|
|
||||||
The verifying Web3Signer is an experimental extension to the [Web3Signer protocol](https://consensys.github.io/web3signer/web3signer-eth2.html#tag/Signing/operation/ETH2_SIGN) which allows the remote signer to verify certain details of the signed blocks before creating a signature (for example, the signer may require the signed block to have a particular fee recipient value).
|
The verifying Web3Signer is an experimental extension to the [Web3Signer protocol](https://consensys.github.io/web3signer/web3signer-eth2.html#tag/Signing/operation/ETH2_SIGN) which allows the remote signer to verify certain details of the signed blocks before creating a signature (for example, the signer may require the signed block to have a particular fee recipient value).
|
||||||
|
|
||||||
To enable this use case, the `BLOCK_V2` request type of the `/api/v1/eth2/sign/{identifier}` endpoint is extended with an additional array field named `proofs`. The array consists of objects with the properties `index`, `proof` and `value`, where `index` is an arbitrary [generalized index](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/ssz/merkle-proofs.md#generalized-merkle-tree-index) of any property nested under the block body and `proof` is its corresponding Merkle proof against the block body root included in the request. The `value` property is optional and it is included only when the SSZ hash of the field included in the Merkle proof doesn't match its value.
|
To enable this use case, the `BLOCK_V2` request type of the `/api/v1/eth2/sign/{identifier}` endpoint is extended with an additional array field named `proofs`. The array consists of objects with the properties `index`, `proof` and `value`, where `index` is an arbitrary [generalized index](https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/ssz/merkle-proofs.md#generalized-merkle-tree-index) of any property nested under the block body and `proof` is its corresponding Merkle proof against the block body root included in the request. The `value` property is optional and it is included only when the SSZ hash of the field included in the Merkle proof doesn't match its value.
|
||||||
|
|
||||||
Since the generalized index of a particular field may change in a hard-fork, in the remote keystore format the proven fields are usually specified by their name:
|
Since the generalized index of a particular field may change in a hard-fork, in the remote keystore format the proven fields are usually specified by their name:
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import
|
||||||
# Test utilities
|
# Test utilities
|
||||||
../../testutil, ../../testblockutil
|
../../testutil, ../../testblockutil
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/tests/core/pyspec/eth2spec/test/helpers/sync_committee.py#L27-L44
|
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/tests/core/pyspec/eth2spec/test/helpers/sync_committee.py#L27-L44
|
||||||
proc compute_aggregate_sync_committee_signature(
|
proc compute_aggregate_sync_committee_signature(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
forked: ForkedHashedBeaconState,
|
forked: ForkedHashedBeaconState,
|
||||||
|
|
Loading…
Reference in New Issue