consensus spec ref URL updates (#4496)
This commit is contained in:
parent
5a03e7400e
commit
4f9064a153
|
@ -5,7 +5,7 @@ This folder holds the various consensus object pools needed for a blockchain cli
|
||||||
Object in those pools have passed the "gossip validation" filter according
|
Object in those pools have passed the "gossip validation" filter according
|
||||||
to specs:
|
to specs:
|
||||||
- blocks: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#beacon_block
|
- blocks: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#beacon_block
|
||||||
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
- aggregate attestations: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||||
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
- unaggregated attestation: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||||
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#voluntary_exit
|
- voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#voluntary_exit
|
||||||
- Attester slashings: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#attester_slashing
|
- Attester slashings: https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#attester_slashing
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Fork choice implementations
|
# Fork choice implementations
|
||||||
|
|
||||||
References:
|
References:
|
||||||
- https://github.com/ethereum/consensus-specs/blob/v0.11.1/specs/phase0/fork-choice.md
|
- https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/fork-choice.md
|
||||||
- https://github.com/protolambda/lmd-ghost
|
- https://github.com/protolambda/lmd-ghost
|
||||||
|
|
|
@ -809,7 +809,7 @@ proc updateBlocksGossipStatus*(
|
||||||
newGossipForks = targetGossipState - currentGossipState
|
newGossipForks = targetGossipState - currentGossipState
|
||||||
oldGossipForks = currentGossipState - targetGossipState
|
oldGossipForks = currentGossipState - targetGossipState
|
||||||
|
|
||||||
discard $eip4844ImplementationMissing & ": for EIP4844, https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/p2p-interface.md#beacon_block notes use beacon_block_and_blobs_sidecar rather than beacon_block"
|
discard $eip4844ImplementationMissing & ": for EIP4844, https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/p2p-interface.md#beacon_block notes use beacon_block_and_blobs_sidecar rather than beacon_block"
|
||||||
for gossipFork in oldGossipForks:
|
for gossipFork in oldGossipForks:
|
||||||
let forkDigest = node.dag.forkDigests[].atStateFork(gossipFork)
|
let forkDigest = node.dag.forkDigests[].atStateFork(gossipFork)
|
||||||
node.network.unsubscribe(getBeaconBlocksTopic(forkDigest))
|
node.network.unsubscribe(getBeaconBlocksTopic(forkDigest))
|
||||||
|
|
|
@ -222,7 +222,7 @@ iterator slots*(epoch: Epoch): Slot =
|
||||||
for slot in start_slot ..< start_slot + SLOTS_PER_EPOCH:
|
for slot in start_slot ..< start_slot + SLOTS_PER_EPOCH:
|
||||||
yield slot
|
yield slot
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.2.0/specs/altair/validator.md#sync-committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/altair/validator.md#sync-committee
|
||||||
template sync_committee_period*(epoch: Epoch): SyncCommitteePeriod =
|
template sync_committee_period*(epoch: Epoch): SyncCommitteePeriod =
|
||||||
if epoch == FAR_FUTURE_EPOCH: FAR_FUTURE_PERIOD
|
if epoch == FAR_FUTURE_EPOCH: FAR_FUTURE_PERIOD
|
||||||
else: SyncCommitteePeriod(epoch div EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
else: SyncCommitteePeriod(epoch div EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
||||||
|
|
|
@ -839,7 +839,7 @@ func is_partially_withdrawable_validator(
|
||||||
has_eth1_withdrawal_credential(validator) and
|
has_eth1_withdrawal_credential(validator) and
|
||||||
has_max_effective_balance and has_excess_balance
|
has_max_effective_balance and has_excess_balance
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/capella/beacon-chain.md#new-get_expected_withdrawals
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#new-get_expected_withdrawals
|
||||||
func get_expected_withdrawals*(
|
func get_expected_withdrawals*(
|
||||||
state: capella.BeaconState | eip4844.BeaconState): seq[Withdrawal] =
|
state: capella.BeaconState | eip4844.BeaconState): seq[Withdrawal] =
|
||||||
let
|
let
|
||||||
|
|
|
@ -37,13 +37,13 @@ type
|
||||||
address*: ExecutionAddress
|
address*: ExecutionAddress
|
||||||
amount*: Gwei
|
amount*: Gwei
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/capella/beacon-chain.md#blstoexecutionchange
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#blstoexecutionchange
|
||||||
BLSToExecutionChange* = object
|
BLSToExecutionChange* = object
|
||||||
validator_index*: uint64
|
validator_index*: uint64
|
||||||
from_bls_pubkey*: ValidatorPubKey
|
from_bls_pubkey*: ValidatorPubKey
|
||||||
to_execution_address*: ExecutionAddress
|
to_execution_address*: ExecutionAddress
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#signedblstoexecutionchange
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#signedblstoexecutionchange
|
||||||
SignedBLSToExecutionChange* = object
|
SignedBLSToExecutionChange* = object
|
||||||
message*: BLSToExecutionChange
|
message*: BLSToExecutionChange
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
@ -55,7 +55,7 @@ type
|
||||||
block_summary_root*: Eth2Digest
|
block_summary_root*: Eth2Digest
|
||||||
state_summary_root*: Eth2Digest
|
state_summary_root*: Eth2Digest
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#executionpayload
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#executionpayload
|
||||||
ExecutionPayload* = object
|
ExecutionPayload* = object
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
||||||
|
@ -75,7 +75,7 @@ type
|
||||||
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
||||||
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD] # [New in Capella]
|
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD] # [New in Capella]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#executionpayloadheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#executionpayloadheader
|
||||||
ExecutionPayloadHeader* = object
|
ExecutionPayloadHeader* = object
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress
|
fee_recipient*: ExecutionAddress
|
||||||
|
|
|
@ -10,7 +10,7 @@ type
|
||||||
Epoch* = distinct uint64
|
Epoch* = distinct uint64
|
||||||
SyncCommitteePeriod* = distinct uint64
|
SyncCommitteePeriod* = distinct uint64
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#custom-types
|
||||||
WithdrawalIndex* = uint64
|
WithdrawalIndex* = uint64
|
||||||
|
|
||||||
DomainType* = distinct array[4, byte]
|
DomainType* = distinct array[4, byte]
|
||||||
|
@ -36,7 +36,7 @@ const
|
||||||
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF* = DomainType([byte 0x08, 0x00, 0x00, 0x00])
|
DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF* = DomainType([byte 0x08, 0x00, 0x00, 0x00])
|
||||||
DOMAIN_CONTRIBUTION_AND_PROOF* = DomainType([byte 0x09, 0x00, 0x00, 0x00])
|
DOMAIN_CONTRIBUTION_AND_PROOF* = DomainType([byte 0x09, 0x00, 0x00, 0x00])
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#domain-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#domain-types
|
||||||
DOMAIN_BLS_TO_EXECUTION_CHANGE* = DomainType([byte 0x0a, 0x00, 0x00, 0x00])
|
DOMAIN_BLS_TO_EXECUTION_CHANGE* = DomainType([byte 0x0a, 0x00, 0x00, 0x00])
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/bellatrix/beacon-chain.md#transition-settings
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/bellatrix/beacon-chain.md#transition-settings
|
||||||
|
|
|
@ -27,13 +27,13 @@ import
|
||||||
export json_serialization, base
|
export json_serialization, base
|
||||||
|
|
||||||
const
|
const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/polynomial-commitments.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/polynomial-commitments.md#constants
|
||||||
BYTES_PER_FIELD_ELEMENT = 32
|
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-alpha.1/specs/eip4844/beacon-chain.md#blob
|
||||||
BLOB_TX_TYPE* = 0x05'u8
|
BLOB_TX_TYPE* = 0x05'u8
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/eip4844/polynomial-commitments.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/polynomial-commitments.md#constants
|
||||||
BLS_MODULUS* = "52435875175126190479447740508185965837690552500527637822603658699938581184513".u256
|
BLS_MODULUS* = "52435875175126190479447740508185965837690552500527637822603658699938581184513".u256
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/p2p-interface.md#configuration
|
# 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
|
MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS* = 4096'u64
|
||||||
|
@ -62,7 +62,7 @@ type
|
||||||
beacon_block*: SignedBeaconBlock
|
beacon_block*: SignedBeaconBlock
|
||||||
blobs_sidecar*: BlobsSidecar
|
blobs_sidecar*: BlobsSidecar
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/beacon-chain.md#executionpayload
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/beacon-chain.md#executionpayload
|
||||||
ExecutionPayload* = object
|
ExecutionPayload* = object
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
||||||
|
@ -83,7 +83,7 @@ type
|
||||||
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
||||||
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
|
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/eip4844/beacon-chain.md#executionpayloadheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/beacon-chain.md#executionpayloadheader
|
||||||
ExecutionPayloadHeader* = object
|
ExecutionPayloadHeader* = object
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress
|
fee_recipient*: ExecutionAddress
|
||||||
|
|
|
@ -19,7 +19,7 @@ export base
|
||||||
const
|
const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/phase0/p2p-interface.md#topics-and-messages
|
||||||
# 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.0/specs/capella/p2p-interface.md#topics-and-messages
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/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"
|
||||||
|
@ -108,7 +108,7 @@ func getSyncCommitteeContributionAndProofTopic*(forkDigest: ForkDigest): string
|
||||||
## For subscribing and unsubscribing to/from a subnet.
|
## For subscribing and unsubscribing to/from a subnet.
|
||||||
eth2Prefix(forkDigest) & "sync_committee_contribution_and_proof/ssz_snappy"
|
eth2Prefix(forkDigest) & "sync_committee_contribution_and_proof/ssz_snappy"
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/light-client/p2p-interface.md#light_client_finality_update
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/altair/light-client/p2p-interface.md#light_client_finality_update
|
||||||
func getLightClientFinalityUpdateTopic*(forkDigest: ForkDigest): string =
|
func getLightClientFinalityUpdateTopic*(forkDigest: ForkDigest): string =
|
||||||
## For broadcasting or obtaining the latest `LightClientFinalityUpdate`.
|
## For broadcasting or obtaining the latest `LightClientFinalityUpdate`.
|
||||||
eth2Prefix(forkDigest) & "light_client_finality_update/ssz_snappy"
|
eth2Prefix(forkDigest) & "light_client_finality_update/ssz_snappy"
|
||||||
|
|
|
@ -370,7 +370,7 @@ proc verify_builder_signature*(
|
||||||
let signing_root = compute_builder_signing_root(fork, msg)
|
let signing_root = compute_builder_signing_root(fork, msg)
|
||||||
blsVerify(pubkey, signing_root.data, signature)
|
blsVerify(pubkey, signing_root.data, signature)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/capella/beacon-chain.md#new-process_bls_to_execution_change
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#new-process_bls_to_execution_change
|
||||||
func compute_bls_to_execution_change_signing_root(
|
func compute_bls_to_execution_change_signing_root(
|
||||||
fork: Fork, genesis_validators_root: Eth2Digest,
|
fork: Fork, genesis_validators_root: Eth2Digest,
|
||||||
epoch: Epoch, msg: BLSToExecutionChange): Eth2Digest =
|
epoch: Epoch, msg: BLSToExecutionChange): Eth2Digest =
|
||||||
|
|
|
@ -571,7 +571,7 @@ proc process_execution_payload*(
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.0/specs/capella/beacon-chain.md#modified-process_execution_payload
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/capella/beacon-chain.md#modified-process_execution_payload
|
||||||
proc process_execution_payload*(
|
proc process_execution_payload*(
|
||||||
state: var capella.BeaconState, payload: capella.ExecutionPayload,
|
state: var capella.BeaconState, payload: capella.ExecutionPayload,
|
||||||
notify_new_payload: capella.ExecutePayload): Result[void, cstring] =
|
notify_new_payload: capella.ExecutePayload): Result[void, cstring] =
|
||||||
|
@ -614,7 +614,7 @@ proc process_execution_payload*(
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/beacon-chain.md#process_execution_payload
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/beacon-chain.md#process_execution_payload
|
||||||
proc process_execution_payload*(
|
proc process_execution_payload*(
|
||||||
state: var eip4844.BeaconState, payload: eip4844.ExecutionPayload,
|
state: var eip4844.BeaconState, payload: eip4844.ExecutionPayload,
|
||||||
notify_new_payload: eip4844.ExecutePayload): Result[void, cstring] =
|
notify_new_payload: eip4844.ExecutePayload): Result[void, cstring] =
|
||||||
|
@ -700,7 +700,7 @@ func process_withdrawals*(
|
||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/beacon-chain.md#tx_peek_blob_versioned_hashes
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/beacon-chain.md#tx_peek_blob_versioned_hashes
|
||||||
func tx_peek_blob_versioned_hashes(opaque_tx: Transaction):
|
func tx_peek_blob_versioned_hashes(opaque_tx: Transaction):
|
||||||
Result[seq[VersionedHash], cstring] =
|
Result[seq[VersionedHash], cstring] =
|
||||||
## This function retrieves the hashes from the `SignedBlobTransaction` as
|
## This function retrieves the hashes from the `SignedBlobTransaction` as
|
||||||
|
@ -729,7 +729,7 @@ func tx_peek_blob_versioned_hashes(opaque_tx: Transaction):
|
||||||
res.add versionedHash
|
res.add versionedHash
|
||||||
ok res
|
ok res
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/eip4844/beacon-chain.md#kzg_commitment_to_versioned_hash
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.0/specs/eip4844/beacon-chain.md#kzg_commitment_to_versioned_hash
|
||||||
func kzg_commitment_to_versioned_hash(
|
func kzg_commitment_to_versioned_hash(
|
||||||
kzg_commitment: eip4844.KZGCommitment): VersionedHash =
|
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-alpha.2/specs/eip4844/beacon-chain.md#blob
|
||||||
|
|
Loading…
Reference in New Issue