Crate penumbra_tct

source
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

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.
  • internalinternal
    The internal implementation of the tree, exposed here for documentation.
  • r1csr1cs
    This module defines how to verify TCT auth paths in a rank-1 constraint system.
  • 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§

  • Forgotteninternal
    A version tracking when a particular piece of the tree was explicitly forgotten.
  • 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 commitment to a note or swap.
  • A sparse merkle tree witnessing up to 65,536 epochs of up to 65,536 blocks of up to 65,536 [Commitment]s.

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?

Statics§

  • The domain separator used for leaves in the tree, and used as a base index for the domain separators of nodes in the tree (nodes get a domain separator of the form DOMAIN_SEPARATOR + HEIGHT).