fix: toBlock argument in L1 getLogs is inclusive #10828
Merged
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.
As @alexghr identified, we got a spurious reorg on a node in the exp1 network. This was caused by the node getting a current
l1BlockNumber=245
, but then fetching an L2 block mined at 246.This caused the
canPrune
check to fail:The
canPruneAtTime
was evaluated at L1 block number 245, and it correctly returned true, since there had been a reorg shortly before (at 240), and no new L2 block had been mined so the rollup hadn't reset its state by then. However, thelocalPendingBlockNumber
was incorrectly increased due to the block mined at 246, which caused the archiver to incorrectly reorg it.This PR fixes the L1 event queries so the
toBlock
is inclusive. A quick test with cast shows that this is the case:And just for good measure, we also filter the logs returned by the block range searched.