Commit Graph

7 Commits

Author SHA1 Message Date
Etan Kissling 5c64a2047a
Add `LightClientHeader` wrapper
In Altair, light client sync protocol exchanges `BeaconBlockHeader`
structures for tracking current progress. Wrapping `BeaconBlockHeader`
inside a `LightClientHeader` allows future extensions of this header,
e.g., to also track `ExecutionPayloadHeader`.

Note: This changes the JSON REST format by adding a `beacon` nesting.
For SSZ, the serialization format stays same (but overall root changes).
2023-01-05 13:36:04 +01:00
Etan Kissling ef2a8b319d
Avoid line continuation syntax 2022-12-13 12:30:14 +01:00
Etan Kissling 8bf801ecc6
Add `block_to_light_client_header` helper
Introduce `block_to_light_client_header` helper function to enable
future forks to override it with additional info (e.g., execution),
without having to change the general light client logic.

Likewise, update existing light client data creation flow to use
`block_to_light_client_header` and default-initialize empty fields.

Furthermore, generalize `create_update` helper to streamline test code
using `block_to_light_client_header`.

Note: In Altair spec, LC header is the same as `BeaconBlockHeader`.
however; future forks will extend it with more information.
2022-12-06 17:44:41 +01:00
Etan Kissling ff0e525ecc
Pass blocks to LC data creation functions
Future light client protocol extensions may include data from the block
in addition to data from the state, e.g., `ExecutionPayloadHeader`.
To prepare for this, also pass the block to the corresponding functions.
In practice, blocks access is easier than historic state access, meaning
there are no practical limitations due to this change.
2022-10-28 22:14:25 +02:00
Etan Kissling af54c97a6c
Consistently use `compute_sync_committee_period_at_slot`
A few LC functions were not yet updated to use a more concise function
for computing sync committee period for a slot. Updating to that func.
2022-10-27 21:36:55 +02:00
Etan Kissling 06d9fd8cd3
Add `LightClient(Finality|Optimistic)Update`
Introduces reduced `LightClientUpdate` structures to allow keeping track
of the latest `finalized_header` and `optimistic_header`. This may also
help in scheduling the next query for a full `LightClientUpdate` once
sync committee finality has been reached.
2022-07-20 13:14:58 +02:00
Etan Kissling 88206117c6
Extract full node specifics to separate doc 2022-07-15 13:37:27 +02:00