package tezos-protocol-013-PtJakart

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

The following operations are subject to cross-validation between rollup nodes and the layer 1.

type tree

The type for the Merkle trees used in this module.

type message = tree

A merkelized message.

type messages = tree

A merkelized sequence of messages.

type history

The history is a merkelized sequence of messages, one per level. The history is typically used by the rollup node to produce inclusion proofs. The protocol only manipulates an empty history as it does not remember previous messages and only keeps a witness of the latest state of the history.

val history_at_genesis : bound:int64 -> history

The beginning of the history is an empty sequence of messages. Fail with Invalid_bound_on_history if bound is not strictly positive.

add_messages history inbox level payloads messages inserts a list of payloads as new messages in the messages of the current level of the inbox. This function returns the new sequence of messages as well as updated inbox and history.

If the inbox's level is older than level, the inbox is updated so that the messages of the levels older than level are archived. To archive a sequence of messages for a given level, we push it at the end of the history and update the witness of this history in the inbox. The inbox's messages for the current level is also emptied to insert the payloads in a fresh sequence of messages for level.

This function fails if level is older than inbox's level.

This function fails with Max_number_of_available_messages_reached if the inbox is full.

add_messages_no_history inbox level payloads messages behaves a add_messages except that it does not remember the inbox history.

get_message messages idx returns Some message if the sequence of messages has a more than idx messages and message is at position idx in this sequence. Returns None otherwise.

get_message_payload messages idx returns Some payload if the sequence of messages has a more than idx messages, message is at position idx in this sequence, and is defined by payload. Returns None otherwise.

type inclusion_proof

Given a inbox A at some level L and another inbox B at some level L' >= L, an inclusion_proof guarantees that A is an older version of B.

To be more precise, an inclusion_proof guarantees that the previous levels messages of A are included in the previous levels messages of B. The current messages of A and B are not considered.

The size of this proof is O(log_basis (L' - L)).

val number_of_proof_steps : inclusion_proof -> int

number_of_proof_steps proof returns the length of proof.

val produce_inclusion_proof : history -> t -> t -> inclusion_proof option

produce_inclusion_proof history inbox1 inbox2 exploits history to produce a self-contained proof that inbox1 is an older version of inbox2.

val verify_inclusion_proof : inclusion_proof -> t -> t -> bool

verify_inclusion_proof proof inbox1 inbox2 returns true iff proof is a minimal and valid proof that inbox1 is included in inbox2.

OCaml

Innovation. Community. Security.