Module penumbra_tct::internal::frontier

source ·
Available on crate feature internal only.
Expand description

Frontier things can be inserted into and updated, always representing the rightmost (most recently inserted) element of a tree.

In sketch: the structure of a single Tier contains eight Nodes, the bottom-most of which contains a Leaf. Alternatively, a tier can be a summarized Hash of what its contents would be, and contain nothing at all besides this hash.

At every level of a frontier::Tier, the rightmost child of a frontier::Node is a frontier::Node; all leftward siblings are complete::Nodes. When the child of a frontier::Node becomes entirely full (all its possible leaves are inserted), it is transformed into a complete::Node and appended to the list of complete siblings of its parent, thus shifting the frontier rightwards.

At any given time, the frontier is always fully materialized; no node within it is ever summarized as a hash. It is at the point when a frontier::Node becomes full and is then finalized into a complete::Node that it is pruned, if it contains no witnessed children.

At the tip of the frontier, however deeply nested (perhaps within multiple Tiers), there is a single Item, which is either a Commitment or a hash of one. Commitments can be inserted either with the intent to remember them, or with the intent to immediately forget them; this determines whether the Item is a commitment or merely its hash.

Structs§

  • The result of Frontier::insert_owned when the Frontier is full.
  • The hash of the most-recently-inserted item, stored at the tip of the frontier.
  • The frontier (rightmost) leaf in a frontier of a tree.
  • A frontier of a node in a tree, into which items can be inserted.
  • A frontier of a tier of the tiered commitment tree, being an 8-deep quad-tree of items.
  • The frontier of the top level of some part of the commitment tree, which may be empty, but may not be finalized or hashed.

Enums§

  • Either an item or just its hash, to be used when inserting into a tree.
  • The mutable-reference version of an Insert<T>, distinct from Insert<&mut T> because it also allows mutation of the contained hash.
  • Whether or not to track forgotten elements of the tree.

Traits§

  • A type which can be the focus of an Frontier tree: it can be finalized to make a Complete tree.
  • Forget about the authentication path to a given index.
  • A frontier of a tree supporting the insertion of new elements and the updating of the most-recently-inserted element.
  • Get the position of the next insertion into the tree.