|
9 | 9 | <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
10 | 10 |
|
11 | 11 | - [Introduction](#introduction) |
12 | | -- [Helper functions](#helper-functions) |
13 | | - - [Modified `block_to_light_client_header`](#modified-block_to_light_client_header) |
14 | 12 |
|
15 | 13 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> |
16 | 14 | <!-- /TOC --> |
17 | 15 |
|
18 | 16 | ## Introduction |
19 | 17 |
|
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. |
0 commit comments