fix(node): check world state against requested block hash#21385
Merged
spalladino merged 2 commits intomerge-train/spartanfrom Mar 12, 2026
Merged
fix(node): check world state against requested block hash#21385spalladino merged 2 commits intomerge-train/spartanfrom
spalladino merged 2 commits intomerge-train/spartanfrom
Conversation
When requesting world state at a given block hash, double check that the returned world state is actually at that same block hash. Also check that world state is synced to the requested block if using block hash.
PhilWindle
approved these changes
Mar 12, 2026
…check-world-state
Collaborator
|
❌ Failed to cherry-pick to |
AztecBot
pushed a commit
that referenced
this pull request
Mar 12, 2026
AztecBot
pushed a commit
that referenced
this pull request
Mar 12, 2026
spalladino
added a commit
that referenced
this pull request
Mar 12, 2026
…21385) (#21421) ## Summary Backport of #21385 to `v4-next`. When requesting world state at a given block hash, double check that the returned world state is actually at that same block hash. Also check that world state is synced to the requested block if using block hash. ## Changes - Changed `#getWorldState` from private to `protected getWorldState` so it can be tested via subclass - Added block hash verification: after getting a snapshot by block number, verify the archive tree has the expected block hash - Added sync range check for block hash lookups (not just block number) - Added comprehensive tests for `getWorldState` and `findLeavesIndexes` ## Conflict resolution - Import conflict in test file: v4-next didn't have `CheckpointedL2Block` or `L1PublishedData` imports (used on `next` but not needed here). Resolved by importing only `BlockHash`, `BlockParameter`, `L2Block`, and `L2BlockSource`. - Test block conflict: v4-next didn't have the `findLeavesIndexes` or `getWorldState` test sections. Both were added from the incoming cherry-pick. ClaudeBox log: https://claudebox.work/s/fb04bb3ea475c9c5?run=1 --------- Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com>
ludamad
pushed a commit
that referenced
this pull request
Mar 12, 2026
…21385) (#21421) Backport of #21385 to `v4-next`. When requesting world state at a given block hash, double check that the returned world state is actually at that same block hash. Also check that world state is synced to the requested block if using block hash. - Changed `#getWorldState` from private to `protected getWorldState` so it can be tested via subclass - Added block hash verification: after getting a snapshot by block number, verify the archive tree has the expected block hash - Added sync range check for block hash lookups (not just block number) - Added comprehensive tests for `getWorldState` and `findLeavesIndexes` - Import conflict in test file: v4-next didn't have `CheckpointedL2Block` or `L1PublishedData` imports (used on `next` but not needed here). Resolved by importing only `BlockHash`, `BlockParameter`, `L2Block`, and `L2BlockSource`. - Test block conflict: v4-next didn't have the `findLeavesIndexes` or `getWorldState` test sections. Both were added from the incoming cherry-pick. ClaudeBox log: https://claudebox.work/s/fb04bb3ea475c9c5?run=1 --------- Co-authored-by: Santiago Palladino <santiago@aztecprotocol.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.
When requesting world state at a given block hash, double check that the returned world state is actually at that same block hash. Also check that world state is synced to the requested block if using block hash.