Library
Module
Module type
Parameter
Class
Class type
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.
type 'a m = 'a Tezos_base.TzPervasives.tzresult Lwt.t
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.
val bls_verify :
(Tezos_protocol_environment_013_PtJakart.Bls_signature.pk * bytes) list ->
Tezos_raw_protocol_013_PtJakart.Tx_rollup_l2_context_sig.signature ->
bool m
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 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.
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.
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
val exists :
index ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_hash.t ->
bool Lwt.t
Returns true if there is a commit with this context hash
val checkout_opt :
index ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_hash.t ->
context option Lwt.t
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.
val checkout_exn :
index ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_hash.t ->
context Lwt.t
Same as checkout_opt
but resolves with an exception if there is no such commit.
val checkout :
index ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_hash.t ->
context Tezos_base.TzPervasives.tzresult Lwt.t
Same as checkout_opt
but resolves with an error if there is no such commit.
val hash :
?message:string ->
t ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_hash.t
Hash a context. The hash can be done with an additional message
.
val commit :
?message:string ->
context ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_hash.t Lwt.t
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.
module Prover_context :
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_sig.CONTEXT
with type t = tree
and type 'a m = 'a Lwt.t
type 'a produce_proof_result = {
tree : tree;
(*the tree modified by the callback function
*)result : 'a;
(*the callback result.
*)
}
'a produce_proof_result
is the result type needed for the produce_proof
callback function.
val produce_proof :
context ->
(tree -> 'a produce_proof_result Lwt.t) ->
(Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_proof.t
* 'a produce_proof_result)
Tezos_base.TzPervasives.tzresult
Lwt.t
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.
val hash_tree : tree -> Tezos_crypto.Context_hash.t
val add_tree :
context ->
tree ->
(context * Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_hash.t)
Lwt.t
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.
val tree_hash_of_context :
context ->
Tezos_crypto.Context_hash.t Tezos_base.TzPervasives.tzresult Lwt.t
Sub-context for tickets
val register_ticket :
context ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_sig.ticket_index ->
Ticket.t ->
context Lwt.t
Adds a new association ticket index -> ticket
in the context.
val get_ticket :
context ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_sig.ticket_index ->
Ticket.t option Lwt.t
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
val register_address :
context ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_sig.address_index ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_address.t ->
context Lwt.t
Adds a new association address index -> address
in the context.
val get_address :
context ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_context_sig.address_index ->
Tezos_protocol_013_PtJakart.Protocol.Tx_rollup_l2_address.t option Lwt.t
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
.