Mavkit_injector.Injector_serverThis module defines an instance of the injector functor used in the standalone injector server binary in bin_injector_server, which is independent of the rollup node and is meant to inject manager operations (only transactions are currently supported).
Other modules in this library which are only used for the injector binary are prefixed with injector_server*. The injector server supports multiple protocols. Each protocol is supported using a plugin module proto_*/lib_injector/injector_plugin.ml
module Configuration : sig ... endtype state = {cctxt : Mavryk_client_base.Client_context.full;fee_parameters : Configuration.fee_parameters;minimal_block_delay and delay_increment_per_round are protocol constants required for the injector plugin to compute the time remaining until the following block
minimal_block_delay : int64;delay_increment_per_round : int64;}include Injector_sigs.S
with type state := state
and type tag := Configuration.tag
and type operation := Injector_server_operation.tmodule Inj_operation :
Injector_sigs.INJECTOR_OPERATION
with type operation = Injector_server_operation.ttype injected_info = {op : Inj_operation.t;The injector operation.
*)oph : Mavryk_base.TzPervasives.Operation_hash.t;The hash of the operation which contains op (this can be an L1 batch of several manager operations).
op_index : int;The index of the operation op in the L1 batch corresponding to oph.
}Information stored about an L1 operation that was injected on a Mavryk node.
type included_info = {op : Inj_operation.t;The injector operation.
*)oph : Mavryk_base.TzPervasives.Operation_hash.t;The hash of the operation which contains op (this can be an L1 batch of several manager operations).
op_index : int;The index of the operation op in the L1 batch corresponding to oph.
l1_block : Mavryk_base.TzPervasives.Block_hash.t;The hash of the L1 block in which the operation was included.
*)l1_level : int32;The level of l1_block.
}Information stored about an L1 operation that was included in a Mavryk block.
type status = | Pending of Injector_server_operation.tThe operation is pending injection.
*)| Injected of injected_infoThe operation has been injected successfully in the node.
*)| Included of included_infoThe operation has been included in a L1 block.
*)Status of an operation in the injector.
val init :
Mavryk_client_base.Client_context.full ->
data_dir:string ->
?retention_period:int ->
?allowed_attempts:int ->
?injection_ttl:int ->
Mavkit_crawler.Layer_1.t ->
state ->
signers:
(Mavryk_base.TzPervasives.Signature.public_key_hash list
* Injector_sigs.injection_strategy
* Configuration.tag list)
list ->
unit Mavryk_base.TzPervasives.tzresult Lwt.tInitializes the injector with the rollup node state, for a list of signers, and start the workers. Each signer's list has its own worker with a queue of operations to inject.
retention_period is the number of blocks for which the injector keeps the included information for, must be positive or zero. By default (when 0), the injector will not keep information longer than necessary. It can be useful to set this value to something > 0 if we want to retrieve information about operations included on L1 for a given period.
allowed_attempts is the number of attempts that will be made to inject an operation. Operations whose injection fails a number of times greater than this value will be discarded from the queue.
injection_ttl is the number of blocks after which an operation that is injected but never include is retried.
Each pkh's list and tag list of signers must be disjoint.
val add_pending_operation :
Injector_server_operation.t ->
Inj_operation.Id.t Mavryk_base.TzPervasives.tzresult Lwt.tAdd an operation as pending injection in the injector. It returns the id of the operation in the injector queue.
val inject :
?tags:Configuration.tag list ->
?header:Mavryk_base.Block_header.shell_header ->
unit ->
unit Lwt.tTrigger an injection of the pending operations for all workers. If tags is given, only the workers which have a tag in tags inject their pending operations. header must be provided for the `Delay_block strategy to compute the next block timestamp.
Shutdown the injectors, waiting for the ongoing request to be processed.
val operation_status : Inj_operation.Id.t -> status optionThe status of an operation in the injector.
val total_queued_operations : unit -> (Configuration.tag list * int) list * intReturns the total operations per worker queue and in total. This function is constant time excepted for the injectors iteration.
val get_queues :
?tag:Configuration.tag ->
unit ->
(Configuration.tag list * Inj_operation.t list) listReturns the queues of the injectors, with the oldest elements first. If tag is provided, returns the queue for the injector which handles this tag.
val clear_queues :
?tag:Configuration.tag ->
unit ->
unit Mavryk_base.TzPervasives.tzresult Lwt.tClears the injectors queues completely. If tag is provided, only queues for the injector which handles this tag is cleared.
val register_proto_client :
Mavryk_base.TzPervasives.Protocol_hash.t ->
(module Injector_sigs.PROTOCOL_CLIENT
with type operation = Injector_server_operation.t
and type state = state) ->
unitRegister a protocol client for a specific protocol to be used by the injector. This function must be called for all protocols that the injector is meant support.