Tezos_protocol_plugin_alpha.Mempool
Plugin for the shell mempool. It must include the signature FILTER.Mempool
from lib_shell/shell_plugin.mli
.
Settings for the pre_filter
:
and for the conflict_handler
:
val default_config : config
Default parameters.
val config_encoding : config Tezos_base.TzPervasives.Data_encoding.t
Encoding for config
.
Static information needed by pre_filter
.
It depends on the head
block upon which a mempool is built.
val init :
Tezos_protocol_alpha.Environment.Context.t ->
head:Tezos_base.TzPervasives.Block_header.shell_header ->
(info, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t
Create an info
based on the head
block and the current context.
val flush :
info ->
head:Tezos_base.TzPervasives.Block_header.shell_header ->
info Tezos_base.TzPervasives.tzresult Lwt.t
val syntactic_check :
Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation ->
[ `Well_formed | `Ill_formed ] Lwt.t
Perform some syntactic checks on the operation.
To be used mostly as an exceptional mechanism to prevent ill-formed operations to block block application.
Should be called before the pre_filter
, does not need a context.
val pre_filter :
info ->
config ->
Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation ->
[ `Passed_prefilter of [ `High | `Medium | `Low of Q.t list ]
| `Branch_delayed of Tezos_base.TzPervasives.tztrace
| `Branch_refused of Tezos_base.TzPervasives.tztrace
| `Refused of Tezos_base.TzPervasives.tztrace
| `Outdated of Tezos_base.TzPervasives.tztrace ]
Lwt.t
Perform some preliminary checks on an operation.
For manager operations, check that its fee, fee/gas ratio, and fee/size ratio all meet the minimal requirements specified in the config
.
For consensus operations, check that it is possible for the operation to have been produced before now (plus additional time equal to the clock_drift
from config
, as a safety margin). Indeed, without this check, a baker could flood the network with consensus operations for any future rounds or levels. The ml file contains more detailled explanations with diagrams.
val conflict_handler :
config ->
Tezos_protocol_alpha.Protocol.Mempool.conflict_handler
Return a conflict handler for Protocol.Mempool.add_operation
(see Protocol.Mempool.conflict_handler
).
For non-manager operations, select the greater operation according to Protocol.Alpha_context.Operation.compare
.
A manager operation is replaced only when the new operation's fee and fee/gas ratio both exceed (or match) the old operation's metrics multiplied by the replace_by_fee
factor specified in the config
.
Precondition: both operations must be individually valid (to be able to call Protocol.Alpha_context.Operation.compare
).
module Conflict_map : sig ... end
The purpose of this module is to provide the fee_needed_to_replace_by_fee
function. For this function to be correct, the caller must maintain the state of type t
by calling update
on each successfully validated operation and its induced replacements.
val fee_needed_to_overtake :
op_to_overtake:Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation ->
candidate_op:Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation ->
int64 option
Compute the minimal fee (expressed in mutez) that candidate_op
would need to have in order to be strictly greater than op_to_overtake
according to Protocol.Alpha_context.Operation.compare
, when both operations are manager operations.
Return None
when at least one operation is not a manager operation.
Also return None
if both operations are manager operations but there was an error while computing the needed fee. However, note that this cannot happen when both manager operations have been successfully validated by the protocol.
The following type, encoding, and default values are exported for bin_sc_rollup_node/configuration.ml
.
val nanotez_enc : nanotez Tezos_base.TzPervasives.Data_encoding.t
Encoding for nanotez
.
val default_minimal_fees : Tezos_protocol_alpha.Protocol.Alpha_context.Tez.t
Minimal absolute fees in default_config
.
val default_minimal_nanotez_per_gas_unit : nanotez
Minimal fee over gas_limit ratio in default_config
.
val default_minimal_nanotez_per_byte : nanotez
Minimal fee over byte size ratio in default_config
.
val get_context :
Tezos_protocol_alpha.Environment.Context.t ->
head:Tezos_base.TzPervasives.Block_header.shell_header ->
ctxt Tezos_base.TzPervasives.tzresult Lwt.t
Return the protocol context
val sources_from_operation :
ctxt ->
Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation ->
Tezos_base.TzPervasives.Signature.public_key_hash list Lwt.t
Return the sources from the operation
module Internal_for_tests : sig ... end