Repository navigation
fix(archiver): avoid loading full blocks during checkpoint ingestion - #25279
Closed
spalladino wants to merge 1 commit into
Closed
spalladino wants to merge 1 commit into
spalladino wants to merge 1 commit into
Conversation
This was referenced Aug 25, 2026
spalladino
force-pushed
the
spl/faster-block-ingestion
branch
from
August 25, 2026 21:13
1f1ba17 to
7ac21f1
Compare
Checkpoint ingestion validated chaining by fetching the previous checkpoint's last block as a full L2Block inside the write transaction, deserializing every tx effect for four header fields. Read the lightweight block data instead, and hoist the per-tx/per-block hash serialization out of the log indexing loop. Cuts per-checkpoint ingestion time by 49%/42% at 36/120 txs per block.
spalladino
force-pushed
the
spl/faster-block-ingestion
branch
from
August 26, 2026 19:09
7ac21f1 to
e68fc6b
Compare
Contributor
Author
|
Closing: this stack rotted after the repo split. The native read-only transaction support is being redone in aztec-packages (native-packages/kvdb), and the archiver/kv-store TS changes are being redone in aztec-node. |
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
Part of A-1817. Bottom to top, each PR targets the branch below it:
spl/faster-block-ingestion->merge-train/spartan-v5— cheaper checkpoint ingestion, so writes hold the store for less time <- this PRspl/kv-store-read-only-tx->spl/faster-block-ingestion— addsreadOnlyTransactionplustxIdon the nativeGET/START_CURSORspl/batched-kv-gets->spl/kv-store-read-only-tx— addsgetMany/getManyAsync; depends on feat(kv-store): expose read-only lmdb transactions #25280 fortxIdonGetRequestspl/faster-get-private-logs-by-tags->spl/batched-kv-gets— faster tag scans; depends on fix(archiver): batch multi-key point reads into one LMDB round trip #25282 forgetManyAsyncon the log store's per-block readsspl/log-store-read-only-snapshots->spl/faster-get-private-logs-by-tags— moves the log store's reads onto snapshots; depends on feat(kv-store): expose read-only lmdb transactions #25280 forreadOnlyTransactionContext
The archiver ingests each checkpoint inside a single
transactionAsync, so ingestion duration directly delays any read queued behind it (notablygetLogsByTags, see #25254). Profiling showed the single biggest cost was not the write itself:getPreviousCheckpointBlockfetched the previous checkpoint's last block as a fullL2Block— one sequential native LMDB round trip plus deserialization per tx effect — when its only consumer,validateCheckpointBlocks, reads four header-level fields.Approach
getPreviousCheckpointBlocknow reads the lightweight block data (asaddProposedBlockalready does) and returns just the chaining info (number,checkpointNumber,indexWithinCheckpoint,archive).L2Blocksatisfies the shape structurally, so the validation body, error types, and messages are unchanged.LogStore.addLogsserialized the sametxHashonce per log and the sameblockHashonce per log in the whole block; both are now serialized once per tx / once per block and passed toencodeValuepre-serialized. The stored byte format is unchanged.Measured A/B (per-checkpoint ingestion
addCheckpoints+addLogs, LMDB on NVMe, mean of 10 checkpoints after warmup, two runs each):