mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 14:54:12 +00:00
consensus spec URL updates to v1.2.0-rc.3 (#4105)
This commit is contained in:
parent
f21495b9d4
commit
1d620f0123
@ -233,7 +233,7 @@ type
|
|||||||
## committee messages will be rejected
|
## committee messages will be rejected
|
||||||
|
|
||||||
optimisticRoots*: HashSet[Eth2Digest]
|
optimisticRoots*: HashSet[Eth2Digest]
|
||||||
## 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
|
||||||
|
|
||||||
EpochKey* = object
|
EpochKey* = object
|
||||||
## The epoch key fully determines the shuffling for proposers and
|
## The epoch key fully determines the shuffling for proposers and
|
||||||
|
@ -92,7 +92,7 @@ func check_propagation_slot_range(
|
|||||||
let
|
let
|
||||||
pastSlot = (wallTime - MAXIMUM_GOSSIP_CLOCK_DISPARITY).toSlot()
|
pastSlot = (wallTime - MAXIMUM_GOSSIP_CLOCK_DISPARITY).toSlot()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#configuration
|
||||||
# The spec value of ATTESTATION_PROPAGATION_SLOT_RANGE is 32, but it can
|
# The spec value of ATTESTATION_PROPAGATION_SLOT_RANGE is 32, but it can
|
||||||
# retransmit attestations on the cusp of being out of spec, and which by
|
# retransmit attestations on the cusp of being out of spec, and which by
|
||||||
# the time they reach their destination might be out of spec.
|
# the time they reach their destination might be out of spec.
|
||||||
|
@ -171,7 +171,7 @@ type
|
|||||||
MounterProc* = proc(network: Eth2Node) {.gcsafe, raises: [Defect, CatchableError].}
|
MounterProc* = proc(network: Eth2Node) {.gcsafe, raises: [Defect, CatchableError].}
|
||||||
MessageContentPrinter* = proc(msg: pointer): string {.gcsafe, raises: [Defect].}
|
MessageContentPrinter* = proc(msg: pointer): string {.gcsafe, raises: [Defect].}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#goodbye
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/p2p-interface.md#goodbye
|
||||||
DisconnectionReason* = enum
|
DisconnectionReason* = enum
|
||||||
# might see other values on the wire!
|
# might see other values on the wire!
|
||||||
ClientShutDown = 1
|
ClientShutDown = 1
|
||||||
@ -2439,7 +2439,7 @@ proc updateStabilitySubnetMetadata*(node: Eth2Node, attnets: AttnetBits) =
|
|||||||
node.metadata.attnets = attnets
|
node.metadata.attnets = attnets
|
||||||
|
|
||||||
# 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.1/specs/phase0/validator.md#phase-0-attestation-subnet-stability
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#attestation-subnet-bitfield
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/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)
|
||||||
})
|
})
|
||||||
@ -2451,7 +2451,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.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 node.metadata.syncnets == syncnets:
|
if node.metadata.syncnets == syncnets:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1020,7 +1020,7 @@ proc trackNextSyncCommitteeTopics(node: BeaconNode, slot: Slot) =
|
|||||||
|
|
||||||
var newSubcommittees: SyncnetBits
|
var newSubcommittees: SyncnetBits
|
||||||
|
|
||||||
# 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
|
||||||
for subcommitteeIdx in SyncSubcommitteeIndex:
|
for subcommitteeIdx in SyncSubcommitteeIndex:
|
||||||
if (not node.network.metadata.syncnets[subcommitteeIdx]) and
|
if (not node.network.metadata.syncnets[subcommitteeIdx]) and
|
||||||
nextSyncCommitteeSubnets[subcommitteeIdx] and
|
nextSyncCommitteeSubnets[subcommitteeIdx] and
|
||||||
|
@ -146,7 +146,7 @@ const
|
|||||||
# 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.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.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
|
||||||
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.2.0-rc.3/specs/altair/light-client/p2p-interface.md#sync-committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/light-client/p2p-interface.md#sync-committee
|
||||||
|
@ -108,7 +108,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.2.0-rc.1/specs/altair/validator.md#synccommitteecontribution
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#synccommitteecontribution
|
||||||
SyncCommitteeAggregationBits* =
|
SyncCommitteeAggregationBits* =
|
||||||
BitArray[SYNC_SUBCOMMITTEE_SIZE]
|
BitArray[SYNC_SUBCOMMITTEE_SIZE]
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ type
|
|||||||
message*: ContributionAndProof
|
message*: ContributionAndProof
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/validator.md#syncaggregatorselectiondata
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/altair/validator.md#syncaggregatorselectiondata
|
||||||
SyncAggregatorSelectionData* = object
|
SyncAggregatorSelectionData* = object
|
||||||
slot*: Slot
|
slot*: Slot
|
||||||
subcommittee_index*: uint64 # `SyncSubcommitteeIndex` after validation
|
subcommittee_index*: uint64 # `SyncSubcommitteeIndex` after validation
|
||||||
|
@ -38,7 +38,7 @@ const
|
|||||||
NEWPAYLOAD_TIMEOUT* = 8.seconds
|
NEWPAYLOAD_TIMEOUT* = 8.seconds
|
||||||
|
|
||||||
type
|
type
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#custom-types
|
||||||
Transaction* = List[byte, Limit MAX_BYTES_PER_TRANSACTION]
|
Transaction* = List[byte, Limit MAX_BYTES_PER_TRANSACTION]
|
||||||
|
|
||||||
ExecutionAddress* = object
|
ExecutionAddress* = object
|
||||||
@ -90,7 +90,7 @@ type
|
|||||||
ExecutePayload* = proc(
|
ExecutePayload* = proc(
|
||||||
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
|
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/fork-choice.md#powblock
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/fork-choice.md#powblock
|
||||||
PowBlock* = object
|
PowBlock* = object
|
||||||
block_hash*: Eth2Digest
|
block_hash*: Eth2Digest
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
|
@ -131,7 +131,7 @@ type
|
|||||||
|
|
||||||
body*: BeaconBlockBody
|
body*: BeaconBlockBody
|
||||||
|
|
||||||
# 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
|
||||||
MetaData* = object
|
MetaData* = object
|
||||||
seq_number*: uint64
|
seq_number*: uint64
|
||||||
attnets*: AttnetBits
|
attnets*: AttnetBits
|
||||||
|
@ -308,7 +308,7 @@ template is_better_update*[A, B: SomeLightClientUpdate](
|
|||||||
new_update: A, old_update: B): bool =
|
new_update: A, old_update: B): bool =
|
||||||
is_better_data(toMeta(new_update), toMeta(old_update))
|
is_better_data(toMeta(new_update), toMeta(old_update))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#is_merge_transition_complete
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#is_merge_transition_complete
|
||||||
func is_merge_transition_complete*(state: bellatrix.BeaconState): bool =
|
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
|
||||||
@ -338,7 +338,7 @@ func is_execution_enabled*(
|
|||||||
bellatrix.SigVerifiedBeaconBlockBody): bool =
|
bellatrix.SigVerifiedBeaconBlockBody): bool =
|
||||||
is_merge_transition_block(state, body) or is_merge_transition_complete(state)
|
is_merge_transition_block(state, body) or is_merge_transition_complete(state)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/beacon-chain.md#compute_timestamp_at_slot
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/bellatrix/beacon-chain.md#compute_timestamp_at_slot
|
||||||
func compute_timestamp_at_slot*(state: ForkyBeaconState, slot: Slot): uint64 =
|
func compute_timestamp_at_slot*(state: ForkyBeaconState, slot: Slot): uint64 =
|
||||||
# Note: This function is unsafe with respect to overflows and underflows.
|
# Note: This function is unsafe with respect to overflows and underflows.
|
||||||
let slots_since_genesis = slot - GENESIS_SLOT
|
let slots_since_genesis = slot - GENESIS_SLOT
|
||||||
|
@ -17,7 +17,7 @@ import
|
|||||||
export base
|
export base
|
||||||
|
|
||||||
const
|
const
|
||||||
# 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
|
||||||
topicBeaconBlocksSuffix* = "beacon_block/ssz_snappy"
|
topicBeaconBlocksSuffix* = "beacon_block/ssz_snappy"
|
||||||
topicVoluntaryExitsSuffix* = "voluntary_exit/ssz_snappy"
|
topicVoluntaryExitsSuffix* = "voluntary_exit/ssz_snappy"
|
||||||
topicProposerSlashingsSuffix* = "proposer_slashing/ssz_snappy"
|
topicProposerSlashingsSuffix* = "proposer_slashing/ssz_snappy"
|
||||||
|
@ -46,7 +46,7 @@ func compute_slot_signing_root*(
|
|||||||
fork, DOMAIN_SELECTION_PROOF, epoch, genesis_validators_root)
|
fork, DOMAIN_SELECTION_PROOF, epoch, genesis_validators_root)
|
||||||
compute_signing_root(slot, domain)
|
compute_signing_root(slot, domain)
|
||||||
|
|
||||||
# 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 get_slot_signature*(
|
func get_slot_signature*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
||||||
privkey: ValidatorPrivKey): CookedSig =
|
privkey: ValidatorPrivKey): CookedSig =
|
||||||
@ -99,7 +99,7 @@ func compute_block_signing_root*(
|
|||||||
fork, DOMAIN_BEACON_PROPOSER, epoch, genesis_validators_root)
|
fork, DOMAIN_BEACON_PROPOSER, epoch, genesis_validators_root)
|
||||||
compute_signing_root(blck, domain)
|
compute_signing_root(blck, domain)
|
||||||
|
|
||||||
# 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
|
||||||
func get_block_signature*(
|
func get_block_signature*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
||||||
root: Eth2Digest, privkey: ValidatorPrivKey): CookedSig =
|
root: Eth2Digest, privkey: ValidatorPrivKey): CookedSig =
|
||||||
@ -128,7 +128,7 @@ func compute_aggregate_and_proof_signing_root*(
|
|||||||
fork, DOMAIN_AGGREGATE_AND_PROOF, epoch, genesis_validators_root)
|
fork, DOMAIN_AGGREGATE_AND_PROOF, epoch, genesis_validators_root)
|
||||||
compute_signing_root(aggregate_and_proof, domain)
|
compute_signing_root(aggregate_and_proof, domain)
|
||||||
|
|
||||||
# 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.3/specs/phase0/validator.md#broadcast-aggregate
|
||||||
func get_aggregate_and_proof_signature*(fork: Fork, genesis_validators_root: Eth2Digest,
|
func get_aggregate_and_proof_signature*(fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
aggregate_and_proof: AggregateAndProof,
|
aggregate_and_proof: AggregateAndProof,
|
||||||
privkey: ValidatorPrivKey): CookedSig =
|
privkey: ValidatorPrivKey): CookedSig =
|
||||||
@ -156,7 +156,7 @@ func compute_attestation_signing_root*(
|
|||||||
fork, DOMAIN_BEACON_ATTESTER, epoch, genesis_validators_root)
|
fork, DOMAIN_BEACON_ATTESTER, epoch, genesis_validators_root)
|
||||||
compute_signing_root(attestation_data, domain)
|
compute_signing_root(attestation_data, domain)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#aggregate-signature
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#aggregate-signature
|
||||||
func get_attestation_signature*(
|
func get_attestation_signature*(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
attestation_data: AttestationData,
|
attestation_data: AttestationData,
|
||||||
|
@ -878,14 +878,14 @@ func get_adjusted_total_slashing_balance*(
|
|||||||
|
|
||||||
# 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 slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool =
|
func slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool =
|
||||||
validator.slashed and
|
validator.slashed and
|
||||||
epoch + EPOCHS_PER_SLASHINGS_VECTOR div 2 == validator.withdrawable_epoch
|
epoch + EPOCHS_PER_SLASHINGS_VECTOR div 2 == validator.withdrawable_epoch
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.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 get_slashing_penalty*(validator: Validator,
|
func get_slashing_penalty*(validator: Validator,
|
||||||
adjusted_total_slashing_balance,
|
adjusted_total_slashing_balance,
|
||||||
total_balance: Gwei): Gwei =
|
total_balance: Gwei): Gwei =
|
||||||
|
@ -376,7 +376,7 @@ proc getContributionAndProofSignature*(v: AttachedValidator, fork: Fork,
|
|||||||
fork, genesis_validators_root, contribution_and_proof)
|
fork, genesis_validators_root, contribution_and_proof)
|
||||||
await v.signData(request)
|
await v.signData(request)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/validator.md#randao-reveal
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/specs/phase0/validator.md#randao-reveal
|
||||||
proc getEpochSignature*(v: AttachedValidator, fork: Fork,
|
proc getEpochSignature*(v: AttachedValidator, fork: Fork,
|
||||||
genesis_validators_root: Eth2Digest, epoch: Epoch
|
genesis_validators_root: Eth2Digest, epoch: Epoch
|
||||||
): Future[SignatureResult] {.async.} =
|
): Future[SignatureResult] {.async.} =
|
||||||
|
@ -137,7 +137,7 @@ let full_sync_committee_bits = block:
|
|||||||
res.bytes.fill(byte.high)
|
res.bytes.fill(byte.high)
|
||||||
res
|
res
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/tests/core/pyspec/eth2spec/test/helpers/light_client.py#L6-L15
|
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.3/tests/core/pyspec/eth2spec/test/helpers/light_client.py#L20-L29
|
||||||
func initialize_light_client_store(state: auto): LightClientStore =
|
func initialize_light_client_store(state: auto): LightClientStore =
|
||||||
LightClientStore(
|
LightClientStore(
|
||||||
finalized_header: BeaconBlockHeader(),
|
finalized_header: BeaconBlockHeader(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user