update some consensus spec URLs to v1.4.0-beta.2 (#5497)
This commit is contained in:
parent
ec1d98cc3a
commit
40616b6243
|
@ -26,7 +26,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.3.0/specs/phase0/fork-choice.md#fork-choice
|
## https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/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
|
||||||
|
|
|
@ -4,12 +4,12 @@ This folder holds the various consensus object pools needed for a blockchain cli
|
||||||
|
|
||||||
Object in those pools have passed the "gossip validation" filter according
|
Object in those pools have passed the "gossip validation" filter according
|
||||||
to specs:
|
to specs:
|
||||||
- blocks: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_block
|
- blocks: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#beacon_block
|
||||||
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||||
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||||
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#voluntary_exit
|
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#voluntary_exit
|
||||||
- Attester slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attester_slashing
|
- Attester slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#attester_slashing
|
||||||
- Proposer slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#proposer_slashing
|
- Proposer slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#proposer_slashing
|
||||||
|
|
||||||
After "gossip validation" the consensus objects can be rebroadcasted as they are optimistically good, however for internal processing further verification is needed.
|
After "gossip validation" the consensus objects can be rebroadcasted as they are optimistically good, however for internal processing further verification is needed.
|
||||||
For blocks, this means verifying state transition and all contained cryptographic signatures (instead of just the proposer signature).
|
For blocks, this means verifying state transition and all contained cryptographic signatures (instead of just the proposer signature).
|
||||||
|
|
|
@ -181,7 +181,7 @@ func makeAttestationData*(
|
||||||
|
|
||||||
doAssert current_epoch == epochRef.epoch
|
doAssert current_epoch == epochRef.epoch
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#attestation-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/validator.md#attestation-data
|
||||||
AttestationData(
|
AttestationData(
|
||||||
slot: slot,
|
slot: slot,
|
||||||
index: committee_index.asUInt64,
|
index: committee_index.asUInt64,
|
||||||
|
|
|
@ -1715,7 +1715,7 @@ template trackFinalizedState*(m: ELManager,
|
||||||
finalizedStateDepositIndex: uint64): bool =
|
finalizedStateDepositIndex: uint64): bool =
|
||||||
trackFinalizedState(m.eth1Chain, finalizedEth1Data, finalizedStateDepositIndex)
|
trackFinalizedState(m.eth1Chain, finalizedEth1Data, finalizedStateDepositIndex)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#get_eth1_data
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/validator.md#get_eth1_data
|
||||||
proc getBlockProposalData*(chain: var Eth1Chain,
|
proc getBlockProposalData*(chain: var Eth1Chain,
|
||||||
state: ForkedHashedBeaconState,
|
state: ForkedHashedBeaconState,
|
||||||
finalizedEth1Data: Eth1Data,
|
finalizedEth1Data: Eth1Data,
|
||||||
|
|
|
@ -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.4.0-beta.1/specs/phase0/fork-choice.md#update_checkpoints
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/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] =
|
||||||
|
|
|
@ -125,7 +125,7 @@ iterator realizePendingCheckpoints*(
|
||||||
# Reset tip tracking for new epoch
|
# Reset tip tracking for new epoch
|
||||||
self.currentEpochTips.clear()
|
self.currentEpochTips.clear()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#get_weight
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/fork-choice.md#get_weight
|
||||||
func calculateProposerBoost(justifiedTotalActiveBalance: Gwei): Gwei =
|
func calculateProposerBoost(justifiedTotalActiveBalance: Gwei): Gwei =
|
||||||
let committee_weight = justifiedTotalActiveBalance div SLOTS_PER_EPOCH
|
let committee_weight = justifiedTotalActiveBalance div SLOTS_PER_EPOCH
|
||||||
(committee_weight * PROPOSER_SCORE_BOOST) div 100
|
(committee_weight * PROPOSER_SCORE_BOOST) div 100
|
||||||
|
@ -189,7 +189,7 @@ func applyScoreChanges*(self: var ProtoArray,
|
||||||
# If we find the node matching the current proposer boost root, increase
|
# If we find the node matching the current proposer boost root, increase
|
||||||
# the delta by the new score amount.
|
# the delta by the new score amount.
|
||||||
#
|
#
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#get_weight
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/fork-choice.md#get_weight
|
||||||
if (not proposerBoostRoot.isZero) and proposerBoostRoot == node.bid.root:
|
if (not proposerBoostRoot.isZero) and proposerBoostRoot == node.bid.root:
|
||||||
proposerBoostScore = calculateProposerBoost(justifiedTotalActiveBalance)
|
proposerBoostScore = calculateProposerBoost(justifiedTotalActiveBalance)
|
||||||
if nodeDelta >= 0 and
|
if nodeDelta >= 0 and
|
||||||
|
|
|
@ -149,11 +149,11 @@ typedef struct ETHBeaconState ETHBeaconState;
|
||||||
* representation - If successful.
|
* representation - If successful.
|
||||||
* @return `NULL` - If the given `sszBytes` is malformed.
|
* @return `NULL` - If the given `sszBytes` is malformed.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/bellatrix/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/bellatrix/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/capella/beacon-chain.md#beaconstate
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/capella/beacon-chain.md#beaconstate
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/configs/README.md
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/configs/README.md
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
ETHBeaconState *ETHBeaconStateCreateFromSsz(
|
ETHBeaconState *ETHBeaconStateCreateFromSsz(
|
||||||
|
@ -198,7 +198,7 @@ ETHRoot *ETHBeaconStateCopyGenesisValidatorsRoot(const ETHBeaconState *state);
|
||||||
*
|
*
|
||||||
* @param root Merkle root.
|
* @param root Merkle root.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/beacon-chain.md#custom-types
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/beacon-chain.md#custom-types
|
||||||
*/
|
*/
|
||||||
void ETHRootDestroy(ETHRoot *root);
|
void ETHRootDestroy(ETHRoot *root);
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ typedef struct ETHLightClientHeader ETHLightClientHeader;
|
||||||
*
|
*
|
||||||
* @return Latest finalized header.
|
* @return Latest finalized header.
|
||||||
*
|
*
|
||||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/capella/light-client/sync-protocol.md#modified-lightclientheader
|
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/capella/light-client/sync-protocol.md#modified-lightclientheader
|
||||||
*/
|
*/
|
||||||
ETH_RESULT_USE_CHECK
|
ETH_RESULT_USE_CHECK
|
||||||
const ETHLightClientHeader *ETHLightClientStoreGetFinalizedHeader(
|
const ETHLightClientHeader *ETHLightClientStoreGetFinalizedHeader(
|
||||||
|
|
|
@ -2568,7 +2568,7 @@ proc updateStabilitySubnetMetadata*(node: Eth2Node, attnets: AttnetBits) =
|
||||||
node.metadata.attnets = attnets
|
node.metadata.attnets = attnets
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnet-subscription
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnet-subscription
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#attestation-subnet-bitfield
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#attestation-subnet-bitfield
|
||||||
let res = node.discovery.updateRecord({
|
let res = node.discovery.updateRecord({
|
||||||
enrAttestationSubnetsField: SSZ.encode(node.metadata.attnets)
|
enrAttestationSubnetsField: SSZ.encode(node.metadata.attnets)
|
||||||
})
|
})
|
||||||
|
@ -2580,7 +2580,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.4.0-beta.1/specs/altair/validator.md#sync-committee-subnet-stability
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/validator.md#sync-committee-subnet-stability
|
||||||
if node.metadata.syncnets == syncnets:
|
if node.metadata.syncnets == syncnets:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -800,7 +800,7 @@ func forkDigests(node: BeaconNode): auto =
|
||||||
node.dag.forkDigests.deneb]
|
node.dag.forkDigests.deneb]
|
||||||
forkDigestsArray
|
forkDigestsArray
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnet-subscription
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#attestation-subnet-subscription
|
||||||
proc updateAttestationSubnetHandlers(node: BeaconNode, slot: Slot) =
|
proc updateAttestationSubnetHandlers(node: BeaconNode, slot: Slot) =
|
||||||
if node.gossipState.card == 0:
|
if node.gossipState.card == 0:
|
||||||
# When disconnected, updateGossipState is responsible for all things
|
# When disconnected, updateGossipState is responsible for all things
|
||||||
|
@ -1598,7 +1598,7 @@ proc installMessageValidators(node: BeaconNode) =
|
||||||
MsgSource.gossip, signedAggregateAndProof)))
|
MsgSource.gossip, signedAggregateAndProof)))
|
||||||
|
|
||||||
# attester_slashing
|
# attester_slashing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attester_slashing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#attester_slashing
|
||||||
node.network.addValidator(
|
node.network.addValidator(
|
||||||
getAttesterSlashingsTopic(digest), proc (
|
getAttesterSlashingsTopic(digest), proc (
|
||||||
attesterSlashing: AttesterSlashing
|
attesterSlashing: AttesterSlashing
|
||||||
|
@ -1642,7 +1642,7 @@ proc installMessageValidators(node: BeaconNode) =
|
||||||
MsgSource.gossip, msg, idx)))
|
MsgSource.gossip, msg, idx)))
|
||||||
|
|
||||||
# sync_committee_contribution_and_proof
|
# sync_committee_contribution_and_proof
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/p2p-interface.md#sync_committee_contribution_and_proof
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/p2p-interface.md#sync_committee_contribution_and_proof
|
||||||
node.network.addAsyncValidator(
|
node.network.addAsyncValidator(
|
||||||
getSyncCommitteeContributionAndProofTopic(digest), proc (
|
getSyncCommitteeContributionAndProofTopic(digest), proc (
|
||||||
msg: SignedContributionAndProof
|
msg: SignedContributionAndProof
|
||||||
|
|
|
@ -142,7 +142,7 @@ const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#prepare-sync-committee-message
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/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.4.0-beta.1/specs/altair/validator.md#broadcast-sync-committee-contribution
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/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.4.0-beta.2/specs/altair/light-client/p2p-interface.md#sync-committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/light-client/p2p-interface.md#sync-committee
|
||||||
|
|
|
@ -267,7 +267,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.3.0/specs/capella/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/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
|
||||||
|
@ -324,7 +324,7 @@ func get_block_root*(state: ForkedHashedBeaconState, epoch: Epoch): Eth2Digest =
|
||||||
withState(state):
|
withState(state):
|
||||||
get_block_root(forkyState.data, epoch)
|
get_block_root(forkyState.data, epoch)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#get_total_balance
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/beacon-chain.md#get_total_balance
|
||||||
template get_total_balance(
|
template get_total_balance(
|
||||||
state: ForkyBeaconState, validator_indices: untyped): Gwei =
|
state: ForkyBeaconState, validator_indices: untyped): Gwei =
|
||||||
## Return the combined effective balance of the ``indices``.
|
## Return the combined effective balance of the ``indices``.
|
||||||
|
@ -546,7 +546,7 @@ func get_attestation_participation_flag_indices(
|
||||||
|
|
||||||
participation_flag_indices
|
participation_flag_indices
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#modified-get_attestation_participation_flag_indices
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/beacon-chain.md#modified-get_attestation_participation_flag_indices
|
||||||
func get_attestation_participation_flag_indices(
|
func get_attestation_participation_flag_indices(
|
||||||
state: deneb.BeaconState,
|
state: deneb.BeaconState,
|
||||||
data: AttestationData, inclusion_delay: uint64): set[TimelyFlag] =
|
data: AttestationData, inclusion_delay: uint64): set[TimelyFlag] =
|
||||||
|
@ -811,7 +811,7 @@ func is_fully_withdrawable_validator(
|
||||||
has_eth1_withdrawal_credential(validator) and
|
has_eth1_withdrawal_credential(validator) and
|
||||||
validator.withdrawable_epoch <= epoch and balance > 0
|
validator.withdrawable_epoch <= epoch and balance > 0
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#is_partially_withdrawable_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/capella/beacon-chain.md#is_partially_withdrawable_validator
|
||||||
func is_partially_withdrawable_validator(
|
func is_partially_withdrawable_validator(
|
||||||
validator: Validator, balance: Gwei): bool =
|
validator: Validator, balance: Gwei): bool =
|
||||||
## Check if ``validator`` is partially withdrawable.
|
## Check if ``validator`` is partially withdrawable.
|
||||||
|
@ -979,7 +979,7 @@ 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.3.0/specs/bellatrix/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/bellatrix/beacon-chain.md#testing
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#testing
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/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*(
|
||||||
|
|
|
@ -79,7 +79,7 @@ static: doAssert TIMELY_SOURCE_WEIGHT + TIMELY_TARGET_WEIGHT +
|
||||||
type
|
type
|
||||||
### New types
|
### New types
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/altair/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/beacon-chain.md#custom-types
|
||||||
ParticipationFlags* = uint8
|
ParticipationFlags* = uint8
|
||||||
|
|
||||||
EpochParticipationFlags* =
|
EpochParticipationFlags* =
|
||||||
|
@ -116,7 +116,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.4.0-beta.1/specs/altair/validator.md#synccommitteecontribution
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/validator.md#synccommitteecontribution
|
||||||
SyncCommitteeAggregationBits* =
|
SyncCommitteeAggregationBits* =
|
||||||
BitArray[SYNC_SUBCOMMITTEE_SIZE]
|
BitArray[SYNC_SUBCOMMITTEE_SIZE]
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ type
|
||||||
|
|
||||||
InactivityScores* = HashList[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
InactivityScores* = HashList[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/altair/beacon-chain.md#beaconstate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/beacon-chain.md#beaconstate
|
||||||
BeaconState* = object
|
BeaconState* = object
|
||||||
# Versioning
|
# Versioning
|
||||||
genesis_time*: uint64
|
genesis_time*: uint64
|
||||||
|
|
|
@ -343,7 +343,7 @@ type
|
||||||
withdrawable_epoch*: Epoch
|
withdrawable_epoch*: Epoch
|
||||||
## When validator can withdraw funds
|
## When validator can withdraw funds
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#pendingattestation
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/beacon-chain.md#pendingattestation
|
||||||
PendingAttestation* = object
|
PendingAttestation* = object
|
||||||
aggregation_bits*: CommitteeValidatorsBits
|
aggregation_bits*: CommitteeValidatorsBits
|
||||||
data*: AttestationData
|
data*: AttestationData
|
||||||
|
|
|
@ -10,7 +10,7 @@ type
|
||||||
Epoch* = distinct uint64
|
Epoch* = distinct uint64
|
||||||
SyncCommitteePeriod* = distinct uint64
|
SyncCommitteePeriod* = distinct uint64
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/capella/beacon-chain.md#custom-types
|
||||||
WithdrawalIndex* = uint64
|
WithdrawalIndex* = uint64
|
||||||
|
|
||||||
DomainType* = distinct array[4, byte]
|
DomainType* = distinct array[4, byte]
|
||||||
|
|
|
@ -33,7 +33,7 @@ const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/polynomial-commitments.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/polynomial-commitments.md#constants
|
||||||
BYTES_PER_FIELD_ELEMENT = 32
|
BYTES_PER_FIELD_ELEMENT = 32
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#blob
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/beacon-chain.md#blob
|
||||||
BLOB_TX_TYPE* = 0x03'u8
|
BLOB_TX_TYPE* = 0x03'u8
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/polynomial-commitments.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/polynomial-commitments.md#constants
|
||||||
|
@ -72,7 +72,7 @@ type
|
||||||
message*: BlobSidecar
|
message*: BlobSidecar
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/p2p-interface.md#blobidentifier
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/p2p-interface.md#blobidentifier
|
||||||
BlobIdentifier* = object
|
BlobIdentifier* = object
|
||||||
block_root*: Eth2Digest
|
block_root*: Eth2Digest
|
||||||
index*: BlobIndex
|
index*: BlobIndex
|
||||||
|
|
|
@ -89,13 +89,13 @@ func getAttestationTopic*(forkDigest: ForkDigest,
|
||||||
## For subscribing and unsubscribing to/from a subnet.
|
## For subscribing and unsubscribing to/from a subnet.
|
||||||
eth2Prefix(forkDigest) & "beacon_attestation_" & $(subnetId) & "/ssz_snappy"
|
eth2Prefix(forkDigest) & "beacon_attestation_" & $(subnetId) & "/ssz_snappy"
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/p2p-interface.md#topics-and-messages
|
||||||
func getSyncCommitteeTopic*(forkDigest: ForkDigest,
|
func getSyncCommitteeTopic*(forkDigest: ForkDigest,
|
||||||
subcommitteeIdx: SyncSubcommitteeIndex): string =
|
subcommitteeIdx: SyncSubcommitteeIndex): string =
|
||||||
## For subscribing and unsubscribing to/from a subnet.
|
## For subscribing and unsubscribing to/from a subnet.
|
||||||
eth2Prefix(forkDigest) & "sync_committee_" & $subcommitteeIdx & "/ssz_snappy"
|
eth2Prefix(forkDigest) & "sync_committee_" & $subcommitteeIdx & "/ssz_snappy"
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/altair/p2p-interface.md#topics-and-messages
|
||||||
func getSyncCommitteeContributionAndProofTopic*(forkDigest: ForkDigest): string =
|
func getSyncCommitteeContributionAndProofTopic*(forkDigest: ForkDigest): string =
|
||||||
## For subscribing and unsubscribing to/from a subnet.
|
## For subscribing and unsubscribing to/from a subnet.
|
||||||
eth2Prefix(forkDigest) & "sync_committee_contribution_and_proof/ssz_snappy"
|
eth2Prefix(forkDigest) & "sync_committee_contribution_and_proof/ssz_snappy"
|
||||||
|
|
|
@ -299,7 +299,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.4.0-beta.1/specs/altair/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/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 =
|
||||||
|
@ -348,7 +348,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.4.0-beta.1/specs/altair/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/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)
|
||||||
|
|
|
@ -485,7 +485,7 @@ proc signData(v: AttachedValidator,
|
||||||
else:
|
else:
|
||||||
v.signWithDistributedKey(request)
|
v.signWithDistributedKey(request)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/validator.md#signature
|
||||||
proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest, slot: Slot,
|
genesis_validators_root: Eth2Digest, slot: Slot,
|
||||||
block_root: Eth2Digest,
|
block_root: Eth2Digest,
|
||||||
|
|
|
@ -51,7 +51,7 @@ These GossipSub topics are used to listen for attestations:
|
||||||
- Unaggregated: `/eth2/{$forkDigest}/beacon_attestation_{subnetIndex}/ssz_snappy`
|
- Unaggregated: `/eth2/{$forkDigest}/beacon_attestation_{subnetIndex}/ssz_snappy`
|
||||||
|
|
||||||
The attestations are then validated by `validateAttestation()` or `validateAggregate()` in either `attestationValidator()` or `aggregateValidator()` according to the P2P specs.
|
The attestations are then validated by `validateAttestation()` or `validateAggregate()` in either `attestationValidator()` or `aggregateValidator()` according to the P2P specs.
|
||||||
- https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
- https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||||
- https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnets
|
- https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnets
|
||||||
|
|
||||||
Finally, valid attestations are added to the local `attestationPool`.
|
Finally, valid attestations are added to the local `attestationPool`.
|
||||||
|
|
|
@ -268,7 +268,7 @@ func makeAttestationData*(
|
||||||
"Computed epoch was " & $slot.epoch &
|
"Computed epoch was " & $slot.epoch &
|
||||||
" while the state current_epoch was " & $current_epoch
|
" while the state current_epoch was " & $current_epoch
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#attestation-data
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/phase0/validator.md#attestation-data
|
||||||
AttestationData(
|
AttestationData(
|
||||||
slot: slot,
|
slot: slot,
|
||||||
index: committee_index.uint64,
|
index: committee_index.uint64,
|
||||||
|
|
Loading…
Reference in New Issue