Add PlutusV3 conformance tests and also control budgets

There were some odd discrepancy for `integerToByteString` on the mem
  side. Either 1 or about 1000 mem units off; which I couldn't quite
  figure out. Yet, it proves useful to validate builtin at large and
  ensure we have a valid cost model for v3.
This commit is contained in:
KtorZ
2024-08-14 02:42:04 +02:00
parent f879f6d183
commit 2cb87f4f8f
2893 changed files with 6385 additions and 13 deletions

View File

@@ -0,0 +1,6 @@
The test cases here are all extracted from the tests in
`plutus-core/untyped-plutus-core/test/Evaluation/Golden.hs` and check that
interleaving of forces and normal arguments for builtin applications behaves
correctly. Most of these are for `ifThenElse` (`ite`) because that has the most
complicated interleaving behaviour of our current builtins (it expects an
argument of the built-in `bool` type, then a `force`, then two term arguments).

View File

@@ -0,0 +1 @@
(program 1.0.0 (builtin ifThenElse))

View File

@@ -0,0 +1,2 @@
({cpu: 23100
| mem: 200})

View File

@@ -0,0 +1 @@
(program 1.0.0 (builtin ifThenElse))

View File

@@ -0,0 +1,15 @@
(program
1.0.0
[
[
[
(force (builtin ifThenElse))
[
[ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22)
]
]
[ (builtin multiplyInteger) (con integer 11) ]
]
[ (builtin subtractInteger) (con integer 22) ]
]
)

View File

@@ -0,0 +1 @@
(program 1.0.0 [ (builtin multiplyInteger) (con integer 11) ])

View File

@@ -0,0 +1,15 @@
(program
1.0.0
[
[
[
(force (builtin ifThenElse))
[
[ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22)
]
]
(builtin multiplyInteger)
]
(builtin subtractInteger)
]
)

View File

@@ -0,0 +1,19 @@
(program
1.0.0
[
[
[
[
(force (builtin ifThenElse))
[
[ (builtin lessThanEqualsInteger) (con integer 11) ]
(con integer 22)
]
]
[ (builtin multiplyInteger) (con integer 11) ]
]
[ (builtin subtractInteger) (con integer 22) ]
]
(con integer 22)
]
)

View File

@@ -0,0 +1,7 @@
(program
1.0.0
[
(force (builtin ifThenElse))
[ [ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22) ]
]
)

View File

@@ -0,0 +1 @@
(program 1.0.0 [ (force (builtin ifThenElse)) (con bool True) ])

View File

@@ -0,0 +1,9 @@
(program
1.0.0
(force
[
(force (builtin ifThenElse))
[ [ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22) ]
]
)
)

View File

@@ -0,0 +1 @@
(program 1.0.0 (force (builtin ifThenElse)))

View File

@@ -0,0 +1,2 @@
({cpu: 46100
| mem: 300})

View File

@@ -0,0 +1 @@
(program 1.0.0 (force (builtin ifThenElse)))

View File

@@ -0,0 +1 @@
(program 1.0.0 (force (force (builtin ifThenElse))))

View File

@@ -0,0 +1,15 @@
(program
1.0.0
[
[
[
(force (builtin ifThenElse))
[
[ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22)
]
]
(con integer 33)
]
(con string "abc")
]
)

View File

@@ -0,0 +1,17 @@
-- This is OK because the branches are terms and there's no requirement that
--their types match in UPLC even if they do happen to be builtin constants.
(program
1.0.0
[
[
[
(force (builtin ifThenElse))
[
[ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22)
]
]
(con string "11 <= 22")
]
(con integer -1111)
]
)

View File

@@ -0,0 +1 @@
(program 1.0.0 (con string "11 <= 22"))

View File

@@ -0,0 +1,15 @@
(program
1.0.0
[
[
[
(force (builtin ifThenElse))
[
[ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22)
]
]
(con string "11 <= 22")
]
(con string "\172(11 <= 22)")
]
)

View File

@@ -0,0 +1 @@
(program 1.0.0 (con string "11 <= 22"))

View File

@@ -0,0 +1,15 @@
(program
1.0.0
[
[
[
(builtin ifThenElse)
[
[ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22)
]
]
(con string "11 <= 22")
]
(con string "\172(11 <= 22)")
]
)

View File

@@ -0,0 +1,7 @@
(program
1.0.0
[
(builtin ifThenElse)
[ [ (builtin lessThanEqualsInteger) (con integer 11) ] (con integer 22) ]
]
)

View File

@@ -0,0 +1,10 @@
(program
1.0.0
[
[
[ (force (builtin ifThenElse)) (con string "11 <= 22") ]
(con string "\172(11 <= 22)")
]
(con string "\172(11 <= 22)")
]
)

View File

@@ -0,0 +1,7 @@
(program
1.0.0
[
[ (force (builtin ifThenElse)) (con string "11 <= 22") ]
(con string "\172(11 <= 22)")
]
)

View File

@@ -0,0 +1,4 @@
(program 1.0.0 [
[ (force (builtin ifThenElse)) (con string "11 <= 22") ]
(con string "\172(11 <= 22)")
])

View File

@@ -0,0 +1,4 @@
(program
1.0.0
[ [ (force (builtin multiplyInteger)) (con integer 11) ] (con integer 22) ]
)

View File

@@ -0,0 +1,4 @@
(program
1.0.0
[ (force [ (builtin multiplyInteger) (con integer 11) ]) (con integer 22) ]
)

View File

@@ -0,0 +1,4 @@
(program
1.0.0
(force [ [ (builtin multiplyInteger) (con integer 11) ] (con integer 22) ])
)