update some consensus spec URLs to v1.4.0-beta.4 (#5594)
This commit is contained in:
parent
9ec7b700a8
commit
c96163dbca
|
@ -181,7 +181,7 @@ func makeAttestationData*(
|
|||
|
||||
doAssert current_epoch == epochRef.epoch
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#attestation-data
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#attestation-data
|
||||
AttestationData(
|
||||
slot: slot,
|
||||
index: committee_index.asUInt64,
|
||||
|
|
|
@ -413,11 +413,11 @@ template toGaugeValue(x: Quantity): int64 =
|
|||
# doAssert SECONDS_PER_ETH1_BLOCK * cfg.ETH1_FOLLOW_DISTANCE < GENESIS_DELAY,
|
||||
# "Invalid configuration: GENESIS_DELAY is set too low"
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#get_eth1_data
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#get_eth1_data
|
||||
func compute_time_at_slot(genesis_time: uint64, slot: Slot): uint64 =
|
||||
genesis_time + slot * SECONDS_PER_SLOT
|
||||
|
||||
# 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.4/specs/phase0/validator.md#get_eth1_data
|
||||
func voting_period_start_time(state: ForkedHashedBeaconState): uint64 =
|
||||
let eth1_voting_period_start_slot =
|
||||
getStateField(state, slot) - getStateField(state, slot) mod
|
||||
|
@ -425,7 +425,7 @@ func voting_period_start_time(state: ForkedHashedBeaconState): uint64 =
|
|||
compute_time_at_slot(
|
||||
getStateField(state, genesis_time), eth1_voting_period_start_slot)
|
||||
|
||||
# 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.4/specs/phase0/validator.md#get_eth1_data
|
||||
func is_candidate_block(cfg: RuntimeConfig,
|
||||
blk: Eth1Block,
|
||||
period_start: uint64): bool =
|
||||
|
@ -1258,7 +1258,7 @@ proc forkchoiceUpdated*(m: ELManager,
|
|||
# block hash provided by this event is stubbed with
|
||||
# `0x0000000000000000000000000000000000000000000000000000000000000000`."
|
||||
# and
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/validator.md#executionpayload
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/bellatrix/validator.md#executionpayload
|
||||
# notes "`finalized_block_hash` is the hash of the latest finalized execution
|
||||
# payload (`Hash32()` if none yet finalized)"
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ proc update_justified(
|
|||
self.update_justified(dag, blck, justified.epoch)
|
||||
ok()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/fork-choice.md#update_checkpoints
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/fork-choice.md#update_checkpoints
|
||||
proc update_checkpoints(
|
||||
self: var Checkpoints, dag: ChainDAGRef,
|
||||
checkpoints: FinalityCheckpoints): FcResult[void] =
|
||||
|
@ -218,7 +218,7 @@ proc update_time*(self: var ForkChoice, dag: ChainDAGRef, time: BeaconTime):
|
|||
|
||||
ok()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#on_attestation
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/fork-choice.md#on_attestation
|
||||
proc on_attestation*(
|
||||
self: var ForkChoice,
|
||||
dag: ChainDAGRef,
|
||||
|
|
|
@ -10,11 +10,11 @@ This folder holds a collection of modules to:
|
|||
Gossip validation is different from consensus verification in particular for blocks.
|
||||
|
||||
- Blocks: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#beacon_block
|
||||
- Attestations (aggregated): https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
- Attestations (aggregated): https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
- Attestations (unaggregated): https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestation-subnets
|
||||
- Voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#voluntary_exit
|
||||
- Proposer slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#proposer_slashing
|
||||
- Attester slashing: https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#attester_slashing
|
||||
- Voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#voluntary_exit
|
||||
- Proposer slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#proposer_slashing
|
||||
- Attester slashing: https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#attester_slashing
|
||||
|
||||
There are multiple consumers of validated consensus objects:
|
||||
- a `ValidationResult.Accept` output triggers rebroadcasting in libp2p
|
||||
|
|
|
@ -1002,7 +1002,7 @@ proc validateAggregate*(
|
|||
|
||||
return ok((attesting_indices, sig))
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/p2p-interface.md#bls_to_execution_change
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/capella/p2p-interface.md#bls_to_execution_change
|
||||
proc validateBlsToExecutionChange*(
|
||||
pool: ValidatorChangePool, batchCrypto: ref BatchCrypto,
|
||||
signed_address_change: SignedBLSToExecutionChange,
|
||||
|
|
|
@ -150,9 +150,9 @@ typedef struct ETHBeaconState ETHBeaconState;
|
|||
* @return `NULL` - If the given `sszBytes` is malformed.
|
||||
*
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/beacon-chain.md#beaconstate
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/beacon-chain.md#beaconstate
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#beaconstate
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/capella/beacon-chain.md#beaconstate
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/capella/beacon-chain.md#beaconstate
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/configs/README.md
|
||||
*/
|
||||
ETH_RESULT_USE_CHECK
|
||||
|
@ -268,7 +268,7 @@ void ETHBeaconClockDestroy(ETHBeaconClock *beaconClock);
|
|||
* @return Slot number for the current wall clock time - If genesis has occurred.
|
||||
* @return `0` - If genesis is still pending.
|
||||
*
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.0/specs/phase0/beacon-chain.md#custom-types
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#custom-types
|
||||
*/
|
||||
ETH_RESULT_USE_CHECK
|
||||
int ETHBeaconClockGetSlot(const ETHBeaconClock *beaconClock);
|
||||
|
@ -576,7 +576,7 @@ typedef struct ETHLightClientHeader ETHLightClientHeader;
|
|||
*
|
||||
* @return Latest finalized header.
|
||||
*
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/capella/light-client/sync-protocol.md#modified-lightclientheader
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/capella/light-client/sync-protocol.md#modified-lightclientheader
|
||||
*/
|
||||
ETH_RESULT_USE_CHECK
|
||||
const ETHLightClientHeader *ETHLightClientStoreGetFinalizedHeader(
|
||||
|
@ -595,7 +595,7 @@ const ETHLightClientHeader *ETHLightClientStoreGetFinalizedHeader(
|
|||
* @return Whether or not the next sync committee is currently known.
|
||||
*
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/light-client/sync-protocol.md#is_next_sync_committee_known
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/light-client/light-client.md
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/light-client/light-client.md
|
||||
*/
|
||||
ETH_RESULT_USE_CHECK
|
||||
bool ETHLightClientStoreIsNextSyncCommitteeKnown(const ETHLightClientStore *store);
|
||||
|
@ -611,7 +611,7 @@ bool ETHLightClientStoreIsNextSyncCommitteeKnown(const ETHLightClientStore *stor
|
|||
*
|
||||
* @return Latest optimistic header.
|
||||
*
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.0/specs/capella/light-client/sync-protocol.md#modified-lightclientheader
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/capella/light-client/sync-protocol.md#modified-lightclientheader
|
||||
*/
|
||||
ETH_RESULT_USE_CHECK
|
||||
const ETHLightClientHeader *ETHLightClientStoreGetOptimisticHeader(
|
||||
|
@ -772,7 +772,7 @@ const ETHRoot *ETHBeaconBlockHeaderGetBodyRoot(const ETHBeaconBlockHeader *beaco
|
|||
*
|
||||
* @return Pointer to a copy of the given header's execution block hash.
|
||||
*
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.0/specs/deneb/beacon-chain.md#executionpayloadheader
|
||||
* @see https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/beacon-chain.md#executionpayloadheader
|
||||
*/
|
||||
ETH_RESULT_USE_CHECK
|
||||
ETHRoot *ETHLightClientHeaderCopyExecutionHash(
|
||||
|
|
|
@ -2542,7 +2542,7 @@ proc subscribeAttestationSubnets*(
|
|||
|
||||
proc unsubscribeAttestationSubnets*(
|
||||
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
||||
# Nimbus won't score attestation subnets for now; we just rely on block and
|
||||
# aggregate which are more stable and reliable
|
||||
|
||||
|
@ -2551,7 +2551,7 @@ proc unsubscribeAttestationSubnets*(
|
|||
node.unsubscribe(getAttestationTopic(forkDigest, SubnetId(subnet_id)))
|
||||
|
||||
proc updateStabilitySubnetMetadata*(node: Eth2Node, attnets: AttnetBits) =
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#metadata
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#metadata
|
||||
if node.metadata.attnets == attnets:
|
||||
return
|
||||
|
||||
|
|
|
@ -1663,7 +1663,7 @@ proc installMessageValidators(node: BeaconNode) =
|
|||
MsgSource.gossip, attestation, subnet_id)))
|
||||
|
||||
# beacon_aggregate_and_proof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||
node.network.addAsyncValidator(
|
||||
getAggregateAndProofsTopic(digest), proc (
|
||||
signedAggregateAndProof: SignedAggregateAndProof
|
||||
|
@ -1683,7 +1683,7 @@ proc installMessageValidators(node: BeaconNode) =
|
|||
MsgSource.gossip, attesterSlashing)))
|
||||
|
||||
# proposer_slashing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#proposer_slashing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#proposer_slashing
|
||||
node.network.addValidator(
|
||||
getProposerSlashingsTopic(digest), proc (
|
||||
proposerSlashing: ProposerSlashing
|
||||
|
@ -1693,7 +1693,7 @@ proc installMessageValidators(node: BeaconNode) =
|
|||
MsgSource.gossip, proposerSlashing)))
|
||||
|
||||
# voluntary_exit
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#voluntary_exit
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#voluntary_exit
|
||||
node.network.addValidator(
|
||||
getVoluntaryExitsTopic(digest), proc (
|
||||
signedVoluntaryExit: SignedVoluntaryExit
|
||||
|
@ -1704,7 +1704,7 @@ proc installMessageValidators(node: BeaconNode) =
|
|||
|
||||
when consensusFork >= ConsensusFork.Altair:
|
||||
# sync_committee_{subnet_id}
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/p2p-interface.md#sync_committee_subnet_id
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/p2p-interface.md#sync_committee_subnet_id
|
||||
for subcommitteeIdx in SyncSubcommitteeIndex:
|
||||
closureScope: # Needed for inner `proc`; don't lift it out of loop.
|
||||
let idx = subcommitteeIdx
|
||||
|
|
|
@ -43,7 +43,7 @@ const
|
|||
GENESIS_SLOT* = Slot(0)
|
||||
GENESIS_EPOCH* = Epoch(0) # compute_epoch_at_slot(GENESIS_SLOT)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#constant
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/fork-choice.md#constant
|
||||
INTERVALS_PER_SLOT* = 3
|
||||
|
||||
FAR_FUTURE_BEACON_TIME* = BeaconTime(ns_since_genesis: int64.high())
|
||||
|
@ -136,7 +136,7 @@ const
|
|||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#attesting
|
||||
attestationSlotOffset* = TimeDiff(nanoseconds:
|
||||
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#broadcast-aggregate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#broadcast-aggregate
|
||||
aggregateSlotOffset* = TimeDiff(nanoseconds:
|
||||
NANOSECONDS_PER_SLOT.int64 * 2 div INTERVALS_PER_SLOT)
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#prepare-sync-committee-message
|
||||
|
|
|
@ -336,7 +336,7 @@ template get_total_balance(
|
|||
res += state.validators[validator_index].effective_balance
|
||||
max(EFFECTIVE_BALANCE_INCREMENT, res)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#is_eligible_for_activation_queue
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#is_eligible_for_activation_queue
|
||||
func is_eligible_for_activation_queue*(validator: Validator): bool =
|
||||
## Check if ``validator`` is eligible to be placed into the activation queue.
|
||||
validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH and
|
||||
|
@ -352,7 +352,7 @@ func is_eligible_for_activation*(
|
|||
# Has not yet been activated
|
||||
validator.activation_epoch == FAR_FUTURE_EPOCH
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#is_valid_indexed_attestation
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#is_valid_indexed_attestation
|
||||
proc is_valid_indexed_attestation*(
|
||||
state: ForkyBeaconState, indexed_attestation: SomeIndexedAttestation,
|
||||
flags: UpdateFlags): Result[void, cstring] =
|
||||
|
|
|
@ -34,7 +34,7 @@ type
|
|||
|
||||
static:
|
||||
# Verify that ordinals follow spec values (the spec uses these as shifts for bit flags)
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/altair/beacon-chain.md#participation-flag-indices
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#participation-flag-indices
|
||||
doAssert ord(TIMELY_SOURCE_FLAG_INDEX) == 0
|
||||
doAssert ord(TIMELY_TARGET_FLAG_INDEX) == 1
|
||||
doAssert ord(TIMELY_HEAD_FLAG_INDEX) == 2
|
||||
|
@ -138,13 +138,13 @@ type
|
|||
signature*: ValidatorSig
|
||||
## Signature by the validator(s) over the block root of `slot`
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#contributionandproof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/validator.md#contributionandproof
|
||||
ContributionAndProof* = object
|
||||
aggregator_index*: uint64 # `ValidatorIndex` after validation
|
||||
contribution*: SyncCommitteeContribution
|
||||
selection_proof*: ValidatorSig
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#signedcontributionandproof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/validator.md#signedcontributionandproof
|
||||
SignedContributionAndProof* = object
|
||||
message*: ContributionAndProof
|
||||
signature*: ValidatorSig
|
||||
|
|
|
@ -413,7 +413,7 @@ type
|
|||
aggregate*: Attestation
|
||||
selection_proof*: ValidatorSig
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#signedaggregateandproof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#signedaggregateandproof
|
||||
SignedAggregateAndProof* = object
|
||||
message*: AggregateAndProof
|
||||
signature*: ValidatorSig
|
||||
|
|
|
@ -97,7 +97,7 @@ type
|
|||
ExecutePayload* = proc(
|
||||
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [].}
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/bellatrix/fork-choice.md#powblock
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/bellatrix/fork-choice.md#powblock
|
||||
PowBlock* = object
|
||||
block_hash*: Eth2Digest
|
||||
parent_hash*: Eth2Digest
|
||||
|
|
|
@ -75,5 +75,5 @@ const
|
|||
GOSSIP_MAX_SIZE* = 10'u64 * 1024 * 1024 # bytes
|
||||
MAX_CHUNK_SIZE* = 10'u64 * 1024 * 1024 # bytes
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/p2p-interface.md#configuration
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/p2p-interface.md#configuration
|
||||
MAX_REQUEST_BLOCKS_DENEB*: uint64 = 128 # TODO Make use of in request code
|
||||
|
|
|
@ -33,7 +33,7 @@ const
|
|||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/polynomial-commitments.md#constants
|
||||
BYTES_PER_FIELD_ELEMENT = 32
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/polynomial-commitments.md#constants
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/polynomial-commitments.md#constants
|
||||
BLS_MODULUS* = "52435875175126190479447740508185965837690552500527637822603658699938581184513".u256
|
||||
|
||||
type
|
||||
|
@ -47,7 +47,7 @@ type
|
|||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/beacon-chain.md#custom-types
|
||||
BlobIndex* = uint64
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/polynomial-commitments.md#custom-types
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/polynomial-commitments.md#custom-types
|
||||
Blob* = array[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB, byte]
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/p2p-interface.md#blobsidecar
|
||||
|
@ -108,7 +108,7 @@ type
|
|||
blockValue*: Wei
|
||||
blobsBundle*: BlobsBundle
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/beacon-chain.md#executionpayloadheader
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/beacon-chain.md#executionpayloadheader
|
||||
ExecutionPayloadHeader* = object
|
||||
# Execution block header fields
|
||||
parent_hash*: Eth2Digest
|
||||
|
|
|
@ -73,7 +73,7 @@ type
|
|||
current_justified_checkpoint*: Checkpoint
|
||||
finalized_checkpoint*: Checkpoint
|
||||
|
||||
# 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.4/specs/phase0/beacon-chain.md#get_total_balance
|
||||
TotalBalances* = object
|
||||
# The total effective balance of all active validators during the _current_
|
||||
# epoch.
|
||||
|
|
|
@ -828,7 +828,7 @@ func migratingToDataFork*[
|
|||
upgradedObject.migrateToDataFork(newKind)
|
||||
upgradedObject
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/altair/light-client/full-node.md#block_to_light_client_header
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/light-client/full-node.md#block_to_light_client_header
|
||||
func toAltairLightClientHeader(
|
||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
||||
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
||||
|
|
|
@ -74,7 +74,7 @@ func is_exited_validator*(validator: Validator, epoch: Epoch): bool =
|
|||
func is_withdrawable_validator*(validator: Validator, epoch: Epoch): bool =
|
||||
epoch >= validator.withdrawable_epoch
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#get_active_validator_indices
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#get_active_validator_indices
|
||||
iterator get_active_validator_indices*(state: ForkyBeaconState, epoch: Epoch):
|
||||
ValidatorIndex =
|
||||
for vidx in state.validators.vindices:
|
||||
|
|
|
@ -105,7 +105,7 @@ func getBlobSidecarTopic*(forkDigest: ForkDigest,
|
|||
subnet_id: BlobId): string =
|
||||
eth2Prefix(forkDigest) & "blob_sidecar_" & $subnet_id & "/ssz_snappy"
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/deneb/validator.md#sidecar
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/validator.md#sidecar
|
||||
func compute_subnet_for_blob_sidecar*(blob_index: BlobIndex): BlobId =
|
||||
BlobId(blob_index mod BLOB_SIDECAR_SUBNET_COUNT)
|
||||
|
||||
|
@ -212,7 +212,7 @@ func getSyncSubnets*(
|
|||
if not nodeHasPubkey(pubkey):
|
||||
continue
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#broadcast-sync-committee-message
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/validator.md#broadcast-sync-committee-message
|
||||
# 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
|
||||
# 3.
|
||||
|
|
|
@ -145,7 +145,7 @@ func compute_attestation_signing_root*(
|
|||
fork, DOMAIN_BEACON_ATTESTER, epoch, genesis_validators_root)
|
||||
compute_signing_root(attestation_data, domain)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#aggregate-signature
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#aggregate-signature
|
||||
func get_attestation_signature*(
|
||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||
attestation_data: AttestationData,
|
||||
|
@ -301,7 +301,7 @@ proc verify_sync_committee_selection_proof*(
|
|||
|
||||
blsVerify(pubkey, signing_root.data, signature)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/validator.md#signature
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/validator.md#signature
|
||||
func compute_contribution_and_proof_signing_root*(
|
||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||
msg: ContributionAndProof): Eth2Digest =
|
||||
|
|
|
@ -460,7 +460,7 @@ proc makeBeaconBlock*(
|
|||
transactions_root.get
|
||||
|
||||
when executionPayload is deneb.ExecutionPayloadForSigning:
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#beaconblockbody
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/beacon-chain.md#beaconblockbody
|
||||
forkyState.data.latest_block_header.body_root = hash_tree_root(
|
||||
[hash_tree_root(randao_reveal),
|
||||
hash_tree_root(eth1_data),
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# State transition - block processing, as described in
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/bellatrix/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/capella/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#block-processing
|
||||
#
|
||||
|
|
|
@ -1141,7 +1141,7 @@ func init*(
|
|||
deneb.BeaconState): T =
|
||||
init(result, state)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#epoch-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/altair/beacon-chain.md#epoch-processing
|
||||
proc process_epoch*(
|
||||
cfg: RuntimeConfig,
|
||||
state: var (altair.BeaconState | bellatrix.BeaconState),
|
||||
|
|
|
@ -455,7 +455,7 @@ func get_beacon_proposer_index*(state: ForkedHashedBeaconState,
|
|||
withState(state):
|
||||
get_beacon_proposer_index(forkyState.data, cache, slot)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#aggregation-selection
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#aggregation-selection
|
||||
func is_aggregator*(committee_len: uint64, slot_signature: ValidatorSig): bool =
|
||||
let modulo = max(1'u64, committee_len div TARGET_AGGREGATORS_PER_COMMITTEE)
|
||||
bytes_to_uint64(eth2digest(
|
||||
|
|
|
@ -1479,13 +1479,13 @@ proc signAndSendAggregate(
|
|||
return
|
||||
res.get()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/validator.md#aggregation-selection
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#aggregation-selection
|
||||
if not is_aggregator(
|
||||
shufflingRef, slot, committee_index, selectionProof):
|
||||
return
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/validator.md#construct-aggregate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/validator.md#aggregateandproof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#aggregateandproof
|
||||
var
|
||||
msg = SignedAggregateAndProof(
|
||||
message: AggregateAndProof(
|
||||
|
|
|
@ -33,7 +33,7 @@ import
|
|||
# - https://notes.ethereum.org/@djrtwo/Bkn3zpwxB#Validator-responsibilities
|
||||
#
|
||||
# Phase 0 spec - Honest Validator - how to avoid slashing
|
||||
# - https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#how-to-avoid-slashing
|
||||
# - https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#how-to-avoid-slashing
|
||||
#
|
||||
# In-depth reading on slashing conditions
|
||||
#
|
||||
|
|
|
@ -715,7 +715,7 @@ proc getSyncCommitteeSelectionProof*(v: AttachedValidator, fork: Fork,
|
|||
)
|
||||
await v.signData(request)
|
||||
|
||||
# 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.4/specs/altair/validator.md#broadcast-sync-committee-contribution
|
||||
proc getContributionAndProofSignature*(v: AttachedValidator, fork: Fork,
|
||||
genesis_validators_root: Eth2Digest,
|
||||
contribution_and_proof: ContributionAndProof
|
||||
|
@ -731,7 +731,7 @@ proc getContributionAndProofSignature*(v: AttachedValidator, fork: Fork,
|
|||
fork, genesis_validators_root, contribution_and_proof)
|
||||
await v.signData(request)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/validator.md#randao-reveal
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#randao-reveal
|
||||
proc getEpochSignature*(v: AttachedValidator, fork: Fork,
|
||||
genesis_validators_root: Eth2Digest, epoch: Epoch
|
||||
): Future[SignatureResult] {.async.} =
|
||||
|
@ -755,7 +755,7 @@ proc getEpochSignature*(v: AttachedValidator, fork: Fork,
|
|||
v.epochSignature = Opt.some((epoch, signature.get))
|
||||
signature
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/validator.md#aggregation-selection
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#aggregation-selection
|
||||
proc getSlotSignature*(v: AttachedValidator, fork: Fork,
|
||||
genesis_validators_root: Eth2Digest, slot: Slot
|
||||
): Future[SignatureResult] {.async.} =
|
||||
|
|
|
@ -115,7 +115,7 @@ Logs:
|
|||
|
||||
### Gossip flow out
|
||||
|
||||
- After validation in `blockValidator()` in the Eth2Processor by `validateBeaconBlock()` according to spec https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#beacon_block
|
||||
- After validation in `blockValidator()` in the Eth2Processor by `validateBeaconBlock()` according to spec https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/p2p-interface.md#beacon_block
|
||||
- Important: P2P validation is not full verification (state transition and internal cryptographic signatures were not checked)
|
||||
- We jump into libp2p/protocols/pubsub/pubsub.nim in the method `validate(PubSub, message)`
|
||||
- which was called by `rpcHandler(GossipSub, PubSubPeer, RPCMsg)`
|
||||
|
|
|
@ -75,7 +75,7 @@ type
|
|||
rewards*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||
penalties*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.3/specs/phase0/validator.md#eth1block
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/validator.md#eth1block
|
||||
Eth1Block* = object
|
||||
timestamp*: uint64
|
||||
deposit_root*: Eth2Digest
|
||||
|
|
Loading…
Reference in New Issue