Skip to content

Commit a054d0f

Browse files
authored
Update EIP-7742: use parent target blob count for excess blob gas calculation
Merged by EIP-Bot.
1 parent da2a86b commit a054d0f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

EIPS/eip-7742.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,17 @@ target blob count given by that genesis block's protocol rule set.
8181
Upon activating this EIP (i.e. before processing any transactions),
8282
the verification of the blob maximum as given in EIP-4844 can be skipped. Concretely, this means any logic relating
8383
to `MAX_BLOB_GAS_PER_BLOCK` as given in EIP-4844 can be deprecated.
84-
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.
84+
85+
Additionally, `calc_excess_blob_gas` is updated as follows:
86+
87+
```python
88+
def calc_excess_blob_gas(parent: Header) -> int:
89+
target_blob_gas = parent.target_blobs_per_block * GAS_PER_BLOB
90+
if parent.excess_blob_gas + parent.blob_gas_used < target_blob_gas:
91+
return 0
92+
else:
93+
return parent.excess_blob_gas + parent.blob_gas_used - target_blob_gas
94+
```
8595

8696
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.
8797

0 commit comments

Comments
 (0)