Skip to content

Commit fddb735

Browse files
committed
txMeasure: add TickedLedgerState argument
1 parent ed92af2 commit fddb735

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Breaking
2+
3+
- Added `TickedLedgerState` argument to `txMeasure`.

ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Ledger/Mempool.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ import Ouroboros.Consensus.Util.Condense
8181

8282
instance TxLimits ByronBlock where
8383
type TxMeasure ByronBlock = ByteSize
84-
txMeasure = ByteSize . txInBlockSize . txForgetValidated
84+
txMeasure _st = ByteSize . txInBlockSize . txForgetValidated
8585
txsBlockCapacity = ByteSize . txsMaxBytes
8686

8787
{-------------------------------------------------------------------------------

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,25 +295,25 @@ theLedgerLens f x =
295295

296296
instance ShelleyCompatible p (ShelleyEra c) => Mempool.TxLimits (ShelleyBlock p (ShelleyEra c)) where
297297
type TxMeasure (ShelleyBlock p (ShelleyEra c)) = Mempool.ByteSize
298-
txMeasure = Mempool.ByteSize . txInBlockSize . txForgetValidated
298+
txMeasure _st = Mempool.ByteSize . txInBlockSize . txForgetValidated
299299
txsBlockCapacity = Mempool.ByteSize . txsMaxBytes
300300

301301
instance ShelleyCompatible p (AllegraEra c) => Mempool.TxLimits (ShelleyBlock p (AllegraEra c)) where
302302
type TxMeasure (ShelleyBlock p (AllegraEra c)) = Mempool.ByteSize
303-
txMeasure = Mempool.ByteSize . txInBlockSize . txForgetValidated
303+
txMeasure _st = Mempool.ByteSize . txInBlockSize . txForgetValidated
304304
txsBlockCapacity = Mempool.ByteSize . txsMaxBytes
305305

306306
instance ShelleyCompatible p (MaryEra c) => Mempool.TxLimits (ShelleyBlock p (MaryEra c)) where
307307
type TxMeasure (ShelleyBlock p (MaryEra c)) = Mempool.ByteSize
308-
txMeasure = Mempool.ByteSize . txInBlockSize . txForgetValidated
308+
txMeasure _st = Mempool.ByteSize . txInBlockSize . txForgetValidated
309309
txsBlockCapacity = Mempool.ByteSize . txsMaxBytes
310310

311311
instance ( ShelleyCompatible p (AlonzoEra c)
312312
) => Mempool.TxLimits (ShelleyBlock p (AlonzoEra c)) where
313313

314314
type TxMeasure (ShelleyBlock p (AlonzoEra c)) = AlonzoMeasure
315315

316-
txMeasure (ShelleyValidatedTx _txid vtx) =
316+
txMeasure _st (ShelleyValidatedTx _txid vtx) =
317317
AlonzoMeasure {
318318
byteSize = Mempool.ByteSize $ txInBlockSize (mkShelleyTx @(AlonzoEra c) @p (SL.extractTx vtx))
319319
, exUnits = fromExUnits $ totExUnits (SL.extractTx vtx)
@@ -342,7 +342,7 @@ instance ( ShelleyCompatible p (BabbageEra c)
342342

343343
type TxMeasure (ShelleyBlock p (BabbageEra c)) = AlonzoMeasure
344344

345-
txMeasure (ShelleyValidatedTx _txid vtx) =
345+
txMeasure _st (ShelleyValidatedTx _txid vtx) =
346346
AlonzoMeasure {
347347
byteSize = Mempool.ByteSize $ txInBlockSize (mkShelleyTx @(BabbageEra c) @p (SL.extractTx vtx))
348348
, exUnits = fromExUnits $ totExUnits (SL.extractTx vtx)
@@ -361,7 +361,7 @@ instance ( ShelleyCompatible p (ConwayEra c)
361361

362362
type TxMeasure (ShelleyBlock p (ConwayEra c)) = AlonzoMeasure
363363

364-
txMeasure (ShelleyValidatedTx _txid vtx) =
364+
txMeasure _st (ShelleyValidatedTx _txid vtx) =
365365
AlonzoMeasure {
366366
byteSize = Mempool.ByteSize $ txInBlockSize (mkShelleyTx @(ConwayEra c) @p (SL.extractTx vtx))
367367
, exUnits = fromExUnits $ totExUnits (SL.extractTx vtx)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Breaking
2+
3+
- Added `TickedLedgerState` argument to `txMeasure`.

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block/Forging.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ takeLargestPrefixThatFits ::
165165
-> [Validated (GenTx blk)]
166166
-> [Validated (GenTx blk)]
167167
takeLargestPrefixThatFits overrides ledger txs =
168-
Measure.take MempoolCapacity.txMeasure capacity txs
168+
Measure.take (MempoolCapacity.txMeasure ledger) capacity txs
169169
where
170170
capacity =
171171
MempoolCapacity.applyOverrides

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Mempool/Capacity.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ class BoundedMeasure (TxMeasure blk) => TxLimits blk where
120120
type TxMeasure blk
121121

122122
-- | What is the measure an individual tx?
123-
txMeasure :: Validated (GenTx blk) -> TxMeasure blk
123+
txMeasure ::
124+
TickedLedgerState blk
125+
-> Validated (GenTx blk)
126+
-> TxMeasure blk
124127

125128
-- | What is the allowed capacity for txs in an individual block?
126129
txsBlockCapacity :: Ticked (LedgerState blk) -> TxMeasure blk

0 commit comments

Comments
 (0)