Skip to content

feat(spice): per-block batch light-client variant (experiment)#15968

Draft
darioush wants to merge 7 commits into
near:masterfrom
darioush:darioush/spice-lc-fanout
Draft

feat(spice): per-block batch light-client variant (experiment)#15968
darioush wants to merge 7 commits into
near:masterfrom
darioush:darioush/spice-lc-fanout

Conversation

@darioush

Copy link
Copy Markdown
Contributor

Experimental per-block "batch" (fan-out) variant of the SPICE light-client execution anchor, built head-to-head against the shipped global-accumulator stack (#15962#15967) to settle whether global was the right call. Based on PR3 (darioush/spice-lc-roots-reader-3), so this diff is the fan-out divergence only and lines up against global's PR4–6.

Instead of one growing fork-safe accumulator anchored at the head, each block commits a small Merkle root (reusing the existing certified_block_merkle_root field) over only the blocks it newly certifies. A proof anchors on the certifying block C via a flat H -> C lookup (the single new CertifiedByBlock column), then anchors C into the head's block_merkle_root with today's consensus block proof. Validation is self-contained: recompute the batch root from the block's own statements and compare, with the index re-pointed to follow the canonical chain on reorg.

Trade vs global: ~31% less production code across 4 fewer files, one DB column instead of three and no new persisted borsh types, at the cost of a permanent 6-field proof (vs 4) and a verification asymmetry (the merklize batch hop hashes its leaf). The comparison writeup recommends keeping global, since the proof cost is paid forever and is consensus-facing while the production-state complexity is paid once behind an internal interface.

Experiment only; not intended to merge.

@darioush darioush changed the base branch from darioush/spice-lc-roots-reader-3 to master June 24, 2026 03:23
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.82524% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.52%. Comparing base (ae46722) to head (db58834).

Files with missing lines Patch % Lines
chain/chain/src/spice/core.rs 83.44% 8 Missing and 17 partials ⚠️
chain/chain/src/chain.rs 64.86% 6 Missing and 7 partials ⚠️
chain/client/src/view_client_actor.rs 81.69% 5 Missing and 8 partials ⚠️
core/store/src/merkle_proof.rs 89.83% 3 Missing and 3 partials ⚠️
core/primitives/src/test_utils.rs 73.33% 4 Missing ⚠️
chain/chain/src/store/mod.rs 90.62% 1 Missing and 2 partials ⚠️
chain/chain/src/chain_update.rs 75.00% 1 Missing and 1 partial ⚠️
chain/client/src/client.rs 75.00% 0 Missing and 2 partials ⚠️
chain/jsonrpc/src/lib.rs 50.00% 2 Missing ⚠️
core/primitives/src/block_header.rs 95.65% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15968      +/-   ##
==========================================
+ Coverage   72.49%   72.52%   +0.02%     
==========================================
  Files         946      946              
  Lines      204277   204704     +427     
  Branches   204277   204704     +427     
==========================================
+ Hits       148094   148461     +367     
- Misses      51215    51240      +25     
- Partials     4968     5003      +35     
Flag Coverage Δ
pytests-nightly 1.10% <0.00%> (-0.01%) ⬇️
unittests 69.34% <25.93%> (-0.13%) ⬇️
unittests-nightly 69.32% <25.93%> (-0.13%) ⬇️
unittests-spice 66.93% <83.26%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant