Functional storage using Merkle Patricia tree
Module type
Class type
Library plebeia
type t = Node_type.t

Merkle proof tree. Hash only nodes are expressed by Hash

val pp : Stdlib.Format.formatter -> t -> unit
val snapshot : Context.t -> t -> Snapshot.t

snapshot ctxt tree builds the snapshot of proof tree tree. Disk nodes in tree are loaded from the context ctxt while snapshooting.

val encoding : Context.t -> t Data_encoding.t

The encoding of the proof tree. The context is used to load Disk nodes and hash calculation.

val make : Context.t -> Node_type.t -> Path.t list -> t * (Path.t * Node_type.t option) list

make ctxt n paths returns the Merkle proof tree of paths of node n under context ctxt and the nodes found (or not found) at paths.

The proof tree may contain Disk nodes which require ctxt to be loaded. To export the proof out of the context, use snapshot or encoding to load all the nodes.

  • n must point to a Bud, otherwise the function fails with Invalid_argument.
val compute_hash : Hash.Hasher.t -> t -> Hash.t * t

Returns the hashed proof tree and its top hash.

The proof tree must be Disk free, otherwise the function fails.

val check : t -> Path.t list -> (Path.t * Node_type.t option) list

check paths tree finds paths in the proof tree tree.