From e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Mon, 4 Nov 2024 21:15:18 +0800 Subject: [PATCH] Use eip7805 --- .../{focil => eip7805}/beacon-chain.md | 20 ++-- .../{focil => eip7805}/fork-choice.md | 12 +- .../{focil => eip7805}/p2p-interface.md | 10 +- .../_features/{focil => eip7805}/validator.md | 6 +- specs/_features/focil/engine-api.md | 105 ------------------ 5 files changed, 24 insertions(+), 129 deletions(-) rename specs/_features/{focil => eip7805}/beacon-chain.md (91%) rename specs/_features/{focil => eip7805}/fork-choice.md (95%) rename specs/_features/{focil => eip7805}/p2p-interface.md (93%) rename specs/_features/{focil => eip7805}/validator.md (96%) delete mode 100644 specs/_features/focil/engine-api.md diff --git a/specs/_features/focil/beacon-chain.md b/specs/_features/eip7805/beacon-chain.md similarity index 91% rename from specs/_features/focil/beacon-chain.md rename to specs/_features/eip7805/beacon-chain.md index c6f9bd8a4d..cf59ee1ca3 100644 --- a/specs/_features/focil/beacon-chain.md +++ b/specs/_features/eip7805/beacon-chain.md @@ -1,4 +1,4 @@ -# FOCIL -- The Beacon Chain +# EIP-7805 -- The Beacon Chain ## Table of contents @@ -32,7 +32,7 @@ ## Introduction -This is the beacon chain specification to add a fork-choice enforced, committee-based inclusion list (FOCIL) mechanism to allow forced transaction inclusion. Refers to the following posts: +This is the beacon chain specification to add EIP-7805 / fork-choice enforced, committee-based inclusion list (FOCIL) mechanism to allow forced transaction inclusion. Refers to the following posts: - [Fork-Choice enforced Inclusion Lists (FOCIL): A simple committee-based inclusion list proposal](https://ethresear.ch/t/fork-choice-enforced-inclusion-lists-focil-a-simple-committee-based-inclusion-list-proposal/19870/1) - [FOCIL CL & EL workflow](https://ethresear.ch/t/focil-cl-el-workflow/20526) *Note:* This specification is built upon [Electra](../../electra/beacon_chain.md) and is under active development. @@ -43,19 +43,19 @@ This is the beacon chain specification to add a fork-choice enforced, committee- | Name | Value | | - | - | -| `DOMAIN_IL_COMMITTEE` | `DomainType('0x0C000000')` # (New in FOCIL)| +| `DOMAIN_IL_COMMITTEE` | `DomainType('0x0C000000')` # (New in EIP-7805)| ### Inclusion List Committee | Name | Value | | - | - | -| `IL_COMMITTEE_SIZE` | `uint64(2**4)` (=16) # (New in FOCIL) | +| `IL_COMMITTEE_SIZE` | `uint64(2**4)` (=16) # (New in EIP-7805) | ### Execution | Name | Value | | - | - | -| `MAX_TRANSACTIONS_PER_INCLUSION_LIST` | `uint64(1)` # (New in FOCIL) TODO: Placeholder | +| `MAX_TRANSACTIONS_PER_INCLUSION_LIST` | `uint64(1)` # (New in EIP-7805) TODO: Placeholder | ## Containers @@ -127,14 +127,14 @@ class NewPayloadRequest(object): versioned_hashes: Sequence[VersionedHash] parent_beacon_block_root: Root execution_requests: ExecutionRequests - il_transactions: List[Transaction, MAX_TRANSACTIONS_PER_INCLUSION_LIST] # [New in FOCIL] + il_transactions: List[Transaction, MAX_TRANSACTIONS_PER_INCLUSION_LIST] # [New in EIP-7805] ``` #### Engine APIs ##### Modified `notify_new_payload` -*Note*: The function `notify_new_payload` is modified to include the additional `il_transactions` parameter in FOCIL. +*Note*: The function `notify_new_payload` is modified to include the additional `il_transactions` parameter in EIP-7805. ```python def notify_new_payload(self: ExecutionEngine, @@ -152,7 +152,7 @@ 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 parameter `il_transactions` -when calling `notify_new_payload` in FOCIL. +when calling `notify_new_payload` in EIP-7805. ```python def verify_and_notify_new_payload(self: ExecutionEngine, @@ -163,7 +163,7 @@ def verify_and_notify_new_payload(self: ExecutionEngine, execution_payload = new_payload_request.execution_payload execution_requests = new_payload_request.execution_requests parent_beacon_block_root = new_payload_request.parent_beacon_block_root - il_transactions = new_payload_request.il_transactions # [New in FOCIL] + il_transactions = new_payload_request.il_transactions # [New in EIP-7805] if not self.is_valid_block_hash(execution_payload, parent_beacon_block_root): return False @@ -171,7 +171,7 @@ def verify_and_notify_new_payload(self: ExecutionEngine, if not self.is_valid_versioned_hashes(new_payload_request): return False - # [Modified in FOCIL] + # [Modified in EIP-7805] if not self.notify_new_payload( execution_payload, execution_requests, diff --git a/specs/_features/focil/fork-choice.md b/specs/_features/eip7805/fork-choice.md similarity index 95% rename from specs/_features/focil/fork-choice.md rename to specs/_features/eip7805/fork-choice.md index 5044598eed..fc4db346eb 100644 --- a/specs/_features/focil/fork-choice.md +++ b/specs/_features/eip7805/fork-choice.md @@ -1,4 +1,4 @@ -# FOCIL -- Fork Choice +# EIP-7805 -- Fork Choice ## Table of contents @@ -15,13 +15,13 @@ ## Introduction -This is the modification of the fork choice accompanying the FOCIL upgrade. +This is the modification of the fork choice accompanying the EIP-7805 upgrade. ## Configuration | Name | Value | Unit | Duration | | - | - | :-: | :-: | -| `VIEW_FREEZE_DEADLINE` | `uint64(9)` | seconds | 9 seconds | # [New in FOCIL] +| `VIEW_FREEZE_DEADLINE` | `uint64(9)` | seconds | 9 seconds | # [New in EIP-7805] ## Helpers @@ -55,9 +55,9 @@ class Store(object): checkpoint_states: Dict[Checkpoint, BeaconState] = field(default_factory=dict) latest_messages: Dict[ValidatorIndex, LatestMessage] = field(default_factory=dict) unrealized_justifications: Dict[Root, Checkpoint] = field(default_factory=dict) - inclusion_lists: Dict[Tuple[Slot, Root], List[InclusionList]] = field(default_factory=dict) # [New in FOCIL] - inclusion_list_equivocators: Dict[Tuple[Slot, Root], Set[ValidatorIndex]] = field(default_factory=dict) # [New in FOCIL] - + inclusion_lists: Dict[Tuple[Slot, Root], List[InclusionList]] = field(default_factory=dict) # [New in EIP-7805] + inclusion_list_equivocators: Dict[Tuple[Slot, Root], Set[ValidatorIndex]] = field(default_factory=dict) # [New in EIP-7805] +``` ### New `on_inclusion_list` diff --git a/specs/_features/focil/p2p-interface.md b/specs/_features/eip7805/p2p-interface.md similarity index 93% rename from specs/_features/focil/p2p-interface.md rename to specs/_features/eip7805/p2p-interface.md index 83b4a86008..d2c0e0ed0e 100644 --- a/specs/_features/focil/p2p-interface.md +++ b/specs/_features/eip7805/p2p-interface.md @@ -1,6 +1,6 @@ -# FOCIL -- Networking +# EIP-7805 -- Networking -This document contains the consensus-layer networking specification for FOCIL. +This document contains the consensus-layer networking specification for EIP-7805. @@ -35,11 +35,11 @@ The new topics along with the type of the `data` field of a gossipsub message ar | Name | Message Type | |-------------------------------|------------------------------------------------------| -| `inclusion_list` | `SignedInclusionList` [New in FOCIL] | +| `inclusion_list` | `SignedInclusionList` [New in EIP-7805] | ##### Global topics -FOCIL introduces a new global topic for inclusion lists. +EIP-7805 introduces a new global topic for inclusion lists. ###### `inclusion_list` @@ -69,7 +69,7 @@ The `` field is calculated as `context = compute_fork_digest(fork | `fork_version` | Chunk SSZ type | |------------------------|------------------------------------------| -| `FOCIL_FORK_VERSION` | `focil.SignedInclusionList` | +| `EIP-7805_FORK_VERSION` | `EIP-7805.SignedInclusionList` | Request Content: ``` diff --git a/specs/_features/focil/validator.md b/specs/_features/eip7805/validator.md similarity index 96% rename from specs/_features/focil/validator.md rename to specs/_features/eip7805/validator.md index bc99f15de5..af27256c1b 100644 --- a/specs/_features/focil/validator.md +++ b/specs/_features/eip7805/validator.md @@ -1,4 +1,4 @@ -# FOCIL -- Honest Validator +# EIP-7805 -- Honest Validator ## Table of contents @@ -25,14 +25,14 @@ ## Introduction -This document represents the changes to be made in the code of an "honest validator" to implement FOCIL. +This document represents the changes to be made in the code of an "honest validator" to implement EIP-7805. ## 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 [FOCIL](./beacon-chain.md) are requisite for this document and used throughout. +All terminology, constants, functions, and protocol mechanics defined in the updated Beacon Chain doc of [EIP-7805](./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. ### Time parameters diff --git a/specs/_features/focil/engine-api.md b/specs/_features/focil/engine-api.md deleted file mode 100644 index b69e059bdb..0000000000 --- a/specs/_features/focil/engine-api.md +++ /dev/null @@ -1,105 +0,0 @@ -# Engine API -- FOCIL - -Engine API changes introduced in FOCIL. - -This specification is based on and extends [Engine API - Prague](./prague.md) specification. - -Warning: This file should be placed in https://github.com/ethereum/execution-apis but I'm placing it here for convenience of reviewing. - -## Table of contents - - - - -- [Constants](#constants) - - [PayloadStatusV2](#payloadstatusv2) -- [Methods](#methods) - - [engine_newPayloadV5](#engine_newpayloadv5) - - [Request](#request) - - [Response](#response) - - [Specification](#specification) - - [engine_updateBlockWithInclusionListV1](#engine_updateblockwithinclusionlistv1) - - [Request](#request-1) - - [Response](#response-1) - - [Specification](#specification-1) - - [engine_getInclusionListV1](#engine_getinclusionlistv1) - - [Request](#request-2) - - [Response](#response-2) - - [Specification](#specification-2) - - - -## Constants - -| Name | Value | -| - | - | -| `INCLUSION_LIST_MAX_GAS` | `uint64(4194304) = 2**22` | - -### PayloadStatusV2 - -This structure contains the result of processing a payload. The fields are encoded as follows: - -- `status`: `enum` - `"VALID" | "INVALID" | "SYNCING" | "ACCEPTED" | "INVALID_BLOCK_HASH" | "INVALID_INCLUSION_LIST"` -- `latestValidHash`: `DATA|null`, 32 Bytes - the hash of the most recent *valid* block in the branch defined by payload and its ancestors -- `validationError`: `String|null` - a message providing additional details on the validation error if the payload is classified as `INVALID` or `INVALID_BLOCK_HASH`. - -## Methods - -### engine_newPayloadV5 - -The request of this method is updated with [`ExecutionPayloadV5`](#ExecutionPayloadV5). - -#### Request - -* method: `engine_newPayloadV5` -* params: - 1. `executionPayload`: [`ExecutionPayloadV4`](#ExecutionPayloadV4). - 2. `expectedBlobVersionedHashes`: `Array of DATA`, 32 Bytes - Array of expected blob versioned hashes to validate. - 3. `parentBeaconBlockRoot`: `DATA`, 32 Bytes - Root of the parent beacon block. - 4. `inclusionListTransactions`: `Array of DATA` - Array of transaction objects, each object is a byte list (`DATA`) representing `TransactionType || TransactionPayload` or `LegacyTransaction` as defined in [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) - -#### Response - -* result: [`PayloadStatusV2`](#PayloadStatusV2) - -#### Specification - -1. Client software **MUST** respond to this method call in the following way: - * `{status: INVALID_INCLUSION_LIST, latestValidHash: null, validationError: null}` if there are any leftover `inclusionListTransactions` that are not part of the `executionPayload`, they can be processed at the end of the `executionPayload` or the block is full. - -### engine_updateBlockWithInclusionListV1 - -#### Request - -* method: `engine_updateBlockWithInclusionListV1` -* params: - 1. `payloadId`: `DATA`, 8 Bytes - Identifier of the payload build process - 2. `inclusionListTransactions`: `Array of DATA` - Array of transaction objects, each object is a byte list (`DATA`) representing `TransactionType || TransactionPayload` or `LegacyTransaction` as defined in [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) -* timeout: 1s - -#### Response - -#### Specification - -1. Given the `payloadId` client software **MUST** update payload build process building with a list of `inclusionListTransactions`. The transactions must be part of the execution payload unless it fails to be included at the end of the execution block. - -* error: code and message set in case an exception happens while getting the payload. - -### engine_getInclusionListV1 - -#### Request - -* method: `engine_getInclusionListV1` -* params: - 1. `parent_hash`: `DATA`, 32 Bytes - parent hash which returned inclusion list should be built upon. -* timeout: 1s - -#### Response - -* result: `object` - - `inclusionListTransactions`: `Array of DATA` - Array of transaction objects, each object is a byte list (`DATA`) representing `TransactionType || TransactionPayload` or `LegacyTransaction` as defined in [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) -* error: code and message set in case an exception happens while getting the inclusion list. - -#### Specification - -1. Client software **MUST** provide a list of transactions for the inclusion list based on local view of the mempool and according to the config specifications. \ No newline at end of file