From 762d50864d755e486eb3dab36cbca57eeee03cbc Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Mon, 16 Mar 2026 10:34:49 -0300 Subject: [PATCH] fix(archiver): update finalized block lookback to account for checkpoints Co-Authored-By: Claude Opus 4.6 (1M context) --- yarn-project/archiver/src/store/block_store.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn-project/archiver/src/store/block_store.ts b/yarn-project/archiver/src/store/block_store.ts index 9b2ee842f095..7da20b7cedeb 100644 --- a/yarn-project/archiver/src/store/block_store.ts +++ b/yarn-project/archiver/src/store/block_store.ts @@ -130,14 +130,14 @@ export class BlockStore { /** * Computes the finalized block number based on the proven block number. - * A block is considered finalized when it's 2 epochs behind the proven block. + * We approximate finalization as 2 epochs worth of checkpoints behind the proven block. + * Each checkpoint is assumed to contain 4 blocks, so the lookback is epochDuration * 2 * 4 blocks. * TODO(#13569): Compute proper finalized block number based on L1 finalized block. - * TODO(palla/mbps): Even the provisional computation is wrong, since it should subtract checkpoints, not blocks * @returns The finalized block number. */ async getFinalizedL2BlockNumber(): Promise { const provenBlockNumber = await this.getProvenBlockNumber(); - return BlockNumber(Math.max(provenBlockNumber - this.l1Constants.epochDuration * 2, 0)); + return BlockNumber(Math.max(provenBlockNumber - this.l1Constants.epochDuration * 2 * 4, 0)); } /**