update consensus layer spec ref URLs to v1.2.0-rc.3 (#4109)
This commit is contained in:
parent
f935f3527b
commit
8be964a152
|
@ -123,7 +123,7 @@ type
|
|||
current_sync_committee*: SyncCommittee # [New in Altair]
|
||||
next_sync_committee*: SyncCommittee # [New in Altair]
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#beaconstate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||
# Memory-representation-equivalent to a Bellatrix BeaconState for in-place SSZ
|
||||
# reading and writing
|
||||
BellatrixBeaconStateNoImmutableValidators* = object
|
||||
|
|
|
@ -536,7 +536,7 @@ proc getAttestationsForBlock*(pool: var AttestationPool,
|
|||
cache: var StateCache): seq[Attestation] =
|
||||
## Retrieve attestations that may be added to a new block at the slot of the
|
||||
## given state
|
||||
## https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#attestations
|
||||
## https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#attestations
|
||||
let newBlockSlot = state.data.slot.uint64
|
||||
|
||||
if newBlockSlot < MIN_ATTESTATION_INCLUSION_DELAY:
|
||||
|
|
|
@ -779,7 +779,7 @@ proc validateAttesterSlashing*(
|
|||
|
||||
ok()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#proposer_slashing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#proposer_slashing
|
||||
proc validateProposerSlashing*(
|
||||
pool: ExitPool, proposer_slashing: ProposerSlashing):
|
||||
Result[void, ValidationError] =
|
||||
|
|
|
@ -783,7 +783,7 @@ func forkDigests(node: BeaconNode): auto =
|
|||
node.dag.forkDigests.bellatrix]
|
||||
forkDigestsArray
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#phase-0-attestation-subnet-stability
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#phase-0-attestation-subnet-stability
|
||||
proc updateAttestationSubnetHandlers(node: BeaconNode, slot: Slot) =
|
||||
if node.gossipState.card == 0:
|
||||
# When disconnected, updateGossipState is responsible for all things
|
||||
|
|
|
@ -143,7 +143,7 @@ const
|
|||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/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.2.0-rc.1/specs/altair/validator.md#prepare-sync-committee-message
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#prepare-sync-committee-message
|
||||
syncCommitteeMessageSlotOffset* = TimeDiff(nanoseconds:
|
||||
NANOSECONDS_PER_SLOT.int64 div INTERVALS_PER_SLOT)
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#broadcast-sync-committee-contribution
|
||||
|
|
|
@ -130,13 +130,13 @@ type
|
|||
signature*: ValidatorSig
|
||||
## Signature by the validator(s) over the block root of `slot`
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/validator.md#contributionandproof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/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.2.0-rc.1/specs/altair/validator.md#signedcontributionandproof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#signedcontributionandproof
|
||||
SignedContributionAndProof* = object
|
||||
message*: ContributionAndProof
|
||||
signature*: ValidatorSig
|
||||
|
|
|
@ -401,7 +401,7 @@ type
|
|||
aggregate*: Attestation
|
||||
selection_proof*: ValidatorSig
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#signedaggregateandproof
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#signedaggregateandproof
|
||||
SignedAggregateAndProof* = object
|
||||
message*: AggregateAndProof
|
||||
signature*: ValidatorSig
|
||||
|
|
|
@ -68,7 +68,7 @@ type
|
|||
block_hash*: Eth2Digest # Hash of execution block
|
||||
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/merge/beacon-chain.md#executionpayloadheader
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#executionpayloadheader
|
||||
ExecutionPayloadHeader* = object
|
||||
parent_hash*: Eth2Digest
|
||||
fee_recipient*: ExecutionAddress
|
||||
|
@ -96,7 +96,7 @@ type
|
|||
parent_hash*: Eth2Digest
|
||||
total_difficulty*: Eth2Digest # uint256
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#beaconstate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#beaconstate
|
||||
BeaconState* = object
|
||||
# Versioning
|
||||
genesis_time*: uint64
|
||||
|
@ -221,7 +221,7 @@ type
|
|||
state_root*: Eth2Digest
|
||||
body*: TrustedBeaconBlockBody
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#beaconblockbody
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#beaconblockbody
|
||||
BeaconBlockBody* = object
|
||||
randao_reveal*: ValidatorSig
|
||||
eth1_data*: Eth1Data
|
||||
|
|
|
@ -322,7 +322,7 @@ func is_execution_block*(blck: SomeForkyBeaconBlock): bool =
|
|||
else:
|
||||
false
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#is_merge_transition_block
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#is_merge_transition_block
|
||||
func is_merge_transition_block(
|
||||
state: bellatrix.BeaconState,
|
||||
body: bellatrix.BeaconBlockBody | bellatrix.TrustedBeaconBlockBody |
|
||||
|
@ -331,7 +331,7 @@ func is_merge_transition_block(
|
|||
not is_merge_transition_complete(state) and
|
||||
body.execution_payload != defaultBellatrixExecutionPayload
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#is_execution_enabled
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#is_execution_enabled
|
||||
func is_execution_enabled*(
|
||||
state: bellatrix.BeaconState,
|
||||
body: bellatrix.BeaconBlockBody | bellatrix.TrustedBeaconBlockBody |
|
||||
|
|
|
@ -1001,7 +1001,7 @@ proc createWallet*(kdfKind: KdfKind,
|
|||
crypto: crypto,
|
||||
nextAccount: nextAccount.get(0))
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v0.12.2/specs/phase0/deposit-contract.md#withdrawal-credentials
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#bls_withdrawal_prefix
|
||||
func makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest =
|
||||
var bytes = eth2digest(k.toRaw())
|
||||
bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8
|
||||
|
|
|
@ -63,12 +63,12 @@ func getAttesterSlashingsTopic*(forkDigest: ForkDigest): string =
|
|||
func getAggregateAndProofsTopic*(forkDigest: ForkDigest): string =
|
||||
eth2Prefix(forkDigest) & topicAggregateAndProofsSuffix
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#broadcast-attestation
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#broadcast-attestation
|
||||
func compute_subnet_for_attestation*(
|
||||
committees_per_slot: uint64, slot: Slot, committee_index: CommitteeIndex):
|
||||
SubnetId =
|
||||
# Compute the correct subnet for an attestation for Phase 0.
|
||||
# Note, this mimics expected Phase 1 behavior where attestations will be
|
||||
## Compute the correct subnet for an attestation for Phase 0.
|
||||
# Note, this mimics expected future behavior where attestations will be
|
||||
# mapped to their shard subnet.
|
||||
let
|
||||
slots_since_epoch_start = slot.since_epoch_start()
|
||||
|
@ -79,7 +79,7 @@ func compute_subnet_for_attestation*(
|
|||
(committees_since_epoch_start + committee_index.asUInt64) mod
|
||||
ATTESTATION_SUBNET_COUNT)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#broadcast-attestation
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#broadcast-attestation
|
||||
func getAttestationTopic*(forkDigest: ForkDigest,
|
||||
subnetId: SubnetId): string =
|
||||
## For subscribing and unsubscribing to/from a subnet.
|
||||
|
@ -181,7 +181,7 @@ func getTargetGossipState*(
|
|||
raiseAssert "Unknown target gossip state"
|
||||
|
||||
func nearSyncCommitteePeriod*(epoch: Epoch): Option[uint64] =
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/validator.md#sync-committee-subnet-stability
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#sync-committee-subnet-stability
|
||||
if epoch.is_sync_committee_period():
|
||||
return some 0'u64
|
||||
let epochsBefore =
|
||||
|
|
|
@ -331,7 +331,7 @@ proc get_contribution_and_proof_signature*(
|
|||
|
||||
blsSign(privkey, signing_root.data)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/validator.md#aggregation-selection
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#aggregation-selection
|
||||
func is_sync_committee_aggregator*(signature: ValidatorSig): bool =
|
||||
let
|
||||
signatureDigest = eth2digest(signature.blob)
|
||||
|
|
|
@ -407,7 +407,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.2.0-rc.1/specs/phase0/validator.md#aggregation-selection
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/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)
|
||||
|
|
|
@ -388,7 +388,7 @@ p2pProtocol BeaconSync(version = 1,
|
|||
if blockRef.slot.epoch >= dag.cfg.ALTAIR_FORK_EPOCH:
|
||||
# Skipping this block should be fine because the spec says:
|
||||
# "Clients MAY limit the number of blocks in the response."
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#beaconblocksbyroot
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#beaconblocksbyroot
|
||||
#
|
||||
# Also, our response would be indistinguishable from a node
|
||||
# that have been synced exactly to the altair transition slot.
|
||||
|
|
|
@ -58,7 +58,7 @@ import
|
|||
# 2. An attester can get slashed for signing
|
||||
# two attestations that together violate
|
||||
# the Casper FFG slashing conditions.
|
||||
# - https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#ffg-vote
|
||||
# - https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#ffg-vote
|
||||
# The "source" is the current_justified_epoch
|
||||
# The "target" is the current_epoch
|
||||
#
|
||||
|
|
|
@ -1152,7 +1152,7 @@ proc signAndSendAggregate(
|
|||
return
|
||||
res.get()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#aggregation-selection
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#aggregation-selection
|
||||
if not is_aggregator(
|
||||
shufflingRef, slot, committee_index, selectionProof):
|
||||
return
|
||||
|
@ -1484,7 +1484,7 @@ proc handleValidatorDuties*(node: BeaconNode, lastSlot, slot: Slot) {.async.} =
|
|||
updateValidatorMetrics(node) # the important stuff is done, update the vanity numbers
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#broadcast-aggregate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/validator.md#broadcast-sync-committee-contribution
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#broadcast-sync-committee-contribution
|
||||
# Wait 2 / 3 of the slot time to allow messages to propagate, then collect
|
||||
# the result in aggregates
|
||||
static:
|
||||
|
|
|
@ -340,7 +340,7 @@ proc getSyncCommitteeMessage*(v: AttachedValidator,
|
|||
)
|
||||
)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/validator.md#aggregation-selection
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#aggregation-selection
|
||||
proc getSyncCommitteeSelectionProof*(v: AttachedValidator, fork: Fork,
|
||||
genesis_validators_root: Eth2Digest,
|
||||
slot: Slot,
|
||||
|
|
|
@ -65,7 +65,7 @@ type
|
|||
rewards*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||
penalties*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#eth1block
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#eth1block
|
||||
Eth1Block* = object
|
||||
timestamp*: uint64
|
||||
deposit_root*: Eth2Digest
|
||||
|
|
Loading…
Reference in New Issue