chore: Properly compute finalized block (#21156) (#21795)#21850
Merged
PhilWindle merged 1 commit intov4from Mar 20, 2026
Merged
chore: Properly compute finalized block (#21156) (#21795)#21850PhilWindle merged 1 commit intov4from
PhilWindle merged 1 commit intov4from
Conversation
Fixes [A-551](https://linear.app/aztec-labs/issue/A-551/properly-compute-finalized-block) Replaces the heuristic finalized block computation (`provenBlock - 2 * epochDuration`) with L1 finality. On each archiver sync iteration, we now: 1. Fetch the finalized L1 block via `getBlock({ blockTag: 'finalized' })` 2. Query the rollup contract for the proven checkpoint number at that L1 block 3. Persist that as the finalized checkpoint, from which the finalized L2 block number is derived Failures in this step are caught and logged as warnings so they don't disrupt the rest of the sync loop (e.g. if the RPC node can't serve state at the finalized block). - `RollupContract.getProvenCheckpointNumber` now accepts an optional `{ blockNumber }` to query historical contract state - `BlockStore` stores a `lastFinalizedCheckpoint` singleton and derives `getFinalizedL2BlockNumber` from it instead of the old arithmetic heuristic - `ArchiverL1Synchronizer` gains `updateFinalizedCheckpoint()`, called every sync iteration - `KVArchiverDataStore` constructor no longer takes `l1Constants` (the `epochDuration` it was used for is no longer needed) - `FakeL1State` updated to support `blockTag: 'finalized'` and `getProvenCheckpointNumber` with a block number, enabling new sync tests --------- Co-authored-by: AztecBot <tech@aztec-labs.com>
aminsammara
approved these changes
Mar 20, 2026
spalladino
added a commit
that referenced
this pull request
Mar 26, 2026
## Summary Merges v4 branch into backport-to-v4-next-staging to bring in 17 commits from v4 that were missing. Key changes from v4: - fix: verify accumulated pairing points in native ChonkVerifier (#21975) - chore: Properly compute finalized block (#21795, #21850) - feat(archiver): validate contract instance addresses before storing (#21787) - feat(p2p): add tx validator for contract instance deployment addresses (#21771) - Various accumulated backports and bug fixes ## Conflicts resolved 6 files had merge conflicts, all resolved: - `archiver/src/factory.ts` — kept `ContractClassPublicWithCommitment` type from staging - `archiver/src/modules/data_store_updater.ts` — merged imports from both branches - `archiver/src/store/kv_archiver_store.test.ts` — took v4's richer describe block structure, adapted to singular `addProposedBlock` API - `aztec-node/src/aztec-node/server.ts` — kept staging's block 0 check and `getWorldState` method name - `stdlib/src/tx/validator/error_texts.ts` — kept staging's contract class error constants - `world-state/src/synchronizer/server_world_state_synchronizer.ts` — kept verbose log level ## Test plan - CI should verify the merge compiles and tests pass - Once merged, this branch can be merged into the backport-to-v4-next branch ClaudeBox log: https://claudebox.work/s/0150633f06bfb379?run=1
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.
Fixes
A-551
Replaces the heuristic finalized block computation (
provenBlock - 2 * epochDuration) with L1 finality.On each archiver sync iteration, we now:
getBlock({ blockTag: 'finalized' })Failures in this step are caught and logged as warnings so they don't disrupt the rest of the sync loop (e.g. if the RPC node can't serve state at the finalized block).
RollupContract.getProvenCheckpointNumbernow accepts an optional{ blockNumber }to query historical contract stateBlockStorestores alastFinalizedCheckpointsingleton and derivesgetFinalizedL2BlockNumberfrom it instead of the old arithmetic heuristicArchiverL1SynchronizergainsupdateFinalizedCheckpoint(), called every sync iterationKVArchiverDataStoreconstructor no longer takesl1Constants(theepochDurationit was used for is no longer needed)FakeL1Stateupdated to supportblockTag: 'finalized'andgetProvenCheckpointNumberwith a block number, enabling new sync tests