consensus-specs v1.3.0 bumps with cleanup (#4918)

Some more consensus-specs v1.3.0 bumps. No semantic logic changes,
but also contains cleanup, so separate PR to reduce noise.
This commit is contained in:
Etan Kissling 2023-05-09 20:16:49 +02:00 committed by GitHub
parent e9319a5947
commit 93899b2e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 50 deletions

View File

@ -52,7 +52,7 @@ This [guide](https://nimbus.guide/migration.html) will take you through the basi
## Related projects ## Related projects
* [status-im/nimbus-eth1](https://github.com/status-im/nimbus-eth1/): Nimbus for Ethereum 1 * [status-im/nimbus-eth1](https://github.com/status-im/nimbus-eth1/): Nimbus for Ethereum 1
* [ethereum/consensus-specs](https://github.com/ethereum/consensus-specs/tree/v1.3.0-rc.5#stable-specifications): Consensus specification that this project implements * [ethereum/consensus-specs](https://github.com/ethereum/consensus-specs/tree/v1.3.0/#stable-specifications): Consensus specification that this project implements
You can check where the beacon chain fits in the Ethereum ecosystem in our Two-Point-Oh series: https://our.status.im/tag/two-point-oh/ You can check where the beacon chain fits in the Ethereum ecosystem in our Two-Point-Oh series: https://our.status.im/tag/two-point-oh/

View File

@ -327,7 +327,7 @@ elif const_preset == "minimal":
# Transition # Transition
# --------------------------------------------------------------- # ---------------------------------------------------------------
# TBD, 2**256-2**10 is a placeholder # 2**256-2**10 for testing minimal network
TERMINAL_TOTAL_DIFFICULTY: TERMINAL_TOTAL_DIFFICULTY:
u256"115792089237316195423570985008687907853269984665640564039457584007913129638912", u256"115792089237316195423570985008687907853269984665640564039457584007913129638912",
# By default, don't use these params # By default, don't use these params

View File

@ -64,8 +64,8 @@ func aggregateAttesters(
if validatorIndices.len == 0: if validatorIndices.len == 0:
# Aggregation spec requires non-empty collection # Aggregation spec requires non-empty collection
# - https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04 # - https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04
# Eth2 spec requires at least one attesting index in attestation # Consensus specs require at least one attesting index in attestation
# - https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#is_valid_indexed_attestation # - https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#is_valid_indexed_attestation
return err("aggregateAttesters: no attesting indices") return err("aggregateAttesters: no attesting indices")
let let
@ -90,8 +90,8 @@ func aggregateAttesters(
if validatorIndices.len == 0: if validatorIndices.len == 0:
# Aggregation spec requires non-empty collection # Aggregation spec requires non-empty collection
# - https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04 # - https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04
# Eth2 spec requires at least one attesting index in attestation # Consensus specs require at least one attesting index in attestation
# - https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#is_valid_indexed_attestation # - https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#is_valid_indexed_attestation
return err("aggregateAttesters: no attesting indices") return err("aggregateAttesters: no attesting indices")
var attestersAgg{.noinit.}: AggregatePublicKey var attestersAgg{.noinit.}: AggregatePublicKey

View File

@ -6,11 +6,11 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
# State transition - block processing, as described in # State transition - block processing, as described in
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#block-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#block-processing
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#block-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#block-processing
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#block-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#block-processing
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#block-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#block-processing
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/beacon-chain.md#block-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#block-processing
# #
# The entry point is `process_block` which is at the bottom of this file. # The entry point is `process_block` which is at the bottom of this file.
# #
@ -38,10 +38,10 @@ from ./datatypes/capella import
export extras, phase0, altair export extras, phase0, altair
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#block-header # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#block-header
func process_block_header*( func process_block_header*(
state: var ForkyBeaconState, blck: SomeForkyBeaconBlock, flags: UpdateFlags, state: var ForkyBeaconState, blck: SomeForkyBeaconBlock,
cache: var StateCache): Result[void, cstring] = flags: UpdateFlags, cache: var StateCache): Result[void, cstring] =
# Verify that the slots match # Verify that the slots match
if not (blck.slot == state.slot): if not (blck.slot == state.slot):
return err("process_block_header: slot mismatch") return err("process_block_header: slot mismatch")
@ -80,10 +80,10 @@ func `xor`[T: array](a, b: T): T =
for i in 0..<result.len: for i in 0..<result.len:
result[i] = a[i] xor b[i] result[i] = a[i] xor b[i]
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#randao # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#randao
proc process_randao( proc process_randao(
state: var ForkyBeaconState, body: SomeForkyBeaconBlockBody, flags: UpdateFlags, state: var ForkyBeaconState, body: SomeForkyBeaconBlockBody,
cache: var StateCache): Result[void, cstring] = flags: UpdateFlags, cache: var StateCache): Result[void, cstring] =
let let
proposer_index = get_beacon_proposer_index(state, cache).valueOr: proposer_index = get_beacon_proposer_index(state, cache).valueOr:
return err("process_randao: proposer index missing, probably along with any active validators") return err("process_randao: proposer index missing, probably along with any active validators")
@ -113,8 +113,10 @@ proc process_randao(
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#eth1-data # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#eth1-data
func process_eth1_data(state: var ForkyBeaconState, body: SomeForkyBeaconBlockBody): Result[void, cstring]= func process_eth1_data(
state: var ForkyBeaconState,
body: SomeForkyBeaconBlockBody): Result[void, cstring] =
if not state.eth1_data_votes.add body.eth1_data: if not state.eth1_data_votes.add body.eth1_data:
# Count is reset in process_final_updates, so this should never happen # Count is reset in process_final_updates, so this should never happen
return err("process_eth1_data: no more room for eth1 data") return err("process_eth1_data: no more room for eth1 data")
@ -124,14 +126,14 @@ func process_eth1_data(state: var ForkyBeaconState, body: SomeForkyBeaconBlockBo
state.eth1_data = body.eth1_data state.eth1_data = body.eth1_data
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#is_slashable_validator # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#is_slashable_validator
func is_slashable_validator(validator: Validator, epoch: Epoch): bool = func is_slashable_validator(validator: Validator, epoch: Epoch): bool =
# Check if ``validator`` is slashable. # Check if ``validator`` is slashable.
(not validator.slashed) and (not validator.slashed) and
(validator.activation_epoch <= epoch) and (validator.activation_epoch <= epoch) and
(epoch < validator.withdrawable_epoch) (epoch < validator.withdrawable_epoch)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#proposer-slashings # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#proposer-slashings
proc check_proposer_slashing*( proc check_proposer_slashing*(
state: ForkyBeaconState, proposer_slashing: SomeProposerSlashing, state: ForkyBeaconState, proposer_slashing: SomeProposerSlashing,
flags: UpdateFlags): flags: UpdateFlags):
@ -175,12 +177,12 @@ proc check_proposer_slashing*(
ValidatorIndex.init(header_1.proposer_index) ValidatorIndex.init(header_1.proposer_index)
proc check_proposer_slashing*( proc check_proposer_slashing*(
state: var ForkedHashedBeaconState; proposer_slashing: SomeProposerSlashing; state: var ForkedHashedBeaconState, proposer_slashing: SomeProposerSlashing,
flags: UpdateFlags): Result[ValidatorIndex, cstring] = flags: UpdateFlags): Result[ValidatorIndex, cstring] =
withState(state): withState(state):
check_proposer_slashing(forkyState.data, proposer_slashing, flags) check_proposer_slashing(forkyState.data, proposer_slashing, flags)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#proposer-slashings # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#proposer-slashings
proc process_proposer_slashing*( proc process_proposer_slashing*(
cfg: RuntimeConfig, state: var ForkyBeaconState, cfg: RuntimeConfig, state: var ForkyBeaconState,
proposer_slashing: SomeProposerSlashing, flags: UpdateFlags, proposer_slashing: SomeProposerSlashing, flags: UpdateFlags,
@ -190,7 +192,7 @@ proc process_proposer_slashing*(
? slash_validator(cfg, state, proposer_index, cache) ? slash_validator(cfg, state, proposer_index, cache)
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#is_slashable_attestation_data # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#is_slashable_attestation_data
func is_slashable_attestation_data( func is_slashable_attestation_data(
data_1: AttestationData, data_2: AttestationData): bool = data_1: AttestationData, data_2: AttestationData): bool =
## Check if ``data_1`` and ``data_2`` are slashable according to Casper FFG ## Check if ``data_1`` and ``data_2`` are slashable according to Casper FFG
@ -202,7 +204,7 @@ func is_slashable_attestation_data(
(data_1.source.epoch < data_2.source.epoch and (data_1.source.epoch < data_2.source.epoch and
data_2.target.epoch < data_1.target.epoch) data_2.target.epoch < data_1.target.epoch)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#attester-slashings # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#attester-slashings
proc check_attester_slashing*( proc check_attester_slashing*(
state: ForkyBeaconState, state: ForkyBeaconState,
attester_slashing: SomeAttesterSlashing, attester_slashing: SomeAttesterSlashing,
@ -239,12 +241,12 @@ proc check_attester_slashing*(
ok slashed_indices ok slashed_indices
proc check_attester_slashing*( proc check_attester_slashing*(
state: var ForkedHashedBeaconState; attester_slashing: SomeAttesterSlashing; state: var ForkedHashedBeaconState, attester_slashing: SomeAttesterSlashing,
flags: UpdateFlags): Result[seq[ValidatorIndex], cstring] = flags: UpdateFlags): Result[seq[ValidatorIndex], cstring] =
withState(state): withState(state):
check_attester_slashing(forkyState.data, attester_slashing, flags) check_attester_slashing(forkyState.data, attester_slashing, flags)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#attester-slashings # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#attester-slashings
proc process_attester_slashing*( proc process_attester_slashing*(
cfg: RuntimeConfig, cfg: RuntimeConfig,
state: var ForkyBeaconState, state: var ForkyBeaconState,
@ -331,7 +333,7 @@ proc process_deposit*(cfg: RuntimeConfig,
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#voluntary-exits # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#voluntary-exits
proc check_voluntary_exit*( proc check_voluntary_exit*(
cfg: RuntimeConfig, cfg: RuntimeConfig,
state: ForkyBeaconState, state: ForkyBeaconState,
@ -374,13 +376,13 @@ proc check_voluntary_exit*(
ValidatorIndex.init(voluntary_exit.validator_index) ValidatorIndex.init(voluntary_exit.validator_index)
proc check_voluntary_exit*( proc check_voluntary_exit*(
cfg: RuntimeConfig, state: ForkedHashedBeaconState; cfg: RuntimeConfig, state: ForkedHashedBeaconState,
signed_voluntary_exit: SomeSignedVoluntaryExit; signed_voluntary_exit: SomeSignedVoluntaryExit,
flags: UpdateFlags): Result[ValidatorIndex, cstring] = flags: UpdateFlags): Result[ValidatorIndex, cstring] =
withState(state): withState(state):
check_voluntary_exit(cfg, forkyState.data, signed_voluntary_exit, flags) check_voluntary_exit(cfg, forkyState.data, signed_voluntary_exit, flags)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#voluntary-exits # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#voluntary-exits
proc process_voluntary_exit*( proc process_voluntary_exit*(
cfg: RuntimeConfig, cfg: RuntimeConfig,
state: var ForkyBeaconState, state: var ForkyBeaconState,
@ -410,8 +412,8 @@ proc process_bls_to_execution_change*(
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#operations # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#operations
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#modified-process_operations # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#modified-process_operations
proc process_operations(cfg: RuntimeConfig, proc process_operations(cfg: RuntimeConfig,
state: var ForkyBeaconState, state: var ForkyBeaconState,
body: SomeForkyBeaconBlockBody, body: SomeForkyBeaconBlockBody,
@ -444,22 +446,24 @@ proc process_operations(cfg: RuntimeConfig,
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/beacon-chain.md#sync-committee-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#sync-aggregate-processing
func get_participant_reward*(total_active_balance: Gwei): Gwei = func get_participant_reward*(total_active_balance: Gwei): Gwei =
let let
total_active_increments = total_active_increments =
total_active_balance div EFFECTIVE_BALANCE_INCREMENT total_active_balance div EFFECTIVE_BALANCE_INCREMENT
total_base_rewards = total_base_rewards =
get_base_reward_per_increment(total_active_balance) * total_active_increments get_base_reward_per_increment(total_active_balance) *
total_active_increments
max_participant_rewards = max_participant_rewards =
total_base_rewards * SYNC_REWARD_WEIGHT div WEIGHT_DENOMINATOR div SLOTS_PER_EPOCH total_base_rewards * SYNC_REWARD_WEIGHT div
WEIGHT_DENOMINATOR div SLOTS_PER_EPOCH
max_participant_rewards div SYNC_COMMITTEE_SIZE max_participant_rewards div SYNC_COMMITTEE_SIZE
# https://github.com/ethereum/consensus-specs/blob/v1.1.0-alpha.6/specs/altair/beacon-chain.md#sync-committee-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#sync-aggregate-processing
func get_proposer_reward*(participant_reward: Gwei): Gwei = func get_proposer_reward*(participant_reward: Gwei): Gwei =
participant_reward * PROPOSER_WEIGHT div (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) participant_reward * PROPOSER_WEIGHT div (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/altair/beacon-chain.md#sync-committee-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#sync-aggregate-processing
proc process_sync_aggregate*( proc process_sync_aggregate*(
state: var (altair.BeaconState | bellatrix.BeaconState | state: var (altair.BeaconState | bellatrix.BeaconState |
capella.BeaconState | deneb.BeaconState), capella.BeaconState | deneb.BeaconState),
@ -556,12 +560,12 @@ proc process_execution_payload*(
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#modified-process_execution_payload # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#modified-process_execution_payload
proc process_execution_payload*( proc process_execution_payload*(
state: var capella.BeaconState, payload: capella.ExecutionPayload, state: var capella.BeaconState, payload: capella.ExecutionPayload,
notify_new_payload: capella.ExecutePayload): Result[void, cstring] = notify_new_payload: capella.ExecutePayload): Result[void, cstring] =
## Verify consistency of the parent hash with respect to the previous # Verify consistency of the parent hash with respect to the previous
## execution payload header # execution payload header
if is_merge_transition_complete(state): if is_merge_transition_complete(state):
if not (payload.parent_hash == if not (payload.parent_hash ==
state.latest_execution_payload_header.block_hash): state.latest_execution_payload_header.block_hash):
@ -599,12 +603,12 @@ proc process_execution_payload*(
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/beacon-chain.md#process_execution_payload # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#process_execution_payload
proc process_execution_payload*( proc process_execution_payload*(
state: var deneb.BeaconState, payload: deneb.ExecutionPayload, state: var deneb.BeaconState, payload: deneb.ExecutionPayload,
notify_new_payload: deneb.ExecutePayload): Result[void, cstring] = notify_new_payload: deneb.ExecutePayload): Result[void, cstring] =
## Verify consistency of the parent hash with respect to the previous # Verify consistency of the parent hash with respect to the previous
## execution payload header # execution payload header
if is_merge_transition_complete(state): if is_merge_transition_complete(state):
if not (payload.parent_hash == if not (payload.parent_hash ==
state.latest_execution_payload_header.block_hash): state.latest_execution_payload_header.block_hash):
@ -643,7 +647,7 @@ proc process_execution_payload*(
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#new-process_withdrawals # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#new-process_withdrawals
func process_withdrawals*( func process_withdrawals*(
state: var (capella.BeaconState | deneb.BeaconState), state: var (capella.BeaconState | deneb.BeaconState),
payload: capella.ExecutionPayload | deneb.ExecutionPayload): payload: capella.ExecutionPayload | deneb.ExecutionPayload):
@ -685,7 +689,7 @@ func process_withdrawals*(
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/beacon-chain.md#tx_peek_blob_versioned_hashes # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#tx_peek_blob_versioned_hashes
func tx_peek_blob_versioned_hashes(opaque_tx: Transaction): func tx_peek_blob_versioned_hashes(opaque_tx: Transaction):
Result[seq[VersionedHash], cstring] = Result[seq[VersionedHash], cstring] =
## This function retrieves the hashes from the `SignedBlobTransaction` as ## This function retrieves the hashes from the `SignedBlobTransaction` as
@ -742,7 +746,7 @@ func verify_kzg_commitments_against_transactions*(
all_versioned_hashes == mapIt(kzg_commitments, it.kzg_commitment_to_versioned_hash) all_versioned_hashes == mapIt(kzg_commitments, it.kzg_commitment_to_versioned_hash)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/beacon-chain.md#blob-kzg-commitments # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#blob-kzg-commitments
func process_blob_kzg_commitments( func process_blob_kzg_commitments(
state: var deneb.BeaconState, state: var deneb.BeaconState,
body: deneb.BeaconBlockBody | deneb.TrustedBeaconBlockBody | body: deneb.BeaconBlockBody | deneb.TrustedBeaconBlockBody |
@ -779,7 +783,7 @@ func is_data_available(
true true
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#block-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#block-processing
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095 # TODO workaround for https://github.com/nim-lang/Nim/issues/18095
# copy of datatypes/phase0.nim # copy of datatypes/phase0.nim
type SomePhase0Block = type SomePhase0Block =
@ -844,7 +848,7 @@ proc process_block*(
if is_execution_enabled(state, blck.body): if is_execution_enabled(state, blck.body):
? process_execution_payload( ? process_execution_payload(
state, blck.body.execution_payload, state, blck.body.execution_payload,
func(_: bellatrix.ExecutionPayload): bool = true) func(_: bellatrix.ExecutionPayload): bool = true) # [New in Bellatrix]
? process_randao(state, blck.body, flags, cache) ? process_randao(state, blck.body, flags, cache)
? process_eth1_data(state, blck.body) ? process_eth1_data(state, blck.body)
@ -859,7 +863,7 @@ proc process_block*(
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/capella/beacon-chain.md#block-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#block-processing
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095 # TODO workaround for https://github.com/nim-lang/Nim/issues/18095
type SomeCapellaBlock = type SomeCapellaBlock =
capella.BeaconBlock | capella.SigVerifiedBeaconBlock | capella.TrustedBeaconBlock capella.BeaconBlock | capella.SigVerifiedBeaconBlock | capella.TrustedBeaconBlock
@ -873,10 +877,11 @@ proc process_block*(
? process_block_header(state, blck, flags, cache) ? process_block_header(state, blck, flags, cache)
if is_execution_enabled(state, blck.body): if is_execution_enabled(state, blck.body):
? process_withdrawals(state, blck.body.execution_payload) # [New in Capella] ? process_withdrawals(
state, blck.body.execution_payload) # [New in Capella]
? process_execution_payload( ? process_execution_payload(
state, blck.body.execution_payload, state, blck.body.execution_payload,
func(_: capella.ExecutionPayload): bool = true) func(_: capella.ExecutionPayload): bool = true) # [Modified in Capella]
? process_randao(state, blck.body, flags, cache) ? process_randao(state, blck.body, flags, cache)
? process_eth1_data(state, blck.body) ? process_eth1_data(state, blck.body)
@ -892,7 +897,7 @@ proc process_block*(
ok() ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/eip4844/beacon-chain.md#block-processing # https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#block-processing
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095 # TODO workaround for https://github.com/nim-lang/Nim/issues/18095
type SomeDenebBlock = type SomeDenebBlock =
deneb.BeaconBlock | deneb.SigVerifiedBeaconBlock | deneb.TrustedBeaconBlock deneb.BeaconBlock | deneb.SigVerifiedBeaconBlock | deneb.TrustedBeaconBlock