merkle_patricia_tree v0.2.5 MerklePatriciaTree.Trie.Verifier

Function to verify the structure of a trie meets the spec as defined in http://gavwood.com/Paper.pdf.

Link to this section Summary

Functions

Runs simple tests to verify a trie matches general specs

Link to this section Functions

Link to this function verify_trie(trie, dict)
verify_trie(MerklePatriciaTree.Trie.t, [{binary, binary}]) ::
  :ok |
  {:error, String.t}

Runs simple tests to verify a trie matches general specs.

We will check:

  1. Leafs have a non-empty value
  2. Leafs’ and branch’s value belong to a set of given values.
  3. Branches have at least two non-empty nodes.
  4. All sub-tries are valid.
  5. Ext’s prefixes aren’t blank.
  6. TODO: Ext’s can’t be extended.