@@ -354,13 +354,6 @@ blockCapacityAlonzoMeasure ledgerState =
354354 where
355355 pparams = getPParams $ tickedShelleyLedgerState ledgerState
356356
357- instance ( ShelleyCompatible p (BabbageEra c )
358- ) => TxLimits (ShelleyBlock p (BabbageEra c )) where
359-
360- type TxMeasure (ShelleyBlock p (BabbageEra c )) = AlonzoMeasure
361- txMeasure _cfg _st = txMeasureAlonzo
362- blockCapacityTxMeasure _cfg = blockCapacityAlonzoMeasure
363-
364357data ConwayMeasure = ConwayMeasure {
365358 alonzoMeasure :: ! AlonzoMeasure
366359 , refScriptsSize :: ! ByteSize
@@ -369,27 +362,50 @@ data ConwayMeasure = ConwayMeasure {
369362 deriving (Measure )
370363 via (InstantiatedAt Generic ConwayMeasure )
371364
365+ txMeasureConway ::
366+ forall proto era .
367+ ( ShelleyCompatible proto era
368+ , L. AlonzoEraTxWits era
369+ , L. BabbageEraTxBody era
370+ )
371+ => TickedLedgerState (ShelleyBlock proto era )
372+ -> GenTx (ShelleyBlock proto era ) -> ConwayMeasure
373+ txMeasureConway st tx@ (ShelleyTx _txid tx') =
374+ ConwayMeasure {
375+ alonzoMeasure = txMeasureAlonzo tx
376+ , refScriptsSize = ByteSize $ fromIntegral $
377+ SL. txNonDistinctRefScriptsSize utxo tx'
378+ }
379+ where
380+ utxo = SL. getUTxO . tickedShelleyLedgerState $ st
381+
382+ blockCapacityConwayMeasure ::
383+ forall proto era .
384+ (ShelleyCompatible proto era , L. AlonzoEraPParams era )
385+ => TickedLedgerState (ShelleyBlock proto era )
386+ -> ConwayMeasure
387+ blockCapacityConwayMeasure st =
388+ ConwayMeasure {
389+ alonzoMeasure = blockCapacityAlonzoMeasure st
390+ , refScriptsSize = ByteSize $ fromIntegral $
391+ -- For post-Conway eras, this will become a protocol parameter.
392+ SL. maxRefScriptSizePerBlock
393+ }
394+
372395instance HasByteSize ConwayMeasure where
373396 txMeasureByteSize = txMeasureByteSize . alonzoMeasure
374397
398+ -- | We anachronistically use 'ConwayMeasure' in Babbage.
399+ instance ( ShelleyCompatible p (BabbageEra c )
400+ ) => TxLimits (ShelleyBlock p (BabbageEra c )) where
401+
402+ type TxMeasure (ShelleyBlock p (BabbageEra c )) = ConwayMeasure
403+ txMeasure _cfg = txMeasureConway
404+ blockCapacityTxMeasure _cfg = blockCapacityConwayMeasure
405+
375406instance ( ShelleyCompatible p (ConwayEra c )
376407 ) => TxLimits (ShelleyBlock p (ConwayEra c )) where
377408
378409 type TxMeasure (ShelleyBlock p (ConwayEra c )) = ConwayMeasure
379-
380- txMeasure _cfg st tx@ (ShelleyTx _txid tx') =
381- ConwayMeasure {
382- alonzoMeasure = txMeasureAlonzo tx
383- , refScriptsSize = ByteSize $ fromIntegral $
384- SL. txNonDistinctRefScriptsSize utxo tx'
385- }
386- where
387- utxo = SL. getUTxO . tickedShelleyLedgerState $ st
388-
389- blockCapacityTxMeasure _cfg st =
390- ConwayMeasure {
391- alonzoMeasure = blockCapacityAlonzoMeasure st
392- , refScriptsSize = ByteSize $ fromIntegral $
393- -- For post-Conway eras, this will become a protocol parameter.
394- SL. maxRefScriptSizePerBlock
395- }
410+ txMeasure _cfg = txMeasureConway
411+ blockCapacityTxMeasure _cfg = blockCapacityConwayMeasure
0 commit comments