ouroboros-consensus-0.18.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Mempool.Capacity

Description

Mempool capacity, size and transaction size datatypes.

This module also defines how to manually override the mempool capacity.

import           Ouroboros.Consensus.Mempool.Capacity (Capacity)
import qualified Ouroboros.Consensus.Mempool.Capacity as Capacity
Synopsis

Mempool capacity

data MempoolCapacityBytesOverride Source #

An override for the default MempoolCapacityBytes which is 2x the maximum transaction capacity

Constructors

NoMempoolCapacityBytesOverride

Use 2x the maximum transaction capacity of a block. This will change dynamically with the protocol parameters adopted in the current ledger.

MempoolCapacityBytesOverride !MempoolCapacityBytes

Use the following MempoolCapacityBytes.

computeMempoolCapacityLedgerSupportsMempool blk ⇒ TickedLedgerState blk → MempoolCapacityBytesOverrideMempoolCapacityBytes Source #

If no override is provided, calculate the default mempool capacity as 2x the current ledger's maximum transaction capacity of a block.

mkCapacityBytesOverrideWord32MempoolCapacityBytesOverride Source #

Create an override for the mempool capacity using the provided number of bytes.

Mempool Size

data MempoolSize Source #

The size of a mempool.

Constructors

MempoolSize 

Fields

Transaction size

newtype ByteSize Source #

Constructors

ByteSize 

Fields

class BoundedMeasure (TxMeasure blk) ⇒ TxLimits blk where Source #

Each block has its limits of how many transactions it can hold. That limit is compared against the sum of measurements taken of each of the transactions in that block.

How we measure the transaction depends of the era that this transaction belongs to (more specifically it depends on the block type to which this transaction will be added). For initial eras (like Byron and initial generations of Shelley based eras) this measure was simply a ByteSize (block could not be bigger then given size - in bytes - specified by the ledger state). In future eras (starting with Alonzo) this measure was a bit more complex as it had to take other factors into account (like execution units). For details please see the individual instances for the TxLimits.

Associated Types

type TxMeasure blk Source #

Methods

txMeasureValidated (GenTx blk) → TxMeasure blk Source #

What is the measure an individual tx?

txsBlockCapacityTicked (LedgerState blk) → TxMeasure blk Source #

What is the allowed capacity for txs in an individual block?

(<=)Measure a ⇒ a → a → Bool Source #

Is every component of the first value less-than-or-equal-to the corresponding component of the second value?

Restricting more strongly than the ledger's limits

data TxOverrides blk Source #

An override that lowers a capacity limit

Specifically, we use this override to let the node operator limit the total TxMeasure of transactions in blocks even more severely than would the ledger state's txsBlockCapacity. The forge logic will use the min (ie the lattice's meet operator) to combine this override with the capacity given by the ledger state. More concretely, that will typically be a componentwise minimum operation, along each of the components/dimensions of TxMeasure blk.

This newtype wrapper distinguishes the intention of this particular TxMeasure as such an override. We use TxMeasure in different ways in this code base. The newtype also allows us to distinguish the one most appropriate monoid among many offered by the TxLimits superclass constraints: it is the monoid induced by the bounded meet-semilattice (see BoundedMeasure) that is relevant to the notion of overriding the ledger's block capacity.

Instances

Instances details
TxLimits blk ⇒ Monoid (TxOverrides blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.Capacity

Methods

memptyTxOverrides blk #

mappendTxOverrides blk → TxOverrides blk → TxOverrides blk #

mconcat ∷ [TxOverrides blk] → TxOverrides blk #

TxLimits blk ⇒ Semigroup (TxOverrides blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.Capacity

Methods

(<>)TxOverrides blk → TxOverrides blk → TxOverrides blk #

sconcatNonEmpty (TxOverrides blk) → TxOverrides blk #

stimesIntegral b ⇒ b → TxOverrides blk → TxOverrides blk #

applyOverridesTxLimits blk ⇒ TxOverrides blk → TxMeasure blk → TxMeasure blk Source #

Apply the override

mkOverridesTxMeasure blk → TxOverrides blk Source #

Smart constructor for Overrides.