package octez-shell-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-shell-libs.shell/Tezos_shell/Prevalidation/Make/index.html
Module Prevalidation.Make
Source
How-to obtain an instance of this module's main module type: T
Parameters
module Proto : Tezos_validation.Protocol_plugin.T
Signature
Similar 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).
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
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.t
Create 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.t
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
.
val pre_filter :
t ->
config ->
protocol_operation Shell_operation.operation ->
[ `Passed_prefilter of Prevalidator_pending_operations.priority
| Prevalidator_classification.error_classification ]
Lwt.t
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)
list
Contain 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
* replacements
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
.
val 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.
Remove an operation from the state.
The state remains unchanged when the operation was not present (though not physically equal to the input state).