From 76d2b1f3625e35a487cd57d2b501f3292429095f Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Mon, 9 Dec 2024 16:38:02 -0700 Subject: [PATCH] use parent target blob count for excess blob gas calculation --- EIPS/eip-7742.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-7742.md b/EIPS/eip-7742.md index 54820d0d83b236..bba972f7a512bb 100644 --- a/EIPS/eip-7742.md +++ b/EIPS/eip-7742.md @@ -81,7 +81,17 @@ target blob count given by that genesis block's protocol rule set. Upon activating this EIP (i.e. before processing any transactions), the verification of the blob maximum as given in EIP-4844 can be skipped. Concretely, this means any logic relating to `MAX_BLOB_GAS_PER_BLOCK` as given in EIP-4844 can be deprecated. -Additionally, any reference to `TARGET_BLOB_GAS_PER_BLOCK` from EIP-4844 can be derived by taking the `target_blobs_per_block` from the CL and multiplying by `GAS_PER_BLOB` as given in EIP-4844. + +Additionally, `calc_excess_blob_gas` is updated as follows: + +```python +def calc_excess_blob_gas(parent: Header) -> int: + target_blob_gas = parent.target_blobs_per_block * GAS_PER_BLOB + if parent.excess_blob_gas + parent.blob_gas_used < target_blob_gas: + return 0 + else: + return parent.excess_blob_gas + parent.blob_gas_used - target_blob_gas +``` Otherwise, the specification of EIP-4844 is not changed. For example, blob base fee accounting and excess blob gas tracking occur in the exact same way.