package tezos-protocol-alpha
Parameters
module El : sig ... end
module H : Tezos_protocol_environment_alpha.S.HASH
Signature
type h = H.t
The type of a hash
type elt = El.t
The type of an element
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 pp_path : Tezos_protocol_environment_alpha.Format.formatter -> path -> unit
val nil : t
The empty Merkle list
val empty : h
The empty hash
compute elems
returns the root hash of the Merkle list constructed with elems
.
val path_encoding : path Tezos_protocol_environment_alpha.Data_encoding.t
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
.
val compute_path :
t ->
int ->
path Tezos_protocol_environment_alpha.Error_monad.tzresult
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.
val elt_bytes : elt -> Tezos_protocol_environment_alpha.Bytes.t