generated from eigerco/beerus
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [x] Add poseidon version of the merkle tree - [x] Add proof computation - [x] Clean and add corresponding tests ## Pull Request type <!-- Please try to limit your pull request to one type; submit multiple pull requests if needed. --> Please check the type of change your PR introduces: - [ ] Bugfix - [x] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no API changes) - [ ] Build-related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior? <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> Issue Number: #169 Issue Number: #170 ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - A new implementation of the MerkleTree using poseidon hash method - Add a `compute_proof` method to the MerkleTreeTrait to generate a proof based on leaves and an index - Rename the previous merkle tree type from MerkleTree to MerkleTreeLegacy - Merkle tree tests refactoring to clarify tests and add tests according to the new feature ## Does this introduce a breaking change? - [x] Yes - [ ] No <!-- If this does introduce a breaking change, please describe the impact and migration path for existing applications below. --> Before the change you could just have: ```cairo use alexandria_data_structures::merkle_tree::MerkleTreeTrait; let mut merkle_tree = MerkleTreeTrait::new(); ``` Now you must specify which kind of merkle tree you want (the legacy version or the new one): ```cairo // The new version, using the poseidon hash method use alexandria_data_structures::merkle_tree::{MerkleTree, HashMethod, MerkleTreeTrait}; let hash_method = HashMethod::Poseidon(()); let mut merkle_tree = MerkleTreeTrait::new(hash_method); ``` ```cairo // The legacy version, using the pedersen hash method use alexandria_data_structures::merkle_tree::{MerkleTree, HashMethod, MerkleTreeTrait}; let hash_method = HashMethod::Poseidon(()); let mut merkle_tree = MerkleTreeTrait::new(hash_method); ``` ## Other information Work load: ~ 8 hours --------- Co-authored-by: LucasLvy <[email protected]> Co-authored-by: Lucas @ StarkWare <[email protected]>
- Loading branch information
1 parent
fa3f7e7
commit eb93e9b
Showing
3 changed files
with
330 additions
and
94 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.