Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
  • Loading branch information
adietrichs and djrtwo committed Oct 5, 2022
1 parent 25752d1 commit d99f81e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,14 @@ def point_evaluation_precompile(input: Bytes) -> Bytes:

### Gas price of blobs (Simplified version)

***WARNING:` This is only for testing***

For early draft implementations, we simply change `get_blob_gas(parent)` to always return `SIMPLE_GAS_PER_BLOB`.

### Gas accounting (Full version)

We introduce data gas as a new type of gas. It is independent of normal gas and follows its own targeting rule, similar to EIP-1559.
We use the `excess_blobs` header field to store persistent data needed to compute the data gas price. For now, only blobs are charged for in data gas. In the future this could be extended to also cover calldata (at a different relative gas cost).
We use the `excess_blobs` header field to store persistent data needed to compute the data gas price. For now, only blobs are priced in data gas. In the future this could be extended to also cover calldata (at a different relative gas cost).

```python
def calc_data_fee(tx: SignedBlobTransaction, parent: Header) -> int:
Expand Down Expand Up @@ -431,7 +433,7 @@ where `excess_blobs` is the total "extra" number of blobs that the chain has acc
Like EIP-1559, it's a self-correcting formula: as the excess goes higher, the `data_gasprice` increases exponentially, reducing usage and eventually forcing the excess back down.

The block-by-block behavior is roughly as follows.
If in block `N`, `data_gasprice = G1`, and block `N` has `X` blobs, then in block `N+1`, `excess_blobs` increases by `X - TARGET_BLOBS_PER_BLOCK`,
If block `N` contains `X` blobs, then in block `N+1` `excess_blobs` increases by `X - TARGET_BLOBS_PER_BLOCK`,
and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_BLOBS_PER_BLOCK) / DATA_GASPRICE_UPDATE_FRACTION)`.
Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed.

Expand Down

0 comments on commit d99f81e

Please sign in to comment.