feat(spice): support the near-indexer under decoupled execution#16010
feat(spice): support the near-indexer under decoupled execution#16010darioush wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enables the near-indexer to stream real execution data when running with SPICE (decoupled execution) by removing the SPICE short-circuit in streamer message construction. To support indexing under SPICE’s tx-only chunks, it also persists produced (outgoing) receipt bodies into DBCol::Receipts and adds corresponding GC + store-validator accounting to keep refcounts balanced. Test-loop indexer tests are re-enabled under SPICE, and a new GC test is added to cover the produced-receipt-body persist → GC lifecycle.
Changes:
- Remove the SPICE early-return in
build_streamer_messageso per-chunk indexing runs under SPICE. - Persist SPICE-produced outgoing receipt bodies into
DBCol::Receipts, and GC/decrement them in tandem withOutgoingReceiptscleanup, including store-validator refcount accounting. - Re-enable previously SPICE-ignored indexer tests and add a targeted GC test for outgoing receipt bodies under SPICE.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test-loop-tests/src/tests/processed_receipts_gc.rs | Adds SPICE-only test verifying produced receipt bodies are persisted and later GC’d with refcount validation. |
| test-loop-tests/src/tests/indexer.rs | Re-enables indexer tests under SPICE and adjusts height anchoring to use execution head where needed. |
| core/store/src/adapter/chain_store.rs | Adds ChainStoreUpdateAdapter::save_receipt to centralize receipt-body refcount persistence. |
| chain/indexer/src/streamer/mod.rs | Removes SPICE short-circuit so streamer messages include full per-chunk data under SPICE. |
| chain/client/src/spice/chunk_executor_actor/per_shard.rs | Persists SPICE-produced outgoing receipt bodies into DBCol::Receipts during chunk postprocessing. |
| chain/chain/src/store/mod.rs | Switches chain-path receipt persistence to call the new adapter helper. |
| chain/chain/src/store_validator/validate.rs | Adds SPICE-gated validation accounting for OutgoingReceipts → Receipts refcounts. |
| chain/chain/src/store_validator.rs | Hooks OutgoingReceipts into store validation and ensures validation order accounts for it before Receipts. |
| chain/chain/src/garbage_collection.rs | Adds SPICE-gated GC decrement for produced outgoing receipt bodies prior to deleting OutgoingReceipts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #16010 +/- ##
==========================================
+ Coverage 72.66% 73.06% +0.39%
==========================================
Files 952 856 -96
Lines 205109 186724 -18385
Branches 205109 186724 -18385
==========================================
- Hits 149048 136428 -12620
+ Misses 51075 45944 -5131
+ Partials 4986 4352 -634
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Makes the near-indexer stream real data under spice (decoupled execution) instead of empty per-shard shells, and fills the receipt-persistence gap that surfaced once it did.
build_streamer_messageno longer short-circuits under spice; the existing per-chunk loop runs unchanged. Under spice the view client already resolvesFinality::Noneto the first executed ancestor, so the streamer only ever builds messages for already-executed blocks.DBCol::Receipts, leavingget_receiptreturningNonefor incoming receipts (e.g. gas refunds) that the indexer needs. The spice chunk executor now persists produced-receipt bodies by id, with a matching GC decrement (gc_spice_outgoing_receipt_bodies) and store-validator accounting so theDBCol::Receiptsrefcount stays balanced. All three legs are spice-gated per block; the non-spice path is unchanged.test_indexer_*tests (three now anchor on the execution head rather than the consensushead()), and addstest_spice_outgoing_receipt_bodies_gccovering persist → GC withvalidate_storeon both sides.