Mavkit_smart_rollup_node.Publisher
The rollup node stores and publishes commitments for the PVM every `Commitment.sc_rollup_commitment_period` levels.
Every time a finalized block is processed by the rollup node, the latter determines whether the last commitment that the node has produced referred to `Commitment.sc_rollup_commitment_period` blocks earlier. In this case, it computes and stores a new commitment in a level-indexed map.
Stored commitments are signed by the rollup node operator and published on the layer1 chain. To ensure that commitments produced by the rollup node are eventually published, storing and publishing commitments are decoupled. Every time a new head is processed, the node tries to publish the oldest commitment that was not published already.
val process_head :
(module Protocol_plugin_sig.S) ->
Node_context.rw ->
predecessor:Mavryk_base.TzPervasives.Block_hash.t ->
Layer1.header ->
Mavryk_layer2_store.Context.rw ->
Mavkit_smart_rollup.Commitment.Hash.t option
Mavryk_base.TzPervasives.tzresult
Lwt.t
process_head plugin node_ctxt ~predecessor head ctxt
builds a new commitment if needed, by looking at the level of head
and checking whether it is a multiple of `Commitment.sc_rollup_commitment_period` levels away from node_ctxt.initial_level
. It uses the functionalities of PVM
to compute the hash of to be included in the commitment.
val create_commitment_if_necessary :
(module Protocol_plugin_sig.S) ->
'a Node_context.t ->
predecessor:Mavryk_base.TzPervasives.Block_hash.t ->
int32 ->
'a Mavryk_layer2_store.Context.t ->
(Mavkit_smart_rollup.Commitment.t option, Mavryk_base.TzPervasives.tztrace)
Stdlib.result
Lwt.t
create_commitment_if_necessary plugin node_ctxt ~predecessor level ctxt
returns the commitment for inbox level level
if there needs to be one. ctxt
should be the context checkouted for level
.
val publish_single_commitment :
_ Node_context.t ->
Mavkit_smart_rollup.Commitment.t ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
publish_single_commitment node_ctxt commitment
publishes a single commitment
if it is missing. This function is meant to be used by the accuser mode to sparingly publish commitments when it detects a conflict.
val recover_bond :
_ Node_context.t ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
recover_bond node_ctxt
publishes a recover bond operator for the Operating key. The submitter is either the operator or another address depending of the rollup node configuration. This function is intended to be used by the bailout mode.
val init : _ Node_context.t -> unit Mavryk_base.TzPervasives.tzresult Lwt.t
Initialize worker for publishing and cementing commitments, if the rollup node mode supports it.
val publish_commitments : unit -> unit Mavryk_base.TzPervasives.tzresult Lwt.t
publish_commitments
publishes the commitments that were not yet published up to the finalized head and which are after the last cemented commitment. This is a no-op if the rollup node is not in the appropriate mode.
val cement_commitments : unit -> unit Mavryk_base.TzPervasives.tzresult Lwt.t
cement_commitments
cements the commitments that can be cemented, i.e. the commitments that are after the current last cemented commitment and which have sc_rollup_challenge_period
levels on top of them since they were originally published. This is a no-op if the rollup node is not in the appropriate mode.