package tezos-shell

  1. Overview
  2. Docs

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

The prevalidator is in charge of the "mempool" (a.k.a. the set of known not-invalid-for-sure operations that are not yet included in the blockchain).

The prevalidator also maintains a sorted subset of the mempool that might correspond to a valid block on top of the current head. The "in-progress" context produced by the application of those operations is called the (pre)validation context.

Before including an operation into the mempool, the prevalidation worker tries to append the operation the prevalidation context. If the operation is (strongly) refused, it will not be added into the mempool and then it will be ignored by the node and never broadcast. If the operation is only "branch_refused" or "branch_delayed", the operation won't be appended in the prevalidation context, but still broadcast.

type t

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

type limits = {
  1. max_refused_operations : int;
    (*

    The maximum number of operations tracked by the mempool for each of the refused, branch delayed, branch refused and outdated operation classifications. Default is 1000

    *)
  2. operation_timeout : Tezos_base.Time.System.Span.t;
    (*

    The maximum time allowed to fetch the contents of an operation advertised by a remote peer. Default is 10 seconds

    *)
  3. operations_batch_size : int;
    (*

    Maximum number of pending operations processed (or classified) at the end of each request to the prevalidator worker. Default is 50

    *)
  4. disable_precheck : bool;
    (*

    If disable_precheck is true (default is false) operations are executed by the protocol before being propagated. This flag is intended to be used for testing and debugging.

    *)
}

This record contains the differents limits and settings that can be updated from a node configuration for a prevalidator

val default_limits : limits

Sane default values for limits

Creates/tear-down a new prevalidator context.

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_error_monad.TzCore.error list) Stdlib.result 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.

val running_workers : unit -> (Tezos_crypto.Chain_id.t * Tezos_crypto.Protocol_hash.t * t) list

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.RPC_directory.t
OCaml

Innovation. Community. Security.