Skip to main content

MerklizedState

Trait MerklizedState 

pub trait MerklizedState<Types, const ARITY: usize>:
    ForgetableMerkleTreeScheme<Commitment = Self::Commit>
    + Send
    + Sync
    + Clone
    + 'static
where Types: NodeType,
{ type Key: Index + Send + Sync + Serialize + ToTraversalPath<ARITY> + FromStr + DeserializeOwned + Display + CanonicalSerialize + CanonicalDeserialize; type Entry: Element + Send + Sync + Serialize + DeserializeOwned + CanonicalSerialize + CanonicalDeserialize; type T: NodeValue + Send; type Commit: MerkleCommitment<Self::T> + Send + for<'a> TryFrom<&'a TaggedBase64> + Display + Debug + Into<TaggedBase64>; type Digest: DigestAlgorithm<Self::Entry, Self::Key, Self::T>; // Required methods fn state_type() -> &'static str; fn header_state_commitment_field() -> &'static str; fn tree_height() -> usize; fn insert_path( &mut self, key: Self::Key, proof: &MerkleProof<Self::Entry, Self::Key, Self::T, ARITY>, ) -> Result<(), Error>; }
Expand description

This trait should be implemented by the MerkleTree that the API module is initialized for. It defines methods utilized by the module.

Required Associated Types§

type Key: Index + Send + Sync + Serialize + ToTraversalPath<ARITY> + FromStr + DeserializeOwned + Display + CanonicalSerialize + CanonicalDeserialize

type Entry: Element + Send + Sync + Serialize + DeserializeOwned + CanonicalSerialize + CanonicalDeserialize

type T: NodeValue + Send

type Commit: MerkleCommitment<Self::T> + Send + for<'a> TryFrom<&'a TaggedBase64> + Display + Debug + Into<TaggedBase64>

type Digest: DigestAlgorithm<Self::Entry, Self::Key, Self::T>

Required Methods§

fn state_type() -> &'static str

Retrieves the name of the state being queried.

fn header_state_commitment_field() -> &'static str

Retrieves the field in the header containing the Merkle tree commitment for the state implementing this trait.

fn tree_height() -> usize

Get the height of the tree

fn insert_path( &mut self, key: Self::Key, proof: &MerkleProof<Self::Entry, Self::Key, Self::T, ARITY>, ) -> Result<(), Error>

Insert a forgotten path into the tree.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl MerklizedState<MockTypes, 8> for MockMerkleTree

Source§

type Key = usize

Source§

type Entry = usize

Source§

type T = Sha3Node

Source§

type Commit = <UniversalMerkleTree<usize, Sha3Digest, usize, 8, Sha3Node> as MerkleTreeScheme>::Commitment

Source§

type Digest = Sha3Digest