Skip to content

Implement sharded v2 inclusion proof composition#142

Merged
jait91 merged 6 commits intoimplement-v2-tree-and-inclusion-proof-formatfrom
tree-format-v2-sharding
Apr 17, 2026
Merged

Implement sharded v2 inclusion proof composition#142
jait91 merged 6 commits intoimplement-v2-tree-and-inclusion-proof-formatfrom
tree-format-v2-sharding

Conversation

@jait91
Copy link
Copy Markdown
Contributor

@jait91 jait91 commented Apr 14, 2026

No description provided.

@jait91 jait91 requested a review from MastaP April 14, 2026 20:35
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/signing/certification_request_validator.go Outdated
Comment thread pkg/api/types.go Outdated
jait91 added 3 commits April 15, 2026 01:15
…-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().
Copy link
Copy Markdown
Member

@MastaP MastaP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/models/block.go
Comment thread internal/smt/smt.go
Comment thread pkg/api/types.go Outdated
Comment thread internal/service/parent_service.go
Comment thread internal/signing/certification_request_validator.go Outdated
Comment thread internal/models/block.go Outdated
Comment thread cmd/performance-test/types.go Outdated
@jait91 jait91 requested a review from MastaP April 16, 2026 09:50
@jait91 jait91 merged commit e78b85e into implement-v2-tree-and-inclusion-proof-format Apr 17, 2026
2 checks passed
@jait91 jait91 deleted the tree-format-v2-sharding branch April 17, 2026 10:44
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.

2 participants