package octez-shell-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Tezos Shell - Prevalidation of pending operations (a.k.a Mempool)

The prevalidator is the worker in charge of the mempool, that is, the operations that are not yet included in a block. It keeps track of which operations are valid (according to the economic protocol), maybe-valid-later, or invalid. The prevalidator is also responsible for deciding which operations are appropriate to broadcast to peers.

Before including an operation into the mempool, the prevalidator performs a few preliminary checks: unparsable operations are noted down so that they will never be considered again; already handled operations or operations that are not branched on any live_block are simply ignored; operations which do not meet some configurable requirements (e.g. minimal fees) are refused at this point.

If the operation passes these preliminary checks, the prevalidator then asks the protocol to validate the operation in its maintained mempool context. Only an operation that passes this validation gets added to the mempool context and broadcast. If the operation is flat-out refused by the protocol, it is noted down to be ignored by the node from now on. If the operation is only branch_refused or branch_delayed, it is kept for later: it may be evaluated again in the future when the mempool's head (a.k.a. the last block it is built on) changes, then added to the mempool and broadcast if it passes this new validation.

See the prevalidator implementation overview to learn more.

type t

An (abstract) prevalidator context. Separate prevalidator contexts should be used for separate chains (e.g., mainchain vs testchain).

val shutdown : t -> unit Lwt.t
val notify_operations : t -> Tezos_base.P2p_peer.Id.t -> Tezos_base.Mempool.t -> unit Lwt.t

Notify the prevalidator that the identified peer has sent a bunch of operations relevant to the specified context.

val inject_operation : t -> force:bool -> Tezos_base.Operation.t -> unit Tezos_base.TzPervasives.tzresult Lwt.t

inject_operation t ~force op notifies the prevalidator worker of a new injected operation. If force is set to true the operation is injected without any check. force should be used for test purpose only.

Notify the prevalidator that a new head has been selected. update is used as an optimisation to know which operations previously classified require to be prevalidated again.

Returns the list of prevalidation contexts running and their associated chain

Worker status and events

val pipeline_length : t -> int
val rpc_directory : t option Tezos_rpc.Directory.t
module Internal_for_tests : sig ... end
OCaml

Innovation. Community. Security.