From 82143e1977a8e0beed25d98fb42b6a48ad63df74 Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Mon, 15 Jan 2024 12:48:22 +0100 Subject: [PATCH] Also bump `EXECUTION_PAYLOAD_GINDEX` --- pysetup/spec_builders/capella.py | 2 +- pysetup/spec_builders/whisk.py | 2 +- specs/capella/light-client/full-node.md | 2 +- specs/capella/light-client/sync-protocol.md | 8 ++++---- specs/deneb/light-client/full-node.md | 2 +- specs/deneb/light-client/sync-protocol.md | 4 ++-- .../test/capella/light_client/test_single_merkle_proof.py | 8 ++++---- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pysetup/spec_builders/capella.py b/pysetup/spec_builders/capella.py index 080bdb537..6630b94f1 100644 --- a/pysetup/spec_builders/capella.py +++ b/pysetup/spec_builders/capella.py @@ -16,5 +16,5 @@ from eth2spec.bellatrix import {preset_name} as bellatrix @classmethod def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]: return { - 'EXECUTION_PAYLOAD_INDEX': 'GeneralizedIndex(25)', + 'EXECUTION_PAYLOAD_GINDEX': 'GeneralizedIndex(25)', } diff --git a/pysetup/spec_builders/whisk.py b/pysetup/spec_builders/whisk.py index c892a1c08..6b4c5a7d7 100644 --- a/pysetup/spec_builders/whisk.py +++ b/pysetup/spec_builders/whisk.py @@ -27,6 +27,6 @@ import json @classmethod def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]: constants = { - 'EXECUTION_PAYLOAD_INDEX': 'GeneralizedIndex(41)', + 'EXECUTION_PAYLOAD_GINDEX': 'GeneralizedIndex(41)', } return {**super().hardcoded_ssz_dep_constants(), **constants} diff --git a/specs/capella/light-client/full-node.md b/specs/capella/light-client/full-node.md index 1d2f677cf..319fb1c94 100644 --- a/specs/capella/light-client/full-node.md +++ b/specs/capella/light-client/full-node.md @@ -47,7 +47,7 @@ def block_to_light_client_header(block: SignedBeaconBlock) -> LightClientHeader: withdrawals_root=hash_tree_root(payload.withdrawals), ) execution_branch = ExecutionBranch( - compute_merkle_proof(block.message.body, EXECUTION_PAYLOAD_INDEX)) + compute_merkle_proof(block.message.body, EXECUTION_PAYLOAD_GINDEX)) else: # Note that during fork transitions, `finalized_header` may still point to earlier forks. # While Bellatrix blocks also contain an `ExecutionPayload` (minus `withdrawals_root`), diff --git a/specs/capella/light-client/sync-protocol.md b/specs/capella/light-client/sync-protocol.md index 2abe5d58c..b241b2137 100644 --- a/specs/capella/light-client/sync-protocol.md +++ b/specs/capella/light-client/sync-protocol.md @@ -32,13 +32,13 @@ Additional documents describes the impact of the upgrade on certain roles: | Name | SSZ equivalent | Description | | - | - | - | -| `ExecutionBranch` | `Vector[Bytes32, floorlog2(EXECUTION_PAYLOAD_INDEX)]` | Merkle branch of `execution_payload` within `BeaconBlockBody` | +| `ExecutionBranch` | `Vector[Bytes32, floorlog2(EXECUTION_PAYLOAD_GINDEX)]` | Merkle branch of `execution_payload` within `BeaconBlockBody` | ## Constants | Name | Value | | - | - | -| `EXECUTION_PAYLOAD_INDEX` | `get_generalized_index(BeaconBlockBody, 'execution_payload')` (= 25) | +| `EXECUTION_PAYLOAD_GINDEX` | `get_generalized_index(BeaconBlockBody, 'execution_payload')` (= 25) | ## Containers @@ -82,8 +82,8 @@ def is_valid_light_client_header(header: LightClientHeader) -> bool: return is_valid_merkle_branch( leaf=get_lc_execution_root(header), branch=header.execution_branch, - depth=floorlog2(EXECUTION_PAYLOAD_INDEX), - index=get_subtree_index(EXECUTION_PAYLOAD_INDEX), + depth=floorlog2(EXECUTION_PAYLOAD_GINDEX), + index=get_subtree_index(EXECUTION_PAYLOAD_GINDEX), root=header.beacon.body_root, ) ``` diff --git a/specs/deneb/light-client/full-node.md b/specs/deneb/light-client/full-node.md index 82814b346..db081b8e4 100644 --- a/specs/deneb/light-client/full-node.md +++ b/specs/deneb/light-client/full-node.md @@ -53,7 +53,7 @@ def block_to_light_client_header(block: SignedBeaconBlock) -> LightClientHeader: execution_header.excess_blob_gas = payload.excess_blob_gas execution_branch = ExecutionBranch( - compute_merkle_proof(block.message.body, EXECUTION_PAYLOAD_INDEX)) + compute_merkle_proof(block.message.body, EXECUTION_PAYLOAD_GINDEX)) else: # Note that during fork transitions, `finalized_header` may still point to earlier forks. # While Bellatrix blocks also contain an `ExecutionPayload` (minus `withdrawals_root`), diff --git a/specs/deneb/light-client/sync-protocol.md b/specs/deneb/light-client/sync-protocol.md index 8f3972d32..38aa3897b 100644 --- a/specs/deneb/light-client/sync-protocol.md +++ b/specs/deneb/light-client/sync-protocol.md @@ -80,8 +80,8 @@ def is_valid_light_client_header(header: LightClientHeader) -> bool: return is_valid_merkle_branch( leaf=get_lc_execution_root(header), branch=header.execution_branch, - depth=floorlog2(EXECUTION_PAYLOAD_INDEX), - index=get_subtree_index(EXECUTION_PAYLOAD_INDEX), + depth=floorlog2(EXECUTION_PAYLOAD_GINDEX), + index=get_subtree_index(EXECUTION_PAYLOAD_GINDEX), root=header.beacon.body_root, ) ``` diff --git a/tests/core/pyspec/eth2spec/test/capella/light_client/test_single_merkle_proof.py b/tests/core/pyspec/eth2spec/test/capella/light_client/test_single_merkle_proof.py index 8401a9444..41bb3f307 100644 --- a/tests/core/pyspec/eth2spec/test/capella/light_client/test_single_merkle_proof.py +++ b/tests/core/pyspec/eth2spec/test/capella/light_client/test_single_merkle_proof.py @@ -15,16 +15,16 @@ def test_execution_merkle_proof(spec, state): block = state_transition_with_full_block(spec, state, True, False) yield "object", block.message.body - execution_branch = spec.compute_merkle_proof(block.message.body, spec.EXECUTION_PAYLOAD_INDEX) + execution_branch = spec.compute_merkle_proof(block.message.body, spec.EXECUTION_PAYLOAD_GINDEX) yield "proof", { "leaf": "0x" + block.message.body.execution_payload.hash_tree_root().hex(), - "leaf_index": spec.EXECUTION_PAYLOAD_INDEX, + "leaf_index": spec.EXECUTION_PAYLOAD_GINDEX, "branch": ['0x' + root.hex() for root in execution_branch] } assert spec.is_valid_merkle_branch( leaf=block.message.body.execution_payload.hash_tree_root(), branch=execution_branch, - depth=spec.floorlog2(spec.EXECUTION_PAYLOAD_INDEX), - index=spec.get_subtree_index(spec.EXECUTION_PAYLOAD_INDEX), + depth=spec.floorlog2(spec.EXECUTION_PAYLOAD_GINDEX), + index=spec.get_subtree_index(spec.EXECUTION_PAYLOAD_GINDEX), root=block.message.body.hash_tree_root(), )