Skip to content

Commit

Permalink
[Test] [Costing] Test that serialising an impossible 'Data' object fi…
Browse files Browse the repository at this point in the history
…nishes (#5703)
  • Loading branch information
effectfully authored Jan 5, 2024
1 parent 7e891f2 commit b8a74e7
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import PlutusCore.Builtin
import PlutusCore.Compiler.Erase (eraseTerm)
import PlutusCore.Data
import PlutusCore.Default
import PlutusCore.Evaluation.Machine.ExBudget
import PlutusCore.Evaluation.Machine.ExBudgetingDefaults
import PlutusCore.Evaluation.Machine.MachineParameters
import PlutusCore.Generators.Hedgehog.Interesting
Expand Down Expand Up @@ -416,6 +417,17 @@ test_TrackCostsRetaining =
]
assertBool err $ expected > actual

test_SerialiseDataImpossible :: TestTree
test_SerialiseDataImpossible =
testCase "Serialising an impossible 'Data' object finishes" $ do
let dataLoop :: Term TyName Name DefaultUni DefaultFun ()
dataLoop = Apply () (Builtin () SerialiseData) $ mkConstant () loop where
loop = List [loop]
budgetMode = restricting . ExRestrictingBudget $ ExBudget 10000000000 10000000
evalRestricting params = fst . unsafeRunCekNoEmit params budgetMode
typecheckAnd def evalRestricting defaultBuiltinCostModel dataLoop @?=
Right EvaluationFailure

-- | Test all integer related builtins
test_Integer :: TestTree
test_Integer = testCase "Integer" $ do
Expand Down Expand Up @@ -874,6 +886,7 @@ test_definition =
, test_IdBuiltinData
, test_TrackCostsRestricting
, test_TrackCostsRetaining
, test_SerialiseDataImpossible
, test_Integer
, test_String
, test_List
Expand Down

1 comment on commit b8a74e7

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Plutus Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: b8a74e7 Previous: 7e891f2 Ratio
validation-decode-ping-pong_2-1 495 μs 469.1 μs 1.06
validation-decode-stablecoin_1-5 878.7 μs 830.8 μs 1.06

This comment was automatically generated by workflow using github-action-benchmark.

CC: @input-output-hk/plutus-core

Please sign in to comment.