#134 Use big endian bit ordering and byte array paths in smt#135
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the Sparse Merkle Tree (SMT) and Sparse Merkle Sum Tree (SMST) implementations to use spec-compliant big-endian key routing instead of LSB-first routing. It replaces bigint-based path routing with direct Uint8Array operations, introducing utility functions like commonPrefixLength, regionFromKey, and getBitAtDepth, while updating node classes, error handling, and tests accordingly. The review feedback focuses on performance optimizations, suggesting byte-by-byte comparisons in commonPrefixLength and using bitwise operators (>> 3 and & 7) instead of division and modulo operations in regionFromKey, getBitAtDepth, and InclusionCertificate.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
MastaP
left a comment
There was a problem hiding this comment.
Reviewed the branch — logic checks out (I also ran dense-random-tree round-trip checks for InclusionCertificate and SplitAllocationProof locally, all green). A few cleanups and test-coverage notes inline.
No description provided.