As described in the latest dev update, persisting light-client data on disk and serving requests with a table lookup will be the best way to provide light client support in teku. It has the advantages of:
is_better_update
, given that light client updates can be compared and saved per sync-committee periodThis doc will briefly describe the interface and details of this table in teku.
Add two columns with type:
<Bytes32> --> LightClientBootstrap
LightClientBootstrap
associated with the blockCheckpoint
(initial slot of epoch, or the slot where all following slots through the initial slot of the next epoch are empty)<Uint64> --> LightClientUpdate
LightClientFinalityUpdate
: single field tracking the latest known (by slot) LightClientFinalityUpdate
LightClientOptimisticUpdate
: single field tracking the latest known (by slot) LightClientOptimisticUpdate
GET /eth/v1/beacon/light_client/bootstrap/{block_root}
LightClientBootstrap
by `BlockRootGET /eth/v1/beacon/light_client/updates?startPeriod=x&count=y
LightClientUpdate
by given sync committee period (both startPeriod
and for count
periods after startPeriod
)GET /eth/v1/beacon/light_client/finality_update
GET /eth/v1/beacon/light_client/optimistic_update
Upon applying a block:
LightClientBootstrap
: save in database with the block rootLightClientUpdate
: compute current sync committee period. Compare the update against the current known for the period according to is_better_update
. Save the best update for the period.LightClientFinalityUpdate
: save if the result has a higher slot than the current updateLightClientOptimisticUpdate
: save if the result has a higher slot than the current updateThe bulk of the data is stored in two new columns, keyed by block root and slot. Light client data is cheap to store, with the sparsity of Checkpoint
for LightClientBootstrap
and sync committee period for LightClientUpdate
. Data is populated upon block apply (e.g. during sync), and is only required to be kept for the block retention period. In practice this means nodes will have all light client data for each block seen during sync, and an archive node is not required. The light client spec permits nodes serving 404 for blocks not seen (e.g. due to checkpoint sync).