Skip to content

Commit 1adcc1b

Browse files
committed
Fix cancun behaviour at fork block
1 parent 717677f commit 1adcc1b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/ethereum/cancun/vm/gas.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,16 @@ def calculate_excess_blob_gas(parent_header: Header) -> U64:
284284
excess_blob_gas: `ethereum.base_types.U64`
285285
The excess blob gas for the current block.
286286
"""
287-
parent_blob_gas = (
288-
parent_header.excess_blob_gas + parent_header.blob_gas_used
289-
)
287+
# At the fork block, these are defined as zero.
288+
excess_blob_gas = U64(0)
289+
blob_gas_used = U64(0)
290+
291+
if isinstance(parent_header, Header):
292+
# After the fork block, read them from the parent header.
293+
excess_blob_gas = parent_header.excess_blob_gas
294+
blob_gas_used = parent_header.blob_gas_used
295+
296+
parent_blob_gas = excess_blob_gas + blob_gas_used
290297
if parent_blob_gas < TARGET_BLOB_GAS_PER_BLOCK:
291298
return U64(0)
292299
else:

0 commit comments

Comments
 (0)