Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions yarn-project/archiver/src/store/block_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<BlockNumber> {
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));
}

/**
Expand Down
Loading