Module Octez_smart_rollup_node.Interpreter

val process_head : (module Protocol_plugin_sig.PARTIAL) -> _ Node_context.t -> < index : _ ; state : Tezos_layer2_store.Access_mode.rw > Tezos_layer2_store.Context.t -> predecessor:Layer1.head -> Layer1.head -> (Octez_smart_rollup.Inbox.t * string list) -> (int * int64 * Z.t) Tezos_base.TzPervasives.tzresult Lwt.t

process_head plugin node_ctxt ctxt ~predecessor head (inbox, messages) interprets the messages associated with a head (where predecessor is the predecessor of head in the L1 chain). This requires the inbox to be updated beforehand. It returns (ctxt, num_messages, num_ticks, tick) where ctxt is the updated layer 2 context (with the new PVM state), num_messages is the number of messages, num_ticks is the number of ticks taken by the PVM for the evaluation and tick is the tick reached by the PVM after the evaluation. NOTE: ctxt is modified in place by process_head. It is the responsibility of the caller to make a copy and revert if needed in case of error.

Genesis state

The genesis state can be retrieved in different variants depending on whether unsafe patches should be applied. The permission parameter tracks the access mode of the underlying PVM state.

type 'a patched =
  1. | Patched
constraint 'a = [< `Read | `Write Read ]

Tag for a genesis state with patches applied.

type 'a unpatched =
  1. | Unpatched
constraint 'a = [< `Read | `Write Read ]

Tag for a genesis state without patches (the original boot sector).

type ('a, 'b) both =
  1. | Both
constraint 'a = [< `Read | `Write Read ] constraint 'b = [< `Read | `Write Read ]

Tag for requesting both the patched and unpatched genesis states.

type _ genesis_state =
  1. | Patched : 'perm Tezos_layer2_store.Context.pvmstate -> 'perm patched genesis_state
    (*

    The PVM state after applying unsafe patches.

    *)
  2. | Unpatched : 'perm Tezos_layer2_store.Context.pvmstate -> 'perm unpatched genesis_state
    (*

    The original PVM state from the boot sector.

    *)
  3. | Both : {
    1. patched : 'perm_patched Tezos_layer2_store.Context.pvmstate;
    2. original : 'perm_orig Tezos_layer2_store.Context.pvmstate;
    } -> ('perm_orig, 'perm_patched) both genesis_state
    (*

    Both variants at once, each with independently tracked permissions.

    *)

A genesis PVM state, parameterized by the requested variant.

type _ genesis_state_mode =
  1. | Patched : 'a Tezos_layer2_store.Access_mode.t -> 'a patched genesis_state_mode
    (*

    Request only the patched state.

    *)
  2. | Unpatched : 'a Tezos_layer2_store.Access_mode.t -> 'a unpatched genesis_state_mode
    (*

    Request only the unpatched state.

    *)
  3. | Both : 'a Tezos_layer2_store.Access_mode.t * 'b Tezos_layer2_store.Access_mode.t -> ('a, 'b) both genesis_state_mode
    (*

    Request both states with potentially different access permissions.

    *)

Selects which genesis state variant to compute and with what access permissions.

genesis_state mode plugin ?genesis_block ?empty node_ctxt the PVM state at the genesis block with and/or without patches applied depending on mode.

state_of_tick plugin node_ctxt cache ?start_state ~tick level returns Some state for a given tick if this tick happened before level and where state is the PVM evaluation state before tick happened. Otherwise, returns None. If provided, the evaluation is resumed from start_state.

State retrieval

val state_of_head : (module Protocol_plugin_sig.PARTIAL) -> < context : 'a ; store : _ > Node_context.t -> < index : 'a ; state : 'b > Tezos_layer2_store.Context.t -> Layer1.head -> 'b Tezos_layer2_store.Context.pvmstate Tezos_base.TzPervasives.tzresult Lwt.t

state_of_head plugin node_ctxt ctxt head returns the state corresponding to the block head, or the state at rollup genesis if the block is before the rollup origination.