type index

A block-indexed (key x value) store directory.

type context

Type of persitant context.

include Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_sig.CONTEXT with type t = context and type 'a m = 'a Tezos_base.TzPervasives.tzresult Lwt.t
type t = context

The state of the Tx_rollup context.

The context provides a type-safe, functional API to interact with the state of a transaction rollup. The functions of this module, manipulating and creating values of type t are called “context operations” afterwards.

The monad used by the context.

Note: It is likely to be the monad of the underlying storage. In the case of the proof verifier, as it is expected to be run into the L1, the monad will also be used to perform gas accounting. This is why all the functions of this module type needs to be inside the monad m.

module Syntax : sig ... end

The necessary monadic operators the storage monad is required to provide.

bls_aggregate_verify allows to verify the aggregated signature of a batch.

module Address_metadata : sig ... end

The metadata associated to an address.

module Address_index : sig ... end

Mapping between Tx_rollup_l2_address.address and address_index.

module Ticket_index : sig ... end

Mapping between Ticket_hash.t and ticket_index.

module Ticket_ledger : sig ... end

The ledger of the layer 2 where are registered the amount of a given ticket a L2 account has in its possession.

val index : context -> index
val init : ?patch_context:(context -> context Tezos_base.TzPervasives.tzresult Lwt.t) -> ?readonly:bool -> ?indexing_strategy:[ `Always | `Minimal ] -> ?index_log_size:int -> string -> index Lwt.t

Open or initialize a versioned store at a given path.

val init_context : index -> t Lwt.t

Initialize an "empty" context from an index. It is not really empty in the sense that the underlying tree is not empty, it is then committed.

val close : index -> unit Lwt.t

Close the index. Does not fail when the context is already closed.

val sync : index -> unit Lwt.t

Sync the context with disk. Only useful for read-only instances. Does not fail when the context is not in read-only mode.

Accessing and Updating Versions

Returns true if there is a commit with this context hash

Checkout the context associated to a context hash. The context must have been committed (with commit). Resolves with None if there is no such commit.

Same as checkout_opt but resolves with an exception if there is no such commit.

Same as checkout_opt but resolves with an error if there is no such commit.

Hash a context. The hash can be done with an additional message.

Create a commit and return the context hash. The hash can be done with an additional message.

Prover Context

The prover context is a subset of the context. It uses the internal context tree to produce proofs.

type tree
type 'a produce_proof_result = {
  1. tree : tree;

    the tree modified by the callback function

  2. result : 'a;

    the callback result.


'a produce_proof_result is the result type needed for the produce_proof callback function.

produce_proof ctxt f applies f in the tree inside ctxt.

It returns a proof that is produced by applying f, the proof is constructed using low-levels accesses to the three, that is, it needs the modified tree to be included in the f's result to calculate the proof.

Beside the proof production, this function can be used to perform semantical changes in the Prover_context. Thus, we give the possibility to return a result in 'aproduce_proof_result to observe f's results.

add_tree ctxt tree adds tree in the ctxt. In order to perform actions on the tree (e.g. proof production), it needs to be persistent. Thus, the context is committed on disk after we added the tree, that is, after every modification on the tree such as a message interpretation.

FIXME: https://gitlab.com/tezos/tezos/-/issues/2780 We would like to avoid the commit in this function for performance matters.

Sub-context for tickets

Adds a new association ticket index -> ticket in the context.

get_ticket ctxt ticket_index retrieves the ticket associated to ticket_index in the context ctxt. Resolves with None if there is no ticket associated to ticket_hash.

Sub-context for address indexes

get_address ctxt address_index retrieves the address associated to address_index in the context ctxt. Resolves with None if there is no address associated to address_index.