package octez-l2-libs

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

Module Octez_smart_rollup.Sc_rollup_blockSource

Structure of layer 2 blocks

Sourcetype header = {
  1. block_hash : Tezos_base.TzPervasives.Block_hash.t;
    (*

    Tezos block hash.

    *)
  2. level : int32;
    (*

    Level of the block, corresponds to the level of the tezos block.

    *)
  3. predecessor : Tezos_base.TzPervasives.Block_hash.t;
    (*

    Predecessor hash of the Tezos block.

    *)
  4. commitment_hash : Octez_smart_rollup.Commitment.Hash.t option;
    (*

    Hash of this block's commitment if any was computed for it.

    *)
  5. previous_commitment_hash : Octez_smart_rollup.Commitment.Hash.t;
    (*

    Previous commitment hash in the chain. If there is a commitment for this block, this field contains the commitment that was previously computed.

    *)
  6. context : Smart_rollup_context_hash.t;
    (*

    Hash of the layer 2 context for this block.

    *)
  7. inbox_witness : Tezos_crypto.Hashed.Smart_rollup_merkelized_payload_hashes_hash.t;
    (*

    Witness for the inbox for this block, i.e. the Merkle hash of payloads of messages.

    *)
  8. inbox_hash : Octez_smart_rollup.Inbox.Hash.t;
    (*

    Hash of the inbox for this block.

    *)
}

A layer 2 block header contains information about the inbox and commitment with respect to a layer 1 block, but without the inbox content of messages.

Sourcetype content = {
  1. inbox : Inbox.t;
    (*

    Inbox for this block.

    *)
  2. messages : string list;
    (*

    Serialized messages added to the inbox in this block.

    *)
  3. commitment : Commitment.t option;
    (*

    Commitment, if any is computed for this block. header.commitment = Some h iff commitment = Some c and hash c = h.

    *)
}

Contents of blocks which include the actual content of the inbox and messages.

Sourcetype ('header, 'content) block = {
  1. header : 'header;
    (*

    Header of this block.

    *)
  2. content : 'content;
    (*

    Content of the block.

    *)
  3. initial_tick : Z.t;
    (*

    Initial tick of the PVM at this block, i.e. before evaluation of the messages.

    *)
  4. num_ticks : int64;
    (*

    Number of ticks produced by the evaluation of the messages in this block.

    *)
}

Block parameterized by a header and content. The parameters are here to allow to split the header and rest of the block.

Sourcetype t = (header, unit) block

The type of layer 2 blocks. This type corresponds to what is stored on disk for L2 blocks. The contents is stored in separate tables because it can be large to read is is not always necessary.

Sourcetype full = (header, content) block

The type of layer 2 blocks including their content (inbox, messages, commitment).

Encodings

Sourceval header_encoding : header Tezos_base.TzPervasives.Data_encoding.t
Sourceval header_size : int
Sourceval content_encoding : content Tezos_base.TzPervasives.Data_encoding.t
Sourceval block_encoding : 'header Tezos_base.TzPervasives.Data_encoding.t -> 'content Tezos_base.TzPervasives.Data_encoding.t -> ('header, 'content) block Tezos_base.TzPervasives.Data_encoding.t
Sourceval encoding : t Tezos_base.TzPervasives.Data_encoding.t
Sourceval full_encoding : full Tezos_base.TzPervasives.Data_encoding.t

Helper functions

Sourceval most_recent_commitment : header -> Octez_smart_rollup.Commitment.Hash.t

most_recent_commitment header returns the most recent commitment information at the block of with header. It is either the commitment for this block if there is one or the previous commitment otherwise.

Sourceval final_tick : ('a, 'b) block -> Z.t

final_tick block is the final tick, after evaluation of the messages in the block, i.e. block.initial_tick + block.num_ticks.

OCaml

Innovation. Community. Security.