Skip to content

Commit 30b1cd2

Browse files
gurukamathSamWilsn
authored andcommitted
Implement EIP-7918
1 parent 0af9e4e commit 30b1cd2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/ethereum/osaka/vm/gas.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from ethereum.utils.numeric import ceil32, taylor_exponential
2121

2222
from ..blocks import Header
23-
from ..transactions import BlobTransaction, Transaction
23+
from ..transactions import TX_BASE_COST, BlobTransaction, Transaction
2424
from . import Evm
2525
from .exceptions import OutOfGasError
2626

@@ -305,7 +305,14 @@ def calculate_excess_blob_gas(parent_header: Header) -> U64:
305305
if parent_blob_gas < TARGET_BLOB_GAS_PER_BLOCK:
306306
return U64(0)
307307
else:
308-
return parent_blob_gas - TARGET_BLOB_GAS_PER_BLOCK
308+
target_blob_gas_price = Uint(
309+
TARGET_BLOB_GAS_PER_BLOCK
310+
) * calculate_blob_gas_price(parent_header.excess_blob_gas)
311+
base_blob_tx_price = TX_BASE_COST * parent_header.base_fee_per_gas
312+
if base_blob_tx_price > target_blob_gas_price:
313+
return parent_blob_gas // U64(3)
314+
else:
315+
return parent_blob_gas - TARGET_BLOB_GAS_PER_BLOCK
309316

310317

311318
def calculate_total_blob_gas(tx: Transaction) -> U64:

0 commit comments

Comments
 (0)