Trait noble_mmr::Config[][src]

This noble’s configuration trait

Associated Types

type Hashing: Hash<Output = Self::Hash>[src]

A hasher type for MMR.

To construct trie nodes that result in merging (bagging) two peaks, depending on the node kind we take either:

  • The node (hash) itself if it’s an inner node.
  • The hash of SCALE-encoding of the leaf data if it’s a leaf node.

Then we create a tuple of these two hashes, SCALE-encode it (concatenate) and hash, to obtain a new MMR inner node - the new peak.

type Hash: Member + MaybeSerializeDeserialize + Debug + Hash + AsRef<[u8]> + AsMut<[u8]> + Copy + Default + Codec + EncodeLike[src]

The hashing output type.

This type is actually going to be stored in the MMR. Required to be provided again, to satisfy trait bounds for storage items.

type LeafData: LeafDataProvider[src]

Data stored in the leaf nodes.

The LeafData is responsible for returning the entire leaf data that will be inserted to the MMR. LeafDataProviders can be composed into tuples to put multiple elements into the tree. In such a case it might be worth using primitives::Compact to make MMR proof for one element of the tuple leaner.

Note that the leaf at each block MUST be unique. You may want to include a block hash or block number as an easiest way to ensure that.

type OnNewRoot: OnNewRoot<Self::Hash>[src]

A hook to act on the new MMR root.

For some applications it might be beneficial to make the MMR root available externally apart from having it in the storage. For instance you might output it in the header digest (see [fabric_system::Module::deposit_log]) to make it available for Light Clients. Hook complexity should be O(1).

type WeightInfo: WeightInfo[src]

Weights for this noble.

Loading content...

Associated Constants

const INDEXING_PREFIX: &'static [u8][src]

Prefix for elements stored in the Off-chain DB via Indexing API.

Each node of the MMR is inserted both on-chain and off-chain via Indexing API. The former does not store full leaf content, just it’s compact version (hash), and some of the inner mmr nodes might be pruned from on-chain storage. The later will contain all the entries in their full form.

Each node is stored in the Off-chain DB under key derived from the Self::INDEXING_PREFIX and it’s in-tree index (MMR position).

Loading content...

Implementors

Loading content...