Skip to content

fix(node): check world state against requested block hash#21385

Merged
spalladino merged 2 commits intomerge-train/spartanfrom
palla/check-world-state
Mar 12, 2026
Merged

fix(node): check world state against requested block hash#21385
spalladino merged 2 commits intomerge-train/spartanfrom
palla/check-world-state

Conversation

@spalladino
Copy link
Contributor

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.

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.
@spalladino spalladino added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure backport-to-v4-next labels Mar 11, 2026
@spalladino spalladino enabled auto-merge (squash) March 12, 2026 12:28
@spalladino spalladino merged commit 26e335d into merge-train/spartan Mar 12, 2026
10 checks passed
@spalladino spalladino deleted the palla/check-world-state branch March 12, 2026 12:34
@AztecBot
Copy link
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. (🤖) View backport run.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v4-next ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants