Skip to content

Commit

Permalink
store excess blob count in header instead of adjusted-total
Browse files Browse the repository at this point in the history
Co-authored-by: vbuterin <v@buterin.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
  • Loading branch information
lightclient and vbuterin committed Aug 10, 2022
1 parent bb9370d commit 7a31d05
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def get_origin(tx: SignedBlobTransaction) -> Address:
### Header extension

The current header encoding is extended with a new 256-bit unsigned integer field `blob_txs`. This is the running
total of blob txs included on chain since this EIP was activated. The resulting RLP encoding of the header is therefore:
total of excess blob txs included on chain since this EIP was activated. The resulting RLP encoding of the header is therefore:

```
rlp([
Expand All @@ -262,12 +262,9 @@ rlp([
The value of `blob_txs` can be calculated using the parent header and number of blob transactions in the block.

```python
def calc_blob_gas(parent: Header, blob_txs_in_block: int) -> int:
# Don't let the new total fall behind the targeted total to avoid
# accumulating a long period of very low fees
blocks_since_start = header.Number - FORK_BLKNUM
targeted_total = blocks_since_start * TARGET_BLOB_TXS_PER_BLOCK
return max(header.blob_txs + blob_txs_in_block, targeted_total)
def calc_excess_blob_txs(parent: Header, blobs: int) -> int:
adjusted = parent.blob_txs + blobs
return adjusted - min(TARGET_BLOB_TXS_PER_BLOCK, adjusted)
```

### Beacon chain validation
Expand Down Expand Up @@ -346,7 +343,7 @@ def get_intrinsic_gas(tx: SignedBlobTransaction, pre_state: ExecState) -> int:
def get_blob_gas(header: Header) -> int:
blocks_since_start = get_current_block(pre_state) - FORK_BLKNUM
targeted_total = blocks_since_start * TARGET_BLOB_TXS_PER_BLOCK
actual_total = header.blob_txs
actual_total = targeted_total + header.blob_txs
if actual_total < targeted_total:
return 0
else:
Expand Down

0 comments on commit 7a31d05

Please sign in to comment.