Expand description

The tiered commitment tree for Penumbra.

Eternity┃           ╱╲ ◀───────────── Anchor
    Tree┃          ╱││╲               = Global Tree Root
        ┃         * ** *           ╮
        ┃      *   *  *   *        │ 8 levels
        ┃   *     *    *     *     ╯
        ┃  ╱╲    ╱╲    ╱╲    ╱╲
        ┃ ╱││╲  ╱││╲  ╱││╲  ╱││╲ ◀─── Global Tree Leaf
                        ▲             = Epoch Root
                     ┌──┘
                     │
                     │
   Epoch┃           ╱╲ ◀───────────── Epoch Root
    Tree┃          ╱││╲
        ┃         * ** *           ╮
        ┃      *   *  *   *        │ 8 levels
        ┃   *     *    *     *     ╯
        ┃  ╱╲    ╱╲    ╱╲    ╱╲
        ┃ ╱││╲  ╱││╲  ╱││╲  ╱││╲ ◀─── Epoch Leaf
                 ▲                    = Block Root
                 └───┐
                     │
                     │
   Block┃           ╱╲ ◀───────────── Block Root
    Tree┃          ╱││╲
        ┃         * ** *           ╮
        ┃      *   *  *   *        │ 8 levels
        ┃   *     *    *     *     ╯
        ┃  ╱╲    ╱╲    ╱╲    ╱╲
        ┃ ╱││╲  ╱││╲  ╱││╲  ╱││╲ ◀─── Block Leaf
                                      = Note Commitment

Re-exports

pub use internal::hash::Forgotten;

Modules

Builders for individual epochs and blocks: useful when constructing a Tree in parallel, but unnecessary in a single thread.

Errors that can occur when inserting into a Tree, deserializing Proofs, or checking internal invariants.

The internal implementation of the tree, exposed here for documentation.

Generation of random Commitments for testing.

Incremental serialization and non-incremental deserialization for the Tree.

A dynamic representation of nodes within the internal tree structure.

Validation checks to ensure that Trees are well-formed.

Structs

A commitment to the value of a note.

The index of a Commitment within a Tree.

A proof of the inclusion of some Commitment in a Tree with a particular Root.

The root hash of a Tree.

A sparse merkle tree witnessing up to 65,536 epochs of up to 65,536 blocks of up to 65,536 Commitments.

Enums

When inserting a [Commitment] into a [Tree], should we Keep it to allow it to be witnessed later, or Forget about it after updating the root hash of the tree?