package octez-shell-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Build a mempool bounding module.

Parameters

Signature

type state

Internal overview of all the valid operations present in the mempool.

val empty : state

Empty state containing no operations.

type protocol_operation = Proto.operation

Type Tezos_protocol_environment.PROTOCOL.operation.

Try and add an operation to the state.

When the state is not full (i.e. adding the operation does not break the max_operations nor the max_total_bytes limits), return the updated state and an empty list.

When the state is full, return either:

  • an updated state and a list of replaced operations, which are all smaller than the new operation (according to the protocol's compare_operations function) and have been removed from the state to make room for the new operation, or
  • an Error when it is not possible to make room for the new operation by removing only operations that are smaller than it. In that case, the error contains op_to_overtake, that is, the smallest operation such that if the new operation were greater than op_to_overtake according to compare_operations (but with an unchanged byte size), then it could be successfully added to the state. The Error can only contain None when no matter how the new operation compares to others, it can never be added, ie. the new operation has a bigger size than config.max_total_bytes by itself.

When the operation is already present in the state, do nothing i.e. return the unchanged state and an empty replacement list.

Precondition: the operation has been validated by the protocol in some context (otherwise calling the protocol's compare_operations function on it may fail).

Remove the operation from the state.

Do nothing if the operation was not in the state (the returned state is then physically equal to the input state).

OCaml

Innovation. Community. Security.