Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EIP-7742: update the required EL headers and the gas fee mechanism #8994

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 48 additions & 34 deletions EIPS/eip-7742.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
eip: 7742
title: Uncouple blob count between CL and EL
title: Uncouple blobs per block between CL and EL
description: Have CL verify blob maximum and have EL get target value from CL
author: Alex Stokes (@ralexstokes)
author: Alex Stokes (@ralexstokes), Gajinder Singh (@g11tech), Bert (@bkellerman)
discussions-to: https://ethereum-magicians.org/t/eip-7742-uncouple-blob-count-between-cl-and-el/20550
status: Review
type: Standards Track
Expand All @@ -13,7 +13,7 @@ requires: 4844

## Abstract

Update blob maximum and target verification from [EIP-4844](./eip-4844.md).
Update blob maximum, target, and blob gas fee computation from [EIP-4844](./eip-4844.md).

The execution layer no longer verifies the blob maximum and receives the target dynamically from the consensus layer.

Expand All @@ -33,67 +33,81 @@ This EIP also changes how the EL sources the current blob target value for two r
The data facility introduced via EIP-4844 adds blobs to Ethereum blocks, which are simply fixed sets of data that can be
included in the canonical chain but have no execution semantics (cf. `calldata` in an Ethereum transaction).

The protocol specifies a maximum allowed blob count per block to prevent DoS vectors via the abuse of this data facility.
The protocol specifies a maximum allowed blobs per block to prevent DoS vectors via the abuse of this data facility.
The protocol also maintains an [EIP-1559](./eip-1559.md)-like "target" value for an intended running average amount of blob throughput per
unit time. Blob usage is compared against this target to influence a "blob base fee" to administer allocation of this
resource to users of the Ethereum protocol.

Both of these values are currently hard-coded in the EL after EIP-4844 and the blob maximum is separately hard-coded in
the CL following EIP-4844. This EIP proposes a set of changes to uncouple these values across the CL and EL to make development
and deployment of changes to the blob count easier.
and deployment of changes to the blobs per block easier.

#### Maximum blobs per block

The blob maximum is verified in the CL node and the EL inherits this verification during the consistency check of the
versioned hashes corresponding to each blob as specified by the Engine API. Because of this, the strict check specified
by EIP-4844 is unnecessary.
The blob maximum is verified in the CL node and the EL inherits this verification during the consistency check of the versioned hashes corresponding to each blob as specified by the Engine API. Because of this, the strict check specified by EIP-4844 is unnecessary.

#### Target amount of blobs per block
For optimistically synced blocks from peer nodes, EL may further assume that the entire ancestor EL peer synced chain blocks correctly obeys this condition by the canonicality and correctness of the block they backfilling from as instructed by the CL.

The target is currently specified as a fixed value in relation to the blob count. The Ethereum community intends to increase
the blob parameters as part of its scaling strategy and the ability to have a more flexible target value in relation to
the blob max is desirable to reduce rigidity in this protocol parameter.
Hence we entirely deprecated the `MAX_BLOB_GAS_PER_BLOCK` checks from [EIP-4844](./eip-4844.md).

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.
#### Target blobs per block

The target is currently specified as a fixed value in relation to the blobs per block. The Ethereum community intends to increase the blob parameters as part of its scaling strategy and the ability to have a more flexible target value in relation to the blob max is desirable to reduce rigidity in this protocol parameter.

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_blobs_per_block` value to preserve the security of optimistic sync.

#### Updated Fee calculations

With the changing target, we also need to scale the `BLOB_BASE_FEE_UPDATE_FRACTION` from [EIP-4844](./eip-4844.md) accordingly to bound the price jumps by +-12.5%. But this introduces some irregularity on the fork block because excess blob gas is effectively scaled down by this changed factor in the fee calculations.

However we consider the target change events to be few and far between and hence not a cause of concern. The likely effect of this factor update will be to bring down the base fee on the fork block and hence would not negatively impact the transactions in txpool.
Comment on lines +59 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't touch the base fee update fraction in 7742 as the EIP is about something very different (even though it can be combined). Instead, there should be a separate change (going into the eip that changes the target) that we ship on as soon as we agree on changing the blob target. This way it's much cleaner.


## Specification

### Block structure and validity
### Block processing

Upon activation of this EIP, execution clients **MUST** extend the header schema with an
additional 64-bit field: the `target_blobs_per_block`. This value is set to the current target blob count. The Engine API
is modified along with this EIP to provide the `target_blobs_per_block` with each payload and implementations can use this
value to correctly set the block header field.
additional 64-bit field: the `target_blobs_per_block`. This values is set to the one provided by the CL during block production.

Validity of the `target_blobs_per_block` is guaranteed from the consensus layer, much like how withdrawals are handled.
Any reference to `TARGET_BLOB_GAS_PER_BLOCK` from [EIP-4844](./eip-4844.md) (for e.g. for `excess_blob_gas` calculations) can be derived by taking the `target_blobs_per_block` from the EL block header and multiplying by `GAS_PER_BLOB`.

When verifying a block, execution clients **MUST** ensure the target blob count in the block header matches the one
provided by the consensus client.
Validity of these values is guaranteed from the consensus layer, much like how withdrawals are handled. Hence when verifying a block, execution clients **MUST** ensure the target blobs per block in the block header matches the one provided by the consensus client.

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.
Furthermore `get_base_fee_per_blob_gas` as specified by [EIP-4844](./eip-4844.md) is as modified below:

### Block processing
| Constant | Value |
| - | - |
| `BLOB_BASE_FEE_UPDATE_FRACTION_PER_TARGET_BLOB` | `1112825` |


```python
g11tech marked this conversation as resolved.
Show resolved Hide resolved
def calc_excess_blob_gas(parent: Header) -> int:
parent_target_blob_gas = parent.target_blobs_per_block * GAS_PER_BLOB
if parent.excess_blob_gas + parent.blob_gas_used < parent_target_blob_gas:
Copy link
Contributor

@bkellerman bkellerman Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 4 lines can be replaced with

return max(parent.excess_blob_gas + parent.blob_gas_used - parent_target_blob_gas, 0)

IMO, this also more intuitively captures the essence of excess_gas, a non-negative accumulation of error, where error=parent.blob_gas_used - parent_target_blob_gas

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we can leave it as it is inline with 4844 style

return 0
else:
return parent.excess_blob_gas + parent.blob_gas_used - parent_target_blob_gas

Upon activating this EIP (i.e. before processing any transactions),
the verification of the blob maximum as given in EIP-4844 can be skipped. Concretely, this means any logic relating
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_blobs_per_block` from the CL and multiplying by `GAS_PER_BLOB` as given in EIP-4844.
def get_base_fee_per_blob_gas(header: Header) -> int:
update_fraction = BLOB_BASE_FEE_UPDATE_FRACTION_PER_TARGET_BLOB * header.target_blobs_per_block
return fake_exponential(
MIN_BASE_FEE_PER_BLOB_GAS,
header.excess_blob_gas,
update_fraction
)
```

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.
Rest of the [EIP-4844](./eip-4844.md) specification is not changed

### Block construction

The Engine API is extended to provide both the `target_blobs_per_block` and the `max_blobs_per_block` when the CL requests the EL to construct a payload for proposal.
To kickstart block construction, CL will now provide EL a target and a maximum blobs per block. These values should be used to ensure the correct number of blobs are included in any constructed payload, and to ensure that the blob base fee accounting is correctly done as specified above.

These values should be used to ensure the correct number of blobs are included in any constructed payload, and to ensure that the blob base fee accounting is correctly computed.
For a genesis block with no existing parent, the value should be set according to the agreed specification for the target blobs per block given by that genesis block's protocol rule set. For the purposes of this EIP, the `target_blobs_per_block` at genesis is set equivalent to [EIP-4844](./eip-4844.md)'s `TARGET_BLOB_GAS_PER_BLOCK`.

## Rationale

### Why not have the CL also compute the blob base fee and remove any notion of blob counts from EL processing?
### Why not have the CL also compute the blob base fee and remove any notion of blobs per block from EL processing?

Hoisting the full computation into the CL is possible, but it does violate the separation of concerns between these two layers of the protocol stack.
The CL maintains a maximum value to address e.g. DoS risks, and the EL maintains knowledge of the target value to address fee accounting.
Expand Down
Loading