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 Mavryk_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.

val config_encoding : config Mavryk_base.TzPervasives.Data_encoding.t

Encoding for config.

Internally an object without any variable fields.

The type implemented by Mavryk_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.

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 -> Mavryk_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).

module Internal_for_tests : sig ... end