-
Notifications
You must be signed in to change notification settings - Fork 961
Description
Description
Presently to create a sync committee message matching head requires the node to wait for the head block to be fully-imported. This is in contrast to attestations where we have the early_attester_cache to attest early before the block is completely written to disk.
Sync committee messages just use the /eth/v1/beacon/head/root API, so it is a bit hard to specialise an optimisation for this case, without affecting all users of the /root API.
One potential issues is if the /root endpoint returned a head block before it is fully imported, its results could be inconsistent with follow-up requests. E.g. user requests head/root and gets A, then requests A/blinded_block and gets a 404 because it isn't written to disk yet. Similarly if user requests head/blinded_block they might get the parent of A due to A not having been committed to the in-memory canonical_head variable, or to disk.
This issue is possibly not insurmountable, but it could be quite fiddly to do perfectly. Something that might help would be a unified and simplified block status table that is used by all endpoints:
On the other hand, maybe these consistency issues are not so bad. We could implement the proposed fix (using early_attester_cache or similar) and see what the fallout is amongst API consumers. The upside is that it will greatly improve Lighthouse's sync committee performance at epoch boundaries. Some users are failing their sync duty at almost all epoch boundaries.