Octez_smart_rollup_node.Injector
type state = {
cctxt : Tezos_client_base.Client_context.full;
fee_parameters : Configuration.fee_parameters;
minimal_block_delay : int64;
delay_increment_per_round : int64;
}
val registry : Prometheus.CollectorRegistry.t
include Octez_injector.Injector_sigs.S
with type state := state
and type tag := Octez_smart_rollup.Operation_kind.t
and type operation := Octez_smart_rollup.L1_operation.t
type injected_info = {
op : Inj_operation.t;
The injector operation.
*)oph : Tezos_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 Tezos node.
type included_info = {
op : Inj_operation.t;
The injector operation.
*)oph : Tezos_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 : Tezos_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 Tezos block.
type status =
| Pending of Octez_smart_rollup.L1_operation.t
The operation is pending injection.
*)| Injected of injected_info
The operation has been injected successfully in the node.
*)| Included of included_info
The operation has been included in a L1 block.
*)Status of an operation in the injector.
val init :
Tezos_client_base.Client_context.full ->
data_dir:string ->
?retention_period:int ->
?allowed_attempts:int ->
?injection_ttl:int ->
?collect_metrics:bool ->
Octez_crawler.Layer_1.t ->
state ->
signers:
(Tezos_base.TzPervasives.Signature.public_key_hash list
* Octez_injector.Injector_sigs.injection_strategy
* Octez_smart_rollup.Operation_kind.t list)
list ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
Initializes 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.
collect_metrics
will allow the prometheus to register metrics for the injector.
Each pkh's list and tag list of signers
must be disjoint.
val add_pending_operation :
?order:Z.t ->
Octez_smart_rollup.L1_operation.t ->
Octez_injector.Injector_sigs.Id.t Tezos_base.TzPervasives.tzresult Lwt.t
Add an operation as pending injection in the injector. It returns the id of the operation in the injector queue.
val inject :
?tags:Octez_smart_rollup.Operation_kind.t list ->
?header:Tezos_base.Block_header.shell_header ->
unit ->
unit Lwt.t
Trigger 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 running_worker_tags : unit -> Octez_smart_rollup.Operation_kind.t list list
List of currently running injectors with their respective tags.
val operation_status : Octez_injector.Injector_sigs.Id.t -> status option
The status of an operation in the injector.
val total_queued_operations :
unit ->
(Octez_smart_rollup.Operation_kind.t list * int) list * int
Returns the total operations per worker queue and in total. This function is constant time excepted for the injectors iteration.
val get_queues :
?tag:Octez_smart_rollup.Operation_kind.t ->
unit ->
(Octez_smart_rollup.Operation_kind.t list * Inj_operation.t list) list
Returns 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 :
?drop_no_order:bool ->
?order_below:Z.t ->
?tag:Octez_smart_rollup.Operation_kind.t ->
unit ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
Clears the injectors queues completely. If tag
is provided, only queues for the injector which handles this tag is cleared. If order_below
, only operation with order below that value are cleared, and if drop_no_order
is true, clear all operation that has no order specified.
val register_proto_client :
Tezos_base.TzPervasives.Protocol_hash.t ->
(module Octez_injector.Injector_sigs.PROTOCOL_CLIENT
with type operation = Octez_smart_rollup.L1_operation.t
and type state = state) ->
unit
Register 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.
val check_and_add_pending_operation :
Configuration.mode ->
?order:Z.t ->
Octez_smart_rollup.L1_operation.t ->
Inj_operation.id option Tezos_base.TzPervasives.tzresult Lwt.t
Checks if an operation can be added as a pending operation in the specified mode. If allowed, adds it to the pending operation. Returns None
when the operation is not allowed in the mode.