Skip to content

feat(spice): certified accumulator ordinal index + inclusion proofs#15966

Draft
darioush wants to merge 1 commit into
darioush/spice-lc-commit-validate-4from
darioush/spice-lc-proofs-5
Draft

feat(spice): certified accumulator ordinal index + inclusion proofs#15966
darioush wants to merge 1 commit into
darioush/spice-lc-commit-validate-4from
darioush/spice-lc-proofs-5

Conversation

@darioush

Copy link
Copy Markdown
Contributor

Adds the canonical per-ordinal index over the certified accumulator and the light-client inclusion-proof generation anchored to it.

  • Two columns: CertifiedAccumulatorByOrdinal (ordinal -> frontier-before-leaf + leaf hash) and CertifiedBlockLeafOrdinal (block -> ordinal).
  • index_canonical_certified_leaves: re-points the ordinal index along the canonical chain only (from postprocess_block when the block is canonical, and from update_height's reorg walk), so orphaned forks can't pollute proofs.
  • compute_certified_block_proof (reusing the shared compute_merkle_path_by_ordinal helper) and Chain::spice_block_header_lite_and_proof.

Testing

  • test_certified_block_proof_unaffected_by_side_fork: a losing fork re-certifies a block with different roots; the canonical proof still verifies.
  • test_certified_block_proof_follows_reorg: a heavier fork wins and the ordinal index re-points; a proof against the new head verifies against the fork's root and differing leaf.

5/6 of the SPICE light-client stack (#15947). Base: #15965.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.15385% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.53%. Comparing base (bb0b522) to head (4824613).

Files with missing lines Patch % Lines
chain/chain/src/chain.rs 61.11% 0 Missing and 7 partials ⚠️
chain/chain/src/store/mod.rs 92.06% 2 Missing and 3 partials ⚠️
chain/chain/src/chain_update.rs 77.77% 1 Missing and 1 partial ⚠️
chain/chain/src/spice/certified_accumulator.rs 81.81% 1 Missing and 1 partial ⚠️
core/store/src/columns.rs 85.71% 2 Missing ⚠️
Additional details and impacted files
@@                           Coverage Diff                           @@
##           darioush/spice-lc-commit-validate-4   #15966      +/-   ##
=======================================================================
+ Coverage                                72.52%   72.53%   +0.01%     
=======================================================================
  Files                                      947      947              
  Lines                                   204612   204741     +129     
  Branches                                204612   204741     +129     
=======================================================================
+ Hits                                    148396   148518     +122     
+ Misses                                   51235    51229       -6     
- Partials                                  4981     4994      +13     
Flag Coverage Δ
pytests-nightly 1.10% <0.00%> (-0.01%) ⬇️
unittests 69.34% <1.69%> (-0.04%) ⬇️
unittests-nightly 69.32% <1.69%> (-0.04%) ⬇️
unittests-spice 66.92% <87.50%> (+0.01%) ⬆️

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