@@ -33,6 +33,7 @@ module Ouroboros.Consensus.Shelley.Ledger.Mempool
33
33
-- * Exported for tests
34
34
, AlonzoMeasure (.. )
35
35
, ConwayMeasure (.. )
36
+ , DijkstraMeasure (.. )
36
37
, fromExUnits
37
38
) where
38
39
@@ -628,6 +629,41 @@ instance
628
629
629
630
-----
630
631
632
+ newtype DijkstraMeasure = DijkstraMeasure
633
+ { conwayMeasure :: ConwayMeasure
634
+ }
635
+ deriving stock (Eq , Generic , Show )
636
+ deriving anyclass NoThunks
637
+ deriving newtype (Semigroup , Monoid , HasByteSize , TxMeasureMetrics )
638
+ deriving
639
+ Measure
640
+ via (InstantiatedAt Generic DijkstraMeasure )
641
+
642
+ blockCapacityDijkstraMeasure ::
643
+ forall proto era mk .
644
+ ( ShelleyCompatible proto era
645
+ , L. AlonzoEraPParams era
646
+ ) =>
647
+ TickedLedgerState (ShelleyBlock proto era ) mk ->
648
+ DijkstraMeasure
649
+ blockCapacityDijkstraMeasure = DijkstraMeasure . blockCapacityConwayMeasure
650
+
651
+ txMeasureDijkstra ::
652
+ forall proto era .
653
+ ( ShelleyCompatible proto era
654
+ , L. AlonzoEraTxWits era
655
+ , L. BabbageEraTxBody era
656
+ , ExUnitsTooBigUTxO era
657
+ , MaxTxSizeUTxO era
658
+ , TxRefScriptsSizeTooBig era
659
+ ) =>
660
+ TickedLedgerState (ShelleyBlock proto era ) ValuesMK ->
661
+ GenTx (ShelleyBlock proto era ) ->
662
+ V. Validation (TxErrorSG era ) DijkstraMeasure
663
+ txMeasureDijkstra st tx = DijkstraMeasure <$> txMeasureConway st tx -- TODO(geo2a): eta-reduce
664
+
665
+ -----
666
+
631
667
data ConwayMeasure = ConwayMeasure
632
668
{ alonzoMeasure :: ! AlonzoMeasure
633
669
, refScriptsSize :: ! (IgnoringOverflow ByteSize32 )
@@ -769,6 +805,6 @@ instance
769
805
ShelleyCompatible p DijkstraEra =>
770
806
TxLimits (ShelleyBlock p DijkstraEra )
771
807
where
772
- type TxMeasure (ShelleyBlock p DijkstraEra ) = ConwayMeasure
773
- txMeasure _cfg st tx = runValidation $ txMeasureConway st tx
774
- blockCapacityTxMeasure _cfg = blockCapacityConwayMeasure
808
+ type TxMeasure (ShelleyBlock p DijkstraEra ) = DijkstraMeasure
809
+ txMeasure _cfg st tx = runValidation $ txMeasureDijkstra st tx
810
+ blockCapacityTxMeasure _cfg = blockCapacityDijkstraMeasure
0 commit comments