L-05: add batchTimestamp <= lastL2BlockTimestamp check#2120
Open
valera-grinenko-ai wants to merge 2 commits intomatter-labs:draft-v31from
Open
L-05: add batchTimestamp <= lastL2BlockTimestamp check#2120valera-grinenko-ai wants to merge 2 commits intomatter-labs:draft-v31from
valera-grinenko-ai wants to merge 2 commits intomatter-labs:draft-v31from
Conversation
The comment states all L2 blocks have timestamps in [batchTimestamp, lastL2BlockTimestamp], implying batchTimestamp <= lastL2BlockTimestamp. This invariant was not explicitly validated, allowing malformed batches to pass. Add the missing consistency check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
StanislavBreadless
approved these changes
Apr 8, 2026
Collaborator
StanislavBreadless
left a comment
There was a problem hiding this comment.
LGTM, but maybe we should add the same check for zksync os if there is no other fix PR that does it:
_newBatch.firstBlockTimestamp,
_newBatch.lastBlockTimestamp,
The old commit path (_verifyBatchTimestamp) already checks batchTimestamp <= lastL2BlockTimestamp. The ZKsync OS path (_commitOneBatchZKsyncOS) validates firstBlockTimestamp not too old and lastBlockTimestamp not too big, but never compares them against each other. Add the same ordering check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
batchTimestamp <= lastL2BlockTimestampinCommitter._verifyBatchTimestamp(old commit path)firstBlockTimestamp <= lastBlockTimestampcheck in_commitOneBatchZKsyncOS(ZKsync OS commit path), which had the identical gapTest plan
forge buildpassesbatchTimestamp > lastL2BlockTimestampare rejected (old path)firstBlockTimestamp > lastBlockTimestampare rejected (ZKsync OS path)🤖 Generated with Claude Code