Repository navigation
perf(archiver): avoid loading full blocks during checkpoint ingestion - #439
Draft
spalladino wants to merge 1 commit into
Draft
spalladino wants to merge 1 commit into
spalladino wants to merge 1 commit into
Conversation
The archiver ingests each checkpoint inside one write transaction, so ingestion time directly delays every read queued behind it. `getPreviousCheckpointBlock` loaded the previous checkpoint's last block as a full `L2Block` (one store round trip and a deserialization per tx effect), although `validateCheckpointBlocks` only needs its number, checkpoint number, index within the checkpoint and archive. It now reads the lightweight block data instead. `LogStore.addLogs` also serialized the same tx hash once per log and the same block hash once per log in the block. Both are now serialized once and passed to `encodeValue` pre-serialized; the stored byte format is unchanged.
This was referenced Oct 9, 2026
This branch has not been deployed
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.
Stack
Bottom to top, each PR targets the branch below it:
Context
Part of A-1817. Redoes AztecProtocol/aztec-packages#25279 (closed after the repo split).
The archiver ingests each checkpoint inside one
transactionAsync, so ingestion time directly delays any read queued behind it, notablygetLogsByTags. The biggest cost wasgetPreviousCheckpointBlockloading the previous checkpoint's last block as a fullL2Block(one native round trip and deserialization per tx effect) when validation only reads four header-level fields.Approach
getPreviousCheckpointBlockreads the lightweight block data and returns only the chaining info (number,checkpointNumber,indexWithinCheckpoint,archive).L2Blocksatisfies that shape, so validation is unchanged.LogStore.addLogsserializestxHashonce per tx andblockHashonce per block and passes them pre-serialized to the codec. The stored byte format is unchanged.The original PR measured per-checkpoint ingestion dropping ~42-49% (36 txs/block: ~82 → ~42ms; 120 txs/block: ~246 → ~142ms).