* merkle: add parent() helper function on NodeIndex
* smt: add pairs_to_leaf() to trait
* smt: add sorted_pairs_to_leaves() and test for it
* smt: implement single subtree-8 hashing, w/ benchmarks & tests
This will be composed into depth-8-subtree-based computation of entire
sparse Merkle trees.
* merkle: add a benchmark for constructing 256-balanced trees
This is intended for comparison with the benchmarks from the previous
commit. This benchmark represents the theoretical perfect-efficiency
performance we could possibly (but impractically) get for computing
depth-8 sparse Merkle subtrees.
* smt: test that SparseMerkleTree::build_subtree() is composable
* smt: test that subtree logic can correctly construct an entire tree
This commit ensures that `SparseMerkleTree::build_subtree()` can
correctly compose into building an entire sparse Merkle tree, without
yet getting into potential complications concurrency introduces.
* smt: implement test for basic parallelized subtree computation w/ rayon
Building on the previous commit, this commit implements a test proving
that `SparseMerkleTree::build_subtree()` can be composed into itself not
just concurrently, but in parallel, without issue.
* smt: add from_raw_parts() to trait interface
This commit adds a new required method to the SparseMerkleTree trait,
to allow generic construction from pre-computed parts.
This will be used to add a generic version of `with_entries()` in a
later commit.
* smt: add parallel constructors to Smt and SimpleSmt
What the previous few commits have been leading up to: SparseMerkleTree
now has a function to construct the tree from existing data in parallel.
This is significantly faster than the singlethreaded equivalent.
Benchmarks incoming!
---------
Co-authored-by: krushimir <krushimir@reilabs.co>
Co-authored-by: krushimir <kresimir.grofelnik@reilabs.io>
Prior to this commit, MerkleStore allowed the creation of Sparse Merkle
tree only with the maximum depth of 63. However, this doesn't fit the
Tiered Sparse Merkle tree requirements, as it will contain trees of
depth 16.
This commit adds the `depth` argument to the MerkleStore methods that
will create Sparse Merkle trees.
Prior to this commit, there was an internal procedure with the merkle
trees to compute empty sub-tree for arbitrary depths.
However, this isn't ideal as this code can be reused in any merkle
implementation that uses RPO as backend.
This commit introduces a structure that will generate these empty
subtrees values.
This commit moves the previous implementation of `SparseMerkleTree` from
miden-core to this crate.
It also include a couple of new tests, a bench suite, and a couple of
minor fixes. The original API was preserved to maintain compatibility
with `AdviceTape`.
closes#21