From c752833e3cdef8327218f2be704567d9ae1557d9 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 12 Dec 2024 12:53:40 -0600 Subject: [PATCH 1/2] Remove EIP-7742 from Electra/Fulu --- README.md | 2 +- configs/mainnet.yaml | 3 - configs/minimal.yaml | 3 - pysetup/spec_builders/electra.py | 6 +- specs/_features/eip7732/beacon-chain.md | 1 - specs/electra/beacon-chain.md | 27 +++----- specs/electra/fork-choice.md | 2 - specs/electra/validator.md | 2 - specs/fulu/beacon-chain.md | 2 - specs/fulu/validator.md | 68 ------------------- .../unittests/test_config_invariants.py | 1 - .../fulu/unittests/test_config_invariants.py | 1 - 12 files changed, 11 insertions(+), 107 deletions(-) delete mode 100644 specs/fulu/validator.md diff --git a/README.md b/README.md index e6ce14ec36..21ca42dddb 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Features are researched and developed in parallel, and then consolidated into se | Seq. | Code Name | Fork Epoch | Specs | | - | - | - | - | | 5 | **Electra** | TBD | | -| 6 | **Fulu** | TBD | | +| 6 | **Fulu** | TBD | | ### Outdated Specifications diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index dadb261b44..deb3dcf5fe 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -160,8 +160,6 @@ MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000 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 @@ -174,7 +172,6 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 SAMPLES_PER_SLOT: 8 CUSTODY_REQUIREMENT: 4 -TARGET_BLOBS_PER_BLOCK_FULU: 9 MAX_BLOBS_PER_BLOCK_FULU: 12 # `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_FULU` MAX_REQUEST_BLOB_SIDECARS_FULU: 1536 diff --git a/configs/minimal.yaml b/configs/minimal.yaml index afb99949a4..460474ebf7 100644 --- a/configs/minimal.yaml +++ b/configs/minimal.yaml @@ -161,8 +161,6 @@ MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000 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 @@ -175,7 +173,6 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 SAMPLES_PER_SLOT: 8 CUSTODY_REQUIREMENT: 4 -TARGET_BLOBS_PER_BLOCK_FULU: 9 MAX_BLOBS_PER_BLOCK_FULU: 12 # `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_FULU` MAX_REQUEST_BLOB_SIDECARS_FULU: 1536 diff --git a/pysetup/spec_builders/electra.py b/pysetup/spec_builders/electra.py index 43362e4102..f473dbadc3 100644 --- a/pysetup/spec_builders/electra.py +++ b/pysetup/spec_builders/electra.py @@ -30,8 +30,7 @@ class NoopExecutionEngine(ExecutionEngine): def notify_new_payload(self: ExecutionEngine, execution_payload: ExecutionPayload, parent_beacon_block_root: Root, - execution_requests_list: Sequence[bytes], - target_blobs_per_block: uint64) -> bool: + execution_requests_list: Sequence[bytes]) -> bool: return True def notify_forkchoice_updated(self: ExecutionEngine, @@ -48,8 +47,7 @@ def get_payload(self: ExecutionEngine, payload_id: PayloadId) -> GetPayloadRespo def is_valid_block_hash(self: ExecutionEngine, execution_payload: ExecutionPayload, parent_beacon_block_root: Root, - execution_requests_list: Sequence[bytes], - target_blobs_per_block: uint64) -> bool: + execution_requests_list: Sequence[bytes]) -> bool: return True def is_valid_versioned_hashes(self: ExecutionEngine, new_payload_request: NewPayloadRequest) -> bool: diff --git a/specs/_features/eip7732/beacon-chain.md b/specs/_features/eip7732/beacon-chain.md index bac64274ee..2303e33d40 100644 --- a/specs/_features/eip7732/beacon-chain.md +++ b/specs/_features/eip7732/beacon-chain.md @@ -705,7 +705,6 @@ 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=TARGET_BLOBS_PER_BLOCK_ELECTRA, ) ) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index d40e89e2c5..17ac0cbff0 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -206,7 +206,6 @@ The following values are (non-configurable) constants used throughout the specif | 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 @@ -1014,22 +1013,19 @@ class NewPayloadRequest(object): versioned_hashes: Sequence[VersionedHash] parent_beacon_block_root: Root execution_requests: ExecutionRequests # [New in Electra] - target_blobs_per_block: uint64 # [New in Electra:EIP7742] ``` #### Engine APIs ##### Modified `is_valid_block_hash` -*Note*: The function `is_valid_block_hash` is modified to include the additional -`execution_requests_list` and `target_blobs_per_block` parameters in Electra. +*Note*: The function `is_valid_block_hash` is modified to include the additional `execution_requests_list`. ```python def is_valid_block_hash(self: ExecutionEngine, execution_payload: ExecutionPayload, parent_beacon_block_root: Root, - execution_requests_list: Sequence[bytes], - target_blobs_per_block: uint64) -> bool: + execution_requests_list: Sequence[bytes]) -> bool: """ Return ``True`` if and only if ``execution_payload.block_hash`` is computed correctly. """ @@ -1038,15 +1034,13 @@ def is_valid_block_hash(self: ExecutionEngine, ##### Modified `notify_new_payload` -*Note*: The function `notify_new_payload` is modified to include the additional -`execution_requests_list` and `target_blobs_per_block` parameters in Electra. +*Note*: The function `notify_new_payload` is modified to include the additional `execution_requests_list`. ```python def notify_new_payload(self: ExecutionEngine, execution_payload: ExecutionPayload, parent_beacon_block_root: Root, - execution_requests_list: Sequence[bytes], - target_blobs_per_block: uint64) -> bool: + execution_requests_list: Sequence[bytes]) -> bool: """ Return ``True`` if and only if ``execution_payload`` and ``execution_requests_list`` are valid with respect to ``self.execution_state``. @@ -1056,9 +1050,8 @@ def notify_new_payload(self: ExecutionEngine, ##### Modified `verify_and_notify_new_payload` -*Note*: The function `verify_and_notify_new_payload` is modified to pass the additional parameters -`execution_requests_list` and `target_blobs_per_block` when calling `is_valid_block_hash` and -`notify_new_payload` in Electra. +*Note*: The function `verify_and_notify_new_payload` is modified to pass the additional parameter +`execution_requests_list` when calling `is_valid_block_hash` and `notify_new_payload` in Electra. ```python def verify_and_notify_new_payload(self: ExecutionEngine, @@ -1069,7 +1062,6 @@ def verify_and_notify_new_payload(self: ExecutionEngine, execution_payload = new_payload_request.execution_payload parent_beacon_block_root = new_payload_request.parent_beacon_block_root execution_requests_list = get_execution_requests_list(new_payload_request.execution_requests) # [New in Electra] - target_blobs_per_block = new_payload_request.target_blobs_per_block # [New in Electra:EIP7742] if b'' in execution_payload.transactions: return False @@ -1078,8 +1070,7 @@ def verify_and_notify_new_payload(self: ExecutionEngine, if not self.is_valid_block_hash( execution_payload, parent_beacon_block_root, - execution_requests_list, - target_blobs_per_block): + execution_requests_list): return False if not self.is_valid_versioned_hashes(new_payload_request): @@ -1089,8 +1080,7 @@ def verify_and_notify_new_payload(self: ExecutionEngine, if not self.notify_new_payload( execution_payload, parent_beacon_block_root, - execution_requests_list, - target_blobs_per_block): + execution_requests_list): return False return True @@ -1254,7 +1244,6 @@ 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=TARGET_BLOBS_PER_BLOCK_ELECTRA, # [New in Electra:EIP7691:EIP7742] ) ) # Cache execution payload header diff --git a/specs/electra/fork-choice.md b/specs/electra/fork-choice.md index 8530239325..8bb03e1d3f 100644 --- a/specs/electra/fork-choice.md +++ b/specs/electra/fork-choice.md @@ -33,6 +33,4 @@ class PayloadAttributes(object): suggested_fee_recipient: ExecutionAddress withdrawals: Sequence[Withdrawal] parent_beacon_block_root: Root - target_blobs_per_block: uint64 # [New in Electra:EIP7742] - max_blobs_per_block: uint64 # [New in Electra:EIP7742] ``` diff --git a/specs/electra/validator.md b/specs/electra/validator.md index f8882227c7..2e980d5345 100644 --- a/specs/electra/validator.md +++ b/specs/electra/validator.md @@ -176,8 +176,6 @@ 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=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/specs/fulu/beacon-chain.md b/specs/fulu/beacon-chain.md index 5dca6580f5..9412eb88c4 100644 --- a/specs/fulu/beacon-chain.md +++ b/specs/fulu/beacon-chain.md @@ -27,7 +27,6 @@ | Name | Value | Description | | - | - | - | -| `TARGET_BLOBS_PER_BLOCK_FULU` | `uint64(9)` | *[New in Fulu:EIP7594]* Target number of blobs in a single block limited by `MAX_BLOBS_PER_BLOCK_FULU` | | `MAX_BLOBS_PER_BLOCK_FULU` | `uint64(12)` | *[New in Fulu:EIP7594]* Maximum number of blobs in a single block limited by `MAX_BLOB_COMMITMENTS_PER_BLOCK` | #### Execution payload @@ -54,7 +53,6 @@ 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=TARGET_BLOBS_PER_BLOCK_FULU, # [Modified in Fulu:EIP7594] ) ) # Cache execution payload header diff --git a/specs/fulu/validator.md b/specs/fulu/validator.md deleted file mode 100644 index b8781e8ad6..0000000000 --- a/specs/fulu/validator.md +++ /dev/null @@ -1,68 +0,0 @@ -# Fulu -- 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 Fulu. - -## 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 [Fulu](./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_FULU, # [Modified in Fulu:EIP7594] - max_blobs_per_block=MAX_BLOBS_PER_BLOCK_FULU, # [Modified in Fulu: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/tests/core/pyspec/eth2spec/test/electra/unittests/test_config_invariants.py b/tests/core/pyspec/eth2spec/test/electra/unittests/test_config_invariants.py index ab9ac149be..ce4b6684a4 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 @@ -19,7 +19,6 @@ def test_processing_pending_partial_withdrawals(spec): @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 == diff --git a/tests/core/pyspec/eth2spec/test/fulu/unittests/test_config_invariants.py b/tests/core/pyspec/eth2spec/test/fulu/unittests/test_config_invariants.py index 57b40f6e2c..fcf98c7e75 100644 --- a/tests/core/pyspec/eth2spec/test/fulu/unittests/test_config_invariants.py +++ b/tests/core/pyspec/eth2spec/test/fulu/unittests/test_config_invariants.py @@ -31,7 +31,6 @@ def test_polynomical_commitments_sampling(spec): @spec_test @single_phase def test_networking(spec): - assert spec.config.TARGET_BLOBS_PER_BLOCK_FULU <= spec.config.MAX_BLOBS_PER_BLOCK_FULU assert spec.config.MAX_BLOBS_PER_BLOCK_FULU <= spec.MAX_BLOB_COMMITMENTS_PER_BLOCK assert ( spec.config.MAX_REQUEST_BLOB_SIDECARS_FULU == From 8f54f87ca5668e4519a74937511a93d40c0dede5 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 12 Dec 2024 17:17:37 -0600 Subject: [PATCH 2/2] Remove unnecessary Electra fork-choice file --- specs/electra/fork-choice.md | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 specs/electra/fork-choice.md diff --git a/specs/electra/fork-choice.md b/specs/electra/fork-choice.md deleted file mode 100644 index 8bb03e1d3f..0000000000 --- a/specs/electra/fork-choice.md +++ /dev/null @@ -1,36 +0,0 @@ -# Electra -- Fork Choice - -## Table of contents - - - - -- [Introduction](#introduction) -- [Containers](#containers) -- [Helpers](#helpers) - - [Extended `PayloadAttributes`](#extended-payloadattributes) - - - - -## Introduction - -This is the modification of the fork choice accompanying the Electra upgrade. - -## Containers - -## Helpers - -### Extended `PayloadAttributes` - -*Note*: `PayloadAttributes` is extended with the target/maximum number of blobs per block. - -```python -@dataclass -class PayloadAttributes(object): - timestamp: uint64 - prev_randao: Bytes32 - suggested_fee_recipient: ExecutionAddress - withdrawals: Sequence[Withdrawal] - parent_beacon_block_root: Root -```