-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces the `SparseMerkleTree` and `TreeStorage`. The sparse merkle tree is a concrete structure that will provide the functionalities of a keyed naive SMT with inclusion proof. It introduces the `MerklePath` structure to fully encapsulate a merkle opening verification - however, it can be just converted into a vector of digests so it will be compatible with the opening prior to this commit. It also introduces the tree storage trait, a backend definition that will be the responsible to manage the state of a tree. This brings the advantage of decoupling the implementation logic of the merkle tree with its backend requirements, and will use `alloc::borrow::Cow` instead of either references or owned values to give further flexibility to the storage. Some storages will lock its own state to fetch a value, and they might provide values to multi-threaded applications - hence, extending the lock might not be desirable for fetched values. In such cases, the storage will have the option to return the value as owned, freeing it from its lifetime bound. There is a memory storage added that will provide in-memory tree storage, backed by `BTreeMap`. closes #21
- Loading branch information
Showing
8 changed files
with
703 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
use super::{Felt, FieldElement, StarkField, ONE, ZERO}; | ||
use winter_crypto::{Digest, ElementHasher, Hasher}; | ||
use super::{Digest, ElementHasher, Felt, FieldElement, Hasher, StarkField, ONE, ZERO}; | ||
|
||
pub mod blake; | ||
pub mod rpo; |
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
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.