ouroboros-consensus- Consensus layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010



Limits on the ledger-specific _measure_ (eg size) of a sequence of transactions

import           Ouroboros.Consensus.Mempool.TxLimits (TxLimits)
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits


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 #


txMeasure :: Validated ( GenTx blk) -> TxMeasure blk Source #

What is the measure an individual tx?

txsBlockCapacity :: Ticked ( 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 Overrides 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.