Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
-
newtype
ByteSize
=
ByteSize
{
- unByteSize :: Word32
-
class
BoundedMeasure
(
TxMeasure
blk) =>
TxLimits
blk
where
- type TxMeasure blk
- txMeasure :: Validated ( GenTx blk) -> TxMeasure blk
- txsBlockCapacity :: Ticked ( LedgerState blk) -> TxMeasure blk
- (<=) :: Measure a => a -> a -> Bool
- data Overrides blk
- applyOverrides :: TxLimits blk => Overrides blk -> TxMeasure blk -> TxMeasure blk
- getOverrides :: Overrides blk -> TxMeasure blk
- mkOverrides :: TxMeasure blk -> Overrides blk
- noOverridesMeasure :: BoundedMeasure a => a
Documentation
Constructors
ByteSize | |
Fields
|
Instances
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.
(<=) :: 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
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.
applyOverrides :: TxLimits blk => Overrides blk -> TxMeasure blk -> TxMeasure blk Source #
Apply the override
getOverrides :: Overrides blk -> TxMeasure blk Source #
noOverridesMeasure :: BoundedMeasure a => a Source #
applyOverrides
noOverrides
m = m