Prevalidation.MakeSourceHow-to obtain an instance of this module's main module type: T
module Filter : Shell_plugin.FILTERSimilar to the same type in the protocol, see Tezos_protocol_environment.PROTOCOL.operation
Similar to the same type in the protocol, see Tezos_protocol_environment.PROTOCOL
The 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 filter 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 ->
filter_config ->
protocol_operation Shell_operation.operation ->
[ `Passed_prefilter of Prevalidator_pending_operations.priority
| Prevalidator_classification.error_classification ]
Lwt.tLight preliminary checks that should be performed on arrival of an operation and after a flush of the prevalidator.
See Shell_plugin.FILTER.Mempool.pre_filter.
type replacement =
(Tezos_base.TzPervasives.Operation_hash.t
* Prevalidator_classification.error_classification)
optionIf an old operation has been replaced by a newly added operation, then this type contains its hash and its new classification. If there is no replaced operation, this is None.
type add_result =
t
* protocol_operation Shell_operation.operation
* Prevalidator_classification.classification
* replacementResult of add_operation.
Contain the updated (or unchanged) state t, the operation (in which count_successful_prechecks has been incremented if appropriate), its classification, and the potential replacement.
Invariant: replacement can only be Some _ when the classification is `Prechecked.
val add_operation :
t ->
filter_config ->
protocol_operation Shell_operation.operation ->
add_result Lwt.tCall the protocol Mempool.add_operation function, providing it with the conflict_handler from the plugin.
Then if the protocol accepts the operation, call the plugin add_operation_and_enforce_mempool_bound, which is responsible for bounding the number of manager operations in the mempool.
See add_result for a description of the output.
Remove an operation from the state.
The state remains unchanged when the operation was not present.