-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of Parallel Merkle Tree #125
Conversation
…af nodes at prev layer was not normalized by upper_bound
…han building all and then calling based on feature
There is currently a change of semantics between the parallel and non-parallel version. Namely, if one of the hash functions (the leaf hash or the two to one hash) return
@mmagician @Pratyush what are your thoughts? |
Rather than duplicating the entire method for the |
@mmagician thanks for your feedback, I will address them and get back to you |
…cordingly unit tests
@mmagician I should have addressed your comments, feel free to get back with feedback :) |
I think it's fine to change the |
Description
This PR implements a Parallel Version of the Merkle Tree, completely transparent to the user, i.e. it defines two new versions of
MerkleTree::new(...)
andMerkleTree::new_with_leaf_digest(...)
which are compiled (in place of the legacy ones) when the "parallel" feature is enabled. The implementation can be found insrc/merkle_tree/mod.rs
. We have also included some benchmarks inbenches/merkle_tree.rs
.Using our implementation, for a Merkle Tree with
2^20
leaves, using SHA256, we obtain a speedup of 80% over legacy on a M1 MacBook.closes: #122
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Pending
section inCHANGELOG.md
Files changed
in the Github PR explorer