You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement Merkle tree type in Symbolic, borrowing ideas from the already implemented List and Hash data types.
Define MerkleTree d x type to represent the tree of depth d (i.e., with $2^d$ leafs)
Define MerkleTreePath d x type (a wrapper around Vector d (Bool (Context x)) or similar) to represent the path to a particular leaf in a tree.
Define the following functions, filling in the appropriate type constraints:
--| Finds an element satisfying the constraintfind:: (x->Bool (Contextx)) ->MerkleTreedx->Maybe (Contextx) x--| Finds a path to an element satisfying the constraintfindPath:: (x->Bool (Contextx)) ->MerkleTreedx->Maybe (Contextx) (MerkleTreePathdx)
--| Returns the element corresponding to a pathlookup::MerkleTreedx->MerkleTreePathdx->x--| Inserts an element at a specified position in a treeinsert::MerkleTreedx->MerkleTreePathdx->x->MerkleTreedx--| Replaces an element satisfying the constraint. A composition of `findPath` and `insert`replace:: (x->Bool (Contextx)) ->MerkleTreedx->x->MerkleTreedx--| Returns the next path in a treeincrementPath::MerkleTreePathdx->MerkleTreePathdx
Add tests to verify (among other things) the circuit efficiency of those operations and their compositions. For example, a composition of findPath and lookup should only do d hashes in-circuit (instead of naive 2*d) since we verify the same path from the leaf to the root.
The text was updated successfully, but these errors were encountered:
Implement Merkle tree type in Symbolic, borrowing ideas from the already implemented
List
andHash
data types.MerkleTree d x
type to represent the tree of depthd
(i.e., withMerkleTreePath d x
type (a wrapper aroundVector d (Bool (Context x))
or similar) to represent the path to a particular leaf in a tree.findPath
andlookup
should only dod
hashes in-circuit (instead of naive2*d
) since we verify the same path from the leaf to the root.The text was updated successfully, but these errors were encountered: