package tezos-protocol-alpha

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type Tezos_protocol_environment_alpha.Error_monad.error +=
  1. | Merkelized_payload_hashes_proof_error of string
type t

A type representing the head of a merkelized list of Sc_rollup_inbox_message_repr.serialized message. It contains the hash of the payload and the index on the list.

type merkelized_and_payload = {
  1. merkelized : t;
  2. payload : Sc_rollup_inbox_message_repr.serialized;
}
module History : sig ... end

A History.t is a lookup table of merkelized_and_payloads. Payloads are indexed by their hash Hash.t. This history is needed in order to produce proof.

val hash : t -> Hash.t

hash merkelized is the hash of merkelized. It is used as key to remember a merkelized payload hash in an History.t.

remember history merkelized payload remembers the {merkelized; payload} in history with key hash merkelized.

val genesis_no_history : Sc_rollup_inbox_message_repr.serialized -> t

genesis_no_history payload is the initial merkelized payload hashes with index 0.

genesis history payload is the initial merkelized payload hashes with index 0. It is remembered in history using remember.

val add_payload_no_history : t -> Sc_rollup_inbox_message_repr.serialized -> t

add_payload_no_history merkelized payload creates a new t with payload and merkelized as ancestor (i.e. index = succ (get_index merkelized)).

add_payload is identical to add_payload_no_history but the resulting merkelized is remembered in history with remember.

val equal : t -> t -> bool
val get_payload_hash : t -> Sc_rollup_inbox_message_repr.Hash.t

get_payload_hash merkelized returns the Sc_rollup_inbox_message_repr.serialized payload's hash of merkelized.

get_index merkelized returns the index of merkelized.

type proof = private t list

Given two t (a, b) and a Sc_rollup_inbox_message_repr.serialized payload, a proof guarantees that payload hash is equal to a and that a is an ancestor of b; i.e. get_index a < get_index b.

val produce_proof : History.t -> index:Tezos_protocol_environment_alpha.Z.t -> t -> (merkelized_and_payload * proof) option

produce_proof history ~index into_ returns a merkelized_and_payload with index index and a proof that it is an ancestor of into_. Returns None if no merkelized payload with index is found (either in the history or index is not inferior to get_index into_).

verify_proof proof returns (a, b) where proof validates that a is an ancestor of b. Fails when proof is not a valid inclusion proof.

module Internal_for_tests : sig ... end
OCaml

Innovation. Community. Security.