update consensus layer spec ref URLs to v1.2.0-rc.3 (#4117)
This commit is contained in:
parent
02a99543c6
commit
80f44f4491
|
@ -295,7 +295,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.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
|
||||||
# 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
|
||||||
|
|
|
@ -2124,7 +2124,7 @@ proc getPersistentNetKeys*(
|
||||||
|
|
||||||
func gossipId(
|
func gossipId(
|
||||||
data: openArray[byte], phase0Prefix, topic: string): seq[byte] =
|
data: openArray[byte], phase0Prefix, topic: string): seq[byte] =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#topics-and-messages
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/p2p-interface.md#topics-and-messages
|
||||||
const
|
const
|
||||||
MESSAGE_DOMAIN_INVALID_SNAPPY = [0x00'u8, 0x00, 0x00, 0x00]
|
MESSAGE_DOMAIN_INVALID_SNAPPY = [0x00'u8, 0x00, 0x00, 0x00]
|
||||||
|
@ -2411,7 +2411,7 @@ proc broadcast(node: Eth2Node, topic: string, msg: auto):
|
||||||
|
|
||||||
proc subscribeAttestationSubnets*(
|
proc subscribeAttestationSubnets*(
|
||||||
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
||||||
# Nimbus won't score attestation subnets for now, we just rely on block and
|
# Nimbus won't score attestation subnets for now, we just rely on block and
|
||||||
# aggregate which are more stable and reliable
|
# aggregate which are more stable and reliable
|
||||||
|
|
||||||
|
@ -2422,7 +2422,7 @@ proc subscribeAttestationSubnets*(
|
||||||
|
|
||||||
proc unsubscribeAttestationSubnets*(
|
proc unsubscribeAttestationSubnets*(
|
||||||
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
node: Eth2Node, subnets: AttnetBits, forkDigest: ForkDigest) =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
||||||
# Nimbus won't score attestation subnets for now; we just rely on block and
|
# Nimbus won't score attestation subnets for now; we just rely on block and
|
||||||
# aggregate which are more stable and reliable
|
# aggregate which are more stable and reliable
|
||||||
|
|
||||||
|
@ -2431,7 +2431,7 @@ proc unsubscribeAttestationSubnets*(
|
||||||
node.unsubscribe(getAttestationTopic(forkDigest, SubnetId(subnet_id)))
|
node.unsubscribe(getAttestationTopic(forkDigest, SubnetId(subnet_id)))
|
||||||
|
|
||||||
proc updateStabilitySubnetMetadata*(node: Eth2Node, attnets: AttnetBits) =
|
proc updateStabilitySubnetMetadata*(node: Eth2Node, attnets: AttnetBits) =
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#metadata
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#metadata
|
||||||
if node.metadata.attnets == attnets:
|
if node.metadata.attnets == attnets:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,7 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
to0xHex(DOMAIN_CONTRIBUTION_AND_PROOF.data),
|
to0xHex(DOMAIN_CONTRIBUTION_AND_PROOF.data),
|
||||||
# PARTICIPATION_FLAG_WEIGHTS
|
# PARTICIPATION_FLAG_WEIGHTS
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#constants
|
||||||
TARGET_AGGREGATORS_PER_COMMITTEE:
|
TARGET_AGGREGATORS_PER_COMMITTEE:
|
||||||
Base10.toString(TARGET_AGGREGATORS_PER_COMMITTEE),
|
Base10.toString(TARGET_AGGREGATORS_PER_COMMITTEE),
|
||||||
RANDOM_SUBNETS_PER_VALIDATOR:
|
RANDOM_SUBNETS_PER_VALIDATOR:
|
||||||
|
|
|
@ -137,7 +137,7 @@ template `+`*(a: TimeDiff, b: Duration): TimeDiff =
|
||||||
const
|
const
|
||||||
# Offsets from the start of the slot to when the corresponding message should
|
# Offsets from the start of the slot to when the corresponding message should
|
||||||
# be sent
|
# be sent
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#attesting
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#attesting
|
||||||
attestationSlotOffset* = TimeDiff(nanoseconds:
|
attestationSlotOffset* = 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.2.0-rc.1/specs/phase0/validator.md#broadcast-aggregate
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#broadcast-aggregate
|
||||||
|
|
|
@ -148,13 +148,13 @@ func get_slashing_penalty*(state: ForkyBeaconState,
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
||||||
func get_whistleblower_reward*(validator_effective_balance: Gwei): Gwei =
|
func get_whistleblower_reward*(validator_effective_balance: Gwei): Gwei =
|
||||||
validator_effective_balance div WHISTLEBLOWER_REWARD_QUOTIENT
|
validator_effective_balance div WHISTLEBLOWER_REWARD_QUOTIENT
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/beacon-chain.md#slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/beacon-chain.md#slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/beacon-chain.md#modified-slash_validator
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#modified-slash_validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.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
|
||||||
|
|
|
@ -94,7 +94,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.2.0-rc.1/specs/altair/validator.md#synccommitteemessage
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.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
|
||||||
|
|
|
@ -449,7 +449,7 @@ type
|
||||||
withdrawable_epoch*: Epoch
|
withdrawable_epoch*: Epoch
|
||||||
## When validator can withdraw or transfer funds
|
## When validator can withdraw or transfer funds
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#eth2-field
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#eth2-field
|
||||||
ENRForkID* = object
|
ENRForkID* = object
|
||||||
fork_digest*: ForkDigest
|
fork_digest*: ForkDigest
|
||||||
next_fork_version*: Version
|
next_fork_version*: Version
|
||||||
|
|
|
@ -313,7 +313,7 @@ func is_merge_transition_complete*(state: bellatrix.BeaconState): bool =
|
||||||
const defaultExecutionPayloadHeader = default(ExecutionPayloadHeader)
|
const defaultExecutionPayloadHeader = default(ExecutionPayloadHeader)
|
||||||
state.latest_execution_payload_header != defaultExecutionPayloadHeader
|
state.latest_execution_payload_header != defaultExecutionPayloadHeader
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/sync/optimistic.md#helpers
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/sync/optimistic.md#helpers
|
||||||
func is_execution_block*(blck: SomeForkyBeaconBlock): bool =
|
func is_execution_block*(blck: SomeForkyBeaconBlock): bool =
|
||||||
when typeof(blck).toFork >= BeaconBlockFork.Bellatrix:
|
when typeof(blck).toFork >= BeaconBlockFork.Bellatrix:
|
||||||
const defaultExecutionPayload =
|
const defaultExecutionPayload =
|
||||||
|
|
|
@ -200,7 +200,7 @@ func getSyncSubnets*(
|
||||||
if not nodeHasPubkey(pubkey):
|
if not nodeHasPubkey(pubkey):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/validator.md#broadcast-sync-committee-message
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.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.
|
||||||
|
|
|
@ -247,7 +247,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.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
|
||||||
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 =
|
||||||
|
@ -282,7 +282,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.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 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 =
|
||||||
|
|
|
@ -897,7 +897,7 @@ func get_slashing_penalty*(validator: Validator,
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/beacon-chain.md#slashings
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#slashings
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.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)
|
||||||
|
|
|
@ -298,7 +298,7 @@ p2pProtocol BeaconSync(version = 1,
|
||||||
|
|
||||||
if startSlot.epoch >= dag.cfg.ALTAIR_FORK_EPOCH:
|
if startSlot.epoch >= dag.cfg.ALTAIR_FORK_EPOCH:
|
||||||
# "Clients MAY limit the number of blocks in the response."
|
# "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#beaconblocksbyrange
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#beaconblocksbyrange
|
||||||
debug "Block range v1 request for post-altair range",
|
debug "Block range v1 request for post-altair range",
|
||||||
peer, startSlot, reqCount, reqStep
|
peer, startSlot, reqCount, reqStep
|
||||||
return
|
return
|
||||||
|
|
|
@ -77,7 +77,7 @@ type
|
||||||
func hash*(x: AggregatorDuty): Hash =
|
func hash*(x: AggregatorDuty): Hash =
|
||||||
hashAllFields(x)
|
hashAllFields(x)
|
||||||
|
|
||||||
# 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
|
||||||
func randomStabilitySubnet(
|
func randomStabilitySubnet(
|
||||||
self: ActionTracker, epoch: Epoch): tuple[subnet_id: SubnetId, expiration: Epoch] =
|
self: ActionTracker, epoch: Epoch): tuple[subnet_id: SubnetId, expiration: Epoch] =
|
||||||
(
|
(
|
||||||
|
@ -147,7 +147,7 @@ proc updateSlot*(tracker: var ActionTracker, wallSlot: Slot) =
|
||||||
# One stability subnet per known validator
|
# One stability subnet per known validator
|
||||||
static: doAssert RANDOM_SUBNETS_PER_VALIDATOR == 1
|
static: doAssert RANDOM_SUBNETS_PER_VALIDATOR == 1
|
||||||
|
|
||||||
# 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
|
||||||
let expectedSubnets =
|
let expectedSubnets =
|
||||||
min(ATTESTATION_SUBNET_COUNT, tracker.knownValidators.len)
|
min(ATTESTATION_SUBNET_COUNT, tracker.knownValidators.len)
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ proc signData(v: AttachedValidator,
|
||||||
else:
|
else:
|
||||||
v.signWithDistributedKey(request)
|
v.signWithDistributedKey(request)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/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,
|
||||||
|
|
Loading…
Reference in New Issue