File tree Expand file tree Collapse file tree 6 files changed +32
-22
lines changed
plutus-ledger-api/testlib/PlutusLedgerApi/Test Expand file tree Collapse file tree 6 files changed +32
-22
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,15 @@ import PlutusPrelude
1616
1717import Data.Int (Int64 )
1818import Data.Map qualified as Map
19- import Data.Maybe
19+ import GHC.Stack ( HasCallStack )
2020
2121-- | Example values of costs for @PlutusV1@, in expected ledger order.
2222-- Suitable to be used in testing.
23- costModelParamsForTesting :: [(V1. ParamName , Int64 )]
24- costModelParamsForTesting = Map. toList $ fromJust $
25- Common. extractCostModelParamsLedgerOrder mCostModel
23+ costModelParamsForTesting :: HasCallStack => [(V1. ParamName , Int64 )]
24+ costModelParamsForTesting =
25+ case Common. extractCostModelParamsLedgerOrder mCostModel of
26+ Nothing -> error " extractCostModelParamsLedgerOrder (V1): nothing extracted"
27+ Just xs -> Map. toList xs
2628
2729-- | The PlutusV1 "cost model" is constructed by the v2 "cost model", by clearing v2 introductions.
2830mCostModel :: MCostModel
Original file line number Diff line number Diff line change @@ -16,13 +16,15 @@ import PlutusPrelude
1616
1717import Data.Int (Int64 )
1818import Data.Map qualified as Map
19- import Data.Maybe
19+ import GHC.Stack ( HasCallStack )
2020
2121-- | Example values of costs for @PlutusV1@, in expected ledger order.
2222-- Suitable to be used in testing.
23- costModelParamsForTesting :: [(V1. ParamName , Int64 )]
24- costModelParamsForTesting = Map. toList $ fromJust $
25- Common. extractCostModelParamsLedgerOrder mCostModel
23+ costModelParamsForTesting :: HasCallStack => [(V1. ParamName , Int64 )]
24+ costModelParamsForTesting =
25+ case Common. extractCostModelParamsLedgerOrder mCostModel of
26+ Nothing -> error " extractCostModelParamsLedgerOrder (V1): nothing extracted"
27+ Just xs -> Map. toList xs
2628
2729-- | The PlutusV1 "cost model" is constructed by the v2 "cost model", by clearing v2 introductions.
2830mCostModel :: MCostModel
Original file line number Diff line number Diff line change @@ -18,13 +18,15 @@ import PlutusPrelude
1818
1919import Data.Int (Int64 )
2020import Data.Map qualified as Map
21- import Data.Maybe
21+ import GHC.Stack ( HasCallStack )
2222
2323-- | Example values of costs for @PlutusV2@, in expected ledger order.
2424-- Suitable to be used in testing.
25- costModelParamsForTesting :: [(V2. ParamName , Int64 )]
26- costModelParamsForTesting = Map. toList $ fromJust $
27- Common. extractCostModelParamsLedgerOrder mCostModel
25+ costModelParamsForTesting :: HasCallStack => [(V2. ParamName , Int64 )]
26+ costModelParamsForTesting =
27+ case Common. extractCostModelParamsLedgerOrder mCostModel of
28+ Nothing -> error " extractCostModelParamsLedgerOrder (V2): nothing extracted"
29+ Just xs -> Map. toList xs
2830
2931-- | The PlutusV2 "cost model" is constructed by the v3 "cost model", by clearing v3 introductions.
3032mCostModel :: MCostModel
Original file line number Diff line number Diff line change @@ -18,13 +18,15 @@ import PlutusPrelude
1818
1919import Data.Int (Int64 )
2020import Data.Map qualified as Map
21- import Data.Maybe
21+ import GHC.Stack ( HasCallStack )
2222
2323-- | Example values of costs for @PlutusV2@, in expected ledger order.
2424-- Suitable to be used in testing.
25- costModelParamsForTesting :: [(V2. ParamName , Int64 )]
26- costModelParamsForTesting = Map. toList $ fromJust $
27- Common. extractCostModelParamsLedgerOrder mCostModel
25+ costModelParamsForTesting :: HasCallStack => [(V2. ParamName , Int64 )]
26+ costModelParamsForTesting =
27+ case Common. extractCostModelParamsLedgerOrder mCostModel of
28+ Nothing -> error " extractCostModelParamsLedgerOrder (V2): nothing extracted"
29+ Just xs -> Map. toList xs
2830
2931-- | The PlutusV2 "cost model" is constructed by the v3 "cost model", by clearing v3 introductions.
3032mCostModel :: MCostModel
Original file line number Diff line number Diff line change @@ -17,14 +17,15 @@ import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts
1717
1818import Data.Int (Int64 )
1919import Data.Map qualified as Map
20- import Data.Maybe
2120import GHC.Stack (HasCallStack )
2221
2322-- | Example values of costs for @PlutusV3@, in expected ledger order.
2423-- Suitable to be used in testing.
2524costModelParamsForTesting :: HasCallStack => [(V3. ParamName , Int64 )]
26- costModelParamsForTesting = Map. toList $ fromJust $
27- Common. extractCostModelParamsLedgerOrder mCostModel
25+ costModelParamsForTesting =
26+ case Common. extractCostModelParamsLedgerOrder mCostModel of
27+ Nothing -> error " extractCostModelParamsLedgerOrder (V3): nothing extracted"
28+ Just xs -> Map. toList xs
2829
2930-- | The PlutusV3 "cost model" is constructed by the v4 "cost model", by clearing v4 introductions.
3031mCostModel :: MCostModel
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts
1818
1919import Data.Int (Int64 )
2020import Data.Map qualified as Map
21- import Data.Maybe
2221import GHC.Stack (HasCallStack )
2322
2423
@@ -29,8 +28,10 @@ import GHC.Stack (HasCallStack)
2928-- | Example values of costs for @PlutusV3@, in expected ledger order.
3029-- Suitable to be used in testing.
3130costModelParamsForTesting :: HasCallStack => [(V3. ParamName , Int64 )]
32- costModelParamsForTesting = Map. toList $ fromJust $
33- Common. extractCostModelParamsLedgerOrder mCostModel
31+ costModelParamsForTesting =
32+ case Common. extractCostModelParamsLedgerOrder mCostModel of
33+ Nothing -> error " extractCostModelParamsLedgerOrder (V3): nothing extracted"
34+ Just xs -> Map. toList xs
3435
3536-- | The PlutusV3 "cost model" is constructed by the v4 "cost model", by clearing v4 introductions.
3637mCostModel :: MCostModel
You can’t perform that action at this time.
0 commit comments