Also bump `EXECUTION_PAYLOAD_GINDEX`

This commit is contained in:
Etan Kissling 2024-01-15 12:48:22 +01:00
parent 0b5bb1ae3f
commit 82143e1977
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
7 changed files with 14 additions and 14 deletions

View File

@ -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)',
}

View File

@ -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}

View File

@ -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`),

View File

@ -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,
)
```

View File

@ -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`),

View File

@ -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,
)
```

View File

@ -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(),
)