diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index c2d26ba7e2..f010bec54d 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -144,14 +144,28 @@ 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 +# `uint64(6)` +TARGET_BLOBS_PER_BLOCK_ELECTRA: 6 +# `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)` @@ -166,13 +180,10 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 SAMPLES_PER_SLOT: 8 CUSTODY_REQUIREMENT: 4 -MAX_BLOBS_PER_BLOCK_EIP7594: 8 +TARGET_BLOBS_PER_BLOCK_EIP7594: 9 +MAX_BLOBS_PER_BLOCK_EIP7594: 12 # `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) +MAX_REQUEST_BLOB_SIDECARS_EIP7594: 1536 # EIP7732 MAX_REQUEST_PAYLOADS: 128 diff --git a/configs/minimal.yaml b/configs/minimal.yaml index c1b62e7470..449dd3c421 100644 --- a/configs/minimal.yaml +++ b/configs/minimal.yaml @@ -145,14 +145,28 @@ 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(6)` +TARGET_BLOBS_PER_BLOCK_ELECTRA: 6 +# `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 @@ -165,13 +179,10 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 SAMPLES_PER_SLOT: 8 CUSTODY_REQUIREMENT: 4 -MAX_BLOBS_PER_BLOCK_EIP7594: 8 +TARGET_BLOBS_PER_BLOCK_EIP7594: 9 +MAX_BLOBS_PER_BLOCK_EIP7594: 12 # `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) +MAX_REQUEST_BLOB_SIDECARS_EIP7594: 1536 # EIP7732 MAX_REQUEST_PAYLOADS: 128 diff --git a/presets/minimal/deneb.yaml b/presets/minimal/deneb.yaml index 9d0db086b8..c101de3162 100644 --- a/presets/minimal/deneb.yaml +++ b/presets/minimal/deneb.yaml @@ -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 diff --git a/specs/_features/eip7594/beacon-chain.md b/specs/_features/eip7594/beacon-chain.md index ffee297942..8f30e683e7 100644 --- a/specs/_features/eip7594/beacon-chain.md +++ b/specs/_features/eip7594/beacon-chain.md @@ -27,7 +27,8 @@ | Name | Value | Description | | - | - | - | -| `MAX_BLOBS_PER_BLOCK_EIP7594` | `uint64(8)` | *[New in EIP7594]* Maximum number of blobs in a single block limited by `MAX_BLOB_COMMITMENTS_PER_BLOCK` | +| `TARGET_BLOBS_PER_BLOCK_EIP7594` | `uint64(9)` | *[New in EIP7594]* Target number of blobs in a single block limited by `MAX_BLOBS_PER_BLOCK_EIP7594` | +| `MAX_BLOBS_PER_BLOCK_EIP7594` | `uint64(12)` | *[New in EIP7594]* Maximum number of blobs in a single block limited by `MAX_BLOB_COMMITMENTS_PER_BLOCK` | #### Execution payload @@ -53,7 +54,7 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi versioned_hashes=versioned_hashes, parent_beacon_block_root=state.latest_block_header.parent_root, execution_requests=body.execution_requests, - target_blobs_per_block=MAX_BLOBS_PER_BLOCK // 2, + target_blobs_per_block=TARGET_BLOBS_PER_BLOCK_EIP7594, # [Modified in EIP7594] ) ) # Cache execution payload header diff --git a/specs/_features/eip7594/p2p-interface.md b/specs/_features/eip7594/p2p-interface.md index e0408ed1d5..1f8172961e 100644 --- a/specs/_features/eip7594/p2p-interface.md +++ b/specs/_features/eip7594/p2p-interface.md @@ -29,8 +29,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) @@ -211,11 +211,11 @@ 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]* +*[Modified in EIP7594]* The `` field is calculated as `context = compute_fork_digest(fork_version, genesis_validators_root)`: @@ -245,11 +245,11 @@ 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]* +*[Modified in EIP7594]* The `` field is calculated as `context = compute_fork_digest(fork_version, genesis_validators_root)`: diff --git a/specs/_features/eip7594/validator.md b/specs/_features/eip7594/validator.md new file mode 100644 index 0000000000..0fddad4ebe --- /dev/null +++ b/specs/_features/eip7594/validator.md @@ -0,0 +1,68 @@ +# EIP7594 -- Honest Validator + +## Table of contents + + + + + +- [Introduction](#introduction) +- [Prerequisites](#prerequisites) +- [Block proposal](#block-proposal) + - [Constructing the `BeaconBlockBody`](#constructing-the-beaconblockbody) + - [Execution payload](#execution-payload) + + + + +## Introduction + +This document represents the changes to be made in the code of an "honest validator" to implement EIP7594. + +## Prerequisites + +This document is an extension of the [Electra -- Honest Validator](../electra/validator.md) guide. +All behaviors and definitions defined in this document, and documents it extends, carry over unless explicitly noted or overridden. + +All terminology, constants, functions, and protocol mechanics defined in the updated Beacon Chain doc of [EIP7594](./beacon-chain.md) are requisite for this document and used throughout. +Please see related Beacon Chain doc before continuing and use them as a reference throughout. + +## Block proposal + +### Constructing the `BeaconBlockBody` + +#### Execution payload + +`prepare_execution_payload` is updated from the Electra specs. + +*Note*: In this section, `state` is the state of the slot for the block proposal _without_ the block yet applied. +That is, `state` is the `previous_state` processed through any empty slots up to the assigned slot using `process_slots(previous_state, slot)`. + +``python +def prepare_execution_payload(state: BeaconState, + safe_block_hash: Hash32, + finalized_block_hash: Hash32, + suggested_fee_recipient: ExecutionAddress, + execution_engine: ExecutionEngine) -> Optional[PayloadId]: + # Verify consistency of the parent hash with respect to the previous execution payload header + parent_hash = state.latest_execution_payload_header.block_hash + + # Set the forkchoice head and initiate the payload build process + withdrawals, _ = get_expected_withdrawals(state) + + payload_attributes = PayloadAttributes( + timestamp=compute_timestamp_at_slot(state, state.slot), + prev_randao=get_randao_mix(state, get_current_epoch(state)), + suggested_fee_recipient=suggested_fee_recipient, + withdrawals=withdrawals, + parent_beacon_block_root=hash_tree_root(state.latest_block_header), + target_blobs_per_block=TARGET_BLOBS_PER_BLOCK_EIP7594, # [Modified in EIP7594] + max_blobs_per_block=MAX_BLOBS_PER_BLOCK_EIP7594, # [Modified in EIP7594] + ) + return execution_engine.notify_forkchoice_updated( + head_block_hash=parent_hash, + safe_block_hash=safe_block_hash, + finalized_block_hash=finalized_block_hash, + payload_attributes=payload_attributes, + ) +``` \ No newline at end of file diff --git a/specs/_features/eip7732/beacon-chain.md b/specs/_features/eip7732/beacon-chain.md index df25fb43ac..bac64274ee 100644 --- a/specs/_features/eip7732/beacon-chain.md +++ b/specs/_features/eip7732/beacon-chain.md @@ -705,7 +705,7 @@ def process_execution_payload(state: BeaconState, versioned_hashes=versioned_hashes, parent_beacon_block_root=state.latest_block_header.parent_root, execution_requests=requests, - target_blobs_per_block=MAX_BLOBS_PER_BLOCK // 2, + target_blobs_per_block=TARGET_BLOBS_PER_BLOCK_ELECTRA, ) ) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index d61228bd31..f4997cd76c 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -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) @@ -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. @@ -200,6 +202,13 @@ The following values are (non-configurable) constants used throughout the specif ## Configuration +### Execution + +| Name | Value | Description | +| - | - | - | +| `TARGET_BLOBS_PER_BLOCK_ELECTRA` | `uint64(6)` | *[New in Electra:EIP7691]* Target number of blobs in a single block limited by `MAX_BLOBS_PER_BLOCK_ELECTRA` | +| `MAX_BLOBS_PER_BLOCK_ELECTRA` | `uint64(9)` | *[New in Electra:EIP7691]* Maximum number of blobs in a single block limited by `MAX_BLOB_COMMITMENTS_PER_BLOCK` | + ### Validator cycle | Name | Value | @@ -1233,7 +1242,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( @@ -1242,7 +1251,7 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi versioned_hashes=versioned_hashes, parent_beacon_block_root=state.latest_block_header.parent_root, execution_requests=body.execution_requests, # [New in Electra] - target_blobs_per_block=MAX_BLOBS_PER_BLOCK // 2, # [New in Electra:EIP7742] + target_blobs_per_block=TARGET_BLOBS_PER_BLOCK_ELECTRA, # [New in Electra:EIP7691:EIP7742] ) ) # Cache execution payload header diff --git a/specs/electra/p2p-interface.md b/specs/electra/p2p-interface.md index 84d67f6e04..0016976e93 100644 --- a/specs/electra/p2p-interface.md +++ b/specs/electra/p2p-interface.md @@ -8,12 +8,18 @@ - [Introduction](#introduction) - [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) @@ -26,6 +32,15 @@ The specification of these changes continues in the same format as the network s ## 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. @@ -44,9 +59,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]` @@ -55,9 +77,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. @@ -74,3 +96,78 @@ 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/` + +*[Modified in Electra:EIP7691]* + +The `` field is calculated as `context = compute_fork_digest(fork_version, genesis_validators_root)`: + +[1]: # (eth2spec: skip) + +| `fork_version` | Chunk SSZ type | +|------------------------|-----------------------| +| `DENEB_FORK_VERSION` | `deneb.BlobSidecar` | +| `ELECTRA_FORK_VERSION` | `electra.BlobSidecar` | + +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/` + +*[Modified in Electra:EIP7691]* + +The `` field is calculated as `context = compute_fork_digest(fork_version, genesis_validators_root)`: + +[1]: # (eth2spec: skip) + +| `fork_version` | Chunk SSZ type | +|------------------------|-----------------------| +| `DENEB_FORK_VERSION` | `deneb.BlobSidecar` | +| `ELECTRA_FORK_VERSION` | `electra.BlobSidecar` | + +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. diff --git a/specs/electra/validator.md b/specs/electra/validator.md index 77476cf394..f8882227c7 100644 --- a/specs/electra/validator.md +++ b/specs/electra/validator.md @@ -176,8 +176,8 @@ def prepare_execution_payload(state: BeaconState, suggested_fee_recipient=suggested_fee_recipient, withdrawals=withdrawals, parent_beacon_block_root=hash_tree_root(state.latest_block_header), - target_blobs_per_block=MAX_BLOBS_PER_BLOCK // 2, # [New in Electra:EIP7742] - max_blobs_per_block=MAX_BLOBS_PER_BLOCK, # [New in Electra:EIP7742] + target_blobs_per_block=TARGET_BLOBS_PER_BLOCK_ELECTRA, # [New in Electra:EIP7742] + max_blobs_per_block=MAX_BLOBS_PER_BLOCK_ELECTRA, # [New in Electra:EIP7742] ) return execution_engine.notify_forkchoice_updated( head_block_hash=parent_hash, diff --git a/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py b/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py index 33eaada407..624976a350 100644 --- a/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py +++ b/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py @@ -31,6 +31,7 @@ def test_polynomical_commitments_sampling(spec): @spec_test @single_phase def test_networking(spec): + assert spec.config.TARGET_BLOBS_PER_BLOCK_EIP7594 <= spec.config.MAX_BLOBS_PER_BLOCK_EIP7594 assert spec.config.MAX_BLOBS_PER_BLOCK_EIP7594 <= spec.MAX_BLOB_COMMITMENTS_PER_BLOCK assert ( spec.config.MAX_REQUEST_BLOB_SIDECARS_EIP7594 == diff --git a/tests/core/pyspec/eth2spec/test/electra/unittests/test_config_invariants.py b/tests/core/pyspec/eth2spec/test/electra/unittests/test_config_invariants.py index 839fa0dbd4..ab9ac149be 100644 --- a/tests/core/pyspec/eth2spec/test/electra/unittests/test_config_invariants.py +++ b/tests/core/pyspec/eth2spec/test/electra/unittests/test_config_invariants.py @@ -13,3 +13,17 @@ 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.TARGET_BLOBS_PER_BLOCK_ELECTRA <= spec.config.MAX_BLOBS_PER_BLOCK_ELECTRA + 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 diff --git a/tests/core/pyspec/eth2spec/test/helpers/blob.py b/tests/core/pyspec/eth2spec/test/helpers/blob.py index c65414b02b..e0d82da1a0 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/blob.py +++ b/tests/core/pyspec/eth2spec/test/helpers/blob.py @@ -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, ) @@ -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