package tezos-protocol-alpha

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Parameters

module El : sig ... end

Signature

type t

The type of a Merkle list

type h = H.t

The type of a hash

type elt = El.t

The type of an element

type path

A path, together with an element's position, is the proof of inclusion of an element in the Merkle list.

val dummy_path : path

A dummy path that can be used as a placeholder when no path is actually required.

val nil : t

The empty Merkle list

val empty : h

The empty hash

val root : t -> h

root t returns the root hash of a Merkle list.

val snoc : t -> elt -> t

snoc t el adds element el to a Merkle list t and returns the new list.

val snoc_tr : t -> elt -> t

Tail recursive variant of snoc.

val of_list : elt list -> t

of_list elems returns the Merkle list constructed with elems.

val compute : elt list -> h

compute elems returns the root hash of the Merkle list constructed with elems.

Encoding of a path.

val bounded_path_encoding : ?max_length:int -> unit -> path Tezos_protocol_environment_alpha.Data_encoding.t

Encoding of a path, with optional bound max_length.

compute_path t pos computes the path of the element in position pos.

Can fail with Merkle_list_invalid_position if pos is negative or if it is greater than the number of elements in the list.

val check_path : path -> int -> elt -> h -> bool Tezos_protocol_environment_alpha.Error_monad.tzresult

check_path path pos elt expected_root checks that an elt with path path at position pos has the expected_root.

Can fail with Merkle_list_invalid_position if pos is negative or if it is greater than the number of elements in the list.

val path_depth : path -> int

path_depth path returns the depth of the tree path is related to.

OCaml

Innovation. Community. Security.