fix(artifacts): unify Merkle odd-node level advancement and explicit sibling indexing - #180
rishiiicreates wants to merge 1 commit into
Conversation
…icit sibling index calculation - introduce _next_merkle_level() helper shared by merkle_root_from_leaf_hashes and generate_merkle_proof - replace fragile XOR (index ^ 1) and in-place list mutation with explicit parity check and bounds guard - add unit tests covering odd/even levels, exhaustive chunk counts (1..16), corruption rejection, and malformed proof handling Closes AOSSIE-Org#45
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughMerkle root construction and proof generation now use a shared helper to advance tree levels. Tests cover odd-level pairing, input-list immutability, proof verification, malformed proofs, and invalid chunk indices. ChangesMerkle tree construction and proofs
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The Merkle changes have no identified issue that needs resolution before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Link your account with GitcordThanks for opening this PR, @rishiiicreates! To receive Discord notifications and contributor tracking for this organization:
Once linked, Gitcord can notify you about reviews, merges, and more. — Posted by Gitcord |
addresses #45
unifies odd-node level advancement and sibling index calculation between
merkle_root_from_leaf_hashes()andgenerate_merkle_proof():_next_merkle_level()helper that handles odd-count node duplication without mutating the input level list in-placeindex ^ 1XOR ingenerate_merkle_proof()with explicit parity check and bounds guarding:tests/test_artifacts.pywith unit tests covering:_next_merkle_level()parity behavior on even and odd liststested locally with
pytest tests/test_artifacts.py(7/7 passed), pythonreproducibility.pyfalsifiability suite (all 5 scenarios passed), andchain.pytrain/audit smoke.Summary by CodeRabbit
Bug Fixes
Tests