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;
  2. operation_timeout : Tezos_base.Time.System.Span.t;
  3. worker_limits : Tezos_base.Worker_types.limits;
  4. operations_batch_size : int;
}
type parameters = {
  1. limits : limits;
  2. chain_db : Distributed_db.chain_db;
}

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 -> Tezos_base.Operation.t -> (unit, Tezos_error_monad.TzCore.error list) result Lwt.t

Notify the prevalidator worker of a new injected operation.

Notify the prevalidator that a new head has been selected.

val timestamp : t -> Tezos_base.Time.System.t

Returns the timestamp of the prevalidator worker, that is the timestamp of the last reset of the prevalidation context

val fitness : t -> Tezos_base.Fitness.t Lwt.t

Returns the fitness of the current prevalidation context

Returns the list of valid operations known to this prevalidation worker

Returns the list of pending operations known to this prevalidation worker

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

Two functions that are useful for managing the prevalidator's transition * from one protocol to the next.

val protocol_hash : t -> Tezos_crypto.Protocol_hash.t

Returns the hash of the protocol the prevalidator was instantiated with

val parameters : t -> parameters

Returns the parameters the prevalidator was created with.

Worker status and events

val pipeline_length : t -> int
val rpc_directory : t option Tezos_rpc.RPC_directory.t