From 19d137e8e07a2005b374ea63b096b29352fdc206 Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Mon, 16 Dec 2024 13:52:51 +0100 Subject: [PATCH] chore: remove extra braces and pragmas, add HasCallStack --- .../PlutusLedgerApi/Test/Common/EvaluationContext.hs | 1 - .../PlutusLedgerApi/Test/V3/Data/EvaluationContext.hs | 8 ++++++-- .../testlib/PlutusLedgerApi/Test/V3/EvaluationContext.hs | 8 ++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plutus-ledger-api/testlib/PlutusLedgerApi/Test/Common/EvaluationContext.hs b/plutus-ledger-api/testlib/PlutusLedgerApi/Test/Common/EvaluationContext.hs index 73c4ee9d948..10eeb3c1ec1 100644 --- a/plutus-ledger-api/testlib/PlutusLedgerApi/Test/Common/EvaluationContext.hs +++ b/plutus-ledger-api/testlib/PlutusLedgerApi/Test/Common/EvaluationContext.hs @@ -1,6 +1,5 @@ {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} module PlutusLedgerApi.Test.Common.EvaluationContext ( MCostModel , MCekMachineCosts diff --git a/plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/Data/EvaluationContext.hs b/plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/Data/EvaluationContext.hs index 0849ba62a39..cd78c295d09 100644 --- a/plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/Data/EvaluationContext.hs +++ b/plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/Data/EvaluationContext.hs @@ -18,10 +18,11 @@ import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts import Data.Int (Int64) import Data.Map qualified as Map import Data.Maybe +import GHC.Stack (HasCallStack) -- | Example values of costs for @PlutusV3@, in expected ledger order. -- Suitable to be used in testing. -costModelParamsForTesting :: [(V3.ParamName, Int64)] +costModelParamsForTesting :: HasCallStack => [(V3.ParamName, Int64)] costModelParamsForTesting = Map.toList $ fromJust $ Common.extractCostModelParamsLedgerOrder mCostModel @@ -29,7 +30,7 @@ costModelParamsForTesting = Map.toList $ fromJust $ mCostModel :: MCostModel mCostModel = -- nothing to clear because v4 does not exist (yet). - (toMCostModel defaultCekCostModelForTesting) & builtinCostModel %~ clearBuiltinCostModel' + toMCostModel defaultCekCostModelForTesting & builtinCostModel %~ clearBuiltinCostModel' {- | Assign to `mempty` those CEK constructs that @PlutusV3@ introduces (indirectly by introducing a ledger language version with those CEK constructs). @@ -84,6 +85,9 @@ clearBuiltinCostModel r = r , paramFindFirstSetBit = mempty , paramRipemd_160 = mempty , paramExpModInteger = mempty + , paramLengthArray = mempty + , paramListToArray = mempty + , paramIndexArray = mempty } diff --git a/plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/EvaluationContext.hs b/plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/EvaluationContext.hs index 21529c32bb0..c5eadb16a39 100644 --- a/plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/EvaluationContext.hs +++ b/plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/EvaluationContext.hs @@ -19,10 +19,11 @@ import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts import Data.Int (Int64) import Data.Map qualified as Map import Data.Maybe +import GHC.Stack (HasCallStack) -- | Example values of costs for @PlutusV3@, in expected ledger order. -- Suitable to be used in testing. -costModelParamsForTesting :: [(V3.ParamName, Int64)] +costModelParamsForTesting :: HasCallStack => [(V3.ParamName, Int64)] costModelParamsForTesting = Map.toList $ fromJust $ Common.extractCostModelParamsLedgerOrder mCostModel @@ -30,7 +31,7 @@ costModelParamsForTesting = Map.toList $ fromJust $ mCostModel :: MCostModel mCostModel = -- nothing to clear because v4 does not exist (yet). - (toMCostModel defaultCekCostModelForTesting) & builtinCostModel %~ clearBuiltinCostModel' + toMCostModel defaultCekCostModelForTesting & builtinCostModel %~ clearBuiltinCostModel' {- | Assign to `mempty` those CEK constructs that @PlutusV3@ introduces (indirectly by introducing a ledger language version with those CEK constructs). @@ -85,6 +86,9 @@ clearBuiltinCostModel r = r , paramFindFirstSetBit = mempty , paramRipemd_160 = mempty , paramExpModInteger = mempty + , paramLengthArray = mempty + , paramListToArray = mempty + , paramIndexArray = mempty }