Module Mavryk_protocol_plugin_alpha.Mempool

Plugin for the shell mempool. It must include the signature FILTER.Mempool from lib_shell/shell_plugin.mli.

type config

Settings for the pre_filter:

  • minimal fees to accept an operation (absolute, relative to the gas limit, and relative to the byte size)
  • clock drift for the prefiltering of consensus operations

and for the conflict_handler:

  • replacement factor, that is, how much better a new manager operation needs to be, in terms of both absolute fees and fee/gas ratios, in order to replace an old conflicting manager operation.
val default_config : config

Default parameters.

val config_encoding : config Mavryk_base.TzPervasives.Data_encoding.t

Encoding for config.

type info

Static information needed by pre_filter.

It depends on the head block upon which a mempool is built.

Create an info based on the head block and the current context.

Create a new info based on the head block.

Parts of the old info (which may have been built on a different block) are recycled, so that this function is more efficient than init and does not need an Environment.Context.t argument.

val syntactic_check : Mavryk_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 -> Mavryk_protocol_alpha.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.

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.

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.

type nanomav = Q.t

An amount of fees in nanomav.

val nanomav_enc : nanomav Mavryk_base.TzPervasives.Data_encoding.t

Encoding for nanomav.

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