Skip to content

Commit d2a9506

Browse files
committed
Clean up electra LC
1 parent 96b1d31 commit d2a9506

File tree

2 files changed

+1
-83
lines changed

2 files changed

+1
-83
lines changed

specs/electra/light-client/full-node.md

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,66 +9,10 @@
99
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1010

1111
- [Introduction](#introduction)
12-
- [Helper functions](#helper-functions)
13-
- [Modified `block_to_light_client_header`](#modified-block_to_light_client_header)
1412

1513
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1614
<!-- /TOC -->
1715

1816
## Introduction
1917

20-
Execution payload data is updated to account for the Electra upgrade.
21-
22-
## Helper functions
23-
24-
### Modified `block_to_light_client_header`
25-
26-
```python
27-
def block_to_light_client_header(block: SignedBeaconBlock) -> LightClientHeader:
28-
epoch = compute_epoch_at_slot(block.message.slot)
29-
30-
if epoch >= CAPELLA_FORK_EPOCH:
31-
payload = block.message.body.execution_payload
32-
execution_header = ExecutionPayloadHeader(
33-
parent_hash=payload.parent_hash,
34-
fee_recipient=payload.fee_recipient,
35-
state_root=payload.state_root,
36-
receipts_root=payload.receipts_root,
37-
logs_bloom=payload.logs_bloom,
38-
prev_randao=payload.prev_randao,
39-
block_number=payload.block_number,
40-
gas_limit=payload.gas_limit,
41-
gas_used=payload.gas_used,
42-
timestamp=payload.timestamp,
43-
extra_data=payload.extra_data,
44-
base_fee_per_gas=payload.base_fee_per_gas,
45-
block_hash=payload.block_hash,
46-
transactions_root=hash_tree_root(payload.transactions),
47-
withdrawals_root=hash_tree_root(payload.withdrawals),
48-
)
49-
if epoch >= DENEB_FORK_EPOCH:
50-
execution_header.blob_gas_used = payload.blob_gas_used
51-
execution_header.excess_blob_gas = payload.excess_blob_gas
52-
53-
execution_branch = ExecutionBranch(
54-
compute_merkle_proof(block.message.body, EXECUTION_PAYLOAD_GINDEX))
55-
else:
56-
# Note that during fork transitions, `finalized_header` may still point to earlier forks.
57-
# While Bellatrix blocks also contain an `ExecutionPayload` (minus `withdrawals_root`),
58-
# it was not included in the corresponding light client data. To ensure compatibility
59-
# with legacy data going through `upgrade_lc_header_to_capella`, leave out execution data.
60-
execution_header = ExecutionPayloadHeader()
61-
execution_branch = ExecutionBranch()
62-
63-
return LightClientHeader(
64-
beacon=BeaconBlockHeader(
65-
slot=block.message.slot,
66-
proposer_index=block.message.proposer_index,
67-
parent_root=block.message.parent_root,
68-
state_root=block.message.state_root,
69-
body_root=hash_tree_root(block.message.body),
70-
),
71-
execution=execution_header,
72-
execution_branch=execution_branch,
73-
)
74-
```
18+
No changes occurred in Electra upgrade.

specs/electra/light-client/sync-protocol.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
- [Modified `current_sync_committee_gindex_at_slot`](#modified-current_sync_committee_gindex_at_slot)
1919
- [Modified `next_sync_committee_gindex_at_slot`](#modified-next_sync_committee_gindex_at_slot)
2020
- [Modified `get_lc_execution_root`](#modified-get_lc_execution_root)
21-
- [Modified `is_valid_light_client_header`](#modified-is_valid_light_client_header)
2221

2322
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2423
<!-- /TOC -->
@@ -152,28 +151,3 @@ def get_lc_execution_root(header: LightClientHeader) -> Root:
152151

153152
return Root()
154153
```
155-
156-
### Modified `is_valid_light_client_header`
157-
158-
```python
159-
def is_valid_light_client_header(header: LightClientHeader) -> bool:
160-
epoch = compute_epoch_at_slot(header.beacon.slot)
161-
162-
if epoch < DENEB_FORK_EPOCH:
163-
if header.execution.blob_gas_used != uint64(0) or header.execution.excess_blob_gas != uint64(0):
164-
return False
165-
166-
if epoch < CAPELLA_FORK_EPOCH:
167-
return (
168-
header.execution == ExecutionPayloadHeader()
169-
and header.execution_branch == ExecutionBranch()
170-
)
171-
172-
return is_valid_merkle_branch(
173-
leaf=get_lc_execution_root(header),
174-
branch=header.execution_branch,
175-
depth=floorlog2(EXECUTION_PAYLOAD_GINDEX),
176-
index=get_subtree_index(EXECUTION_PAYLOAD_GINDEX),
177-
root=header.beacon.body_root,
178-
)
179-
```

0 commit comments

Comments
 (0)