CommitmentTree (Anoma v0.25.0)

A simple commitment tree.

Currently stores all commitments forever, and stores the full tree in memory, pending future more sophisticated retention policies. Does not yet store any anchors itself for the same reason--this is a complex policy level decision.

Has a fixed depth.

Fiats that empty subtrees have a hash of 0 for simplicity.

Summary

Functions

Adds commitments to the commitment tree, and returns the new tree and the anchor. TODO handle the tree's filling up

Creates a new CommitmentTree struct.

Types

@type t() :: %CommitmentTree{
  root: CommitmentTree.Node.t(),
  size: integer(),
  spec: CommitmentTree.Spec.t(),
  table: term()
}

Functions

@spec add(t(), [binary()]) :: tuple()

Adds commitments to the commitment tree, and returns the new tree and the anchor. TODO handle the tree's filling up

Link to this function

init_storage(mnesia_table)

Link to this function

new(spec, table)

@spec new(CommitmentTree.Spec.t(), term()) :: t()

Creates a new CommitmentTree struct.

@spec prove(t(), integer()) :: CommitmentTree.Proof.t()