Update sum-tree hashing to match the new spec#34
Merged
b3y0urs3lf merged 8 commits intomainfrom Nov 19, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the sum-tree hashing implementation to align with a new specification, simplifying the API and improving code maintainability.
Key Changes:
- Refactored
SparseMerkleSumTreeRootNodeto directly expose hash and value methods instead of returning aRootwrapper object - Simplified
SparseMerkleSumTreePathStepby removing the nestedBranchclass and flattening the structure with directdataandvaluefields - Updated hashing algorithm in
FinalizedNodeBranchto directly encode left/right hashes and counters instead of using an intermediate children hash
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| SparseMerkleSumTreeTest.java | Updated test assertions to use new simplified API methods (getValue(), getRootHash(), getData()) |
| TokenSplitBuilder.java | Updated to access root value and hash through new direct methods instead of nested object access |
| SplitMintReason.java | Simplified coin tree verification by accessing value directly; removed unused Branch import |
| MintTransactionReasonJson.java | Cleaned up unused imports related to removed serialization classes |
| SparseMerkleSumTreeRootNode.java | Major refactoring: replaced Root object with direct hash/value access, updated path generation logic to use flattened structure |
| SparseMerkleSumTreePathStepJson.java | Deleted - JSON serialization now handled by simpler structure |
| SparseMerkleSumTreePathStepBranchJson.java | Deleted - Branch class removed from API |
| SparseMerkleSumTreePathStep.java | Simplified by removing Branch inner class and using direct fields for data and value |
| SparseMerkleSumTreePath.java | Replaced Root field with direct DataHash; updated verification algorithm to work with new structure |
| FinalizedNodeBranch.java | Updated hashing to encode left/right branches directly instead of computing intermediate children hash |
| SparseMerkleTreeRootNode.java | Removed unused path field that was always set to the same value |
| UnicitySealHashMatchesWithRootHashRule.java | Reordered imports for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MastaP
reviewed
Nov 11, 2025
| return List.of( | ||
| new SparseMerkleSumTreePathStep(branch.getPath(), siblingBranch, | ||
| (FinalizedNodeBranch) branch)); | ||
| ArrayList<SparseMerkleSumTreePathStep> list = new ArrayList<>( |
Member
There was a problem hiding this comment.
Super minor neatpick, usually type definition is an interface or "var": List<SparseMerkleSumTreePathStep> list = new ArrayList<> or var list = new ArrayList<>. the latter is ok since target is java11
MastaP
approved these changes
Nov 13, 2025
This was referenced Nov 13, 2025
This was
linked to
issues
Nov 14, 2025
#35 Add isMinted and isStateSpent methods in transition client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.