feat(checkpoint): read hot-archive entries so archived wasm hashes are stored - #694
Open
aditya1702 wants to merge 1 commit into
Open
feat(checkpoint): read hot-archive entries so archived wasm hashes are stored#694aditya1702 wants to merge 1 commit into
aditya1702 wants to merge 1 commit into
Conversation
…e stored PopulateFromCheckpoint reads only the live bucket list, so contract code and contract instances evicted under protocol-23 state archival never reached protocol_wasms/protocol_contracts. Archived SEP-41 contracts therefore stayed unclassified and their current state was never computed, producing wrong balances once those contracts were restored. Add a hot-archive pass (ingest.NewHotArchiveIterator) inside the same load transaction, before finalize: archived ContractCode joins wasmClassifications and archived wasm-executable contract instances land in contract_tokens and protocol_contracts. Archived balance entries and SAC instances are skipped; live ingestion recreates their rows on restore. Checkpoints predating protocol 23 (HAS version < 2) skip the pass instead of failing on the absent hot-archive bucket list. Classification needs no changes: stellar-rpc (protocol 23+) getLedgerEntries returns archived entries with bytecode, so the RPC-based setup pass resolves archived wasm hashes as-is.
aditya1702
force-pushed
the
checkpoint-hot-archive-wasms
branch
from
August 21, 2026 17:18
781ed46 to
16cc934
Compare
aditya1702
requested review from
aristidesstaffieri
and
a balanced review from Copilot
August 21, 2026 18:26
Contributor
There was a problem hiding this comment.
Pull request overview
Extends checkpoint restoration to preserve Soroban contracts and WASM hashes held in the protocol-23 hot archive.
Changes:
- Streams hot-archive entries during checkpoint loading.
- Persists archived WASM code and contract-instance mappings.
- Adds coverage for ingestion, skipping rules, legacy checkpoints, and iterator failures.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
internal/services/checkpoint.go |
Integrates hot-archive processing into checkpoint restoration. |
internal/services/checkpoint_test.go |
Tests archived-entry handling and error paths. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
TL;DR: checkpoint load now also reads the protocol-23 hot archive. Evicted wasm hashes and contract instances land in
protocol_wasms/protocol_contracts/contract_tokensinstead of vanishing.The bug
protocol_wasms.protocol_contracts.The fix
One new pass in the same load transaction, right before
finalize. It streamsingest.NewHotArchiveIterator.protocol_wasmscontract_tokens(UNKNOWN) +protocol_contractsmappingEntries restored before the checkpoint never appear: the SDK's hot-archive tombstones suppress them.
Why the code looks the way it does
WithFilter. A key filter breaks tombstone suppression and resurrects restored entries.Classification: zero changes needed
stellar-rpc (protocol 23+)
getLedgerEntriesreturns archived entries with bytecode (verified in v28 source,internal/ledgerentries/main.go). The existing RPC classify pass resolves archived hashes as-is.Testing
protocol_contractsmapping present (silently dropped before this PR).internal/servicessuite green.make checkgreen.No schema changes. No migrations (wallet-backend is pre-release).