package tezos-protocol-015-PtLimaPt

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

This module exposes a type t that represents inbox messages. Inbox messages are produced by the Layer 1 protocol and are encoded using the serialize function, before being added to a smart-contract rollup's inbox.

They are part of the Rollup Management Protocol that defines the communication protocol for exchanging messages between Layer 1 and Layer 2 for a smart-contract rollup.

There are two types of inbox messages: external and internal.

Internal messages originate from Layer 1 smart-contract and consist of:

  • payload the parameters passed to the smart-contract rollup.
  • sender the Layer 1 contract caller.
  • source the public key hash used for originating the transaction.

External messages originate from the Sc_rollup_add_messages manager-operation and consists of strings. The Layer 2 node is responsible for decoding and interpreting these messages.

type internal_inbox_message = {
  1. payload : Script_repr.expr;
    (*

    A Micheline value containing the parameters passed to the rollup.

    *)
  2. sender : Contract_hash.t;
    (*

    The contract hash of an Layer 1 originated contract sending a message to the rollup.

    *)
  3. source : Tezos_protocol_environment_015_PtLimaPt.Signature.public_key_hash;
    (*

    The implicit account that originated the transaction.

    *)
}

internal_inbox_message represent an internal message in a inbox (L1 -> L2). This is not inline so it can easily be used by Sc_rollup_costs.cost_serialize_internal_inbox_message.

type t =
  1. | Internal of internal_inbox_message
  2. | External of string

A type representing messages from Layer 1 to Layer 2. Internal ones are originated from Layer 1 smart-contracts and external ones are messages from an external manager operation.

type serialized = private string

Encoding for messages from Layer 1 to Layer 2

serialize msg encodes the inbox message msg in binary format.

deserialize bs decodes bs as an inbox_message t.

val unsafe_of_string : string -> serialized
val unsafe_to_string : serialized -> string
OCaml

Innovation. Community. Security.