Skip to content

Commit de2429f

Browse files
authored
Use MAX_BLOBS_PER_BLOCK from config in state transition (#6959)
Start phasing out the compile-time `MAX_BLOBS_PER_BLOCK` and use the value from the network config in state transition instead.
1 parent f5c94c3 commit de2429f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

beacon_chain/spec/state_transition_block.nim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,8 @@ type SomeDenebBeaconBlockBody =
957957

958958
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#process_execution_payload
959959
proc process_execution_payload*(
960-
state: var deneb.BeaconState, body: SomeDenebBeaconBlockBody,
960+
cfg: RuntimeConfig, state: var deneb.BeaconState,
961+
body: SomeDenebBeaconBlockBody,
961962
notify_new_payload: deneb.ExecutePayload): Result[void, cstring] =
962963
template payload: auto = body.execution_payload
963964

@@ -976,7 +977,7 @@ proc process_execution_payload*(
976977
return err("process_execution_payload: invalid timestamp")
977978

978979
# [New in Deneb] Verify commitments are under limit
979-
if not (lenu64(body.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK):
980+
if not (lenu64(body.blob_kzg_commitments) <= cfg.MAX_BLOBS_PER_BLOCK):
980981
return err("process_execution_payload: too many KZG commitments")
981982

982983
# Verify the execution payload is valid
@@ -1329,7 +1330,7 @@ proc process_block*(
13291330
if is_execution_enabled(state, blck.body):
13301331
? process_withdrawals(state, blck.body.execution_payload)
13311332
? process_execution_payload(
1332-
state, blck.body,
1333+
cfg, state, blck.body,
13331334
func(_: deneb.ExecutionPayload): bool = true) # [Modified in Deneb]
13341335
? process_randao(state, blck.body, flags, cache)
13351336
? process_eth1_data(state, blck.body)

tests/consensus_spec/deneb/test_fixture_operations.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ suite baseDescription & "Execution Payload " & preset():
175175
preState.latest_block_root(
176176
assignClone(preState)[].hash_tree_root())))
177177
func executePayload(_: deneb.ExecutionPayload): bool = payloadValid
178-
process_execution_payload(preState, body, executePayload)
178+
process_execution_payload(
179+
defaultRuntimeConfig, preState, body, executePayload)
179180

180181
for path in walkTests(OpExecutionPayloadDir):
181182
let applyExecutionPayload = makeApplyExecutionPayloadCb(path)

0 commit comments

Comments
 (0)