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>
github-merge-queue bot pushed a commit that referenced this pull request Mar 16, 2026
BEGIN_COMMIT_OVERRIDE
feat: add ETHEREUM_HTTP_TIMEOUT_MS env var for viem HTTP transport
(#20919)
fix(archiver): filter tagged log queries by block number (#21388)
fix(node): handle slot zero in getL2ToL1Messages (#21386)
feat(sequencer): redistribute checkpoint budget evenly across remaining
blocks (#21378)
fix: fall back to package.json for CLI version detection (#21382)
chore: Removed multiplier config (#21412)
chore: Removed default snapshot url config (#21413)
chore: Read tx filestores from network config (#21416)
fix(node): check world state against requested block hash (#21385)
feat(p2p): use l2 priority fee only for tx priority (#21420)
feat(p2p): reject and evict txs with insufficient max fee per gas
(#21281)
revert "feat(p2p): reject and evict txs with insufficient max fee per
gas (#21281)" (#21432)
chore: Reduce log spam (#21436)
fix(tx): reject txs with invalid setup when unprotecting (#21224)
fix: orchestrator enqueue yield (#21286)
chore(builder): check archive tree next leaf index during block building
(#21457)
fix: scenario deployment (#21428)
chore: add claude skill to read network-logs (#21495)
chore: update claude network-logs skill (#21523)
feat(rpc): add package version to RPC response headers (#21526)
chore(prover): silence "epoch to prove" debug logs (#21527)
chore(sequencer): do not log blob data (#21530)
fix: dependabot alerts (#21531)
docs(p2p): nicer READMEs (#21456)
fix(archiver): guard getL1ToL2Messages against incomplete message sync
(#21494)
fix(sequencer): await syncing proposed block to archiver (#21554)
feat(ethereum): check VK tree root and protocol contracts hash in rollup
compatibility (#21537)
fix: marking peer as dumb on failed responses (#21316)
fix(kv-store): make LMDB clear and drop operations atomic across
sub-databases (#21539)
feat(world-state): add blockHash verification to syncImmediate (#21556)
chore(monitor): print out l2 fees components (#21559)
chore: rm faucet (#21538)
chore: remove old merkle trees (#21577)
feat: Implement commit all and revert all for world state checkpoints
(#21532)
chore: skip flaky browser acir tests in CI (#21596)
fix: Better detection for epoch prune (#21478)
chore: logging (#21604)
fix: Don't update state if we failed to execute sufficient transactions
(#21443)
END_COMMIT_OVERRIDE
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