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

Add EIP-7691: Blob throughput increase #4023

Merged
merged 18 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
22 changes: 15 additions & 7 deletions configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,26 @@ ATTESTATION_SUBNET_PREFIX_BITS: 6
# Deneb
# `2**7` (=128)
MAX_REQUEST_BLOCKS_DENEB: 128
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
MAX_REQUEST_BLOB_SIDECARS: 768
# `2**12` (= 4096 epochs, ~18 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
## `uint64(6)`
# `uint64(6)`
MAX_BLOBS_PER_BLOCK: 6
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
MAX_REQUEST_BLOB_SIDECARS: 768

# Electra
# 2**7 * 10**9 (= 128,000,000,000)
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000
# 2**8 * 10**9 (= 256,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000
# `9`
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 9
jtraglia marked this conversation as resolved.
Show resolved Hide resolved
jtraglia marked this conversation as resolved.
Show resolved Hide resolved
# `uint64(9)`
MAX_BLOBS_PER_BLOCK_ELECTRA: 9
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152

# Whisk
# `Epoch(2**8)`
Expand All @@ -170,9 +182,5 @@ MAX_BLOBS_PER_BLOCK_EIP7594: 8
# `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_EIP7594`
MAX_REQUEST_BLOB_SIDECARS_EIP7594: 1024

# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000 # 2**8 * 10**9 (= 256,000,000,000)

# EIP7732
MAX_REQUEST_PAYLOADS: 128
20 changes: 14 additions & 6 deletions configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,26 @@ ATTESTATION_SUBNET_PREFIX_BITS: 6
# Deneb
# `2**7` (=128)
MAX_REQUEST_BLOCKS_DENEB: 128
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
MAX_REQUEST_BLOB_SIDECARS: 768
# `2**12` (= 4096 epochs, ~18 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
## `uint64(6)`
MAX_BLOBS_PER_BLOCK: 6
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
MAX_REQUEST_BLOB_SIDECARS: 768

# Electra
# [customized] 2**6 * 10**9 (= 64,000,000,000)
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000
# [customized] 2**7 * 10**9 (= 128,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 128000000000
# `9`
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 9
# `uint64(9)`
MAX_BLOBS_PER_BLOCK_ELECTRA: 9
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152

# Whisk
WHISK_EPOCHS_PER_SHUFFLING_PHASE: 4
Expand All @@ -169,9 +181,5 @@ MAX_BLOBS_PER_BLOCK_EIP7594: 8
# `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_EIP7594`
MAX_REQUEST_BLOB_SIDECARS_EIP7594: 1024

# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000 # 2**6 * 10**9 (= 64,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)

# EIP7732
MAX_REQUEST_PAYLOADS: 128
6 changes: 3 additions & 3 deletions presets/minimal/deneb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
# `uint64(4096)`
FIELD_ELEMENTS_PER_BLOB: 4096
# [customized]
MAX_BLOB_COMMITMENTS_PER_BLOCK: 16
# [customized] `floorlog2(get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments')) + 1 + ceillog2(MAX_BLOB_COMMITMENTS_PER_BLOCK)` = 4 + 1 + 4 = 9
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 9
MAX_BLOB_COMMITMENTS_PER_BLOCK: 32
# [customized] `floorlog2(get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments')) + 1 + ceillog2(MAX_BLOB_COMMITMENTS_PER_BLOCK)` = 4 + 1 + 5 = 10
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 10
12 changes: 6 additions & 6 deletions specs/_features/eip7594/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
- [`data_column_sidecar_{subnet_id}`](#data_column_sidecar_subnet_id)
- [The Req/Resp domain](#the-reqresp-domain)
- [Messages](#messages)
- [BlobSidecarsByRoot v2](#blobsidecarsbyroot-v2)
- [BlobSidecarsByRange v2](#blobsidecarsbyrange-v2)
- [BlobSidecarsByRoot v3](#blobsidecarsbyroot-v3)
- [BlobSidecarsByRange v3](#blobsidecarsbyrange-v3)
- [DataColumnSidecarsByRoot v1](#datacolumnsidecarsbyroot-v1)
- [DataColumnSidecarsByRange v1](#datacolumnsidecarsbyrange-v1)
- [GetMetaData v3](#getmetadata-v3)
Expand Down Expand Up @@ -204,9 +204,9 @@ The following validations MUST pass before forwarding the `sidecar: DataColumnSi

#### Messages

##### BlobSidecarsByRoot v2
##### BlobSidecarsByRoot v3

**Protocol ID:** `/eth2/beacon_chain/req/blob_sidecars_by_root/2/`
**Protocol ID:** `/eth2/beacon_chain/req/blob_sidecars_by_root/3/`

*[Updated in EIP7594]*

Expand Down Expand Up @@ -238,9 +238,9 @@ Response Content:

No more than `MAX_REQUEST_BLOB_SIDECARS_EIP7594` may be requested at a time.

##### BlobSidecarsByRange v2
##### BlobSidecarsByRange v3

**Protocol ID:** `/eth2/beacon_chain/req/blob_sidecars_by_range/2/`
**Protocol ID:** `/eth2/beacon_chain/req/blob_sidecars_by_range/3/`

*[Updated in EIP7594]*

Expand Down
10 changes: 9 additions & 1 deletion specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Withdrawals processing](#withdrawals-processing)
- [Pending deposits processing](#pending-deposits-processing)
- [Configuration](#configuration)
- [Execution](#execution-1)
- [Validator cycle](#validator-cycle)
- [Containers](#containers)
- [New containers](#new-containers)
Expand Down Expand Up @@ -119,6 +120,7 @@ Electra is a consensus-layer upgrade containing a number of features. Including:
* [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002): Execution layer triggerable exits
* [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): Increase the MAX_EFFECTIVE_BALANCE
* [EIP-7549](https://eips.ethereum.org/EIPS/eip-7549): Move committee index outside Attestation
* [EIP-7691](https://eips.ethereum.org/EIPS/eip-7691): Blob throughput increase

*Note:* This specification is built upon [Deneb](../deneb/beacon-chain.md) and is under active development.

Expand Down Expand Up @@ -200,6 +202,12 @@ The following values are (non-configurable) constants used throughout the specif

## Configuration

### Execution

| Name | Value | Description |
| - | - | - |
| `MAX_BLOBS_PER_BLOCK_ELECTRA` | `uint64(9)` | *[New in Electra:EIP-7691]* Maximum number of blobs in a single block limited by `MAX_BLOB_COMMITMENTS_PER_BLOCK` |

### Validator cycle

| Name | Value |
Expand Down Expand Up @@ -1205,7 +1213,7 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi
# Verify timestamp
assert payload.timestamp == compute_timestamp_at_slot(state, state.slot)
# Verify commitments are under limit
assert len(body.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK
assert len(body.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK_ELECTRA # [Modified in Electra:EIP7691]
# Verify the execution payload is valid
versioned_hashes = [kzg_commitment_to_versioned_hash(commitment) for commitment in body.blob_kzg_commitments]
assert execution_engine.verify_and_notify_new_payload(
Expand Down
111 changes: 103 additions & 8 deletions specs/electra/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,33 @@ The specification of these changes continues in the same format as the network s
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Modifications in Electra](#modifications-in-electra)
- [Configuration](#configuration)
- [The gossip domain: gossipsub](#the-gossip-domain-gossipsub)
- [Topics and messages](#topics-and-messages)
- [Global topics](#global-topics)
- [`beacon_aggregate_and_proof`](#beacon_aggregate_and_proof)
- [Attestation subnets](#attestation-subnets)
- [`beacon_attestation_{subnet_id}`](#beacon_attestation_subnet_id)
- [Global topics](#global-topics)
- [`beacon_block`](#beacon_block)
- [`beacon_aggregate_and_proof`](#beacon_aggregate_and_proof)
- [Attestation subnets](#attestation-subnets)
- [`beacon_attestation_{subnet_id}`](#beacon_attestation_subnet_id)
- [The Req/Resp domain](#the-reqresp-domain)
- [Messages](#messages)
- [BlobSidecarsByRoot v2](#blobsidecarsbyroot-v2)
- [BlobSidecarsByRange v2](#blobsidecarsbyrange-v2)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- /TOC -->

## Modifications in Electra

### Configuration

*[New in Electra:EIP7691]*

| Name | Value | Description |
|------------------------------------------------|----------------------------------------------------------|---------------------------------------------------------------------------|
| `MAX_REQUEST_BLOB_SIDECARS_ELECTRA` | `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA` | Maximum number of blob sidecars in a single request |
| `BLOB_SIDECAR_SUBNET_COUNT_ELECTRA` | `9` | The number of blob sidecar subnets used in the gossipsub protocol |

### The gossip domain: gossipsub

Some gossip meshes are upgraded in the fork of Electra to support upgraded types.
Expand All @@ -41,9 +56,16 @@ The specification around the creation, validation, and dissemination of messages

The derivation of the `message-id` remains stable.

#### Global topics
##### Global topics

###### `beacon_block`

##### `beacon_aggregate_and_proof`
*Updated validation*

- _[REJECT]_ The length of KZG commitments is less than or equal to the limitation defined in Consensus Layer --
i.e. validate that `len(body.signed_beacon_block.message.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK_ELECTRA`

###### `beacon_aggregate_and_proof`

The following convenience variables are re-defined
- `index = get_committee_indices(aggregate.committee_bits)[0]`
Expand All @@ -52,9 +74,9 @@ The following validations are added:
* [REJECT] `len(committee_indices) == 1`, where `committee_indices = get_committee_indices(aggregate)`.
* [REJECT] `aggregate.data.index == 0`

#### Attestation subnets
##### Attestation subnets

##### `beacon_attestation_{subnet_id}`
###### `beacon_attestation_{subnet_id}`

The topic is updated to propagate `SingleAttestation` objects.

Expand All @@ -71,3 +93,76 @@ The following validations are removed:
that is, it has exactly one participating validator (`len([bit for bit in aggregation_bits if bit]) == 1`, i.e. exactly 1 bit is set).
- _[REJECT]_ The number of aggregation bits matches the committee size -- i.e.
`len(aggregation_bits) == len(get_beacon_committee(state, attestation.data.slot, index))`.

### The Req/Resp domain

#### Messages

##### BlobSidecarsByRoot v2

**Protocol ID:** `/eth2/beacon_chain/req/blob_sidecars_by_root/2/`

*[Updated in ]*

The `<context-bytes>` field is calculated as `context = compute_fork_digest(fork_version, genesis_validators_root)`:

[1]: # (eth2spec: skip)

| `fork_version` | Chunk SSZ type |
|------------------------|-----------------------|
| `ELECTRA_FORK_VERSION` | `electra.BlobSidecar` |
hwwhww marked this conversation as resolved.
Show resolved Hide resolved

Request Content:

```
(
List[BlobIdentifier, MAX_REQUEST_BLOB_SIDECARS_ELECTRA]
)
```

Response Content:

```
(
List[BlobSidecar, MAX_REQUEST_BLOB_SIDECARS_ELECTRA]
)
```

*Updated validation*

No more than `MAX_REQUEST_BLOB_SIDECARS_ELECTRA` may be requested at a time.

##### BlobSidecarsByRange v2

**Protocol ID:** `/eth2/beacon_chain/req/blob_sidecars_by_range/2/`

*[Updated in ]*

The `<context-bytes>` field is calculated as `context = compute_fork_digest(fork_version, genesis_validators_root)`:

[1]: # (eth2spec: skip)

| `fork_version` | Chunk SSZ type |
|------------------------|-----------------------|
| `ELECTRA_FORK_VERSION` | `electra.BlobSidecar` |
hwwhww marked this conversation as resolved.
Show resolved Hide resolved

Request Content:

```
(
start_slot: Slot
count: uint64
)
```

Response Content:

```
(
List[BlobSidecar, MAX_REQUEST_BLOB_SIDECARS_ELECTRA]
)
```

*Updated validation*

Clients MUST respond with at least the blob sidecars of the first blob-carrying block that exists in the range, if they have it, and no more than `MAX_REQUEST_BLOB_SIDECARS_ELECTRA` sidecars.
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,16 @@ def test_processing_pending_partial_withdrawals(spec):
spec.MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP
< spec.MAX_WITHDRAWALS_PER_PAYLOAD
)


@with_electra_and_later
@spec_test
@single_phase
def test_networking(spec):
assert spec.config.MAX_BLOBS_PER_BLOCK_ELECTRA <= spec.MAX_BLOB_COMMITMENTS_PER_BLOCK
assert (
spec.config.MAX_REQUEST_BLOB_SIDECARS_ELECTRA ==
spec.config.MAX_REQUEST_BLOCKS_DENEB * spec.config.MAX_BLOBS_PER_BLOCK_ELECTRA
)
# Start with the same size, but `BLOB_SIDECAR_SUBNET_COUNT` could potentially increase later.
assert spec.config.BLOB_SIDECAR_SUBNET_COUNT_ELECTRA == spec.config.MAX_BLOBS_PER_BLOCK_ELECTRA
3 changes: 3 additions & 0 deletions tests/core/pyspec/eth2spec/test/helpers/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rlp.sedes import Binary, CountableList, List as RLPList, big_endian_int, binary

from eth2spec.test.helpers.forks import (
is_post_electra,
is_post_eip7594,
)

Expand Down Expand Up @@ -108,5 +109,7 @@ def get_sample_blob_tx(spec, blob_count=1, rng=random.Random(5566), is_valid_blo
def get_max_blob_count(spec):
if is_post_eip7594(spec):
return spec.config.MAX_BLOBS_PER_BLOCK_EIP7594
elif is_post_electra(spec):
return spec.config.MAX_BLOBS_PER_BLOCK_ELECTRA
else:
return spec.config.MAX_BLOBS_PER_BLOCK