{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
module PlutusLedgerApi.Test.V4.EvaluationContext
( costModelParamsForTesting
, mCostModel
, clearMachineCostModel
, clearBuiltinCostModel
) where
import PlutusCore.Evaluation.Machine.ExBudgetingDefaults
import PlutusLedgerApi.Test.Common.EvaluationContext as Common
import PlutusLedgerApi.V4 qualified as V4
import Data.Int (Int64)
import Data.Map qualified as Map
import GHC.Stack (HasCallStack)
costModelParamsForTesting :: HasCallStack => [(V4.ParamName, Int64)]
costModelParamsForTesting :: HasCallStack => [(ParamName, Int64)]
costModelParamsForTesting =
case MCostModel -> Maybe (Map ParamName Int64)
forall p.
(IsParamName p, Ord p) =>
MCostModel -> Maybe (Map p Int64)
Common.extractCostModelParamsLedgerOrder MCostModel
mCostModel of
Maybe (Map ParamName Int64)
Nothing -> [Char] -> [(ParamName, Int64)]
forall a. HasCallStack => [Char] -> a
error [Char]
"extractCostModelParamsLedgerOrder (V4): nothing extracted"
Just Map ParamName Int64
xs -> Map ParamName Int64 -> [(ParamName, Int64)]
forall k a. Map k a -> [(k, a)]
Map.toList Map ParamName Int64
xs
mCostModel :: MCostModel
mCostModel :: MCostModel
mCostModel = CostModel CekMachineCosts BuiltinCostModel -> MCostModel
toMCostModel CostModel CekMachineCosts BuiltinCostModel
defaultCekCostModelForTesting
clearMachineCostModel :: m ~ MCekMachineCosts => m -> m
clearMachineCostModel :: forall m. (m ~ MCekMachineCosts) => m -> m
clearMachineCostModel = m -> m
forall a. a -> a
id
clearBuiltinCostModel :: m ~ MBuiltinCostModel => m -> m
clearBuiltinCostModel :: forall m. (m ~ MBuiltinCostModel) => m -> m
clearBuiltinCostModel = m -> m
forall a. a -> a
id