Make finality update cache for current period#36
Merged
Conversation
added 4 commits
February 8, 2026 12:00
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
f3b1b1b to
18c23e5
Compare
added 2 commits
February 9, 2026 13:16
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
added 2 commits
February 9, 2026 20:44
siburu
approved these changes
Feb 10, 2026
siburu
reviewed
Feb 10, 2026
| /// - Failure to fetch or deserialize the finality update. | ||
| /// - Delayed finality L1 blocks. | ||
| /// - If a valid and up-to-date finalized block is found, it returns the L1 block's hash and raw response. | ||
| /// - Fetches the light client update for the period corresponding to the finalized slot. |
Collaborator
There was a problem hiding this comment.
Suggested change
| /// - Fetches the light client update for the period corresponding to the finalized slot. | |
| /// - Fetches the light client update for the period corresponding to the signature slot. |
siburu
reviewed
Feb 10, 2026
Comment on lines
+113
to
+122
| #[derive(Debug, Clone, serde::Deserialize)] | ||
| pub struct LightClientUpdateResponse { | ||
| pub data: LightClientUpdate, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, serde::Deserialize)] | ||
| pub struct LightClientUpdate { | ||
| pub finalized_header: LightClientHeader, | ||
| pub sync_aggregate: SyncAggregate, | ||
| } |
Collaborator
There was a problem hiding this comment.
AI says these structs are dead code, right?
Collaborator
Author
There was a problem hiding this comment.
These type are used.
siburu
reviewed
Feb 10, 2026
| } | ||
|
|
||
| /// Computes the slot from a timestamp and genesis time. | ||
| /// Returns None if the timestamp is before genesis or not aligned to slot boundaries. |
Collaborator
There was a problem hiding this comment.
Even for non-aligned timestamp, this implementation returns Some.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds period-aware caching for finalized L1 data to ensure consistency between preimage-maker and relayer during sync committee
updates.
Background
The relayer's GetSyncCommitteesFromClaimedToLatest function needs to use the same light client update data that was cached at the time of
derivation. Without this, there's a race condition where:
Changes
/eth/v1/beacon/light_client/updates?start_period={period}&count=1
presets
API Response Change
GET /get_finalized_l1 now returns:
{
"raw_finality_update": {...},
"raw_light_client_update": {...},
"period": 1664
}
The relayer uses this period value as latestPeriod in GetSyncCommitteesFromClaimedToLatest and uses the cached raw_light_client_update as
the snapshot for that period.