Implement sharded v2 inclusion proof composition#142
Implement sharded v2 inclusion proof composition#142jait91 merged 6 commits intoimplement-v2-tree-and-inclusion-proof-formatfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements the composition of inclusion proofs for sharded environments, transitioning from a path-joining approach to a native fragment-based composition. Key changes include updating the Block model to store ParentInclusionFragment, refactoring the Sparse Merkle Tree (SMT) to generate these fragments, and implementing ComposeInclusionCert to merge child and parent proofs. Additionally, the performance test suite was updated to perform full cryptographic verification of inclusion proofs. Feedback suggests refactoring duplicated shard verification logic into a shared utility and improving the robustness of the ParentInclusionFragment.Verify method by explicitly passing the expected key length.
…-format-v2-sharding # Conflicts: # internal/smt/thread_safe_smt_test.go
…o ParentInclusionFragment.Verify Extract shared MatchesShardPrefix into pkg/api and replace three duplicate implementations. Make ParentInclusionFragment.Verify take an explicit keyLength parameter instead of deriving it from shardID.BitLen().
MastaP
left a comment
There was a problem hiding this comment.
Seven inline comments below covering items 5, 7-12 from a thorough review. Items 1-4 (self-verify CPU cost on read path, v1-in-child-mode hard break, child-mode BlockNumber semantics change, ParentBlockNumber==0 overload) are more consequential and I'll raise those separately.
Item 6 (dead code, doesn't map to a diff hunk so no inline): smt.JoinPaths at internal/smt/smt.go:953 has no production caller left after this PR — the old child-mode path join in service.go was deleted. The only remaining reference is TestJoinPaths in smt_test.go:1384. Delete both the function and the test to reduce maintenance surface.
e78b85e
into
implement-v2-tree-and-inclusion-proof-format
No description provided.