Add docstrings to explain empty header

This commit is contained in:
Etan Kissling 2023-01-13 11:19:53 +01:00
parent b7205813fd
commit ca32fe8347
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
2 changed files with 8 additions and 0 deletions

View File

@ -57,6 +57,10 @@ def block_to_light_client_header(block: SignedBeaconBlock) -> LightClientHeader:
)
execution_branch = compute_merkle_proof_for_block_body(block.message.body, EXECUTION_PAYLOAD_INDEX)
else:
# Note that during fork transitions, `finalized_header` may still point to earlier forks.
# While Bellatrix blocks also contain an `ExecutionPayload` (minus `withdrawals_root`),
# it was not included in the corresponding light client data. To ensure compatibility
# with legacy data going through `upgrade_lc_header_to_capella`, leave out execution data.
execution_header = ExecutionPayloadHeader()
execution_branch = [Bytes32() for _ in range(floorlog2(EXECUTION_PAYLOAD_INDEX))]

View File

@ -53,6 +53,10 @@ def block_to_light_client_header(block: SignedBeaconBlock) -> LightClientHeader:
execution_branch = compute_merkle_proof_for_block_body(block.message.body, EXECUTION_PAYLOAD_INDEX)
else:
# Note that during fork transitions, `finalized_header` may still point to earlier forks.
# While Bellatrix blocks also contain an `ExecutionPayload` (minus `withdrawals_root`),
# it was not included in the corresponding light client data. To ensure compatibility
# with legacy data going through `upgrade_lc_header_to_capella`, leave out execution data.
execution_header = ExecutionPayloadHeader()
execution_branch = [Bytes32() for _ in range(floorlog2(EXECUTION_PAYLOAD_INDEX))]