Skip to content

Commit

Permalink
apply review feedback
Browse files Browse the repository at this point in the history
Co-authored-by: Ansgar Dietrichs <adietrichs@gmail.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
  • Loading branch information
lightclient and adietrichs committed Sep 8, 2022
1 parent 235b2e2 commit 9b22385
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ def get_origin(tx: SignedBlobTransaction) -> Address:

### Header extension

The current header encoding is extended with a new 256-bit unsigned integer field `blobs`. This is the running
The current header encoding is extended with a new 256-bit unsigned integer field `excess_blobs`. This is the running
total of excess blobs included on chain since this EIP was activated. If the total number of blobs is below the
average, `blobs` is capped at zero.
average, `excess_blobs` is capped at zero.

The resulting RLP encoding of the header is therefore:

Expand All @@ -258,16 +258,18 @@ rlp([
mix_digest,
nonce,
base_fee,
blobs
excess_blobs
])
```

The value of `blobs` can be calculated using the parent header and number of blobs in the block.
The value of `excess_blobs` can be calculated using the parent header and number of blobs in the block.

```python
def calc_excess_blobs(parent: Header, blobs: int) -> int:
adjusted = parent.blobs + blobs
return adjusted - min(TARGET_BLOBS_PER_BLOCK, adjusted)
def calc_excess_blobs(parent: Header, new_blobs: int) -> int:
if parent.excess_blobs + new_blobs < TARGET_BLOBS_PER_BLOCK:
return 0
else:
return parent.excess_blobs + new_blobs - TARGET_BLOBS_PER_BLOCK
```

### Beacon chain validation
Expand Down Expand Up @@ -344,13 +346,10 @@ def get_intrinsic_gas(tx: SignedBlobTransaction, pre_state: ExecState) -> int:
return intrinsic_gas

def get_blob_gas(header: Header) -> int:
if header.blobs == 0:
return 0
else:
return fake_exponential(
header.blobs,
GASPRICE_UPDATE_FRACTION_PER_BLOB
)
return fake_exponential(
header.excess_blobs,
GASPRICE_UPDATE_FRACTION_PER_BLOB
)
```

### Networking
Expand Down

0 comments on commit 9b22385

Please sign in to comment.