@@ -39,7 +39,7 @@ module Ouroboros.Consensus.Shelley.Ledger.Mempool (
39
39
import qualified Cardano.Crypto.Hash as Hash
40
40
import qualified Cardano.Ledger.Allegra.Rules as AllegraEra
41
41
import Cardano.Ledger.Alonzo.Core (Tx , TxSeq , bodyTxL , eraProtVerLow ,
42
- fromTxSeq , ppMaxBBSizeL , ppMaxBlockExUnitsL , sizeTxF )
42
+ fromTxSeq , ppMaxBBSizeL , ppMaxBlockExUnitsL , sizeTxF , wireSizeTxF )
43
43
import qualified Cardano.Ledger.Alonzo.Rules as AlonzoEra
44
44
import Cardano.Ledger.Alonzo.Scripts (ExUnits , ExUnits' ,
45
45
pointWiseExUnits , unWrapExUnits )
@@ -146,6 +146,8 @@ instance (ShelleyCompatible proto era, TxLimits (ShelleyBlock proto era))
146
146
147
147
reapplyTx = reapplyShelleyTx
148
148
149
+ wireTxSize (ShelleyTx _ tx) = fromIntegral $ tx ^. wireSizeTxF
150
+
149
151
txForgetValidated (ShelleyValidatedTx txid vtx) = ShelleyTx txid (SL. extractTx vtx)
150
152
151
153
mkShelleyTx :: forall era proto . ShelleyBasedEra era => Tx era -> GenTx (ShelleyBlock proto era )
@@ -385,16 +387,19 @@ instance MaxTxSizeUTxO (ConwayEra c) where
385
387
386
388
instance ShelleyCompatible p (ShelleyEra c ) => TxLimits (ShelleyBlock p (ShelleyEra c )) where
387
389
type TxMeasure (ShelleyBlock p (ShelleyEra c )) = IgnoringOverflow ByteSize32
390
+ txWireSize (ShelleyTx _ tx) = fromIntegral (tx ^. wireSizeTxF)
388
391
txMeasure _cfg st tx = runValidation $ txInBlockSize st tx
389
392
blockCapacityTxMeasure _cfg = txsMaxBytes
390
393
391
394
instance ShelleyCompatible p (AllegraEra c ) => TxLimits (ShelleyBlock p (AllegraEra c )) where
392
395
type TxMeasure (ShelleyBlock p (AllegraEra c )) = IgnoringOverflow ByteSize32
396
+ txWireSize (ShelleyTx _ tx) = fromIntegral (tx ^. wireSizeTxF)
393
397
txMeasure _cfg st tx = runValidation $ txInBlockSize st tx
394
398
blockCapacityTxMeasure _cfg = txsMaxBytes
395
399
396
400
instance ShelleyCompatible p (MaryEra c ) => TxLimits (ShelleyBlock p (MaryEra c )) where
397
401
type TxMeasure (ShelleyBlock p (MaryEra c )) = IgnoringOverflow ByteSize32
402
+ txWireSize (ShelleyTx _ tx) = fromIntegral (tx ^. wireSizeTxF)
398
403
txMeasure _cfg st tx = runValidation $ txInBlockSize st tx
399
404
blockCapacityTxMeasure _cfg = txsMaxBytes
400
405
@@ -485,6 +490,7 @@ instance ( ShelleyCompatible p (AlonzoEra c)
485
490
) => TxLimits (ShelleyBlock p (AlonzoEra c )) where
486
491
487
492
type TxMeasure (ShelleyBlock p (AlonzoEra c )) = AlonzoMeasure
493
+ txWireSize (ShelleyTx _ tx) = fromIntegral (tx ^. wireSizeTxF)
488
494
txMeasure _cfg st tx = runValidation $ txMeasureAlonzo st tx
489
495
blockCapacityTxMeasure _cfg = blockCapacityAlonzoMeasure
490
496
@@ -582,12 +588,14 @@ instance ( ShelleyCompatible p (BabbageEra c)
582
588
) => TxLimits (ShelleyBlock p (BabbageEra c )) where
583
589
584
590
type TxMeasure (ShelleyBlock p (BabbageEra c )) = ConwayMeasure
591
+ txWireSize (ShelleyTx _ tx) = fromIntegral (tx ^. wireSizeTxF)
585
592
txMeasure _cfg st tx = runValidation $ txMeasureBabbage st tx
586
593
blockCapacityTxMeasure _cfg = blockCapacityConwayMeasure
587
594
588
595
instance ( ShelleyCompatible p (ConwayEra c )
589
596
) => TxLimits (ShelleyBlock p (ConwayEra c )) where
590
597
591
598
type TxMeasure (ShelleyBlock p (ConwayEra c )) = ConwayMeasure
599
+ txWireSize (ShelleyTx _ tx) = fromIntegral (tx ^. wireSizeTxF)
592
600
txMeasure _cfg st tx = runValidation $ txMeasureConway st tx
593
601
blockCapacityTxMeasure _cfg = blockCapacityConwayMeasure
0 commit comments