fix(archiver): always advance L1-to-L2 messages syncpoint to current L1 block#22154
Open
spalladino wants to merge 1 commit intomerge-train/spartanfrom
Open
fix(archiver): always advance L1-to-L2 messages syncpoint to current L1 block#22154spalladino wants to merge 1 commit intomerge-train/spartanfrom
spalladino wants to merge 1 commit intomerge-train/spartanfrom
Conversation
…L1 block The messages syncpoint used to track the L1 block of the last downloaded message, causing unnecessary re-scans when no messages were sent for a long time. Now it always advances to currentL1BlockNumber, with the rolling hash check and rollback logic providing reorg protection. Also moves setInboxTreeInProgress to after message insertion to prevent concurrent reads from seeing a checkpoint as sealed before its messages are available, and fixes a pre-existing division by zero in metrics when a batch has no messages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2d4461c to
77c7876
Compare
ludamad
reviewed
Mar 31, 2026
| name = '', | ||
| maxRetries: number, | ||
| retryInterval = 1, | ||
| ) { |
Collaborator
There was a problem hiding this comment.
I'm surprised nothing else fit :)
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.
Motivation
The L1-to-L2 messages syncpoint tracked the L1 block of the last downloaded message. If no messages were sent for a long time, the syncpoint got stuck and the next non-empty sync iteration re-scanned old block ranges. The rolling hash check and rollback logic already handle L1 reorgs, making this conservative syncpoint advancement redundant.
Approach
The syncpoint now always advances to
currentL1BlockNumberon success. After downloading, local state is verified against L1; on mismatch the syncpoint rolls back and the operation retries (up to 3 times within the same L1 sync iteration).Extras
Method
setInboxTreeInProgresswas called before messages were downloaded, allowing concurrent RPC reads to see a checkpoint as sealed before its messages were available. Also,retrieveL1ToL2Messagewould scan a large block range, as opposed to just using the L1 sync data already stored in the archiver.Changes
handleL1ToL2Messagesto always advance the syncpoint on success, with rollback-and-retry on mismatch. MergedsetInboxTreeInProgressandsetMessageSynchedL1Blockinto a single atomicsetMessageSyncState. Re-throws unexpected (non-MessageStoreError) exceptions instead of swallowing them. Updated README to document the new sync logic.setMessageSyncState. Improvedfake_l1_stateto correctly filter messages by block number ingetStateand supportgetMessageSentEventByHash.InboxContract.getMessageSentEventByHashsignature to take(msgHash, l1BlockHash)instead of(hash, fromBlock, toBlock).retryTimesutility function (likeretryUntilbut with a retry count instead of a timeout).