consensus spec ref URL updates to v1.3.0-rc.2 (#4626)
This commit is contained in:
parent
218ea42220
commit
b7c3037f01
|
@ -26,7 +26,7 @@ type
|
|||
## which blocks are valid - in particular, blocks are not valid if they
|
||||
## come from the future as seen from the local clock.
|
||||
##
|
||||
## https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/phase0/fork-choice.md#fork-choice
|
||||
## https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/phase0/fork-choice.md#fork-choice
|
||||
##
|
||||
# TODO consider NTP and network-adjusted timestamps as outlined here:
|
||||
# https://ethresear.ch/t/network-adjusted-timestamps/4187
|
||||
|
|
|
@ -813,19 +813,19 @@ func get_next_sync_committee_keys(
|
|||
i += 1'u64
|
||||
res
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#has_eth1_withdrawal_credential
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#has_eth1_withdrawal_credential
|
||||
func has_eth1_withdrawal_credential(validator: Validator): bool =
|
||||
## Check if ``validator`` has an 0x01 prefixed "eth1" withdrawal credential.
|
||||
validator.withdrawal_credentials.data[0] == ETH1_ADDRESS_WITHDRAWAL_PREFIX
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#is_fully_withdrawable_validator
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#is_fully_withdrawable_validator
|
||||
func is_fully_withdrawable_validator(
|
||||
validator: Validator, balance: Gwei, epoch: Epoch): bool =
|
||||
## Check if ``validator`` is fully withdrawable.
|
||||
has_eth1_withdrawal_credential(validator) and
|
||||
validator.withdrawable_epoch <= epoch and balance > 0
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#is_partially_withdrawable_validator
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#is_partially_withdrawable_validator
|
||||
func is_partially_withdrawable_validator(
|
||||
validator: Validator, balance: Gwei): bool =
|
||||
## Check if ``validator`` is partially withdrawable.
|
||||
|
@ -836,7 +836,7 @@ func is_partially_withdrawable_validator(
|
|||
has_eth1_withdrawal_credential(validator) and
|
||||
has_max_effective_balance and has_excess_balance
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#new-get_expected_withdrawals
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#new-get_expected_withdrawals
|
||||
func get_expected_withdrawals*(
|
||||
state: capella.BeaconState | eip4844.BeaconState): seq[Withdrawal] =
|
||||
let
|
||||
|
|
|
@ -42,7 +42,7 @@ const
|
|||
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 16
|
||||
SYNC_COMMITTEE_SUBNET_COUNT* = 4
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/altair/light-client/sync-protocol.md#constants
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/altair/light-client/sync-protocol.md#constants
|
||||
# All of these indices are rooted in `BeaconState`.
|
||||
# The first member (`genesis_time`) is 32, subsequent members +1 each.
|
||||
# If there are ever more than 32 members in `BeaconState`, indices change!
|
||||
|
|
|
@ -205,7 +205,7 @@ type
|
|||
## safety threshold)
|
||||
current_max_active_participants*: uint64
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#beaconstate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#beaconstate
|
||||
BeaconState* = object
|
||||
# Versioning
|
||||
genesis_time*: uint64
|
||||
|
|
|
@ -10,7 +10,7 @@ type
|
|||
Epoch* = distinct uint64
|
||||
SyncCommitteePeriod* = distinct uint64
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#custom-types
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#custom-types
|
||||
WithdrawalIndex* = uint64
|
||||
|
||||
DomainType* = distinct array[4, byte]
|
||||
|
@ -36,7 +36,7 @@ const
|
|||
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF* = DomainType([byte 0x08, 0x00, 0x00, 0x00])
|
||||
DOMAIN_CONTRIBUTION_AND_PROOF* = DomainType([byte 0x09, 0x00, 0x00, 0x00])
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#domain-types
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#domain-types
|
||||
DOMAIN_BLS_TO_EXECUTION_CHANGE* = DomainType([byte 0x0a, 0x00, 0x00, 0x00])
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/bellatrix/beacon-chain.md#transition-settings
|
||||
|
|
|
@ -27,13 +27,13 @@ import
|
|||
export json_serialization, base
|
||||
|
||||
const
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/polynomial-commitments.md#constants
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/polynomial-commitments.md#constants
|
||||
BYTES_PER_FIELD_ELEMENT = 32
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/beacon-chain.md#blob
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#blob
|
||||
BLOB_TX_TYPE* = 0x05'u8
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/polynomial-commitments.md#constants
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/polynomial-commitments.md#constants
|
||||
BLS_MODULUS* = "52435875175126190479447740508185965837690552500527637822603658699938581184513".u256
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/p2p-interface.md#configuration
|
||||
MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS* = 4096'u64
|
||||
|
|
|
@ -230,7 +230,7 @@ func get_safety_threshold*(store: ForkyLightClientStore): uint64 =
|
|||
store.current_max_active_participants
|
||||
) div 2
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.0/specs/altair/light-client/sync-protocol.md#is_better_update
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/altair/light-client/sync-protocol.md#is_better_update
|
||||
type LightClientUpdateMetadata* = object
|
||||
attested_slot*, finalized_slot*, signature_slot*: Slot
|
||||
has_sync_committee*, has_finality*: bool
|
||||
|
|
|
@ -61,11 +61,11 @@ func getAttesterSlashingsTopic*(forkDigest: ForkDigest): string =
|
|||
func getAggregateAndProofsTopic*(forkDigest: ForkDigest): string =
|
||||
eth2Prefix(forkDigest) & topicAggregateAndProofsSuffix
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/p2p-interface.md#topics-and-messages
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/p2p-interface.md#topics-and-messages
|
||||
func getBlsToExecutionChangeTopic*(forkDigest: ForkDigest): string =
|
||||
eth2Prefix(forkDigest) & topicBlsToExecutionChangeSuffix
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/p2p-interface.md#topics-and-messages
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/p2p-interface.md#topics-and-messages
|
||||
func getBeaconBlockAndBlobsSidecarTopic*(forkDigest: ForkDigest): string =
|
||||
eth2Prefix(forkDigest) & topicBeaconBlockAndBlobsSidecarTopicSuffix
|
||||
|
||||
|
@ -102,7 +102,7 @@ func getSyncCommitteeContributionAndProofTopic*(forkDigest: ForkDigest): string
|
|||
## For subscribing and unsubscribing to/from a subnet.
|
||||
eth2Prefix(forkDigest) & "sync_committee_contribution_and_proof/ssz_snappy"
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/altair/light-client/p2p-interface.md#light_client_finality_update
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/altair/light-client/p2p-interface.md#light_client_finality_update
|
||||
func getLightClientFinalityUpdateTopic*(forkDigest: ForkDigest): string =
|
||||
## For broadcasting or obtaining the latest `LightClientFinalityUpdate`.
|
||||
eth2Prefix(forkDigest) & "light_client_finality_update/ssz_snappy"
|
||||
|
|
|
@ -664,7 +664,7 @@ proc process_execution_payload*(
|
|||
|
||||
ok()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#new-process_withdrawals
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#new-process_withdrawals
|
||||
func process_withdrawals*(
|
||||
state: var (capella.BeaconState | eip4844.BeaconState),
|
||||
payload: capella.ExecutionPayload | eip4844.ExecutionPayload):
|
||||
|
@ -738,7 +738,7 @@ func tx_peek_blob_versioned_hashes(opaque_tx: Transaction):
|
|||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#kzg_commitment_to_versioned_hash
|
||||
func kzg_commitment_to_versioned_hash(
|
||||
kzg_commitment: eip4844.KZGCommitment): VersionedHash =
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/eip4844/beacon-chain.md#blob
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#blob
|
||||
const VERSIONED_HASH_VERSION_KZG = 0x01'u8
|
||||
|
||||
var res: VersionedHash
|
||||
|
@ -746,7 +746,7 @@ func kzg_commitment_to_versioned_hash(
|
|||
res[1 .. 31] = eth2digest(kzg_commitment).data.toOpenArray(1, 31)
|
||||
res
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/eip4844/beacon-chain.md#verify_kzg_commitments_against_transactions
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#verify_kzg_commitments_against_transactions
|
||||
func verify_kzg_commitments_against_transactions*(
|
||||
transactions: seq[Transaction],
|
||||
kzg_commitments: seq[eip4844.KZGCommitment]): bool =
|
||||
|
@ -884,7 +884,7 @@ proc process_block*(
|
|||
|
||||
ok()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/capella/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#block-processing
|
||||
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
|
||||
type SomeCapellaBlock =
|
||||
capella.BeaconBlock | capella.SigVerifiedBeaconBlock | capella.TrustedBeaconBlock
|
||||
|
|
|
@ -1176,7 +1176,7 @@ proc process_epoch*(
|
|||
|
||||
ok()
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#epoch-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#epoch-processing
|
||||
proc process_epoch*(
|
||||
cfg: RuntimeConfig,
|
||||
state: var (capella.BeaconState | eip4844.BeaconState),
|
||||
|
|
|
@ -170,7 +170,7 @@ proc doRequest(
|
|||
raise newException(ResponseError, "Invalid context bytes")
|
||||
return response
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/altair/light-client/p2p-interface.md#getlightclientfinalityupdate
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/altair/light-client/p2p-interface.md#getlightclientfinalityupdate
|
||||
proc doRequest(
|
||||
e: typedesc[FinalityUpdate],
|
||||
peer: Peer
|
||||
|
|
|
@ -27,7 +27,7 @@ const
|
|||
|
||||
blockResponseCost = allowedOpsPerSecondCost(64) # Allow syncing ~64 blocks/sec (minus request costs)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.0/specs/altair/light-client/p2p-interface.md#configuration
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/altair/light-client/p2p-interface.md#configuration
|
||||
MAX_REQUEST_LIGHT_CLIENT_UPDATES* = 128
|
||||
lightClientBootstrapResponseCost = allowedOpsPerSecondCost(1)
|
||||
## Only one bootstrap per peer should ever be needed - no need to allow more
|
||||
|
@ -445,7 +445,7 @@ p2pProtocol BeaconSync(version = 1,
|
|||
debug "Block root request done",
|
||||
peer, roots = blockRoots.len, count, found
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/p2p-interface.md#beaconblockandblobssidecarbyroot-v1
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/p2p-interface.md#beaconblockandblobssidecarbyroot-v1
|
||||
proc beaconBlockAndBlobsSidecarByRoot_v1(
|
||||
peer: Peer,
|
||||
# Please note that the SSZ list here ensures that the
|
||||
|
|
Loading…
Reference in New Issue