Skip to main content

Module tree

Module tree 

Source
Expand description

Hash tiles: how the writer grows them, how a reader checks them, and the root both agree on.

The tree over size leaves is a right fold over its perfect subtrees, largest first (RFC 9162 splits at the largest power of two below the width). Those subtree roots are exactly the hashes of the partial tiles, so the frontier of a log is its partial tiles and nothing else, and a reader checks every partial tile at once by recomputing the root from them. A full tile is checked against the hash it folds to in the tile one level up.

Structs§

Frontier
The growing edge of a log: for each level, the hashes of its partial tile. Pushing a leaf fills level 0; a level that reaches 256 hashes becomes a full tile and contributes one hash to the level above.
TileHashReader
Reads the tiles a root or a proof needs, and no tile that has not been checked against the trusted root: the partial tiles together through the root they fold to, each full tile through its hash in the level above.

Functions§

decode_tile
The hashes of a tile’s bytes; refused unless 1 to 256 whole hashes.
encode_tile
The bytes of a tile: its hashes, concatenated.
split_point
The largest power of two strictly below width, where RFC 9162 divides a tree of that width.
tile_root
The root over a run of hashes that stand for perfect subtrees of equal size, folded with the RFC 9162 shape. Over 256 leaf hashes this is the hash the full tile contributes to the level above.

Type Aliases§

Hash
A hash as the tree stores it.