Mavryk_protocol_plugin_001_PtAtLas.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.
Static information needed by pre_filter
.
It depends on the head
block upon which a mempool is built.
val init :
Mavryk_protocol_001_PtAtLas.Environment.Context.t ->
head:Mavryk_base.TzPervasives.Block_header.shell_header ->
(info, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t
Create an info
based on the head
block and the current context.
val flush :
info ->
head:Mavryk_base.TzPervasives.Block_header.shell_header ->
info Mavryk_base.TzPervasives.tzresult Lwt.t
val syntactic_check :
Mavryk_protocol_001_PtAtLas.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 ->
Mavryk_protocol_001_PtAtLas.Protocol.Alpha_context.packed_operation ->
[ `Passed_prefilter of [ `High | `Medium | `Low of Q.t list ]
| `Branch_delayed of Mavryk_base.TzPervasives.tztrace
| `Branch_refused of Mavryk_base.TzPervasives.tztrace
| `Refused of Mavryk_base.TzPervasives.tztrace
| `Outdated of Mavryk_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 ->
Mavryk_protocol_001_PtAtLas.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:
Mavryk_protocol_001_PtAtLas.Protocol.Alpha_context.packed_operation ->
candidate_op:
Mavryk_protocol_001_PtAtLas.Protocol.Alpha_context.packed_operation ->
int64 option
Compute the minimal fee (expressed in mumav) 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 default_minimal_fees :
Mavryk_protocol_001_PtAtLas.Protocol.Alpha_context.Tez.t
Minimal absolute fees in default_config
.
val default_minimal_nanomav_per_gas_unit : nanomav
Minimal fee over gas_limit ratio in default_config
.
val default_minimal_nanomav_per_byte : nanomav
Minimal fee over byte size ratio in default_config
.
module Internal_for_tests : sig ... end