Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Oct 23, 2024
1 parent 1619718 commit 3dce0db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions EIPS/eip-7742.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ The target is currently specified as a fixed value in relation to the blob count

Even if the EL keeps a fixed target value based on the max, removing the max implies the EL would not know what the target value should be. To address this lack of information, this EIP proposes the CL sends the current target value to the EL with each provided payload over the Engine API. The EL block header will also need to be extended with this target value to preserve the security of optimistic sync.

#### Normalized excess gas
#### Normalized excess blob gas

At any block we don't want the gas update factor (whether pushing gas up or down) to exceed ~1.125. This is essentially achieved in [EIP-4844](./eip-4844.md) by having an appropriate `BLOB_BASE_FEE_UPDATE_FRACTION` to divide `excessGas` accumulator while exponetiating it
At any block we don't want the gas update factor (whether pushing gas up or down) to exceed ~1.125. This is essentially achieved in [EIP-4844](./eip-4844.md) by having an appropriate `BLOB_BASE_FEE_UPDATE_FRACTION` to divide `excess_blob_gas` accumulator while exponetiating it

Since the target from CL could theoratically change block to block, we need to normalize excess gas accumulation because the update fraction is actually directly based on the target (max value excessGas can jump by in a block).
Since the target from CL could theoratically change block to block, we need to normalize excess gas accumulation because the update fraction is actually directly based on the target (max value `excess_blob_gas` can jump by in a block).

We propose to "normalize" the gas diffs every block against its target and then accumulate in `excessGas` so that we accumulate normalized `excessGas` every block and can use a constant normalized update fraction in our fee calculations.
We propose to "normalize" the gas diffs every block against its target and then accumulate in `excess_blob_gas` so that we accumulate normalized `excess_blob_gas` every block and can use a constant normalized update fraction in our fee calculations.

Note: CLs must also ensure that the target is always equal to or more than half the max otherwise we will need to also track the max for normalizing our gas calculations (otherwise full blocks will make the price jump by a factor of more than 1.125)

Expand All @@ -73,9 +73,9 @@ Validity of these values is guaranteed from the consensus layer, much like how w

For a genesis block with no existing parent, the value should be set according to the agreed specification for the target blob count given by that genesis block's protocol rule set.

`excess_gas` in the block now holds _normalized_ excess gas accumulating `((blob_gas_used-target_blob_gas)/T) * EXCESS_GAS_NORMALIZATION_FACTOR`. We choose `EXCESS_GAS_NORMALIZATION_FACTOR` to `100E6` and this makes our choice of `NORMALIZED_UPDATE_FRACTION` as `3338477 * 100E6 // 393216 = 849018605`.
`excess_blob_gas` in the block now holds _normalized_ excess blob gas accumulating `((blob_gas_used-target_blob_gas)/T) * EXCESS_BLOB_GAS_NORMALIZATION_FACTOR`. We choose `EXCESS_BLOB_GAS_NORMALIZATION_FACTOR` to `100E6` and this makes our choice of `NORMALIZED_UPDATE_FRACTION` as `3338477 * 100E6 // 393216 = 849018605`.

At the fork block (where parent.timestamp < FORK_TIMESTAMP), we convert parent's accumulated `excess_gas` to the normalized `excess_gas` to be used in this block's `excess_gas` accumulator.
At the fork block (where parent.timestamp < FORK_TIMESTAMP), we convert parent's accumulated `excess_blob_gas` to the normalized `excess_blob_gas` to be used in this block's `excess_blob_gas` accumulator.

```python
def calc_excess_blob_gas(block: Header) -> int:
Expand Down Expand Up @@ -103,7 +103,7 @@ the verification of the blob maximum as given in EIP-4844 can be skipped. Concre
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_blob_count` from the CL and multiplying by `GAS_PER_BLOB` as given in EIP-4844.

Block `excess_gas` and blob fees charged are now validated as per the new normalized calculations.
Block `excess_blob_gas` and blob fees charged are now validated as per the new normalized calculations.

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.

Expand Down

0 comments on commit 3dce0db

Please sign in to comment.