Skip to content

🎉 feat: Add MerkleTree with proof length validation#264

Merged
roninjin10 merged 1 commit intomainfrom
fix/issue-111-merkle-proof
Jan 4, 2026
Merged

🎉 feat: Add MerkleTree with proof length validation#264
roninjin10 merged 1 commit intomainfrom
fix/issue-111-merkle-proof

Conversation

@roninjin10
Copy link
Contributor

Summary

Test plan

  • 25 tests for MerkleTree
  • Proof length validation tests
  • Edge cases covered

🤖 Generated with Claude Code

Fixes #111: MerkleTree proof verification now validates that proof.siblings.length === proof.treeDepth.

Changes:
- Create MerkleTree module with from(), getProof(), verify() functions
- verify() throws InvalidProofLengthError if proof length doesn't match expected tree depth
- Add Proof.verifyWithDepth() to Zig for depth-validated verification
- Comprehensive tests for proof length validation

For a balanced tree with n leaves, depth = ceil(log2(n)). A proof with incorrect length is rejected.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
dist Error Error Jan 4, 2026 8:14am
voltaire Error Error Jan 4, 2026 8:14am

Copy link
Contributor Author

@roninjin10 roninjin10 left a comment

Choose a reason for hiding this comment

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

Automated review summary for PR #264 — 🎉 feat: Add MerkleTree with proof length validation\n\nTouched areas: MerkleTree, Proof | Files changed: 8 (+829/-0)\n\n- Tests: yes\n- Types & API: yes\n- Docs: ensure behavior is documented where user-facing.\n- Performance: consider micro-allocations in tight loops.\n\nFocus points:\n - State hash fn and leaf ordering (sorted vs indexed).\n - Verify proof length matches depth; test invalid length/order.\n - Align with MerkleTree proofs; reject malformed nodes and lengths.\n\nOutcome: Comment-only review; no blocking issues spotted. Please consider the above suggestions.\n

@roninjin10 roninjin10 merged commit 6f4370f into main Jan 4, 2026
20 of 49 checks passed
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.

Bug: MerkleTree proof verification doesn't validate proof length

1 participant