ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Mempool.TxLimits

Description

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
Synopsis

Documentation

newtype ByteSize Source #

Constructors

ByteSize 

Fields

Instances

Instances details
Eq ByteSize Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.TxLimits

Ord ByteSize Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.TxLimits

Show ByteSize Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.TxLimits

BoundedMeasure ByteSize Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.TxLimits

Methods

maxBoundByteSize

Measure ByteSize Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.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 #

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 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.

Instances

Instances details
TxLimits blk ⇒ Semigroup (Overrides blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.TxLimits

Methods

(<>)Overrides blk → Overrides blk → Overrides blk Source #

sconcatNonEmpty (Overrides blk) → Overrides blk Source #

stimesIntegral b ⇒ b → Overrides blk → Overrides blk Source #

TxLimits blk ⇒ Monoid (Overrides blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Mempool.TxLimits

Methods

memptyOverrides blk Source #

mappendOverrides blk → Overrides blk → Overrides blk Source #

mconcat ∷ [Overrides blk] → Overrides blk Source #

applyOverridesTxLimits blk ⇒ Overrides blk → TxMeasure blk → TxMeasure blk Source #

Apply the override

mkOverridesTxMeasure blk → Overrides blk Source #

Smart constructor for Overrides.

noOverridesMeasure ∷ BoundedMeasure a ⇒ a Source #

applyOverrides noOverrides m = m