From a803b77a841a25d441c27b8b51b8f9ed8948b9e2 Mon Sep 17 00:00:00 2001 From: effectfully Date: Thu, 14 Nov 2024 22:59:40 +0100 Subject: [PATCH] [Benchmark] Include 'mkTermToEvaluate' in 'benchmark-decode' --- plutus-benchmark/validation/bench/BenchDec.hs | 9 +++++++-- plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/plutus-benchmark/validation/bench/BenchDec.hs b/plutus-benchmark/validation/bench/BenchDec.hs index 01925647f6d..c207f1401b1 100644 --- a/plutus-benchmark/validation/bench/BenchDec.hs +++ b/plutus-benchmark/validation/bench/BenchDec.hs @@ -39,6 +39,11 @@ main = benchWith mkDecBM !(benchScript :: SerialisedScript) = force (serialiseUPLC $ UPLC.Program () v unsaturated) + -- The validation benchmarks were all created from PlutusV1 scripts + ll = PlutusV1 + pv = ledgerLanguageIntroducedIn ll + -- Deserialize using 'FakeNamedDeBruijn' to get the fake names added - in whnf (either throw id . void . deserialiseScript futurePV - ) benchScript + in flip whnf benchScript $ \scriptBytes -> + let scriptForEval = either throw id $ deserialiseScript pv scriptBytes + in either throw id . void $ mkTermToEvaluate ll pv scriptForEval [] diff --git a/plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs b/plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs index 07649572e37..6d9432eaa9a 100644 --- a/plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs +++ b/plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs @@ -57,6 +57,8 @@ data EvaluationError = deriving stock (Show, Eq) makeClassyPrisms ''EvaluationError +instance Exception EvaluationError + instance AsScriptDecodeError EvaluationError where _ScriptDecodeError = _CodecError