smt-circom 0.1.0

Sparse Merkle Tree, compatible with circom proofs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub use self::mem::MemStore;
#[cfg(feature = "rocksdb")]
pub use self::rocksdb::RocksStore;
use crate::Node;

mod mem;
#[cfg(feature = "rocksdb")]
mod rocksdb;

/// A store for SMT nodes.
pub trait NodeStore {
    type Error: core::fmt::Debug;

    fn get(&self, key: [u8; 32]) -> Result<Option<Node>, Self::Error>;
    fn put(&mut self, key: [u8; 32], node: [u8; 65]) -> Result<(), Self::Error>;
    fn get_root(&self) -> Result<[u8; 32], Self::Error>;
    fn set_root(&mut self, root: [u8; 32]) -> Result<(), Self::Error>;
}