Module Evm_node_lib_dev.Tx_queue

The Tx_queue is a worker allowing to batch raw transactions in a single eth_sendRawTransaction at a regular interval. It provides a non-blocking interface based on the use of callbacks.

nonce ~next_nonce address must returns the next gap nonce available.

add ~next_nonce tx_object raw_tx returns the next gap nonce available based on the pending transaction of the tx_queue. next_nonce is the next expected nonce found in the backend.

find hash returns the transaction_object found in tx container.

content () returns all the transactions found in tx container.

val shutdown : unit -> unit Tezos_base.TzPervasives.tzresult Lwt.t

shutdown () stops the tx container, waiting for the ongoing request to be processed.

val clear : unit -> unit Tezos_base.TzPervasives.tzresult Lwt.t

clear () removes the container data but keeps the allocated space

val tx_queue_tick : evm_node_endpoint:Services_backend_sig.endpoint -> unit Tezos_base.TzPervasives.tzresult Lwt.t

Trigger a tick in the Tx_queue.

val tx_queue_beacon : evm_node_endpoint:Services_backend_sig.endpoint -> tick_interval:float -> unit Tezos_base.TzPervasives.tzresult Lwt.t

tx_queue_beacon ~evm_node_endpoint ~tick_interval is a never fulfilled promise which triggers a tick in the Tx_queue every tick_interval seconds.

val confirm_transactions : clear_pending_queue_after:bool -> confirmed_txs: Evm_node_lib_dev_encoding.Ethereum_types.hash Tezos_base.TzPervasives.Seq.t -> unit Tezos_base.TzPervasives.tzresult Lwt.t

The Tx_queue has a table of pending transactions. There are two ways for transactions to be removed from this table; either they are confirmed because they have been seen in a block or they are dropped.

confirm_transactions ~clear_pending_queue_after ~confirmed_txs confirms confirmed_txs hash. If clear_pending_queue_after then any other pending transactions in the tx_queue are dropped.

val dropped_transaction : dropped_tx:Evm_node_lib_dev_encoding.Ethereum_types.hash -> reason:string -> unit Tezos_base.TzPervasives.tzresult Lwt.t

The Tx_queue has a table of pending transactions. There are two ways for transactions to be removed from this table; either they are confirmed because they have been seen in a block or they are dropped.

dropped_transaction ~dropped_tx drops dropped_tx hash.

val add_pending_callback : Evm_node_lib_dev_encoding.Ethereum_types.hash -> callback: [ `Confirmed | `Dropped | `Missing ] Services_backend_sig.variant_callback -> unit Tezos_base.TzPervasives.tzresult Lwt.t

add_pending_callback hash ~callback registers callback for the transaction associated with hash. If the transaction is not found, callback is called immediately with `Missing. Otherwise, callback will be called when the transaction is either confirmed or dropped.

val pop_transactions : maximum_cumulative_size:int -> validate_tx: ('a -> string -> Tx_queue_types.transaction_object_t -> [ `Keep of 'a | `Drop of string | `Stop ] Tezos_base.TzPervasives.tzresult Lwt.t) -> initial_validation_state:'a -> (string * Tx_queue_types.transaction_object_t) list Tezos_base.TzPervasives.tzresult Lwt.t

The Tx_pool pops transactions until the sum of the sizes of the popped transactions reaches maximum_cumulative_size; it ignores the validate_tx and initial_validation_state arguments, The Tx_queue however ignores maximum_cumulative_size and instead uses validate_tx to pop valid transactions until either `Drop or `Stop is returned.

size_info returns the size of the tx container.

val start : config:Evm_node_config.Configuration.tx_queue -> keep_alive:bool -> timeout:float -> start_injector_worker:bool -> unit -> unit Tezos_base.TzPervasives.tzresult Lwt.t
module Internal_for_tests : sig ... end