From 9fc1a4058b469faba68781682da2d0b2ab3e09aa Mon Sep 17 00:00:00 2001 From: teodanciu Date: Tue, 26 Nov 2024 15:34:57 +0000 Subject: [PATCH] [temp ] -crazy logs --- .../Cardano/Ledger/Alonzo/Plutus/Evaluate.hs | 19 +- .../testlib/Test/Cardano/Ledger/Alonzo/Imp.hs | 3 + .../Cardano/Ledger/Alonzo/Imp/UtxoSpec.hs | 255 +++++++++++++++++- .../Test/Cardano/Ledger/Alonzo/ImpTest.hs | 34 ++- .../src/Cardano/Ledger/Plutus/Evaluate.hs | 16 +- .../src/Cardano/Ledger/Plutus/Language.hs | 9 +- 6 files changed, 323 insertions(+), 13 deletions(-) diff --git a/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Plutus/Evaluate.hs b/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Plutus/Evaluate.hs index a37c7fdd5af..deefdb529cd 100644 --- a/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Plutus/Evaluate.hs +++ b/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Plutus/Evaluate.hs @@ -63,6 +63,7 @@ import Data.MapExtras (fromElems) import Data.Maybe (mapMaybe) import qualified Data.Set as Set import Data.Text (Text) +import Debug.Trace import qualified Debug.Trace as Debug import GHC.Generics import Lens.Micro @@ -369,7 +370,8 @@ evalTxExUnitsWithLogs :: evalTxExUnitsWithLogs pp tx utxo epochInfo systemStart = Map.mapWithKey findAndCount rdmrs where keyedByPurpose (plutusPurpose, _) = hoistPlutusPurpose toAsIx plutusPurpose - purposeToScriptHash = fromElems keyedByPurpose scriptsNeeded + purposeToScriptHash = fromElems keyedByPurpose $ trace ("Scripts needed:" <> show scriptsNeeded) scriptsNeeded + msg = "\n!!!!!!!!!!!!!!!!!!!!!!!!! PURPOSE TO SCRIPT HASH:" <> (show purposeToScriptHash) ledgerTxInfo = LedgerTxInfo { ltiProtVer = protVer @@ -389,7 +391,7 @@ evalTxExUnitsWithLogs pp tx utxo epochInfo systemStart = Map.mapWithKey findAndC findAndCount pointer (redeemerData, exUnits) = do (plutusPurpose, plutusScriptHash) <- note (RedeemerPointsToUnknownScriptHash pointer) $ - Map.lookup pointer purposeToScriptHash + Map.lookup pointer (trace msg purposeToScriptHash) let ptrToPlutusScriptNoContext = Map.map ( \(sp, sh) -> @@ -414,7 +416,18 @@ evalTxExUnitsWithLogs pp tx utxo epochInfo systemStart = Map.mapWithKey findAndC ledgerTxInfo (redeemerData, maxBudget) costModel - case evaluatePlutusWithContext P.Verbose pwc of + let !_ = trace ("\n PLUTUS CONTEXT:" <> (show pwc) <> "\n") True + let res = evaluatePlutusWithContext P.Verbose pwc + let !_ = + trace + ( "\n CALLING evaluatePlutusWithContext, with costmodel: " + <> show costModel + <> "\nand with result: " + <> (show res) + <> "\n" + ) + True + case res of (logs, Left err) -> Left $ ValidationFailure exUnits err logs pwc (logs, Right exBudget) -> note (IncompatibleBudget exBudget) $ diff --git a/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp.hs b/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp.hs index 7b8edca0350..fafa51267c1 100644 --- a/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp.hs +++ b/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp.hs @@ -8,11 +8,13 @@ module Test.Cardano.Ledger.Alonzo.Imp where import Cardano.Ledger.Alonzo.Core +import Cardano.Ledger.Alonzo.Plutus.Context (EraPlutusTxInfo) import Cardano.Ledger.Alonzo.Rules ( AlonzoUtxoPredFailure, AlonzoUtxosPredFailure, AlonzoUtxowPredFailure, ) +import Cardano.Ledger.Plutus.Language (Language (..)) import Cardano.Ledger.Shelley.Rules (ShelleyUtxoPredFailure, ShelleyUtxowPredFailure) import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxoSpec as Utxo import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxosSpec as Utxos @@ -25,6 +27,7 @@ spec :: forall era. ( Arbitrary (TxAuxData era) , AlonzoEraImp era + , EraPlutusTxInfo 'PlutusV1 era , InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era , InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era , InjectRuleFailure "LEDGER" AlonzoUtxoPredFailure era diff --git a/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp/UtxoSpec.hs b/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp/UtxoSpec.hs index 6524482c88e..1ffb45e2b96 100644 --- a/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp/UtxoSpec.hs +++ b/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp/UtxoSpec.hs @@ -1,6 +1,7 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -9,28 +10,46 @@ module Test.Cardano.Ledger.Alonzo.Imp.UtxoSpec (spec) where import Cardano.Ledger.Alonzo.Core + +-- (eraLanguages) + +-- (Globals (..), Mismatch (..), Network (..), StrictMaybe (..)) + +-- (Data (..), ExUnits (..), hashPlutusScript, withSLanguage) + +import Cardano.Ledger.Alonzo.Plutus.Context +import Cardano.Ledger.Alonzo.Plutus.Evaluate import Cardano.Ledger.Alonzo.Rules (AlonzoUtxoPredFailure (..)) -import Cardano.Ledger.Alonzo.Scripts (eraLanguages) +import Cardano.Ledger.Alonzo.Scripts import Cardano.Ledger.Alonzo.TxAuxData (mkAlonzoTxAuxData) import Cardano.Ledger.Alonzo.TxWits (Redeemers (..)) -import Cardano.Ledger.BaseTypes (Mismatch (..), Network (..), StrictMaybe (..)) +import Cardano.Ledger.Alonzo.UTxO (AlonzoEraUTxO (..)) +import Cardano.Ledger.BaseTypes import Cardano.Ledger.Coin (Coin (..), toDeltaCoin) import qualified Cardano.Ledger.Metadata as M import Cardano.Ledger.Plutus import Cardano.Ledger.Shelley.LedgerState (curPParamsEpochStateL, nesEsL) import Control.Monad (forM) +import Data.Either (fromRight) +import Data.Map ((!)) import qualified Data.Map.Strict as Map +import Data.Proxy import Data.Ratio ((%)) import Debug.Trace import Lens.Micro (to, (&), (.~), (<>~), (^.)) +import Lens.Micro.Mtl (use) import qualified PlutusLedgerApi.Common as P +import qualified PlutusLedgerApi.V1 as PV1 import Test.Cardano.Ledger.Alonzo.ImpTest import Test.Cardano.Ledger.Imp.Common +import Test.Cardano.Ledger.Plutus import Test.Cardano.Ledger.Plutus.Examples (alwaysSucceedsWithDatum) spec :: forall era. ( AlonzoEraImp era + , AlonzoEraUTxO era + , EraPlutusTxInfo 'PlutusV1 era , InjectRuleFailure "LEDGER" AlonzoUtxoPredFailure era ) => SpecWith (ImpInit (LedgerSpec era)) @@ -53,6 +72,238 @@ spec = describe "UTXO" $ do (True) withNoFixup $ submitTx_ tx + let fixupPreRedeemers = + addNativeScriptTxWits + >=> fixupAuxDataHash + >=> addCollateralInput + >=> addRootTxIn + >=> fixupScriptWits + >=> fixupOutputDatums + >=> fixupDatums + >=> fixupRedeemerIndices + let fixupPostRedeemers = + fixupPPHash + >=> fixupTxOuts + >=> fixupFees + >=> updateAddrTxWits + + it "calculateBudget" $ do + let calcBudget + pv + epochInfo + systemStart + utxo + ec + plRunnable + tx + (prpIdxIt, scriptHash, ScriptTestContext plutus (PlutusArgs dat mbSpendingDat)) = + let proxy = Proxy @PlutusV1 + prpIx = hoistPlutusPurpose @era toAsIx prpIdxIt + prpIt = hoistPlutusPurpose @era toAsItem prpIdxIt + maybeSpendingDatum = getSpendingDatum utxo tx prpIt + lti = LedgerTxInfo pv epochInfo systemStart utxo tx + + Right budget = do + txInfo <- toPlutusTxInfo proxy lti + plutusArgs <- toPlutusArgs proxy pv txInfo prpIdxIt maybeSpendingDatum (Data dat) + pure $ evaluatePlutusRunnableBudget @PlutusV1 (pvMajor pv) P.Verbose ec plRunnable plutusArgs + in budget + Globals {systemStart, epochInfo} <- use impGlobalsL + pp <- getsNES $ nesEsL . curPParamsEpochStateL + let pv = pp ^. ppProtocolVersionL + let ec = getEvaluationContext $ costModelsValid (pp ^. ppCostModelsL) ! PlutusV1 + + let pl = alwaysSucceedsWithDatum SPlutusV1 + let (Right plRunnable) = decodePlutusRunnable @PlutusV1 (pvMajor pv) pl + tx <- do + txIn <- produceScript . hashPlutusScript $ pl + pure $ mkBasicTx mkBasicTxBody & bodyTxL . inputsTxBodyL .~ [txIn] + utxo <- getUTxO + contexts <- impGetPlutusContexts tx + + let budget = calcBudget pv epochInfo systemStart utxo ec plRunnable tx <$> contexts + let !_ = trace ("\n BUDGET:" <> (show budget) <> "\n") (True) + pure () + + it "aaa" $ do + Globals {systemStart, epochInfo} <- use impGlobalsL + pp <- getsNES $ nesEsL . curPParamsEpochStateL + let pv = pp ^. ppProtocolVersionL + let cm = pp ^. ppCostModelsL + let cmV1 = (costModelsValid cm) ! PlutusV1 + let ec = getEvaluationContext cmV1 + + let pl = alwaysSucceedsWithDatum SPlutusV1 + let (Right plRunnable) = decodePlutusRunnable @PlutusV1 (pvMajor pv) pl + + txIn <- produceScript . hashPlutusScript $ pl + let tx0 = mkBasicTx mkBasicTxBody & bodyTxL . inputsTxBodyL .~ [txIn] + tx1 <- (fixupPreRedeemers >=> txWithMaxRedeemers) tx0 + -- tx1 <- fixupPreRedeemers tx0 + let !_ = trace ("\n Max Redeemers::" <> (show (tx1 ^. witsTxL . rdmrsTxWitsL)) <> "\n") (True) + utxo <- getUTxO + + contexts <- impGetPlutusContexts tx1 + + let f tx (prpIdxIt, scriptHash, ScriptTestContext plutus (PlutusArgs dat mbSpendingDat)) = + let proxy = Proxy @PlutusV1 + prpIx = hoistPlutusPurpose @era toAsIx prpIdxIt + prpIt = hoistPlutusPurpose @era toAsItem prpIdxIt + maybeSpendingDatum = getSpendingDatum utxo tx prpIt + lti = LedgerTxInfo pv epochInfo systemStart utxo tx + + res = do + txInfo <- toPlutusTxInfo proxy lti + plutusArgs <- toPlutusArgs proxy pv txInfo prpIdxIt maybeSpendingDatum (Data dat) + pure $ evaluatePlutusRunnableBudget @PlutusV1 (pvMajor pv) P.Verbose ec plRunnable plutusArgs + in res + + let x = f tx1 <$> contexts + + let !_ = trace ("\n XXXXXXX" <> (show x) <> "\n") (True) + -- let reports = evalTxExUnitsWithLogs pp tx1 utxo epochInfo systemStart + -- let !_ = trace ("\n ====================REPORTS:" <> (show reports) <> "\n") True + + tx2 <- fixupPostRedeemers tx1 + + let y = f tx2 <$> contexts + let !_ = trace ("\n YYYYYY" <> (show y) <> "\n") (True) + + pure () + + it "bbb" $ do + let pl = alwaysSucceedsWithDatum SPlutusV1 + txIn <- produceScript . hashPlutusScript $ pl + let tx0 = mkBasicTx mkBasicTxBody & bodyTxL . inputsTxBodyL .~ [txIn] + tx <- (fixupPreRedeemers >=> txWithMaxRedeemers >=> fixupPostRedeemers >=> fixupRedeemers) tx0 + + let !_ = + trace + ( "\n ------------------------------------ REDEEEMERS:" + <> (show (tx ^. witsTxL . rdmrsTxWitsL)) + <> "\n" + ) + (True) + withNoFixup $ submitTx_ tx + + it "ccc" $ do + let pl = alwaysSucceedsWithDatum SPlutusV1 + txIn <- produceScript . hashPlutusScript $ pl + let tx0 = mkBasicTx mkBasicTxBody & bodyTxL . inputsTxBodyL .~ [txIn] + txWithMax <- + (fixupPreRedeemers >=> txWithMaxRedeemers >=> fixupPostRedeemers >=> fixupRedeemers) tx0 + let !_ = + trace + ( "\n ------------------------------------ REDEEEMERS:" + <> (show (txWithMax ^. witsTxL . rdmrsTxWitsL)) + <> "\n" + ) + (True) + let !_ = + trace + ( "\n ------------------------------------ FEES:" + <> (show (txWithMax ^. bodyTxL . feeTxBodyL)) + <> "\n" + ) + (True) + + txWithNormal <- fixupTx tx0 + let !_ = + trace + ( "\n ------------------------------------ REDEEEMERS:" + <> (show (txWithNormal ^. witsTxL . rdmrsTxWitsL)) + <> "\n" + ) + (True) + let !_ = + trace + ( "\n ------------------------------------ FEES:" + <> (show (txWithNormal ^. bodyTxL . feeTxBodyL)) + <> "\n" + ) + (True) + + pure () + + it "yyy" $ do + let version = natVersion @5 + Globals {systemStart, epochInfo} <- use impGlobalsL + pp <- getsNES $ nesEsL . curPParamsEpochStateL + + let cm = pp ^. ppCostModelsL + let cmV1 = (costModelsValid cm) ! PlutusV1 + let ec = getEvaluationContext cmV1 + + let plutus = alwaysSucceedsWithDatum SPlutusV1 + let plHash = hashPlutusScript @(EraCrypto era) plutus + + let (PlutusBinary sbs) = plutusBinary plutus + let (Right (PlutusRunnable rs)) = decodePlutusRunnable version plutus + + let maxSteps = 10000000000 + let maxMem = 10000000 + let x = + PV1.evaluateScriptRestricting + (P.MajorProtocolVersion 5) + P.Verbose + ec + (PV1.ExBudget (PV1.ExCPU (fromIntegral maxSteps)) (PV1.ExMemory (fromIntegral maxMem))) + rs + + let !_ = trace ("\n cmV1" <> (show cmV1) <> "\n") True + pure () + + it "zzz" $ do + utxo <- getUTxO + Globals {systemStart, epochInfo} <- use impGlobalsL + pp <- getsNES $ nesEsL . curPParamsEpochStateL + txIn <- produceScript . hashPlutusScript $ alwaysSucceedsWithDatum SPlutusV1 + printUTxO + let tx0 = mkBasicTx mkBasicTxBody & bodyTxL . inputsTxBodyL .~ [txIn] + + tx1 <- fixupTx tx0 + + let reports = evalTxExUnitsWithLogs pp tx1 utxo epochInfo systemStart + + let !_ = + trace + ( "\n --------------------------------------------------- ULTIMATE REPORTS----------------------------------------" + <> (show reports) + <> "\n" + ) + True + + pure () + it "xxx" $ do + forM_ (eraLanguages @era) $ \lang -> + withSLanguage lang $ \slang -> do + -- maxExUnits <- getsNES $ nesEsL . curPParamsEpochStateL . ppMaxTxExUnitsL + txIn <- produceScript . hashPlutusScript $ alwaysSucceedsWithDatum slang + let tx0 = mkBasicTx mkBasicTxBody & bodyTxL . inputsTxBodyL .~ [txIn] + tx1 <- + ( addNativeScriptTxWits + >=> fixupAuxDataHash + >=> addCollateralInput + >=> addRootTxIn + >=> fixupScriptWits + >=> fixupOutputDatums + >=> fixupDatums + >=> fixupRedeemerIndices + ) + tx0 + tx2 <- fixupRedeemers tx1 + tx3 <- + ( fixupPPHash + >=> fixupTxOuts + >=> fixupFees + >=> updateAddrTxWits + ) + tx2 + pure () + withNoFixup $ submitTx_ tx3 + -- submitTx_ tx0 + + -- submitTx_ tx it "Wrong network ID" $ do submitFailingTx (mkBasicTx mkBasicTxBody & bodyTxL . networkIdTxBodyL .~ SJust Mainnet) diff --git a/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/ImpTest.hs b/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/ImpTest.hs index 7ff4d032c44..9bf9566c441 100644 --- a/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/ImpTest.hs +++ b/eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/ImpTest.hs @@ -39,6 +39,15 @@ module Test.Cardano.Ledger.Alonzo.ImpTest ( fixupRedeemers, fixupRedeemerIndices, fixupScriptWits, + addNativeScriptTxWits, + fixupAuxDataHash, + addRootTxIn, + fixupTxOuts, + fixupFees, + updateAddrTxWits, + printUTxO, + impGlobalsL, + txWithMaxRedeemers, ) where import Cardano.Crypto.DSIGN (DSIGNAlgorithm (..), Ed25519DSIGN) @@ -213,6 +222,11 @@ fixupRedeemers :: Tx era -> ImpTestM era (Tx era) fixupRedeemers tx = impAnn "fixupRedeemers" $ do + let !_ = + trace + ("\n CALLING fixupRedeemers for txid:" <> show (txIdTx tx) <> ". TX IS: " <> (show tx) <> "\n") + True + printUTxO contexts <- impGetPlutusContexts tx pp <- getsNES $ nesEsL . curPParamsEpochStateL let @@ -225,10 +239,15 @@ fixupRedeemers tx = impAnn "fixupRedeemers" $ do tx & witsTxL . rdmrsTxWitsL .~ Redeemers newMaxRedeemers utxo <- getUTxO Globals {systemStart, epochInfo} <- use impGlobalsL + let !_ = trace ("\n MAX EXUNITS:" <> (show maxExUnit) <> "\n") True + let !_ = trace ("\n Cost models:" <> (show (pp ^. ppCostModelsL)) <> "\n") True + let !_ = trace ("\n OLD REDEEMERS" <> (show oldRedeemers) <> "\n") True let reports = evalTxExUnits pp txWithMaxExUnits utxo epochInfo systemStart + let !_ = trace ("\n REPORTS:" <> (show reports) <> "\n") True exUnitsPerPurpose <- fmap (Map.mapMaybe id) $ forM reports $ \case Left err -> do + error $ "!!!! EXECUTION UNITS ESTIMATION ERROR:" <> show err logString $ "Execution Units estimation error: " <> show err pure Nothing Right exUnits -> @@ -245,10 +264,12 @@ fixupRedeemers tx = impAnn "fixupRedeemers" $ do pure Nothing Just exUnits -> pure $ Just (ptr, (Data dat, exUnits)) - newRedeemers <- Map.fromList . catMaybes <$> mapM mkNewRedeemers contexts + _newRedeemers <- Map.fromList . catMaybes <$> mapM mkNewRedeemers contexts + let !_ = trace ("\n NEW REDEEMERS:" <> (show _newRedeemers) <> "\n") True + let !_ = trace ("\n NEW MAX REDEEMERS:" <> (show newMaxRedeemers) <> "\n") True pure $ tx - & witsTxL . rdmrsTxWitsL .~ Redeemers (Map.unions [oldRedeemers, newRedeemers, newMaxRedeemers]) + & witsTxL . rdmrsTxWitsL .~ Redeemers (Map.unions [oldRedeemers, _newRedeemers, newMaxRedeemers]) fixupScriptWits :: forall era. @@ -588,3 +609,12 @@ expectTxSuccess tx expectUTxOContent utxo [(txIn, isNothing) | txIn <- Set.toList collaterals] impAnn "Outputs should not be in UTxO" $ expectUTxOContent utxo [(txIn, isNothing) | (txIn, _txOut) <- outputs] + +printUTxO :: Show (TxOut era) => ImpTestM era () +printUTxO = do + UTxO utxo <- getUTxO + let msg = "\n UTXO" <> showF (Map.assocs utxo) <> "\n" + let !_ = trace msg True + pure () + where + showF = foldl (\acc x -> acc ++ "\n" ++ show x) "" diff --git a/libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Evaluate.hs b/libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Evaluate.hs index 54066b5a1ea..0c2ce95987b 100644 --- a/libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Evaluate.hs +++ b/libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Evaluate.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} @@ -70,6 +71,7 @@ import qualified Data.ByteString.UTF8 as BSU import Data.List.NonEmpty (NonEmpty (..)) import Data.Maybe (fromMaybe) import Data.Text (Text, pack) +import Debug.Trace import GHC.Generics (Generic) import PlutusLedgerApi.Common as P (EvaluationError (CodecError), ExBudget, VerboseMode (..)) import Prettyprinter (Pretty (..)) @@ -251,11 +253,19 @@ runPlutusScript = snd . runPlutusScriptWithLogs runPlutusScriptWithLogs :: PlutusWithContext c -> ([Text], ScriptResult c) -runPlutusScriptWithLogs pwc = toScriptResult <$> evaluatePlutusWithContext P.Quiet pwc +runPlutusScriptWithLogs pwc = + trace ("********************* RUNNING SCRIPT WITH COSTMODEL:" <> show (pwcCostModel pwc)) $ + toScriptResult <$> evaluatePlutusWithContext P.Quiet pwc where toScriptResult = \case - Left evalError -> explainPlutusEvaluationError pwc evalError - Right _ -> scriptPass pwc + Left evalError -> trace "##### LEFT FUCK!!!!" $ explainPlutusEvaluationError pwc evalError + Right x -> + trace + ( "##################################################################Budget just before running: " + <> show x + ) + scriptPass + pwc evaluatePlutusWithContext :: P.VerboseMode -> diff --git a/libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Language.hs b/libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Language.hs index d0f588c8512..558d7044190 100644 --- a/libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Language.hs +++ b/libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Language.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} @@ -97,6 +98,7 @@ import Data.Proxy (Proxy (..)) import Data.Text (Text) import Data.Typeable (Typeable, gcast) import Data.Word (Word8) +import Debug.Trace import GHC.Generics (Generic) import NoThunks.Class (NoThunks) import PlutusCore (DefaultFun, DefaultUni) @@ -472,9 +474,10 @@ instance PlutusLanguage 'PlutusV1 where decodePlutusRunnable pv (Plutus (PlutusBinary bs)) = PlutusRunnable <$> PV1.deserialiseScript (toMajorProtocolVersion pv) bs evaluatePlutusRunnable pv vm ec exBudget (PlutusRunnable rs) = - PV1.evaluateScriptRestricting (toMajorProtocolVersion pv) vm ec exBudget rs - . legacyPlutusArgsToData - . unPlutusV1Args + trace ("-----CALLING evaluateScriptRestricting with budget:" <> show exBudget) $ + PV1.evaluateScriptRestricting (toMajorProtocolVersion pv) vm ec exBudget rs + . legacyPlutusArgsToData + . unPlutusV1Args evaluatePlutusRunnableBudget pv vm ec (PlutusRunnable rs) = PV1.evaluateScriptCounting (toMajorProtocolVersion pv) vm ec rs . legacyPlutusArgsToData