finish eip4844 to deneb module rename (#4705)

This commit is contained in:
tersec 2023-03-09 00:34:17 +00:00 committed by GitHub
parent 879f8ab5e8
commit a47f0b054e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 805 additions and 807 deletions

View File

@ -307,7 +307,7 @@ proc newExecutionPayload*(
proc getExecutionValidity( proc getExecutionValidity(
elManager: ELManager, elManager: ELManager,
blck: bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock | blck: bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock |
eip4844.SignedBeaconBlock): deneb.SignedBeaconBlock):
Future[NewPayloadStatus] {.async.} = Future[NewPayloadStatus] {.async.} =
if not blck.message.is_execution_block: if not blck.message.is_execution_block:
return NewPayloadStatus.valid # vacuously return NewPayloadStatus.valid # vacuously

View File

@ -12,7 +12,7 @@ import
stew/results, stew/results,
chronicles, chronos, metrics, taskpools, chronicles, chronos, metrics, taskpools,
../spec/[helpers, forks], ../spec/[helpers, forks],
../spec/datatypes/[altair, phase0, eip4844], ../spec/datatypes/[altair, phase0, deneb],
../consensus_object_pools/[ ../consensus_object_pools/[
block_clearance, block_quarantine, blockchain_dag, exit_pool, attestation_pool, block_clearance, block_quarantine, blockchain_dag, exit_pool, attestation_pool,
light_client_pool, sync_committee_msg_pool], light_client_pool, sync_committee_msg_pool],

View File

@ -791,7 +791,7 @@ func chunkMaxSize[T](): uint32 =
when T is ForkySignedBeaconBlock: when T is ForkySignedBeaconBlock:
when T is phase0.SignedBeaconBlock or T is altair.SignedBeaconBlock or when T is phase0.SignedBeaconBlock or T is altair.SignedBeaconBlock or
T is bellatrix.SignedBeaconBlock or T is capella.SignedBeaconBlock or T is bellatrix.SignedBeaconBlock or T is capella.SignedBeaconBlock or
T is eip4844.SignedBeaconBlock: T is deneb.SignedBeaconBlock:
MAX_CHUNK_SIZE_BELLATRIX MAX_CHUNK_SIZE_BELLATRIX
else: else:
{.fatal: "what's the chunk size here?".} {.fatal: "what's the chunk size here?".}
@ -801,14 +801,14 @@ func chunkMaxSize[T](): uint32 =
MAX_CHUNK_SIZE_BELLATRIX MAX_CHUNK_SIZE_BELLATRIX
from ../spec/datatypes/capella import SignedBeaconBlock from ../spec/datatypes/capella import SignedBeaconBlock
from ../spec/datatypes/eip4844 import SignedBeaconBlock from ../spec/datatypes/deneb import SignedBeaconBlock
template gossipMaxSize(T: untyped): uint32 = template gossipMaxSize(T: untyped): uint32 =
const maxSize = static: const maxSize = static:
when isFixedSize(T): when isFixedSize(T):
fixedPortionSize(T) fixedPortionSize(T)
elif T is bellatrix.SignedBeaconBlock or T is capella.SignedBeaconBlock or elif T is bellatrix.SignedBeaconBlock or T is capella.SignedBeaconBlock or
T is eip4844.SignedBeaconBlock: T is deneb.SignedBeaconBlock:
GOSSIP_MAX_SIZE_BELLATRIX GOSSIP_MAX_SIZE_BELLATRIX
# TODO https://github.com/status-im/nim-ssz-serialization/issues/20 for # TODO https://github.com/status-im/nim-ssz-serialization/issues/20 for
# Attestation, AttesterSlashing, and SignedAggregateAndProof, which all # Attestation, AttesterSlashing, and SignedAggregateAndProof, which all
@ -2627,11 +2627,11 @@ proc broadcastBeaconBlock*(
node.broadcast(topic, blck) node.broadcast(topic, blck)
proc broadcastBeaconBlock*( proc broadcastBeaconBlock*(
node: Eth2Node, blck: eip4844.SignedBeaconBlock): Future[SendResult] = node: Eth2Node, blck: deneb.SignedBeaconBlock): Future[SendResult] =
let topic = getBeaconBlocksTopic(node.forkDigests.eip4844) let topic = getBeaconBlocksTopic(node.forkDigests.eip4844)
node.broadcast(topic, blck) node.broadcast(topic, blck)
from ../spec/datatypes/eip4844 import SignedBeaconBlock from ../spec/datatypes/deneb import SignedBeaconBlock
proc broadcastSyncCommitteeMessage*( proc broadcastSyncCommitteeMessage*(
node: Eth2Node, msg: SyncCommitteeMessage, node: Eth2Node, msg: SyncCommitteeMessage,

View File

@ -27,7 +27,7 @@ import
when defined(posix): when defined(posix):
import system/ansi_c import system/ansi_c
from ./spec/datatypes/eip4844 import SignedBeaconBlock from ./spec/datatypes/deneb import SignedBeaconBlock
from from
libp2p/protocols/pubsub/gossipsub libp2p/protocols/pubsub/gossipsub
@ -1469,7 +1469,7 @@ proc installMessageValidators(node: BeaconNode) =
node.network.addValidator( node.network.addValidator(
getBeaconBlocksTopic(forkDigests.eip4844), getBeaconBlocksTopic(forkDigests.eip4844),
proc (signedBlock: eip4844.SignedBeaconBlock): ValidationResult = proc (signedBlock: deneb.SignedBeaconBlock): ValidationResult =
if node.shouldSyncOptimistically(node.currentSlot): if node.shouldSyncOptimistically(node.currentSlot):
toValidationResult( toValidationResult(
node.optimisticProcessor.processSignedBeaconBlock(signedBlock)) node.optimisticProcessor.processSignedBeaconBlock(signedBlock))

View File

@ -13,7 +13,7 @@ import
./gossip_processing/optimistic_processor, ./gossip_processing/optimistic_processor,
./networking/topic_params, ./networking/topic_params,
./spec/beaconstate, ./spec/beaconstate,
./spec/datatypes/[phase0, altair, bellatrix, capella, eip4844], ./spec/datatypes/[phase0, altair, bellatrix, capella, deneb],
"."/[filepath, light_client, light_client_db, nimbus_binary_common, version] "."/[filepath, light_client, light_client_db, nimbus_binary_common, version]
from ./gossip_processing/block_processor import newExecutionPayload from ./gossip_processing/block_processor import newExecutionPayload
@ -148,7 +148,7 @@ programMain:
optimisticProcessor.processSignedBeaconBlock(signedBlock))) optimisticProcessor.processSignedBeaconBlock(signedBlock)))
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.eip4844), getBeaconBlocksTopic(forkDigests.eip4844),
proc (signedBlock: eip4844.SignedBeaconBlock): ValidationResult = proc (signedBlock: deneb.SignedBeaconBlock): ValidationResult =
toValidationResult( toValidationResult(
optimisticProcessor.processSignedBeaconBlock(signedBlock))) optimisticProcessor.processSignedBeaconBlock(signedBlock)))
lightClient.installMessageValidators() lightClient.installMessageValidators()

View File

@ -14,7 +14,7 @@ import
../beacon_node, ../beacon_node,
../consensus_object_pools/[blockchain_dag, exit_pool, spec_cache], ../consensus_object_pools/[blockchain_dag, exit_pool, spec_cache],
../spec/[deposit_snapshots, eth2_merkleization, forks, network, validator], ../spec/[deposit_snapshots, eth2_merkleization, forks, network, validator],
../spec/datatypes/[phase0, altair, eip4844], ../spec/datatypes/[phase0, altair, deneb],
../validators/message_router_mev ../validators/message_router_mev
export rest_utils export rest_utils

View File

@ -1,2 +1,752 @@
import ./eip4844 # beacon_chain
export eip4844 # Copyright (c) 2022-2023 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
# Types specific to Deneb (i.e. known to have changed across hard forks) - see
# `base` for types and guidelines common across forks
# TODO Careful, not nil analysis is broken / incomplete and the semantics will
# likely change in future versions of the language:
# https://github.com/nim-lang/RFCs/issues/250
{.experimental: "notnil".}
{.push raises: [].}
import
chronicles,
stew/[bitops2, byteutils],
json_serialization,
ssz_serialization/[merkleization, proofs],
ssz_serialization/types as sszTypes,
../digest,
"."/[base, phase0, altair, bellatrix, capella]
export json_serialization, base
const
# 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-rc.2/specs/eip4844/beacon-chain.md#blob
BLOB_TX_TYPE* = 0x05'u8
# 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
type
# this block belongs elsewhere - will figure out after implementing c-kzg bindings
KZGCommitment* = array[48, byte]
KZGProof* = array[48, byte]
BLSFieldElement* = array[32, byte]
KZGCommitments* = List[KZGCommitment, Limit MAX_BLOBS_PER_BLOCK]
Blobs* = List[Blob, Limit MAX_BLOBS_PER_BLOCK]
# TODO this apparently is suppposed to be SSZ-equivalent to Bytes32, but
# current spec doesn't ever SSZ-serialize it or hash_tree_root it
VersionedHash* = array[32, byte]
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/beacon-chain.md#custom-types
BlobIndex* = uint64
Blob* = array[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB, byte]
# TODO remove BlobsSidecar; it's not in rc.3 anymore
BlobsSidecar* = object
beacon_block_root*: Eth2Digest
beacon_block_slot*: Slot
blobs*: Blobs
kzg_aggregated_proof*: KZGProof
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/p2p-interface.md#blobsidecar
BlobSidecar* = object
block_root*: Eth2Digest
index*: BlobIndex # Index of blob in block
slot*: Slot
block_parent_root*: Eth2Digest # Proposer shuffling determinant
proposer_index*: uint64
blob*: Blob
kzg_commitment*: KZGCommitment
kzg_proof*: KZGProof # Allows for quick verification of kzg_commitment
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/p2p-interface.md#signedblobsidecar
SignedBlobSidecar* = object
message*: BlobSidecar
signature*: ValidatorSig
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/p2p-interface.md#blobidentifier
BlobIdentifier* = object
block_root*: Eth2Digest
index*: BlobIndex
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/beacon-chain.md#executionpayload
ExecutionPayload* = object
parent_hash*: Eth2Digest
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
state_root*: Eth2Digest
receipts_root*: Eth2Digest # 'receipts root' in the yellow paper
logs_bloom*: BloomLogs
prev_randao*: Eth2Digest # 'difficulty' in the yellow paper
block_number*: uint64 # 'number' in the yellow paper
gas_limit*: uint64
gas_used*: uint64
timestamp*: uint64
extra_data*: List[byte, MAX_EXTRA_DATA_BYTES]
base_fee_per_gas*: UInt256
# Extra payload fields
block_hash*: Eth2Digest # Hash of execution block
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
excess_data_gas*: UInt256 # [New in Deneb]
ExecutionPayloadForSigning* = object
executionPayload*: ExecutionPayload
blockValue*: Wei
kzgs*: KZGCommitments
blobs*: Blobs
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#executionpayloadheader
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/beacon-chain.md#executionpayloadheader
ExecutionPayloadHeader* = object
parent_hash*: Eth2Digest
fee_recipient*: ExecutionAddress
state_root*: Eth2Digest
receipts_root*: Eth2Digest
logs_bloom*: BloomLogs
prev_randao*: Eth2Digest
block_number*: uint64
gas_limit*: uint64
gas_used*: uint64
timestamp*: uint64
extra_data*: List[byte, MAX_EXTRA_DATA_BYTES]
base_fee_per_gas*: UInt256
# Extra payload fields
block_hash*: Eth2Digest # Hash of execution block
transactions_root*: Eth2Digest
withdrawals_root*: Eth2Digest
excess_data_gas*: UInt256 # [New in Deneb]
ExecutePayload* = proc(
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/capella/light-client/sync-protocol.md#lightclientheader
LightClientHeader* = object
beacon*: BeaconBlockHeader
## Beacon block header
execution*: ExecutionPayloadHeader
## Execution payload header corresponding to `beacon.body_root` (from Capella onward)
execution_branch*: capella.ExecutionBranch
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientbootstrap
LightClientBootstrap* = object
header*: LightClientHeader
## Header matching the requested beacon block root
current_sync_committee*: SyncCommittee
## Current sync committee corresponding to `header.beacon.state_root`
current_sync_committee_branch*: altair.CurrentSyncCommitteeBranch
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientupdate
LightClientUpdate* = object
attested_header*: LightClientHeader
## Header attested to by the sync committee
next_sync_committee*: SyncCommittee
## Next sync committee corresponding to `attested_header.beacon.state_root`
next_sync_committee_branch*: altair.NextSyncCommitteeBranch
# Finalized header corresponding to `attested_header.beacon.state_root`
finalized_header*: LightClientHeader
finality_branch*: altair.FinalityBranch
sync_aggregate*: SyncAggregate
## Sync committee aggregate signature
signature_slot*: Slot
## Slot at which the aggregate signature was created (untrusted)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientfinalityupdate
LightClientFinalityUpdate* = object
# Header attested to by the sync committee
attested_header*: LightClientHeader
# Finalized header corresponding to `attested_header.beacon.state_root`
finalized_header*: LightClientHeader
finality_branch*: altair.FinalityBranch
# Sync committee aggregate signature
sync_aggregate*: SyncAggregate
# Slot at which the aggregate signature was created (untrusted)
signature_slot*: Slot
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientoptimisticupdate
LightClientOptimisticUpdate* = object
# Header attested to by the sync committee
attested_header*: LightClientHeader
# Sync committee aggregate signature
sync_aggregate*: SyncAggregate
# Slot at which the aggregate signature was created (untrusted)
signature_slot*: Slot
SomeLightClientUpdateWithSyncCommittee* =
LightClientUpdate
SomeLightClientUpdateWithFinality* =
LightClientUpdate |
LightClientFinalityUpdate
SomeLightClientUpdate* =
LightClientUpdate |
LightClientFinalityUpdate |
LightClientOptimisticUpdate
SomeLightClientObject* =
LightClientBootstrap |
SomeLightClientUpdate
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientstore
LightClientStore* = object
finalized_header*: LightClientHeader
## Header that is finalized
current_sync_committee*: SyncCommittee
## Sync committees corresponding to the finalized header
next_sync_committee*: SyncCommittee
best_valid_update*: Opt[LightClientUpdate]
## Best available header to switch finalized head to if we see nothing else
optimistic_header*: LightClientHeader
## Most recent available reasonably-safe header
previous_max_active_participants*: uint64
## Max number of active participants in a sync committee (used to compute
## 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
# changes indirectly via ExecutionPayloadHeader
BeaconState* = object
# Versioning
genesis_time*: uint64
genesis_validators_root*: Eth2Digest
slot*: Slot
fork*: Fork
# History
latest_block_header*: BeaconBlockHeader
## `latest_block_header.state_root == ZERO_HASH` temporarily
block_roots*: HashArray[Limit SLOTS_PER_HISTORICAL_ROOT, Eth2Digest]
## Needed to process attestations, older to newer
state_roots*: HashArray[Limit SLOTS_PER_HISTORICAL_ROOT, Eth2Digest]
historical_roots*: HashList[Eth2Digest, Limit HISTORICAL_ROOTS_LIMIT]
# Eth1
eth1_data*: Eth1Data
eth1_data_votes*:
HashList[Eth1Data, Limit(EPOCHS_PER_ETH1_VOTING_PERIOD * SLOTS_PER_EPOCH)]
eth1_deposit_index*: uint64
# Registry
validators*: HashList[Validator, Limit VALIDATOR_REGISTRY_LIMIT]
balances*: HashList[Gwei, Limit VALIDATOR_REGISTRY_LIMIT]
# Randomness
randao_mixes*: HashArray[Limit EPOCHS_PER_HISTORICAL_VECTOR, Eth2Digest]
# Slashings
slashings*: HashArray[Limit EPOCHS_PER_SLASHINGS_VECTOR, Gwei]
## Per-epoch sums of slashed effective balances
# Participation
previous_epoch_participation*: EpochParticipationFlags
current_epoch_participation*: EpochParticipationFlags
# Finality
justification_bits*: JustificationBits
previous_justified_checkpoint*: Checkpoint
## Previous epoch snapshot
current_justified_checkpoint*: Checkpoint
finalized_checkpoint*: Checkpoint
# Inactivity
inactivity_scores*: InactivityScores
# Light client sync committees
current_sync_committee*: SyncCommittee
next_sync_committee*: SyncCommittee
# Execution
latest_execution_payload_header*: ExecutionPayloadHeader
# Withdrawals
next_withdrawal_index*: WithdrawalIndex
next_withdrawal_validator_index*: uint64
# Deep history valid from Capella onwards
historical_summaries*:
HashList[HistoricalSummary, Limit HISTORICAL_ROOTS_LIMIT]
# TODO Careful, not nil analysis is broken / incomplete and the semantics will
# likely change in future versions of the language:
# https://github.com/nim-lang/RFCs/issues/250
BeaconStateRef* = ref BeaconState not nil
NilableBeaconStateRef* = ref BeaconState
# TODO: There should be only a single generic HashedBeaconState definition
HashedBeaconState* = object
data*: BeaconState
root*: Eth2Digest # hash_tree_root(data)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#beaconblock
BeaconBlock* = object
## For each slot, a proposer is chosen from the validator pool to propose
## a new block. Once the block as been proposed, it is transmitted to
## validators that will have a chance to vote on it through attestations.
## Each block collects attestations, or votes, on past blocks, thus a chain
## is formed.
slot*: Slot
proposer_index*: uint64 # `ValidatorIndex` after validation
parent_root*: Eth2Digest
## Root hash of the previous block
state_root*: Eth2Digest
## The state root, _after_ this block has been processed
body*: BeaconBlockBody
SigVerifiedBeaconBlock* = object
## A BeaconBlock that contains verified signatures
## but that has not been verified for state transition
slot*: Slot
proposer_index*: uint64 # `ValidatorIndex` after validation
parent_root*: Eth2Digest
## Root hash of the previous block
state_root*: Eth2Digest
## The state root, _after_ this block has been processed
body*: SigVerifiedBeaconBlockBody
TrustedBeaconBlock* = object
## When we receive blocks from outside sources, they are untrusted and go
## through several layers of validation. Blocks that have gone through
## validations can be trusted to be well-formed, with a correct signature,
## having a parent and applying cleanly to the state that their parent
## left them with.
##
## When loading such blocks from the database, to rewind states for example,
## it is expensive to redo the validations (in particular, the signature
## checks), thus `TrustedBlock` uses a `TrustedSig` type to mark that these
## checks can be skipped.
##
## TODO this could probably be solved with some type trickery, but there
## too many bugs in nim around generics handling, and we've used up
## the trickery budget in the serialization library already. Until
## then, the type must be manually kept compatible with its untrusted
## cousin.
slot*: Slot
proposer_index*: uint64 # `ValidatorIndex` after validation
parent_root*: Eth2Digest
state_root*: Eth2Digest
body*: TrustedBeaconBlockBody
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#beaconblockbody
BeaconBlockBody* = object
randao_reveal*: ValidatorSig
eth1_data*: Eth1Data
## Eth1 data vote
graffiti*: GraffitiBytes
## Arbitrary data
# Operations
proposer_slashings*: List[ProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
attester_slashings*: List[AttesterSlashing, Limit MAX_ATTESTER_SLASHINGS]
attestations*: List[Attestation, Limit MAX_ATTESTATIONS]
deposits*: List[Deposit, Limit MAX_DEPOSITS]
voluntary_exits*: List[SignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
sync_aggregate*: SyncAggregate
# Execution
execution_payload*: ExecutionPayload
bls_to_execution_changes*: SignedBLSToExecutionChangeList
blob_kzg_commitments*: KZGCommitments # [New in EIP-4844]
SigVerifiedBeaconBlockBody* = object
## A BeaconBlock body with signatures verified
## including:
## - Randao reveal
## - Attestations
## - ProposerSlashing (SignedBeaconBlockHeader)
## - AttesterSlashing (IndexedAttestation)
## - SignedVoluntaryExits
## - SyncAggregate
##
## However:
## - ETH1Data (Deposits) can contain invalid BLS signatures
##
## The block state transition has NOT been verified
randao_reveal*: TrustedSig
eth1_data*: Eth1Data
## Eth1 data vote
graffiti*: GraffitiBytes
## Arbitrary data
# Operations
proposer_slashings*: List[TrustedProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
attester_slashings*: List[TrustedAttesterSlashing, Limit MAX_ATTESTER_SLASHINGS]
attestations*: List[TrustedAttestation, Limit MAX_ATTESTATIONS]
deposits*: List[Deposit, Limit MAX_DEPOSITS]
voluntary_exits*: List[TrustedSignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
sync_aggregate*: TrustedSyncAggregate
# Execution
execution_payload*: ExecutionPayload
bls_to_execution_changes*: SignedBLSToExecutionChangeList
blob_kzg_commitments*: List[KZGCommitment, Limit MAX_BLOBS_PER_BLOCK] # [New in EIP-4844]
TrustedBeaconBlockBody* = object
## A full verified block
randao_reveal*: TrustedSig
eth1_data*: Eth1Data
## Eth1 data vote
graffiti*: GraffitiBytes
## Arbitrary data
# Operations
proposer_slashings*: List[TrustedProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
attester_slashings*: List[TrustedAttesterSlashing, Limit MAX_ATTESTER_SLASHINGS]
attestations*: List[TrustedAttestation, Limit MAX_ATTESTATIONS]
deposits*: List[Deposit, Limit MAX_DEPOSITS]
voluntary_exits*: List[TrustedSignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
sync_aggregate*: TrustedSyncAggregate
# Execution
execution_payload*: ExecutionPayload
bls_to_execution_changes*: SignedBLSToExecutionChangeList
blob_kzg_commitments*: List[KZGCommitment, Limit MAX_BLOBS_PER_BLOCK] # [New in EIP-4844]
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#signedbeaconblock
SignedBeaconBlock* = object
message*: BeaconBlock
signature*: ValidatorSig
root* {.dontSerialize.}: Eth2Digest # cached root of signed beacon block
SigVerifiedSignedBeaconBlock* = object
## A SignedBeaconBlock with signatures verified
## including:
## - Block signature
## - BeaconBlockBody
## - Randao reveal
## - Attestations
## - ProposerSlashing (SignedBeaconBlockHeader)
## - AttesterSlashing (IndexedAttestation)
## - SignedVoluntaryExits
##
## - ETH1Data (Deposits) can contain invalid BLS signatures
##
## The block state transition has NOT been verified
message*: SigVerifiedBeaconBlock
signature*: TrustedSig
root* {.dontSerialize.}: Eth2Digest # cached root of signed beacon block
MsgTrustedSignedBeaconBlock* = object
message*: TrustedBeaconBlock
signature*: ValidatorSig
root* {.dontSerialize.}: Eth2Digest # cached root of signed beacon block
TrustedSignedBeaconBlock* = object
message*: TrustedBeaconBlock
signature*: TrustedSig
root* {.dontSerialize.}: Eth2Digest # cached root of signed beacon block
SomeSignedBeaconBlock* =
SignedBeaconBlock |
SigVerifiedSignedBeaconBlock |
MsgTrustedSignedBeaconBlock |
TrustedSignedBeaconBlock
SomeBeaconBlock* =
BeaconBlock |
SigVerifiedBeaconBlock |
TrustedBeaconBlock
SomeBeaconBlockBody* =
BeaconBlockBody |
SigVerifiedBeaconBlockBody |
TrustedBeaconBlockBody
BlockParams = object
parentHash*: string
timestamp*: string
# TODO: There should be only a single generic HashedBeaconState definition
func initHashedBeaconState*(s: BeaconState): HashedBeaconState =
HashedBeaconState(data: s)
func shortLog*(v: SomeBeaconBlock): auto =
(
slot: shortLog(v.slot),
proposer_index: v.proposer_index,
parent_root: shortLog(v.parent_root),
state_root: shortLog(v.state_root),
eth1data: v.body.eth1_data,
graffiti: $v.body.graffiti,
proposer_slashings_len: v.body.proposer_slashings.len(),
attester_slashings_len: v.body.attester_slashings.len(),
attestations_len: v.body.attestations.len(),
deposits_len: v.body.deposits.len(),
voluntary_exits_len: v.body.voluntary_exits.len(),
sync_committee_participants: v.body.sync_aggregate.num_active_participants,
block_number: v.body.execution_payload.block_number,
# TODO checksum hex? shortlog?
fee_recipient: to0xHex(v.body.execution_payload.fee_recipient.data),
)
func shortLog*(v: SomeSignedBeaconBlock): auto =
(
blck: shortLog(v.message),
signature: shortLog(v.signature)
)
func shortLog*(v: ExecutionPayload): auto =
(
parent_hash: shortLog(v.parent_hash),
fee_recipient: $v.fee_recipient,
state_root: shortLog(v.state_root),
receipts_root: shortLog(v.receipts_root),
prev_randao: shortLog(v.prev_randao),
block_number: v.block_number,
gas_limit: v.gas_limit,
gas_used: v.gas_used,
timestamp: v.timestamp,
extra_data_len: len(v.extra_data),
base_fee_per_gas: $(v.base_fee_per_gas),
excess_data_gas: $(v.excess_data_gas),
block_hash: shortLog(v.block_hash),
num_transactions: len(v.transactions),
num_withdrawals: len(v.withdrawals)
)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/sync-protocol.md#get_lc_execution_root
func get_lc_execution_root*(
header: LightClientHeader, cfg: RuntimeConfig): Eth2Digest =
let epoch = header.beacon.slot.epoch
if epoch >= cfg.DENEB_FORK_EPOCH:
return hash_tree_root(header.execution)
if epoch >= cfg.CAPELLA_FORK_EPOCH:
let execution_header = capella.ExecutionPayloadHeader(
parent_hash: header.execution.parent_hash,
fee_recipient: header.execution.fee_recipient,
state_root: header.execution.state_root,
receipts_root: header.execution.receipts_root,
logs_bloom: header.execution.logs_bloom,
prev_randao: header.execution.prev_randao,
block_number: header.execution.block_number,
gas_limit: header.execution.gas_limit,
gas_used: header.execution.gas_used,
timestamp: header.execution.timestamp,
extra_data: header.execution.extra_data,
base_fee_per_gas: header.execution.base_fee_per_gas,
block_hash: header.execution.block_hash,
transactions_root: header.execution.transactions_root,
withdrawals_root: header.execution.withdrawals_root)
return hash_tree_root(execution_header)
ZERO_HASH
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/sync-protocol.md#is_valid_light_client_header
func is_valid_light_client_header*(
header: LightClientHeader, cfg: RuntimeConfig): bool =
let epoch = header.beacon.slot.epoch
if epoch < cfg.DENEB_FORK_EPOCH:
if header.execution.excess_data_gas != 0.u256:
return false
if epoch < cfg.CAPELLA_FORK_EPOCH:
return
header.execution == default(ExecutionPayloadHeader) and
header.execution_branch == default(ExecutionBranch)
is_valid_merkle_branch(
get_lc_execution_root(header, cfg),
header.execution_branch,
log2trunc(EXECUTION_PAYLOAD_INDEX),
get_subtree_index(EXECUTION_PAYLOAD_INDEX),
header.beacon.body_root)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_header_to_eip4844
func upgrade_lc_header_to_eip4844*(
pre: capella.LightClientHeader): LightClientHeader =
LightClientHeader(
beacon: pre.beacon,
execution: ExecutionPayloadHeader(
parent_hash: pre.execution.parent_hash,
fee_recipient: pre.execution.fee_recipient,
state_root: pre.execution.state_root,
receipts_root: pre.execution.receipts_root,
logs_bloom: pre.execution.logs_bloom,
prev_randao: pre.execution.prev_randao,
block_number: pre.execution.block_number,
gas_limit: pre.execution.gas_limit,
gas_used: pre.execution.gas_used,
timestamp: pre.execution.timestamp,
extra_data: pre.execution.extra_data,
base_fee_per_gas: pre.execution.base_fee_per_gas,
block_hash: pre.execution.block_hash,
transactions_root: pre.execution.transactions_root,
withdrawals_root: pre.execution.withdrawals_root),
execution_branch: pre.execution_branch)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_bootstrap_to_eip4844
func upgrade_lc_bootstrap_to_eip4844*(
pre: capella.LightClientBootstrap): LightClientBootstrap =
LightClientBootstrap(
header: upgrade_lc_header_to_eip4844(pre.header),
current_sync_committee: pre.current_sync_committee,
current_sync_committee_branch: pre.current_sync_committee_branch)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_update_to_eip4844
func upgrade_lc_update_to_eip4844*(
pre: capella.LightClientUpdate): LightClientUpdate =
LightClientUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
next_sync_committee: pre.next_sync_committee,
next_sync_committee_branch: pre.next_sync_committee_branch,
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
finality_branch: pre.finality_branch,
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_finality_update_to_eip4844
func upgrade_lc_finality_update_to_eip4844*(
pre: capella.LightClientFinalityUpdate): LightClientFinalityUpdate =
LightClientFinalityUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
finality_branch: pre.finality_branch,
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_optimistic_update_to_eip4844
func upgrade_lc_optimistic_update_to_eip4844*(
pre: capella.LightClientOptimisticUpdate): LightClientOptimisticUpdate =
LightClientOptimisticUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
func shortLog*(v: LightClientHeader): auto =
(
beacon: shortLog(v.beacon),
execution: (
block_hash: v.execution.block_hash,
block_number: v.execution.block_number)
)
func shortLog*(v: LightClientBootstrap): auto =
(
header: shortLog(v.header)
)
func shortLog*(v: LightClientUpdate): auto =
(
attested: shortLog(v.attested_header),
has_next_sync_committee:
v.next_sync_committee != default(typeof(v.next_sync_committee)),
finalized: shortLog(v.finalized_header),
num_active_participants: v.sync_aggregate.num_active_participants,
signature_slot: v.signature_slot
)
func shortLog*(v: LightClientFinalityUpdate): auto =
(
attested: shortLog(v.attested_header),
finalized: shortLog(v.finalized_header),
num_active_participants: v.sync_aggregate.num_active_participants,
signature_slot: v.signature_slot
)
func shortLog*(v: LightClientOptimisticUpdate): auto =
(
attested: shortLog(v.attested_header),
num_active_participants: v.sync_aggregate.num_active_participants,
signature_slot: v.signature_slot,
)
chronicles.formatIt LightClientBootstrap: shortLog(it)
chronicles.formatIt LightClientUpdate: shortLog(it)
chronicles.formatIt LightClientFinalityUpdate: shortLog(it)
chronicles.formatIt LightClientOptimisticUpdate: shortLog(it)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_store_to_eip4844
func upgrade_lc_store_to_eip4844*(
pre: capella.LightClientStore): LightClientStore =
let best_valid_update =
if pre.best_valid_update.isNone:
Opt.none(LightClientUpdate)
else:
Opt.some upgrade_lc_update_to_eip4844(pre.best_valid_update.get)
LightClientStore(
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
current_sync_committee: pre.current_sync_committee,
next_sync_committee: pre.next_sync_committee,
best_valid_update: best_valid_update,
optimistic_header: upgrade_lc_header_to_eip4844(pre.optimistic_header),
previous_max_active_participants: pre.previous_max_active_participants,
current_max_active_participants: pre.current_max_active_participants)
template asSigned*(
x: SigVerifiedSignedBeaconBlock |
MsgTrustedSignedBeaconBlock |
TrustedSignedBeaconBlock): SignedBeaconBlock =
isomorphicCast[SignedBeaconBlock](x)
template asSigVerified*(
x: SignedBeaconBlock |
MsgTrustedSignedBeaconBlock |
TrustedSignedBeaconBlock): SigVerifiedSignedBeaconBlock =
isomorphicCast[SigVerifiedSignedBeaconBlock](x)
template asSigVerified*(
x: BeaconBlock | TrustedBeaconBlock): SigVerifiedBeaconBlock =
isomorphicCast[SigVerifiedBeaconBlock](x)
template asMsgTrusted*(
x: SignedBeaconBlock |
SigVerifiedSignedBeaconBlock |
TrustedSignedBeaconBlock): MsgTrustedSignedBeaconBlock =
isomorphicCast[MsgTrustedSignedBeaconBlock](x)
template asTrusted*(
x: SignedBeaconBlock |
SigVerifiedSignedBeaconBlock |
MsgTrustedSignedBeaconBlock): TrustedSignedBeaconBlock =
isomorphicCast[TrustedSignedBeaconBlock](x)

View File

@ -1,752 +0,0 @@
# beacon_chain
# Copyright (c) 2022-2023 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
# Types specific to Deneb (i.e. known to have changed across hard forks) - see
# `base` for types and guidelines common across forks
# TODO Careful, not nil analysis is broken / incomplete and the semantics will
# likely change in future versions of the language:
# https://github.com/nim-lang/RFCs/issues/250
{.experimental: "notnil".}
{.push raises: [].}
import
chronicles,
stew/[bitops2, byteutils],
json_serialization,
ssz_serialization/[merkleization, proofs],
ssz_serialization/types as sszTypes,
../digest,
"."/[base, phase0, altair, bellatrix, capella]
export json_serialization, base
const
# 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-rc.2/specs/eip4844/beacon-chain.md#blob
BLOB_TX_TYPE* = 0x05'u8
# 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
type
# this block belongs elsewhere - will figure out after implementing c-kzg bindings
KZGCommitment* = array[48, byte]
KZGProof* = array[48, byte]
BLSFieldElement* = array[32, byte]
KZGCommitments* = List[KZGCommitment, Limit MAX_BLOBS_PER_BLOCK]
Blobs* = List[Blob, Limit MAX_BLOBS_PER_BLOCK]
# TODO this apparently is suppposed to be SSZ-equivalent to Bytes32, but
# current spec doesn't ever SSZ-serialize it or hash_tree_root it
VersionedHash* = array[32, byte]
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/beacon-chain.md#custom-types
BlobIndex* = uint64
Blob* = array[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB, byte]
# TODO remove BlobsSidecar; it's not in rc.3 anymore
BlobsSidecar* = object
beacon_block_root*: Eth2Digest
beacon_block_slot*: Slot
blobs*: Blobs
kzg_aggregated_proof*: KZGProof
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/p2p-interface.md#blobsidecar
BlobSidecar* = object
block_root*: Eth2Digest
index*: BlobIndex # Index of blob in block
slot*: Slot
block_parent_root*: Eth2Digest # Proposer shuffling determinant
proposer_index*: uint64
blob*: Blob
kzg_commitment*: KZGCommitment
kzg_proof*: KZGProof # Allows for quick verification of kzg_commitment
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/p2p-interface.md#signedblobsidecar
SignedBlobSidecar* = object
message*: BlobSidecar
signature*: ValidatorSig
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/p2p-interface.md#blobidentifier
BlobIdentifier* = object
block_root*: Eth2Digest
index*: BlobIndex
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/beacon-chain.md#executionpayload
ExecutionPayload* = object
parent_hash*: Eth2Digest
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
state_root*: Eth2Digest
receipts_root*: Eth2Digest # 'receipts root' in the yellow paper
logs_bloom*: BloomLogs
prev_randao*: Eth2Digest # 'difficulty' in the yellow paper
block_number*: uint64 # 'number' in the yellow paper
gas_limit*: uint64
gas_used*: uint64
timestamp*: uint64
extra_data*: List[byte, MAX_EXTRA_DATA_BYTES]
base_fee_per_gas*: UInt256
# Extra payload fields
block_hash*: Eth2Digest # Hash of execution block
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
excess_data_gas*: UInt256 # [New in Deneb]
ExecutionPayloadForSigning* = object
executionPayload*: ExecutionPayload
blockValue*: Wei
kzgs*: KZGCommitments
blobs*: Blobs
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#executionpayloadheader
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/beacon-chain.md#executionpayloadheader
ExecutionPayloadHeader* = object
parent_hash*: Eth2Digest
fee_recipient*: ExecutionAddress
state_root*: Eth2Digest
receipts_root*: Eth2Digest
logs_bloom*: BloomLogs
prev_randao*: Eth2Digest
block_number*: uint64
gas_limit*: uint64
gas_used*: uint64
timestamp*: uint64
extra_data*: List[byte, MAX_EXTRA_DATA_BYTES]
base_fee_per_gas*: UInt256
# Extra payload fields
block_hash*: Eth2Digest # Hash of execution block
transactions_root*: Eth2Digest
withdrawals_root*: Eth2Digest
excess_data_gas*: UInt256 # [New in Deneb]
ExecutePayload* = proc(
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/capella/light-client/sync-protocol.md#lightclientheader
LightClientHeader* = object
beacon*: BeaconBlockHeader
## Beacon block header
execution*: ExecutionPayloadHeader
## Execution payload header corresponding to `beacon.body_root` (from Capella onward)
execution_branch*: capella.ExecutionBranch
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientbootstrap
LightClientBootstrap* = object
header*: LightClientHeader
## Header matching the requested beacon block root
current_sync_committee*: SyncCommittee
## Current sync committee corresponding to `header.beacon.state_root`
current_sync_committee_branch*: altair.CurrentSyncCommitteeBranch
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientupdate
LightClientUpdate* = object
attested_header*: LightClientHeader
## Header attested to by the sync committee
next_sync_committee*: SyncCommittee
## Next sync committee corresponding to `attested_header.beacon.state_root`
next_sync_committee_branch*: altair.NextSyncCommitteeBranch
# Finalized header corresponding to `attested_header.beacon.state_root`
finalized_header*: LightClientHeader
finality_branch*: altair.FinalityBranch
sync_aggregate*: SyncAggregate
## Sync committee aggregate signature
signature_slot*: Slot
## Slot at which the aggregate signature was created (untrusted)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientfinalityupdate
LightClientFinalityUpdate* = object
# Header attested to by the sync committee
attested_header*: LightClientHeader
# Finalized header corresponding to `attested_header.beacon.state_root`
finalized_header*: LightClientHeader
finality_branch*: altair.FinalityBranch
# Sync committee aggregate signature
sync_aggregate*: SyncAggregate
# Slot at which the aggregate signature was created (untrusted)
signature_slot*: Slot
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientoptimisticupdate
LightClientOptimisticUpdate* = object
# Header attested to by the sync committee
attested_header*: LightClientHeader
# Sync committee aggregate signature
sync_aggregate*: SyncAggregate
# Slot at which the aggregate signature was created (untrusted)
signature_slot*: Slot
SomeLightClientUpdateWithSyncCommittee* =
LightClientUpdate
SomeLightClientUpdateWithFinality* =
LightClientUpdate |
LightClientFinalityUpdate
SomeLightClientUpdate* =
LightClientUpdate |
LightClientFinalityUpdate |
LightClientOptimisticUpdate
SomeLightClientObject* =
LightClientBootstrap |
SomeLightClientUpdate
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/light-client/sync-protocol.md#lightclientstore
LightClientStore* = object
finalized_header*: LightClientHeader
## Header that is finalized
current_sync_committee*: SyncCommittee
## Sync committees corresponding to the finalized header
next_sync_committee*: SyncCommittee
best_valid_update*: Opt[LightClientUpdate]
## Best available header to switch finalized head to if we see nothing else
optimistic_header*: LightClientHeader
## Most recent available reasonably-safe header
previous_max_active_participants*: uint64
## Max number of active participants in a sync committee (used to compute
## 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
# changes indirectly via ExecutionPayloadHeader
BeaconState* = object
# Versioning
genesis_time*: uint64
genesis_validators_root*: Eth2Digest
slot*: Slot
fork*: Fork
# History
latest_block_header*: BeaconBlockHeader
## `latest_block_header.state_root == ZERO_HASH` temporarily
block_roots*: HashArray[Limit SLOTS_PER_HISTORICAL_ROOT, Eth2Digest]
## Needed to process attestations, older to newer
state_roots*: HashArray[Limit SLOTS_PER_HISTORICAL_ROOT, Eth2Digest]
historical_roots*: HashList[Eth2Digest, Limit HISTORICAL_ROOTS_LIMIT]
# Eth1
eth1_data*: Eth1Data
eth1_data_votes*:
HashList[Eth1Data, Limit(EPOCHS_PER_ETH1_VOTING_PERIOD * SLOTS_PER_EPOCH)]
eth1_deposit_index*: uint64
# Registry
validators*: HashList[Validator, Limit VALIDATOR_REGISTRY_LIMIT]
balances*: HashList[Gwei, Limit VALIDATOR_REGISTRY_LIMIT]
# Randomness
randao_mixes*: HashArray[Limit EPOCHS_PER_HISTORICAL_VECTOR, Eth2Digest]
# Slashings
slashings*: HashArray[Limit EPOCHS_PER_SLASHINGS_VECTOR, Gwei]
## Per-epoch sums of slashed effective balances
# Participation
previous_epoch_participation*: EpochParticipationFlags
current_epoch_participation*: EpochParticipationFlags
# Finality
justification_bits*: JustificationBits
previous_justified_checkpoint*: Checkpoint
## Previous epoch snapshot
current_justified_checkpoint*: Checkpoint
finalized_checkpoint*: Checkpoint
# Inactivity
inactivity_scores*: InactivityScores
# Light client sync committees
current_sync_committee*: SyncCommittee
next_sync_committee*: SyncCommittee
# Execution
latest_execution_payload_header*: ExecutionPayloadHeader
# Withdrawals
next_withdrawal_index*: WithdrawalIndex
next_withdrawal_validator_index*: uint64
# Deep history valid from Capella onwards
historical_summaries*:
HashList[HistoricalSummary, Limit HISTORICAL_ROOTS_LIMIT]
# TODO Careful, not nil analysis is broken / incomplete and the semantics will
# likely change in future versions of the language:
# https://github.com/nim-lang/RFCs/issues/250
BeaconStateRef* = ref BeaconState not nil
NilableBeaconStateRef* = ref BeaconState
# TODO: There should be only a single generic HashedBeaconState definition
HashedBeaconState* = object
data*: BeaconState
root*: Eth2Digest # hash_tree_root(data)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#beaconblock
BeaconBlock* = object
## For each slot, a proposer is chosen from the validator pool to propose
## a new block. Once the block as been proposed, it is transmitted to
## validators that will have a chance to vote on it through attestations.
## Each block collects attestations, or votes, on past blocks, thus a chain
## is formed.
slot*: Slot
proposer_index*: uint64 # `ValidatorIndex` after validation
parent_root*: Eth2Digest
## Root hash of the previous block
state_root*: Eth2Digest
## The state root, _after_ this block has been processed
body*: BeaconBlockBody
SigVerifiedBeaconBlock* = object
## A BeaconBlock that contains verified signatures
## but that has not been verified for state transition
slot*: Slot
proposer_index*: uint64 # `ValidatorIndex` after validation
parent_root*: Eth2Digest
## Root hash of the previous block
state_root*: Eth2Digest
## The state root, _after_ this block has been processed
body*: SigVerifiedBeaconBlockBody
TrustedBeaconBlock* = object
## When we receive blocks from outside sources, they are untrusted and go
## through several layers of validation. Blocks that have gone through
## validations can be trusted to be well-formed, with a correct signature,
## having a parent and applying cleanly to the state that their parent
## left them with.
##
## When loading such blocks from the database, to rewind states for example,
## it is expensive to redo the validations (in particular, the signature
## checks), thus `TrustedBlock` uses a `TrustedSig` type to mark that these
## checks can be skipped.
##
## TODO this could probably be solved with some type trickery, but there
## too many bugs in nim around generics handling, and we've used up
## the trickery budget in the serialization library already. Until
## then, the type must be manually kept compatible with its untrusted
## cousin.
slot*: Slot
proposer_index*: uint64 # `ValidatorIndex` after validation
parent_root*: Eth2Digest
state_root*: Eth2Digest
body*: TrustedBeaconBlockBody
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#beaconblockbody
BeaconBlockBody* = object
randao_reveal*: ValidatorSig
eth1_data*: Eth1Data
## Eth1 data vote
graffiti*: GraffitiBytes
## Arbitrary data
# Operations
proposer_slashings*: List[ProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
attester_slashings*: List[AttesterSlashing, Limit MAX_ATTESTER_SLASHINGS]
attestations*: List[Attestation, Limit MAX_ATTESTATIONS]
deposits*: List[Deposit, Limit MAX_DEPOSITS]
voluntary_exits*: List[SignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
sync_aggregate*: SyncAggregate
# Execution
execution_payload*: ExecutionPayload
bls_to_execution_changes*: SignedBLSToExecutionChangeList
blob_kzg_commitments*: KZGCommitments # [New in EIP-4844]
SigVerifiedBeaconBlockBody* = object
## A BeaconBlock body with signatures verified
## including:
## - Randao reveal
## - Attestations
## - ProposerSlashing (SignedBeaconBlockHeader)
## - AttesterSlashing (IndexedAttestation)
## - SignedVoluntaryExits
## - SyncAggregate
##
## However:
## - ETH1Data (Deposits) can contain invalid BLS signatures
##
## The block state transition has NOT been verified
randao_reveal*: TrustedSig
eth1_data*: Eth1Data
## Eth1 data vote
graffiti*: GraffitiBytes
## Arbitrary data
# Operations
proposer_slashings*: List[TrustedProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
attester_slashings*: List[TrustedAttesterSlashing, Limit MAX_ATTESTER_SLASHINGS]
attestations*: List[TrustedAttestation, Limit MAX_ATTESTATIONS]
deposits*: List[Deposit, Limit MAX_DEPOSITS]
voluntary_exits*: List[TrustedSignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
sync_aggregate*: TrustedSyncAggregate
# Execution
execution_payload*: ExecutionPayload
bls_to_execution_changes*: SignedBLSToExecutionChangeList
blob_kzg_commitments*: List[KZGCommitment, Limit MAX_BLOBS_PER_BLOCK] # [New in EIP-4844]
TrustedBeaconBlockBody* = object
## A full verified block
randao_reveal*: TrustedSig
eth1_data*: Eth1Data
## Eth1 data vote
graffiti*: GraffitiBytes
## Arbitrary data
# Operations
proposer_slashings*: List[TrustedProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
attester_slashings*: List[TrustedAttesterSlashing, Limit MAX_ATTESTER_SLASHINGS]
attestations*: List[TrustedAttestation, Limit MAX_ATTESTATIONS]
deposits*: List[Deposit, Limit MAX_DEPOSITS]
voluntary_exits*: List[TrustedSignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS]
sync_aggregate*: TrustedSyncAggregate
# Execution
execution_payload*: ExecutionPayload
bls_to_execution_changes*: SignedBLSToExecutionChangeList
blob_kzg_commitments*: List[KZGCommitment, Limit MAX_BLOBS_PER_BLOCK] # [New in EIP-4844]
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#signedbeaconblock
SignedBeaconBlock* = object
message*: BeaconBlock
signature*: ValidatorSig
root* {.dontSerialize.}: Eth2Digest # cached root of signed beacon block
SigVerifiedSignedBeaconBlock* = object
## A SignedBeaconBlock with signatures verified
## including:
## - Block signature
## - BeaconBlockBody
## - Randao reveal
## - Attestations
## - ProposerSlashing (SignedBeaconBlockHeader)
## - AttesterSlashing (IndexedAttestation)
## - SignedVoluntaryExits
##
## - ETH1Data (Deposits) can contain invalid BLS signatures
##
## The block state transition has NOT been verified
message*: SigVerifiedBeaconBlock
signature*: TrustedSig
root* {.dontSerialize.}: Eth2Digest # cached root of signed beacon block
MsgTrustedSignedBeaconBlock* = object
message*: TrustedBeaconBlock
signature*: ValidatorSig
root* {.dontSerialize.}: Eth2Digest # cached root of signed beacon block
TrustedSignedBeaconBlock* = object
message*: TrustedBeaconBlock
signature*: TrustedSig
root* {.dontSerialize.}: Eth2Digest # cached root of signed beacon block
SomeSignedBeaconBlock* =
SignedBeaconBlock |
SigVerifiedSignedBeaconBlock |
MsgTrustedSignedBeaconBlock |
TrustedSignedBeaconBlock
SomeBeaconBlock* =
BeaconBlock |
SigVerifiedBeaconBlock |
TrustedBeaconBlock
SomeBeaconBlockBody* =
BeaconBlockBody |
SigVerifiedBeaconBlockBody |
TrustedBeaconBlockBody
BlockParams = object
parentHash*: string
timestamp*: string
# TODO: There should be only a single generic HashedBeaconState definition
func initHashedBeaconState*(s: BeaconState): HashedBeaconState =
HashedBeaconState(data: s)
func shortLog*(v: SomeBeaconBlock): auto =
(
slot: shortLog(v.slot),
proposer_index: v.proposer_index,
parent_root: shortLog(v.parent_root),
state_root: shortLog(v.state_root),
eth1data: v.body.eth1_data,
graffiti: $v.body.graffiti,
proposer_slashings_len: v.body.proposer_slashings.len(),
attester_slashings_len: v.body.attester_slashings.len(),
attestations_len: v.body.attestations.len(),
deposits_len: v.body.deposits.len(),
voluntary_exits_len: v.body.voluntary_exits.len(),
sync_committee_participants: v.body.sync_aggregate.num_active_participants,
block_number: v.body.execution_payload.block_number,
# TODO checksum hex? shortlog?
fee_recipient: to0xHex(v.body.execution_payload.fee_recipient.data),
)
func shortLog*(v: SomeSignedBeaconBlock): auto =
(
blck: shortLog(v.message),
signature: shortLog(v.signature)
)
func shortLog*(v: ExecutionPayload): auto =
(
parent_hash: shortLog(v.parent_hash),
fee_recipient: $v.fee_recipient,
state_root: shortLog(v.state_root),
receipts_root: shortLog(v.receipts_root),
prev_randao: shortLog(v.prev_randao),
block_number: v.block_number,
gas_limit: v.gas_limit,
gas_used: v.gas_used,
timestamp: v.timestamp,
extra_data_len: len(v.extra_data),
base_fee_per_gas: $(v.base_fee_per_gas),
excess_data_gas: $(v.excess_data_gas),
block_hash: shortLog(v.block_hash),
num_transactions: len(v.transactions),
num_withdrawals: len(v.withdrawals)
)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/sync-protocol.md#get_lc_execution_root
func get_lc_execution_root*(
header: LightClientHeader, cfg: RuntimeConfig): Eth2Digest =
let epoch = header.beacon.slot.epoch
if epoch >= cfg.DENEB_FORK_EPOCH:
return hash_tree_root(header.execution)
if epoch >= cfg.CAPELLA_FORK_EPOCH:
let execution_header = capella.ExecutionPayloadHeader(
parent_hash: header.execution.parent_hash,
fee_recipient: header.execution.fee_recipient,
state_root: header.execution.state_root,
receipts_root: header.execution.receipts_root,
logs_bloom: header.execution.logs_bloom,
prev_randao: header.execution.prev_randao,
block_number: header.execution.block_number,
gas_limit: header.execution.gas_limit,
gas_used: header.execution.gas_used,
timestamp: header.execution.timestamp,
extra_data: header.execution.extra_data,
base_fee_per_gas: header.execution.base_fee_per_gas,
block_hash: header.execution.block_hash,
transactions_root: header.execution.transactions_root,
withdrawals_root: header.execution.withdrawals_root)
return hash_tree_root(execution_header)
ZERO_HASH
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/sync-protocol.md#is_valid_light_client_header
func is_valid_light_client_header*(
header: LightClientHeader, cfg: RuntimeConfig): bool =
let epoch = header.beacon.slot.epoch
if epoch < cfg.DENEB_FORK_EPOCH:
if header.execution.excess_data_gas != 0.u256:
return false
if epoch < cfg.CAPELLA_FORK_EPOCH:
return
header.execution == default(ExecutionPayloadHeader) and
header.execution_branch == default(ExecutionBranch)
is_valid_merkle_branch(
get_lc_execution_root(header, cfg),
header.execution_branch,
log2trunc(EXECUTION_PAYLOAD_INDEX),
get_subtree_index(EXECUTION_PAYLOAD_INDEX),
header.beacon.body_root)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_header_to_eip4844
func upgrade_lc_header_to_eip4844*(
pre: capella.LightClientHeader): LightClientHeader =
LightClientHeader(
beacon: pre.beacon,
execution: ExecutionPayloadHeader(
parent_hash: pre.execution.parent_hash,
fee_recipient: pre.execution.fee_recipient,
state_root: pre.execution.state_root,
receipts_root: pre.execution.receipts_root,
logs_bloom: pre.execution.logs_bloom,
prev_randao: pre.execution.prev_randao,
block_number: pre.execution.block_number,
gas_limit: pre.execution.gas_limit,
gas_used: pre.execution.gas_used,
timestamp: pre.execution.timestamp,
extra_data: pre.execution.extra_data,
base_fee_per_gas: pre.execution.base_fee_per_gas,
block_hash: pre.execution.block_hash,
transactions_root: pre.execution.transactions_root,
withdrawals_root: pre.execution.withdrawals_root),
execution_branch: pre.execution_branch)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_bootstrap_to_eip4844
func upgrade_lc_bootstrap_to_eip4844*(
pre: capella.LightClientBootstrap): LightClientBootstrap =
LightClientBootstrap(
header: upgrade_lc_header_to_eip4844(pre.header),
current_sync_committee: pre.current_sync_committee,
current_sync_committee_branch: pre.current_sync_committee_branch)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_update_to_eip4844
func upgrade_lc_update_to_eip4844*(
pre: capella.LightClientUpdate): LightClientUpdate =
LightClientUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
next_sync_committee: pre.next_sync_committee,
next_sync_committee_branch: pre.next_sync_committee_branch,
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
finality_branch: pre.finality_branch,
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_finality_update_to_eip4844
func upgrade_lc_finality_update_to_eip4844*(
pre: capella.LightClientFinalityUpdate): LightClientFinalityUpdate =
LightClientFinalityUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
finality_branch: pre.finality_branch,
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_optimistic_update_to_eip4844
func upgrade_lc_optimistic_update_to_eip4844*(
pre: capella.LightClientOptimisticUpdate): LightClientOptimisticUpdate =
LightClientOptimisticUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
func shortLog*(v: LightClientHeader): auto =
(
beacon: shortLog(v.beacon),
execution: (
block_hash: v.execution.block_hash,
block_number: v.execution.block_number)
)
func shortLog*(v: LightClientBootstrap): auto =
(
header: shortLog(v.header)
)
func shortLog*(v: LightClientUpdate): auto =
(
attested: shortLog(v.attested_header),
has_next_sync_committee:
v.next_sync_committee != default(typeof(v.next_sync_committee)),
finalized: shortLog(v.finalized_header),
num_active_participants: v.sync_aggregate.num_active_participants,
signature_slot: v.signature_slot
)
func shortLog*(v: LightClientFinalityUpdate): auto =
(
attested: shortLog(v.attested_header),
finalized: shortLog(v.finalized_header),
num_active_participants: v.sync_aggregate.num_active_participants,
signature_slot: v.signature_slot
)
func shortLog*(v: LightClientOptimisticUpdate): auto =
(
attested: shortLog(v.attested_header),
num_active_participants: v.sync_aggregate.num_active_participants,
signature_slot: v.signature_slot,
)
chronicles.formatIt LightClientBootstrap: shortLog(it)
chronicles.formatIt LightClientUpdate: shortLog(it)
chronicles.formatIt LightClientFinalityUpdate: shortLog(it)
chronicles.formatIt LightClientOptimisticUpdate: shortLog(it)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_store_to_eip4844
func upgrade_lc_store_to_eip4844*(
pre: capella.LightClientStore): LightClientStore =
let best_valid_update =
if pre.best_valid_update.isNone:
Opt.none(LightClientUpdate)
else:
Opt.some upgrade_lc_update_to_eip4844(pre.best_valid_update.get)
LightClientStore(
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
current_sync_committee: pre.current_sync_committee,
next_sync_committee: pre.next_sync_committee,
best_valid_update: best_valid_update,
optimistic_header: upgrade_lc_header_to_eip4844(pre.optimistic_header),
previous_max_active_participants: pre.previous_max_active_participants,
current_max_active_participants: pre.current_max_active_participants)
template asSigned*(
x: SigVerifiedSignedBeaconBlock |
MsgTrustedSignedBeaconBlock |
TrustedSignedBeaconBlock): SignedBeaconBlock =
isomorphicCast[SignedBeaconBlock](x)
template asSigVerified*(
x: SignedBeaconBlock |
MsgTrustedSignedBeaconBlock |
TrustedSignedBeaconBlock): SigVerifiedSignedBeaconBlock =
isomorphicCast[SigVerifiedSignedBeaconBlock](x)
template asSigVerified*(
x: BeaconBlock | TrustedBeaconBlock): SigVerifiedBeaconBlock =
isomorphicCast[SigVerifiedBeaconBlock](x)
template asMsgTrusted*(
x: SignedBeaconBlock |
SigVerifiedSignedBeaconBlock |
TrustedSignedBeaconBlock): MsgTrustedSignedBeaconBlock =
isomorphicCast[MsgTrustedSignedBeaconBlock](x)
template asTrusted*(
x: SignedBeaconBlock |
SigVerifiedSignedBeaconBlock |
MsgTrustedSignedBeaconBlock): TrustedSignedBeaconBlock =
isomorphicCast[TrustedSignedBeaconBlock](x)

View File

@ -220,7 +220,7 @@ template LightClientUpdate*(kind: static LightClientDataFork): auto =
template LightClientFinalityUpdate*(kind: static LightClientDataFork): auto = template LightClientFinalityUpdate*(kind: static LightClientDataFork): auto =
when kind == LightClientDataFork.EIP4844: when kind == LightClientDataFork.EIP4844:
typedesc[eip4844.LightClientFinalityUpdate] typedesc[deneb.LightClientFinalityUpdate]
elif kind == LightClientDataFork.Capella: elif kind == LightClientDataFork.Capella:
typedesc[capella.LightClientFinalityUpdate] typedesc[capella.LightClientFinalityUpdate]
elif kind == LightClientDataFork.Altair: elif kind == LightClientDataFork.Altair:

View File

@ -11,7 +11,7 @@ import
std/[options, tables, sets, macros], std/[options, tables, sets, macros],
chronicles, chronos, snappy, snappy/codec, chronicles, chronos, snappy, snappy/codec,
libp2p/switch, libp2p/switch,
../spec/datatypes/[phase0, altair, bellatrix, capella, eip4844], ../spec/datatypes/[phase0, altair, bellatrix, capella, deneb],
../spec/[helpers, forks, network], ../spec/[helpers, forks, network],
".."/[beacon_clock], ".."/[beacon_clock],
../networking/eth2_network, ../networking/eth2_network,
@ -112,7 +112,7 @@ proc readChunkPayload*(
else: else:
return err(res.error) return err(res.error)
elif contextBytes == peer.network.forkDigests.eip4844: elif contextBytes == peer.network.forkDigests.eip4844:
let res = await readChunkPayload(conn, peer, eip4844.SignedBeaconBlock) let res = await readChunkPayload(conn, peer, deneb.SignedBeaconBlock)
if res.isOk: if res.isOk:
return ok newClone(ForkedSignedBeaconBlock.init(res.get)) return ok newClone(ForkedSignedBeaconBlock.init(res.get))
else: else:

View File

@ -43,7 +43,7 @@ proc fetchDepositSnapshot(client: RestClientRef):
return ok snapshot return ok snapshot
from ./spec/datatypes/eip4844 import asSigVerified, shortLog from ./spec/datatypes/deneb import asSigVerified, shortLog
proc doTrustedNodeSync*( proc doTrustedNodeSync*(
cfg: RuntimeConfig, cfg: RuntimeConfig,

View File

@ -17,7 +17,7 @@ import
../gossip_processing/eth2_processor, ../gossip_processing/eth2_processor,
../networking/eth2_network, ../networking/eth2_network,
./activity_metrics, ./activity_metrics,
../spec/datatypes/eip4844 ../spec/datatypes/deneb
export eth2_processor, eth2_network export eth2_processor, eth2_network

View File

@ -866,10 +866,10 @@ proc proposeBlock(node: BeaconNode,
var forkedBlck = newBlock.get() var forkedBlck = newBlock.get()
withBlck(forkedBlck): withBlck(forkedBlck):
var blobs_sidecar = eip4844.BlobsSidecar( var blobs_sidecar = deneb.BlobsSidecar(
beacon_block_slot: slot, beacon_block_slot: slot,
) )
when blck is eip4844.BeaconBlock: when blck is deneb.BeaconBlock:
# TODO: The blobs_sidecar variable is not currently used. # TODO: The blobs_sidecar variable is not currently used.
# It could be initialized in makeBeaconBlockForHeadAndSlot # It could be initialized in makeBeaconBlockForHeadAndSlot
# where the required information is available. # where the required information is available.
@ -919,7 +919,7 @@ proc proposeBlock(node: BeaconNode,
elif blck is capella.BeaconBlock: elif blck is capella.BeaconBlock:
capella.SignedBeaconBlock( capella.SignedBeaconBlock(
message: blck, signature: signature, root: blockRoot) message: blck, signature: signature, root: blockRoot)
elif blck is eip4844.BeaconBlock: elif blck is deneb.BeaconBlock:
# TODO: also route blobs # TODO: also route blobs
deneb.SignedBeaconBlock(message: blck, signature: signature, root: blockRoot) deneb.SignedBeaconBlock(message: blck, signature: signature, root: blockRoot)
else: else:

View File

@ -1,5 +1,5 @@
# beacon_chain # beacon_chain
# Copyright (c) 2022 Status Research & Development GmbH # Copyright (c) 2022-2023 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -269,7 +269,7 @@ proc collectEpochRewardsAndPenalties*(
proc collectEpochRewardsAndPenalties*( proc collectEpochRewardsAndPenalties*(
rewardsAndPenalties: var seq[RewardsAndPenalties], rewardsAndPenalties: var seq[RewardsAndPenalties],
state: var (altair.BeaconState | bellatrix.BeaconState | state: var (altair.BeaconState | bellatrix.BeaconState |
capella.BeaconState | eip4844.BeaconState), capella.BeaconState | deneb.BeaconState),
cache: var StateCache, cfg: RuntimeConfig, flags: UpdateFlags) = cache: var StateCache, cfg: RuntimeConfig, flags: UpdateFlags) =
if get_current_epoch(state) == GENESIS_EPOCH: if get_current_epoch(state) == GENESIS_EPOCH:
return return

View File

@ -40,7 +40,7 @@ proc findValidator(validators: seq[Validator], pubKey: ValidatorPubKey):
Opt.some idx.ValidatorIndex Opt.some idx.ValidatorIndex
from ../beacon_chain/spec/datatypes/capella import SignedBeaconBlock from ../beacon_chain/spec/datatypes/capella import SignedBeaconBlock
from ../beacon_chain/spec/datatypes/eip4844 import SignedBeaconBlock from ../beacon_chain/spec/datatypes/deneb import SignedBeaconBlock
cli do(validatorsDir: string, secretsDir: string, cli do(validatorsDir: string, secretsDir: string,
startState: string, network: string): startState: string, network: string):
@ -205,7 +205,7 @@ cli do(validatorsDir: string, secretsDir: string,
dump(".", signedBlock) dump(".", signedBlock)
of ConsensusFork.Deneb: of ConsensusFork.Deneb:
blockRoot = hash_tree_root(message.denebData) blockRoot = hash_tree_root(message.denebData)
let signedBlock = eip4844.SignedBeaconBlock( let signedBlock = deneb.SignedBeaconBlock(
message: message.denebData, message: message.denebData,
root: blockRoot, root: blockRoot,
signature: get_block_signature( signature: get_block_signature(

View File

@ -1,5 +1,5 @@
# beacon_chain # beacon_chain
# Copyright (c) 2022 Status Research & Development GmbH # Copyright (c) 2022-2023 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -10,7 +10,7 @@
import import
unittest2, unittest2,
../beacon_chain/spec/forks, ../beacon_chain/spec/forks,
../beacon_chain/spec/datatypes/[phase0,eip4844], ../beacon_chain/spec/datatypes/[phase0, deneb],
../beacon_chain/consensus_object_pools/block_quarantine ../beacon_chain/consensus_object_pools/block_quarantine
func makeBlock(slot: Slot, parent: Eth2Digest): ForkedSignedBeaconBlock = func makeBlock(slot: Slot, parent: Eth2Digest): ForkedSignedBeaconBlock =

View File

@ -1,5 +1,5 @@
# beacon_chain # beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH # Copyright (c) 2021-2023 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -17,7 +17,7 @@ from stint import UInt256
from ../beacon_chain/spec/datatypes/bellatrix import from ../beacon_chain/spec/datatypes/bellatrix import
BloomLogs, ExecutionAddress, ExecutionPayload, fromHex BloomLogs, ExecutionAddress, ExecutionPayload, fromHex
from ../beacon_chain/spec/datatypes/capella import ExecutionPayload from ../beacon_chain/spec/datatypes/capella import ExecutionPayload
from ../beacon_chain/spec/datatypes/eip4844 import ExecutionPayload from ../beacon_chain/spec/datatypes/deneb import ExecutionPayload
from ../beacon_chain/spec/digest import Eth2Digest from ../beacon_chain/spec/digest import Eth2Digest
from ../beacon_chain/spec/presets import from ../beacon_chain/spec/presets import
MAX_BYTES_PER_TRANSACTION, MAX_EXTRA_DATA_BYTES, MAX_TRANSACTIONS_PER_PAYLOAD MAX_BYTES_PER_TRANSACTION, MAX_EXTRA_DATA_BYTES, MAX_TRANSACTIONS_PER_PAYLOAD
@ -1034,7 +1034,7 @@ suite "Eth1 monitor":
# high withdrawal indexes or validator indexes), but should be supported in # high withdrawal indexes or validator indexes), but should be supported in
# this layer regardless, so sample across entire domain. # this layer regardless, so sample across entire domain.
const executionPayloads = [ const executionPayloads = [
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x760d4d1fced29500a422c401a646ee5bb5d65a07efa1492856a72cff9948a434"), parent_hash: Eth2Digest.fromHex("0x760d4d1fced29500a422c401a646ee5bb5d65a07efa1492856a72cff9948a434"),
fee_recipient: ExecutionAddress.fromHex("0x315f583fa44fc6684553d3c88c3d26e9ed7123d8"), fee_recipient: ExecutionAddress.fromHex("0x315f583fa44fc6684553d3c88c3d26e9ed7123d8"),
state_root: Eth2Digest.fromHex("0xa6975bac699618cc22c05b1ba8f47cbd162475669474316d7a79ea84bce3c690"), state_root: Eth2Digest.fromHex("0xa6975bac699618cc22c05b1ba8f47cbd162475669474316d7a79ea84bce3c690"),
@ -1057,7 +1057,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 4839737623914146930'u64, validator_index: 273755626242170824'u64, address: ExecutionAddress.fromHex("0xcacc573cfc0ad561aae27f7be1c38b8dd6fab2cc"), amount: 9475975971913976804'u64.Gwei), capella.Withdrawal(index: 4839737623914146930'u64, validator_index: 273755626242170824'u64, address: ExecutionAddress.fromHex("0xcacc573cfc0ad561aae27f7be1c38b8dd6fab2cc"), amount: 9475975971913976804'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x2cb54ddf357864102f4ab6bce57317a75cee972f303449bf7047f4e0e5809127"), parent_hash: Eth2Digest.fromHex("0x2cb54ddf357864102f4ab6bce57317a75cee972f303449bf7047f4e0e5809127"),
fee_recipient: ExecutionAddress.fromHex("0x92af67d9604b945fd2cbaccd29598e2b47ef5d2d"), fee_recipient: ExecutionAddress.fromHex("0x92af67d9604b945fd2cbaccd29598e2b47ef5d2d"),
state_root: Eth2Digest.fromHex("0xc64221514816a2f87a29c2c474abf99547820b2a12e6e5956f160dd54579e521"), state_root: Eth2Digest.fromHex("0xc64221514816a2f87a29c2c474abf99547820b2a12e6e5956f160dd54579e521"),
@ -1080,7 +1080,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 727020'u64, validator_index: 10133766089843653238'u64, address: ExecutionAddress.fromHex("0x6a1ed64277cf1eba8c96281531d2799d1fa7c409"), amount: 130469'u64.Gwei), capella.Withdrawal(index: 727020'u64, validator_index: 10133766089843653238'u64, address: ExecutionAddress.fromHex("0x6a1ed64277cf1eba8c96281531d2799d1fa7c409"), amount: 130469'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xac5a7347865f503e1578d1b47271c8e60027b5ba24b0da8e7c3733bcdbeda220"), parent_hash: Eth2Digest.fromHex("0xac5a7347865f503e1578d1b47271c8e60027b5ba24b0da8e7c3733bcdbeda220"),
fee_recipient: ExecutionAddress.fromHex("0x8b7fa656e67f6af2074ec3f16930ad742a69f189"), fee_recipient: ExecutionAddress.fromHex("0x8b7fa656e67f6af2074ec3f16930ad742a69f189"),
state_root: Eth2Digest.fromHex("0xeb50f351f6945df8983cf4037ee264dcb2ceef3313ae452248571811d8a3a8cf"), state_root: Eth2Digest.fromHex("0xeb50f351f6945df8983cf4037ee264dcb2ceef3313ae452248571811d8a3a8cf"),
@ -1100,7 +1100,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 1'u64, validator_index: 239183'u64, address: ExecutionAddress.fromHex("0x75efb2a04b5f25ae56ff7256ee9f4fdc4e25baf3"), amount: 402148'u64.Gwei), capella.Withdrawal(index: 1'u64, validator_index: 239183'u64, address: ExecutionAddress.fromHex("0x75efb2a04b5f25ae56ff7256ee9f4fdc4e25baf3"), amount: 402148'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xd3be9b45bfe67229afb47461ca2970505586cab8eb8e00f280ceb07a9d47866f"), parent_hash: Eth2Digest.fromHex("0xd3be9b45bfe67229afb47461ca2970505586cab8eb8e00f280ceb07a9d47866f"),
fee_recipient: ExecutionAddress.fromHex("0xde645d4a77f0a386a45c52357948e1d7eac5e780"), fee_recipient: ExecutionAddress.fromHex("0xde645d4a77f0a386a45c52357948e1d7eac5e780"),
state_root: Eth2Digest.fromHex("0x69b70e0188e7b88e38df90853b2dfd2e4c7181e83d82d77ab81c57d161216b92"), state_root: Eth2Digest.fromHex("0x69b70e0188e7b88e38df90853b2dfd2e4c7181e83d82d77ab81c57d161216b92"),
@ -1118,7 +1118,7 @@ suite "Eth1 monitor":
transactions: List[bellatrix.Transaction, MAX_TRANSACTIONS_PER_PAYLOAD].init(@[List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[99'u8, 198'u8, 91'u8, 86'u8, 23'u8, 222'u8, 121'u8, 250'u8, 12'u8, 135'u8, 133'u8, 37'u8, 61'u8]), List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[]), List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[81'u8, 173'u8, 241'u8, 145'u8, 54'u8, 3'u8, 36'u8, 121'u8])]), transactions: List[bellatrix.Transaction, MAX_TRANSACTIONS_PER_PAYLOAD].init(@[List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[99'u8, 198'u8, 91'u8, 86'u8, 23'u8, 222'u8, 121'u8, 250'u8, 12'u8, 135'u8, 133'u8, 37'u8, 61'u8]), List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[]), List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[81'u8, 173'u8, 241'u8, 145'u8, 54'u8, 3'u8, 36'u8, 121'u8])]),
withdrawals: List[capella.Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD].init(@[]) withdrawals: List[capella.Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD].init(@[])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x06504beb0dc3bae44ef75678d29ec5138d87da68d307ca7d43e259cede60fda6"), parent_hash: Eth2Digest.fromHex("0x06504beb0dc3bae44ef75678d29ec5138d87da68d307ca7d43e259cede60fda6"),
fee_recipient: ExecutionAddress.fromHex("0x527ce602a0be18c0944dc27b2864c711a91f89a6"), fee_recipient: ExecutionAddress.fromHex("0x527ce602a0be18c0944dc27b2864c711a91f89a6"),
state_root: Eth2Digest.fromHex("0xad3bbef5d22bdc2429da09eb85137c881f85fe6e6b3ea207e5eaeb399c755055"), state_root: Eth2Digest.fromHex("0xad3bbef5d22bdc2429da09eb85137c881f85fe6e6b3ea207e5eaeb399c755055"),
@ -1138,7 +1138,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 18446744073709551615'u64, validator_index: 15531362396155364476'u64, address: ExecutionAddress.fromHex("0x063b2e1de01c4dad4402641553c7c60ea990ab30"), amount: 106054'u64.Gwei), capella.Withdrawal(index: 18446744073709551615'u64, validator_index: 15531362396155364476'u64, address: ExecutionAddress.fromHex("0x063b2e1de01c4dad4402641553c7c60ea990ab30"), amount: 106054'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xb5d4a5eae3a1ea004ed573b0b8f8a22c847616758c0faf1e7e9589f16e55415c"), parent_hash: Eth2Digest.fromHex("0xb5d4a5eae3a1ea004ed573b0b8f8a22c847616758c0faf1e7e9589f16e55415c"),
fee_recipient: ExecutionAddress.fromHex("0xf7ac0877fd8bcadde1e050f6c7ddad13688ec071"), fee_recipient: ExecutionAddress.fromHex("0xf7ac0877fd8bcadde1e050f6c7ddad13688ec071"),
state_root: Eth2Digest.fromHex("0x7472f824376a723894f8d539743c7f93b69839772f28cf6a83e2102fde99c3c9"), state_root: Eth2Digest.fromHex("0x7472f824376a723894f8d539743c7f93b69839772f28cf6a83e2102fde99c3c9"),
@ -1158,7 +1158,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 5416630176463173042'u64, validator_index: 0'u64, address: ExecutionAddress.fromHex("0xd7b1d18e4eb7b5041b4b08bae2ce8e22982d6e6c"), amount: 911474'u64.Gwei), capella.Withdrawal(index: 5416630176463173042'u64, validator_index: 0'u64, address: ExecutionAddress.fromHex("0xd7b1d18e4eb7b5041b4b08bae2ce8e22982d6e6c"), amount: 911474'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x2629683cfc70198038837270bde3c60176c2a4aeeced0d4a4f14dc99a380c377"), parent_hash: Eth2Digest.fromHex("0x2629683cfc70198038837270bde3c60176c2a4aeeced0d4a4f14dc99a380c377"),
fee_recipient: ExecutionAddress.fromHex("0xd234af1937861b66ca84c334824763fb54347677"), fee_recipient: ExecutionAddress.fromHex("0xd234af1937861b66ca84c334824763fb54347677"),
state_root: Eth2Digest.fromHex("0xf79f02d52d7f2a4be99eebba3dfb3bce74136ea739da515703d095a66ce203d5"), state_root: Eth2Digest.fromHex("0xf79f02d52d7f2a4be99eebba3dfb3bce74136ea739da515703d095a66ce203d5"),
@ -1180,7 +1180,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 2046299652899032730'u64, validator_index: 18446744073709551615'u64, address: ExecutionAddress.fromHex("0x44bfe00f98603a5e8363030de4202ba50c7e8138"), amount: 15403504672180847702'u64.Gwei), capella.Withdrawal(index: 2046299652899032730'u64, validator_index: 18446744073709551615'u64, address: ExecutionAddress.fromHex("0x44bfe00f98603a5e8363030de4202ba50c7e8138"), amount: 15403504672180847702'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x190544155dd98bf86d3ed5ee94d01afd3a8e67b8476f94d90604706da0a7d340"), parent_hash: Eth2Digest.fromHex("0x190544155dd98bf86d3ed5ee94d01afd3a8e67b8476f94d90604706da0a7d340"),
fee_recipient: ExecutionAddress.fromHex("0x799d176d73d5d6d54d66941ad6cef8208677371c"), fee_recipient: ExecutionAddress.fromHex("0x799d176d73d5d6d54d66941ad6cef8208677371c"),
state_root: Eth2Digest.fromHex("0x07e626b9c44b0ff14586d17acf79cb136ccc5d37fd7135da33cec516af168f43"), state_root: Eth2Digest.fromHex("0x07e626b9c44b0ff14586d17acf79cb136ccc5d37fd7135da33cec516af168f43"),
@ -1203,7 +1203,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 10622085591419415519'u64, validator_index: 8179967808007927229'u64, address: ExecutionAddress.fromHex("0x03d2493395b71bb181db626a99c24dbc1d07065f"), amount: 18446744073709551615'u64.Gwei), capella.Withdrawal(index: 10622085591419415519'u64, validator_index: 8179967808007927229'u64, address: ExecutionAddress.fromHex("0x03d2493395b71bb181db626a99c24dbc1d07065f"), amount: 18446744073709551615'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x86d7b430f69b215ab5ae863998ce41f01a5016376c8bec7f5b7a6e16a2326d92"), parent_hash: Eth2Digest.fromHex("0x86d7b430f69b215ab5ae863998ce41f01a5016376c8bec7f5b7a6e16a2326d92"),
fee_recipient: ExecutionAddress.fromHex("0x73068946d757f5d145a38fe9de817b8b1e9d6c43"), fee_recipient: ExecutionAddress.fromHex("0x73068946d757f5d145a38fe9de817b8b1e9d6c43"),
state_root: Eth2Digest.fromHex("0x312b4af4d3ca5960dda2f99531819f5c32624753cc0756c05d242f65dd605d92"), state_root: Eth2Digest.fromHex("0x312b4af4d3ca5960dda2f99531819f5c32624753cc0756c05d242f65dd605d92"),
@ -1226,7 +1226,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 530041'u64, validator_index: 18446744073709551615'u64, address: ExecutionAddress.fromHex("0x4b7853973d34b1efe7722be5c688589b49c1aaa9"), amount: 18446744073709551615'u64.Gwei), capella.Withdrawal(index: 530041'u64, validator_index: 18446744073709551615'u64, address: ExecutionAddress.fromHex("0x4b7853973d34b1efe7722be5c688589b49c1aaa9"), amount: 18446744073709551615'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xc51bf481df9be981c6656081e3854ffcf27551e2b4fdaed4ab12b355f247f4e1"), parent_hash: Eth2Digest.fromHex("0xc51bf481df9be981c6656081e3854ffcf27551e2b4fdaed4ab12b355f247f4e1"),
fee_recipient: ExecutionAddress.fromHex("0xd79098c25eed05c9f6d55e95f5f6f58c1472fb28"), fee_recipient: ExecutionAddress.fromHex("0xd79098c25eed05c9f6d55e95f5f6f58c1472fb28"),
state_root: Eth2Digest.fromHex("0x1a6b1eb78e5ac155d4be247a3b48d8d8d8574a16fa846681553037629b97ffd0"), state_root: Eth2Digest.fromHex("0x1a6b1eb78e5ac155d4be247a3b48d8d8d8574a16fa846681553037629b97ffd0"),
@ -1249,7 +1249,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 18446744073709551615'u64, validator_index: 2895353066704396409'u64, address: ExecutionAddress.fromHex("0x7e8b34a029236dc0d15db19153165d1eccab05a8"), amount: 3749025806369957542'u64.Gwei), capella.Withdrawal(index: 18446744073709551615'u64, validator_index: 2895353066704396409'u64, address: ExecutionAddress.fromHex("0x7e8b34a029236dc0d15db19153165d1eccab05a8"), amount: 3749025806369957542'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x8b3e7e8d447527b9d00693389928260e7ea9da6855efd99369182bd9c213988a"), parent_hash: Eth2Digest.fromHex("0x8b3e7e8d447527b9d00693389928260e7ea9da6855efd99369182bd9c213988a"),
fee_recipient: ExecutionAddress.fromHex("0xb45716c9aeddeb030c0b94202fcb97bd75a039b6"), fee_recipient: ExecutionAddress.fromHex("0xb45716c9aeddeb030c0b94202fcb97bd75a039b6"),
state_root: Eth2Digest.fromHex("0x8114b285e5f3277c04a66e660fef3b86295d6ca859dfa216df3309c0a7242f2d"), state_root: Eth2Digest.fromHex("0x8114b285e5f3277c04a66e660fef3b86295d6ca859dfa216df3309c0a7242f2d"),
@ -1267,7 +1267,7 @@ suite "Eth1 monitor":
transactions: List[bellatrix.Transaction, MAX_TRANSACTIONS_PER_PAYLOAD].init(@[List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[]), List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[16'u8, 66'u8, 215'u8, 40'u8, 223'u8, 195'u8, 43'u8, 228'u8, 225'u8, 244'u8, 34'u8, 14'u8, 117'u8]), List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[92'u8, 46'u8, 215'u8, 218'u8, 71'u8, 99'u8, 115'u8, 119'u8])]), transactions: List[bellatrix.Transaction, MAX_TRANSACTIONS_PER_PAYLOAD].init(@[List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[]), List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[16'u8, 66'u8, 215'u8, 40'u8, 223'u8, 195'u8, 43'u8, 228'u8, 225'u8, 244'u8, 34'u8, 14'u8, 117'u8]), List[byte, Limit MAX_BYTES_PER_TRANSACTION].init(@[92'u8, 46'u8, 215'u8, 218'u8, 71'u8, 99'u8, 115'u8, 119'u8])]),
withdrawals: List[capella.Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD].init(@[]) withdrawals: List[capella.Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD].init(@[])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xa4854e346d2e9a921cc6b3c4ce9fc739c99795cf10002924089f9886f8624d59"), parent_hash: Eth2Digest.fromHex("0xa4854e346d2e9a921cc6b3c4ce9fc739c99795cf10002924089f9886f8624d59"),
fee_recipient: ExecutionAddress.fromHex("0xa88781cf69a1eed63bcc3a32b6f9aba35d4f5b5e"), fee_recipient: ExecutionAddress.fromHex("0xa88781cf69a1eed63bcc3a32b6f9aba35d4f5b5e"),
state_root: Eth2Digest.fromHex("0xdc06d9210fd2738b0fa9df6d68e4ffbfef0dd7d7d8093fdbcd97ff845318cf6b"), state_root: Eth2Digest.fromHex("0xdc06d9210fd2738b0fa9df6d68e4ffbfef0dd7d7d8093fdbcd97ff845318cf6b"),
@ -1290,7 +1290,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 861292'u64, validator_index: 101133'u64, address: ExecutionAddress.fromHex("0x70e7126e6288dd8559b6bf8946b98fe02bc53e8f"), amount: 5439105246644982514'u64.Gwei), capella.Withdrawal(index: 861292'u64, validator_index: 101133'u64, address: ExecutionAddress.fromHex("0x70e7126e6288dd8559b6bf8946b98fe02bc53e8f"), amount: 5439105246644982514'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x5e7b12465e0461e5dfa59a3254282378c55961b0e411023ce89d968bbdc33e9c"), parent_hash: Eth2Digest.fromHex("0x5e7b12465e0461e5dfa59a3254282378c55961b0e411023ce89d968bbdc33e9c"),
fee_recipient: ExecutionAddress.fromHex("0xbd1a1396ab49631cc933770944996b294da97d43"), fee_recipient: ExecutionAddress.fromHex("0xbd1a1396ab49631cc933770944996b294da97d43"),
state_root: Eth2Digest.fromHex("0x74e6ccfb15da8afb94eebf28cb3ba3f9ce63e3354097f2f2527fe1cf978e76bf"), state_root: Eth2Digest.fromHex("0x74e6ccfb15da8afb94eebf28cb3ba3f9ce63e3354097f2f2527fe1cf978e76bf"),
@ -1311,7 +1311,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 256915780184525584'u64, validator_index: 364410'u64, address: ExecutionAddress.fromHex("0x40a55ad4a156caf112e2abe789554520814e48a1"), amount: 297315'u64.Gwei), capella.Withdrawal(index: 256915780184525584'u64, validator_index: 364410'u64, address: ExecutionAddress.fromHex("0x40a55ad4a156caf112e2abe789554520814e48a1"), amount: 297315'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xa8f90a617f1f230506d200c6026bd60e38f599930ed04f90cdc320a6d45bb022"), parent_hash: Eth2Digest.fromHex("0xa8f90a617f1f230506d200c6026bd60e38f599930ed04f90cdc320a6d45bb022"),
fee_recipient: ExecutionAddress.fromHex("0x3531157eaf2c185bd8720f3edfaf76829632f07d"), fee_recipient: ExecutionAddress.fromHex("0x3531157eaf2c185bd8720f3edfaf76829632f07d"),
state_root: Eth2Digest.fromHex("0xa16f8936e945ecd45a4ae107e46acd8530e438fa1bc8eb85aef62afaca1656da"), state_root: Eth2Digest.fromHex("0xa16f8936e945ecd45a4ae107e46acd8530e438fa1bc8eb85aef62afaca1656da"),
@ -1331,7 +1331,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 645596'u64, validator_index: 248698'u64, address: ExecutionAddress.fromHex("0x124e32ea8d0363647a58a5511b6de35bdd50236e"), amount: 18446744073709551615'u64.Gwei), capella.Withdrawal(index: 645596'u64, validator_index: 248698'u64, address: ExecutionAddress.fromHex("0x124e32ea8d0363647a58a5511b6de35bdd50236e"), amount: 18446744073709551615'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xc914f63464f3f1588a32d3751900d415bbf1fe002c42068650f5c7c588b1935c"), parent_hash: Eth2Digest.fromHex("0xc914f63464f3f1588a32d3751900d415bbf1fe002c42068650f5c7c588b1935c"),
fee_recipient: ExecutionAddress.fromHex("0x61523b6add59cc65d3c5b75c6f749fa601e157de"), fee_recipient: ExecutionAddress.fromHex("0x61523b6add59cc65d3c5b75c6f749fa601e157de"),
state_root: Eth2Digest.fromHex("0xe84ecb995f6c7e753355c8d2e24694441c528b65ef9b1d8c6f4e9d98d409342b"), state_root: Eth2Digest.fromHex("0xe84ecb995f6c7e753355c8d2e24694441c528b65ef9b1d8c6f4e9d98d409342b"),
@ -1353,7 +1353,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 944680'u64, validator_index: 507423'u64, address: ExecutionAddress.fromHex("0x640d578aeed6b8a9acc83f13343f3139fe8f4a15"), amount: 941781'u64.Gwei), capella.Withdrawal(index: 944680'u64, validator_index: 507423'u64, address: ExecutionAddress.fromHex("0x640d578aeed6b8a9acc83f13343f3139fe8f4a15"), amount: 941781'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x086322b79160568c7d096747ef351338ddc93f252dab1df3ef65aaf24723d2c3"), parent_hash: Eth2Digest.fromHex("0x086322b79160568c7d096747ef351338ddc93f252dab1df3ef65aaf24723d2c3"),
fee_recipient: ExecutionAddress.fromHex("0x03c6998b5a3ff1c98538c2333d279f2b1cc59f7f"), fee_recipient: ExecutionAddress.fromHex("0x03c6998b5a3ff1c98538c2333d279f2b1cc59f7f"),
state_root: Eth2Digest.fromHex("0x446d99a7e9fd2c327fbd445dbfb3b3e3a895cdfa6f208496dd09c0f84f7ac0fd"), state_root: Eth2Digest.fromHex("0x446d99a7e9fd2c327fbd445dbfb3b3e3a895cdfa6f208496dd09c0f84f7ac0fd"),
@ -1375,7 +1375,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 12003547154719720523'u64, validator_index: 18446744073709551615'u64, address: ExecutionAddress.fromHex("0xe888b3288bfaf8f979c93699cbabef6c1f156f19"), amount: 18446744073709551615'u64.Gwei), capella.Withdrawal(index: 12003547154719720523'u64, validator_index: 18446744073709551615'u64, address: ExecutionAddress.fromHex("0xe888b3288bfaf8f979c93699cbabef6c1f156f19"), amount: 18446744073709551615'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xcfba7f4aa4ff01d3d9de84dbe1761c79627a10c3188fb0a7c8adfa0d489e6441"), parent_hash: Eth2Digest.fromHex("0xcfba7f4aa4ff01d3d9de84dbe1761c79627a10c3188fb0a7c8adfa0d489e6441"),
fee_recipient: ExecutionAddress.fromHex("0x106b3bcaae4ff58dd837768be35c29c48571e4a4"), fee_recipient: ExecutionAddress.fromHex("0x106b3bcaae4ff58dd837768be35c29c48571e4a4"),
state_root: Eth2Digest.fromHex("0xe6242399020361e70cb6b89701001fa8326251e6bae3b4ca1978eded8831d9a7"), state_root: Eth2Digest.fromHex("0xe6242399020361e70cb6b89701001fa8326251e6bae3b4ca1978eded8831d9a7"),
@ -1395,7 +1395,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 18405055677765556765'u64, validator_index: 13513833286292305941'u64, address: ExecutionAddress.fromHex("0xfe53af2bf3560b2157a683a545d4f898354f4d55"), amount: 911502'u64.Gwei), capella.Withdrawal(index: 18405055677765556765'u64, validator_index: 13513833286292305941'u64, address: ExecutionAddress.fromHex("0xfe53af2bf3560b2157a683a545d4f898354f4d55"), amount: 911502'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x063bc56b731eeeff8bf1c33d88523a04a14fa0c745eb3c750139842d88244982"), parent_hash: Eth2Digest.fromHex("0x063bc56b731eeeff8bf1c33d88523a04a14fa0c745eb3c750139842d88244982"),
fee_recipient: ExecutionAddress.fromHex("0x415b1cd5b42709a3724ab2f6f50a6dab7399d7ca"), fee_recipient: ExecutionAddress.fromHex("0x415b1cd5b42709a3724ab2f6f50a6dab7399d7ca"),
state_root: Eth2Digest.fromHex("0xf261abf37066b8dc5c868946346c98aae445adbb48e6dd05969fbb49267a276e"), state_root: Eth2Digest.fromHex("0xf261abf37066b8dc5c868946346c98aae445adbb48e6dd05969fbb49267a276e"),
@ -1416,7 +1416,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 0'u64, validator_index: 1'u64, address: ExecutionAddress.fromHex("0x3d22a723824a2944ea9accc8653002bf7d61a10a"), amount: 2799163561369818755'u64.Gwei), capella.Withdrawal(index: 0'u64, validator_index: 1'u64, address: ExecutionAddress.fromHex("0x3d22a723824a2944ea9accc8653002bf7d61a10a"), amount: 2799163561369818755'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xb31c41d39ef7e9a9b905cc93d82264415024d7daef48d886f1b3bc0fd6545edb"), parent_hash: Eth2Digest.fromHex("0xb31c41d39ef7e9a9b905cc93d82264415024d7daef48d886f1b3bc0fd6545edb"),
fee_recipient: ExecutionAddress.fromHex("0x5ad4b6c0d6b986e775f3a9ae2be73a330ba9f87c"), fee_recipient: ExecutionAddress.fromHex("0x5ad4b6c0d6b986e775f3a9ae2be73a330ba9f87c"),
state_root: Eth2Digest.fromHex("0x01dbc857a3d8994cf10cd1be3b2018be0e26ba54a5456e10a6e5729328a0b5f5"), state_root: Eth2Digest.fromHex("0x01dbc857a3d8994cf10cd1be3b2018be0e26ba54a5456e10a6e5729328a0b5f5"),
@ -1437,7 +1437,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 560588584813483246'u64, validator_index: 18446744073709551615'u64, address: ExecutionAddress.fromHex("0x1a1b89bf52af0d4a8eff759986ffd93cf4464114"), amount: 13046900622089392610'u64.Gwei), capella.Withdrawal(index: 560588584813483246'u64, validator_index: 18446744073709551615'u64, address: ExecutionAddress.fromHex("0x1a1b89bf52af0d4a8eff759986ffd93cf4464114"), amount: 13046900622089392610'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0xf6cba3ced37c08da230babbf9d1e360661e5a21ac235fefa75cbe756f15809de"), parent_hash: Eth2Digest.fromHex("0xf6cba3ced37c08da230babbf9d1e360661e5a21ac235fefa75cbe756f15809de"),
fee_recipient: ExecutionAddress.fromHex("0x0c080349793b7f43fb3ee9101889e7d32e02c01d"), fee_recipient: ExecutionAddress.fromHex("0x0c080349793b7f43fb3ee9101889e7d32e02c01d"),
state_root: Eth2Digest.fromHex("0x6a33580fc482e9783d66bee9276f42b74a2cbc2b7434fc408a6ba9df77db0ceb"), state_root: Eth2Digest.fromHex("0x6a33580fc482e9783d66bee9276f42b74a2cbc2b7434fc408a6ba9df77db0ceb"),
@ -1460,7 +1460,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 834083'u64, validator_index: 10715076713456342424'u64, address: ExecutionAddress.fromHex("0x07ee24f650e7254d10d61b832db7174128bf22b4"), amount: 17794546242151296198'u64.Gwei), capella.Withdrawal(index: 834083'u64, validator_index: 10715076713456342424'u64, address: ExecutionAddress.fromHex("0x07ee24f650e7254d10d61b832db7174128bf22b4"), amount: 17794546242151296198'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x62ce6a6d68578309c4730f96f98a809d4b4225fc3d37a285daf26288b10f9590"), parent_hash: Eth2Digest.fromHex("0x62ce6a6d68578309c4730f96f98a809d4b4225fc3d37a285daf26288b10f9590"),
fee_recipient: ExecutionAddress.fromHex("0x8c892b06f1e9c877c310b6eccefb20fcf5e00227"), fee_recipient: ExecutionAddress.fromHex("0x8c892b06f1e9c877c310b6eccefb20fcf5e00227"),
state_root: Eth2Digest.fromHex("0x578f93b83206e3239c69f51cc8e59cd89087260cda9f0efc892aa2ffb2bf386e"), state_root: Eth2Digest.fromHex("0x578f93b83206e3239c69f51cc8e59cd89087260cda9f0efc892aa2ffb2bf386e"),
@ -1480,7 +1480,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 0'u64, validator_index: 780337'u64, address: ExecutionAddress.fromHex("0xf0ab5949e96d8befa8090fe5612d9c45beea0c8f"), amount: 2246589958612652012'u64.Gwei), capella.Withdrawal(index: 0'u64, validator_index: 780337'u64, address: ExecutionAddress.fromHex("0xf0ab5949e96d8befa8090fe5612d9c45beea0c8f"), amount: 2246589958612652012'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x4f8251c361a23171de8648d1e96c91fea2cc5a691dcd884e3a957dc8f6a8802a"), parent_hash: Eth2Digest.fromHex("0x4f8251c361a23171de8648d1e96c91fea2cc5a691dcd884e3a957dc8f6a8802a"),
fee_recipient: ExecutionAddress.fromHex("0x7da9175abaf6e4e400e0ee516fd3ab07dd659f2a"), fee_recipient: ExecutionAddress.fromHex("0x7da9175abaf6e4e400e0ee516fd3ab07dd659f2a"),
state_root: Eth2Digest.fromHex("0x1bd3a5da4c266dd396b8209288e68be066176ebe64cd4c17c4c6cdccaf03577e"), state_root: Eth2Digest.fromHex("0x1bd3a5da4c266dd396b8209288e68be066176ebe64cd4c17c4c6cdccaf03577e"),
@ -1498,7 +1498,7 @@ suite "Eth1 monitor":
transactions: List[bellatrix.Transaction, MAX_TRANSACTIONS_PER_PAYLOAD].init(@[]), transactions: List[bellatrix.Transaction, MAX_TRANSACTIONS_PER_PAYLOAD].init(@[]),
withdrawals: List[capella.Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD].init(@[]) withdrawals: List[capella.Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD].init(@[])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x0c67b44b492590ffb9e6d2a63c84714821be7526ce1c337c06276e33a62b7b93"), parent_hash: Eth2Digest.fromHex("0x0c67b44b492590ffb9e6d2a63c84714821be7526ce1c337c06276e33a62b7b93"),
fee_recipient: ExecutionAddress.fromHex("0x1d16dbe66ead2ba8afb8594acaf8d536be08dac3"), fee_recipient: ExecutionAddress.fromHex("0x1d16dbe66ead2ba8afb8594acaf8d536be08dac3"),
state_root: Eth2Digest.fromHex("0xeeb40e334aff8512435b5908a8dd3c06993cadca8bc44e9a6c28c6003162c6a9"), state_root: Eth2Digest.fromHex("0xeeb40e334aff8512435b5908a8dd3c06993cadca8bc44e9a6c28c6003162c6a9"),
@ -1518,7 +1518,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 820354'u64, validator_index: 626992'u64, address: ExecutionAddress.fromHex("0x4abb3f9a694bf6b27be97e24290ca6826b23c5d0"), amount: 100271'u64.Gwei), capella.Withdrawal(index: 820354'u64, validator_index: 626992'u64, address: ExecutionAddress.fromHex("0x4abb3f9a694bf6b27be97e24290ca6826b23c5d0"), amount: 100271'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x7a9d6ab34c0314959d5bdceb0bd80f142e59e5e2addedcd178612303897e7a8a"), parent_hash: Eth2Digest.fromHex("0x7a9d6ab34c0314959d5bdceb0bd80f142e59e5e2addedcd178612303897e7a8a"),
fee_recipient: ExecutionAddress.fromHex("0x3425bc529b4791f5fdb7dd365501199b2f81e578"), fee_recipient: ExecutionAddress.fromHex("0x3425bc529b4791f5fdb7dd365501199b2f81e578"),
state_root: Eth2Digest.fromHex("0x4eb1a9a3c4b9392325a14f3f8efbc0b3cc3bfc2d7e9992377abd84af6c556db5"), state_root: Eth2Digest.fromHex("0x4eb1a9a3c4b9392325a14f3f8efbc0b3cc3bfc2d7e9992377abd84af6c556db5"),
@ -1539,7 +1539,7 @@ suite "Eth1 monitor":
capella.Withdrawal(index: 9475052657186699106'u64, validator_index: 759532'u64, address: ExecutionAddress.fromHex("0x97559fac3168c6ee81b0f0b0b88563080ca24769"), amount: 4852567582077527137'u64.Gwei), capella.Withdrawal(index: 9475052657186699106'u64, validator_index: 759532'u64, address: ExecutionAddress.fromHex("0x97559fac3168c6ee81b0f0b0b88563080ca24769"), amount: 4852567582077527137'u64.Gwei),
]) ])
), ),
(eip4844.ExecutionPayload)( (deneb.ExecutionPayload)(
parent_hash: Eth2Digest.fromHex("0x806a868f0f31e8f519fa6339ad18c414dba17feb03aaf6ca3775b152bac64f3b"), parent_hash: Eth2Digest.fromHex("0x806a868f0f31e8f519fa6339ad18c414dba17feb03aaf6ca3775b152bac64f3b"),
fee_recipient: ExecutionAddress.fromHex("0xa2bcc8b793c4a5d4e0f68251d2f22e1ff4366d2c"), fee_recipient: ExecutionAddress.fromHex("0xa2bcc8b793c4a5d4e0f68251d2f22e1ff4366d2c"),
state_root: Eth2Digest.fromHex("0x6979ac9545f31eaf7ed8bd227cd7cbd1017492b892bcc118f7417ea87d50d412"), state_root: Eth2Digest.fromHex("0x6979ac9545f31eaf7ed8bd227cd7cbd1017492b892bcc118f7417ea87d50d412"),