Skip to content

Commit

Permalink
Fix cancun behaviour at fork block
Browse files Browse the repository at this point in the history
  • Loading branch information
SamWilsn committed Nov 8, 2024
1 parent 98d6dda commit 0fb7970
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/ethereum/cancun/vm/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,16 @@ def calculate_excess_blob_gas(parent_header: Header) -> U64:
excess_blob_gas: `ethereum.base_types.U64`
The excess blob gas for the current block.
"""
parent_blob_gas = (
parent_header.excess_blob_gas + parent_header.blob_gas_used
)
# At the fork block, these are defined as zero.
excess_blob_gas = U64(0)
blob_gas_used = U64(0)

if isinstance(parent_header, Header):
# After the fork block, read them from the parent header.
excess_blob_gas = parent_header.excess_blob_gas
blob_gas_used = parent_header.blob_gas_used

parent_blob_gas = excess_blob_gas + blob_gas_used
if parent_blob_gas < TARGET_BLOB_GAS_PER_BLOCK:
return U64(0)
else:
Expand Down

0 comments on commit 0fb7970

Please sign in to comment.