Prevalidation.MakeHow-to obtain an instance of this module's main module type: T
module Proto : Tezos_validation.Protocol_plugin.Ttype protocol_operation = Proto.operationSimilar to the same type in the protocol, see Tezos_protocol_environment.PROTOCOL.operation
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 : configDefault mempool configuration.
val config_encoding : config Tezos_base.TzPervasives.Data_encoding.tEncoding for config.
Internally an object without any variable fields.
type chain_store = Tezos_store.Store.chain_storeThe type implemented by Tezos_store.Store.chain_store in production, and mocked in tests
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.
val create :
chain_store ->
head:Tezos_store.Store.Block.t ->
timestamp:Tezos_base.Time.Protocol.t ->
t Tezos_base.TzPervasives.tzresult Lwt.tCreate an empty state based on the head block.
Called only once when a prevalidator starts.
val flush :
chain_store ->
head:Tezos_store.Store.Block.t ->
timestamp:Tezos_base.Time.Protocol.t ->
t ->
t Tezos_base.TzPervasives.tzresult Lwt.tCreate 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.
val pre_filter :
t ->
config ->
protocol_operation Shell_operation.operation ->
[ `Passed_prefilter of Prevalidator_pending_operations.priority
| Prevalidator_classification.error_classification ]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.
type replacements =
(Tezos_base.TzPervasives.Operation_hash.t
* Prevalidator_classification.error_classification)
listContain the hash and new classification of any operations that had to be removed to make room for a newly added operation.
type add_result =
t
* protocol_operation Shell_operation.operation
* Prevalidator_classification.classification
* replacementsResult 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.
type partially_validated_operation =
(protocol_operation Shell_operation.operation
* (unit -> unit Tezos_base.TzPervasives.tzresult) list)
Tezos_base.TzPervasives.tzresultRepresents either:
val partial_op_validation :
t ->
protocol_operation Shell_operation.operation ->
partially_validated_operation Lwt.tRuns the protocol partial_op_validation but does not check the remaining pending checks. This aims to be used in pair with handle_partially_validated.
An operation that passed partial_op_validation and the pending checks resulting from this call.
val handle_partially_validated :
partially_validated_operation ->
(valid_operation, Prevalidator_classification.error_classification)
Tezos_base.TzPervasives.Result.tRun 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_resultval legacy_add_operation :
t ->
config ->
protocol_operation Shell_operation.operation ->
add_result Lwt.tTry 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 -> tRemove an operation from the state.
The state remains unchanged when the operation was not present (though not physically equal to the input state).
val get_context :
chain_store ->
predecessor:Tezos_store.Store.Block.t ->
timestamp:Tezos_base.Time.Protocol.t ->
Tezos_protocol_environment.Context.t Tezos_base.TzPervasives.tzresult Lwt.tGet the protocol context from the predecessor
module Internal_for_tests : sig ... end