package octez-libs

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

Module Hashed.Operation_list_hashSource

Sourcetype elt

The element type elt of the Merkle tree.

Sourceval elt_bytes : elt -> Bytes.t

elt_bytes x returns the byte sequence representation of the element x.

Sourcetype t
Sourceval name : string
Sourceval title : string
Sourceval pp : Format.formatter -> t -> unit
Sourceval pp_short : Format.formatter -> t -> unit
include Tezos_stdlib.Compare.S with type t := t
Sourceval (=) : t -> t -> bool

x = y iff compare x y = 0

Sourceval (<>) : t -> t -> bool

x <> y iff compare x y <> 0

Sourceval (<) : t -> t -> bool

x < y iff compare x y < 0

Sourceval (<=) : t -> t -> bool

x <= y iff compare x y <= 0

Sourceval (>=) : t -> t -> bool

x >= y iff compare x y >= 0

Sourceval (>) : t -> t -> bool

x > y iff compare x y > 0

Sourceval compare : t -> t -> int

compare an alias for the functor parameter's compare function

Sourceval equal : t -> t -> bool

equal x y iff compare x y = 0

Sourceval max : t -> t -> t

max x y is x if x >= y otherwise it is y

Sourceval min : t -> t -> t

min x y is x if x <= y otherwise it is y

Sourceval hash_bytes : ?key:Bytes.t -> Bytes.t list -> t
Sourceval hash_string : ?key:string -> string list -> t

hash_string ?key inputs returns a hash.

Raises an Assert_failure if String.length key > 64.

Sourceval zero : t
Sourceval size : int
Sourceval to_hex : t -> Tezos_stdlib.Hex.t
Sourceval of_hex_opt : Tezos_stdlib.Hex.t -> t option
Sourceval of_hex_exn : Tezos_stdlib.Hex.t -> t
Sourceval to_string : t -> string
Sourceval of_string_opt : string -> t option
Sourceval of_string_exn : string -> t
Sourceval to_bytes : t -> Bytes.t
Sourceval of_bytes_opt : Bytes.t -> t option
Sourceval of_bytes_exn : Bytes.t -> t
Sourceval to_b58check : t -> string
Sourceval to_short_b58check : t -> string
Sourceval of_b58check_exn : string -> t
Sourceval of_b58check_opt : string -> t option
Sourcetype Base58.data +=
  1. | Data of t
Sourceval b58check_encoding : t Base58.encoding
Sourceval encoding : t Data_encoding.t
Sourceval rpc_arg : t Tezos_rpc.Arg.t
Sourceval hash : t -> int
Sourceval seeded_hash : int -> t -> int
Sourceval to_path : t -> string list -> string list
Sourceval of_path : string list -> t option
Sourceval of_path_exn : string list -> t
Sourceval prefix_path : string -> string list
Sourceval path_length : int
Sourcemodule Set : sig ... end
Sourcemodule Map : sig ... end
Sourcemodule Table : sig ... end
Sourcemodule Error_table : sig ... end
Sourcemodule WeakRingTable : sig ... end
Sourceval compute : elt list -> t

compute xs computes a full binary tree from the list xs.

In this tree the ith leaf (from left to right) is the ith element of the list xs. If xs is the empty list, then the result is the empty tree. If the length of xs is not a power of 2, then the tree is padded with leaves containing the last element of xs such that a full tree is obtained.

Example: given the list [1; 2; 3], the tree

      /\
     /  \
    /\  /\
   1 2  3 3

is built.

Sourceval empty : t

The empty Merkle tree.

Sourcetype path =
  1. | Left of path * t
  2. | Right of t * path
  3. | Op

A path to an element in a Merkle tree.

A path is either:

  • Left (p, r), indicating that the element is in the left subtree, from which the path p should be taken to find the element. r is the left subtree where this branching decision is made.
  • Right (l, p), indicating that the element is in the right subtree, from which the path p should be taken to find the element. l is the left subtree where this branching decision is made.
  • Op, indicating that the path traversal has reached the element.

Example:

     /\
    /  \
   /\  /\
  4 5  6 7

The path to the third leaf, containing 6 will be:

Right (node (leaf 4, leaf 5), Left (Op, leaf 7))

Consequently, the path will contain all the information to reconstruct the full tree, except the element to which the path lead.

Sourceval path_encoding : path Data_encoding.t

Encoding of a path.

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

Encoding of a path, with optional bound max_length.

The encoding is bounded to log2(max_length) * (size + 1) + 1 bytes.

Sourceval compute_path : elt list -> int -> path

compute_path xs i computes the path to the ith leaf of the Merkle tree computed from xs, that will also contain the ith element of xs.

Sourceval check_path : path -> elt -> t * int

check_path p x returns a pair (t, i) where t is the full Merkle tree reconstructed from the path t with x at the last position of the path, and i is the index of x in that tree.

OCaml

Innovation. Community. Security.