Module Prevalidation.Make

How-to obtain an instance of this module's main module type: T

Parameters

Signature

type protocol_operation = Proto.operation

Similar to the same type in the protocol, see Tezos_protocol_environment.PROTOCOL.operation

type config

Mempool configuration that groups both the plugin config (e.g. minimal fee to pass the pre_filter) and the bounding config (e.g. max number of valid operations in the mempool).

val default_config : config

Default mempool configuration.

Encoding for config.

Internally an object without any variable fields.

The type implemented by Tezos_store.Store.chain_store in production, and mocked in tests

type t

The state used internally by this module. Created by create and then passed back and possibly updated by add_operation and remove_operation.

This state notably contains a representation of the protocol mempool, as well as the bounding state.

Create an empty state based on the head block.

Called only once when a prevalidator starts.

Create a new empty state based on the head block.

The previous state must be provided (even when it was based on a different block). Indeed, parts of it are recycled to make this function more efficient than create.

Light preliminary checks that should be performed on arrival of an operation and after a flush of the prevalidator.

See Protocol_plugin.T.Plugin.pre_filter.

Contain the hash and new classification of any operations that had to be removed to make room for a newly added operation.

Result of add_operation.

Contain the updated (or unchanged) state t, the operation (in which the signature_checked field has been updated if appropriate), its classification, and the potential replacements.

Invariant: replacements can only be non-empty when the classification is `Prechecked.

Represents either:

  • an operation that was partially validated associated with pending checks that must be ran before considering the operation as valid,
  • an operation validation error

Runs the protocol partial_op_validation but does not check the remaining pending checks. This aims to be used in pair with handle_partially_validated.

type valid_operation

An operation that passed partial_op_validation and the pending checks resulting from this call.

Run the pending checks associated with a partially validated operation Without this call, the partial_op_validation is not complete.

val add_valid_operation : t -> config -> valid_operation -> add_result
val legacy_add_operation : t -> config -> protocol_operation Shell_operation.operation -> add_result Lwt.t

Try and add an operation to the protocol's mempool; also ensure that this mempool remains bounded (in terms of both operation count and total byte size; the bounds are specified in the config).

See add_result for a description of the output.

val remove_operation : t -> Tezos_base.TzPervasives.Operation_hash.t -> t

Remove an operation from the state.

The state remains unchanged when the operation was not present (though not physically equal to the input state).

Get the protocol context from the predecessor

module Internal_for_tests : sig ... end