package octez-shell-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13
doc/octez-shell-libs.shell/Tezos_shell/Prevalidator/index.html
Module Tezos_shell.Prevalidator
Source
Tezos Shell - Prevalidation of pending operations (a.k.a Mempool)
The prevalidator is the worker in charge of the mempool
, that is, the operations that are not yet included in a block. It keeps track of which operations are valid (according to the economic protocol), maybe-valid-later, or invalid. The prevalidator is also responsible for deciding which operations are appropriate to broadcast to peers.
Before including an operation into the mempool, the prevalidator performs a few preliminary checks: unparsable
operations are noted down so that they will never be considered again; already handled operations or operations that are not branched on any live_block
are simply ignored; operations which do not meet some configurable requirements (e.g. minimal fees) are refused
at this point.
If the operation passes these preliminary checks, the prevalidator then asks the protocol to validate the operation in its maintained mempool context. Only an operation that passes this validation gets added to the mempool context and broadcast. If the operation is flat-out refused
by the protocol, it is noted down to be ignored by the node from now on. If the operation is only branch_refused
or branch_delayed
, it is kept for later: it may be evaluated again in the future when the mempool's head (a.k.a. the last block it is built on) changes, then added to the mempool and broadcast if it passes this new validation.
See the prevalidator implementation overview to learn more.
An (abstract) prevalidator context. Separate prevalidator contexts should be used for separate chains (e.g., mainchain vs testchain).
val create :
Tezos_shell_services.Shell_limits.prevalidator_limits ->
(module Tezos_validation.Protocol_plugin.T) ->
Distributed_db.chain_db ->
t Tezos_base.TzPervasives.tzresult Lwt.t
Creates/tear-down a new prevalidator context.
Notify the prevalidator that the identified peer has sent a bunch of operations relevant to the specified context.
val inject_operation :
t ->
force:bool ->
Tezos_base.Operation.t ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
inject_operation t ~force op
notifies the prevalidator worker of a new injected operation. If force
is set to true
the operation is injected without any check. force
should be used for test purpose only.
val flush :
t ->
Tezos_shell_services.Chain_validator_worker_state.update ->
Tezos_base.TzPervasives.Block_hash.t ->
Tezos_base.TzPervasives.Block_hash.Set.t ->
Tezos_base.TzPervasives.Operation_hash.Set.t ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
Notify the prevalidator that a new head has been selected. update
is used as an optimisation to know which operations previously classified require to be prevalidated again.
val running_workers :
unit ->
(Tezos_base.TzPervasives.Chain_id.t
* Tezos_base.TzPervasives.Protocol_hash.t
* t)
list
Returns the list of prevalidation contexts running and their associated chain
Worker status and events
val pending_requests :
t ->
(Tezos_base.Time.System.t
* Tezos_shell_services.Prevalidator_worker_state.Request.view)
list
val current_request :
t ->
(Tezos_base.Time.System.t
* Tezos_base.Time.System.t
* Tezos_shell_services.Prevalidator_worker_state.Request.view)
option