Commit Graph

139 Commits

Author SHA1 Message Date
KtorZ
5943d94c6c Finish re-working machine errors display. 2024-08-25 16:20:06 +02:00
rvcas
e174532bfd chore: add more redacted values to machine errors 2024-08-25 16:20:05 +02:00
KtorZ
8dfaa1bf90 Fix parsing of v3 cost model
Closes #1002.
2024-08-24 18:26:37 +02:00
KtorZ
9aa9070f56 Revise desugaring following feedback
- We now consistently desugar an expect in the last position as
    `Void`. Regardless of the pattern. Desugaring to a boolean value is
    deemed too confusing.

  - This commit also removes the desugaring for let-binding. It's only
    ever allowed for _expect_ which then behaves like a side effect.

  - We also now allow tests to return either `Bool` or `Void`. A test
    that returns `Void` is treated the same as a test returning `True`.
2024-08-23 16:04:40 +02:00
KtorZ
42784965d2 Implement new costing function for {divide,quotient,mod,remainder}_integer
As well as fixing a couple of other issues thanks to conformance
  tests. Some functions like multiply_integer or verify_ed25519_signature
  have also slightly changed their costing function.
2024-08-14 02:50:05 +02:00
KtorZ
f879f6d183 Fix script context translations for withdrawals and validity intervals. 2024-08-13 23:43:47 +02:00
KtorZ
b158469144 Improve / fix machine and uplc error reporting. 2024-08-13 10:56:28 +02:00
KtorZ
f848bad3f2 define UPLC machine default cost models for Plutus V3. 2024-08-13 10:55:23 +02:00
KtorZ
ff4a480242 Upgrade pallas to v0.0.29, and start support for simulating transactions carrying Plutus v3 scripts. 2024-08-13 10:55:22 +02:00
KtorZ
846c16087e Test (and fix) unwrap_or helpers. 2024-08-08 00:39:44 -04:00
KtorZ
643e43f8aa Fix zero-arg builtins invokations.
There are currently two zero-arg builtins:

  - mkNilData
  - mkNilPairData

  And while they have strictly speaking no arguments, the VM still
  requires that they are called with an extra unit argument applied.
2024-08-02 00:17:16 -04:00
Matthias Benkort
28515e70ec Merge pull request #950 from hadelive/k256-error
Fix k256 error does not implement clone
2024-05-30 13:42:57 +02:00
hade
740e140c89 fix: custom k256 error 2024-05-30 16:13:51 +07:00
hade
b367ec2113 fix: fmt check 2024-05-30 16:09:32 +07:00
hade
ad3c9f24b7 chore: minimal pallas dependencies 2024-05-30 15:09:05 +07:00
rvcas
e28b0df840 fix: add v3 mapping for builtin semantics relates to #907 2024-05-21 17:06:18 -04:00
rvcas
3bc3792aa3 feat: add plutus version to aiken.toml
relates to #907
2024-05-21 17:02:20 -04:00
KtorZ
bff822ea7f Rework unit test report to leverage new reification
And also provide slightly better errors when traces, or trace-if-false operators are present.
2024-03-07 01:20:40 +01:00
KtorZ
14f1025f0b Display counterexamples as Aiken values instead of raw UPLC. 2024-03-03 19:33:24 +01:00
KtorZ
a703db4d14 Borrow integrated shrinking approach from MiniThesis. 2024-03-03 19:33:24 +01:00
KtorZ
3762473a60 Add preliminary plumbing to run property test through the CLI.
This is very very rough at the moment. But it does a couple of thing:

  1. The 'ArgVia' now contains an Expr/TypedExpr which should unify to a Fuzzer. This is to avoid having to introduce custom logic to handle fuzzer referencing. So this now accepts function call, field access etc.. so long as they unify to the right thing.

  2. I've done quite a lot of cleanup in aiken-project mostly around the tests and the naming surrounding them. What we used to call 'Script' is now called 'Test' and is an enum between UnitTest (ex-Script) and PropertyTest. I've moved some boilerplate and relevant function under those module Impl.

  3. I've completed the end-to-end pipeline of:
     - Compiling the property test
     - Compiling the fuzzer
     - Generating an initial seed
     - Running property tests sequentially, threading the seed through each step.

   An interesting finding is that, I had to wrap the prop test in a similar wrapper that we use for validator, to ensure we convert primitive types wrapped in Data back to UPLC terms. This is necessary because the fuzzer return a ProtoPair (and soon an Array) which holds 'Data'.

  At the moment, we do nothing with the size, though the size should ideally grow after each iteration (up to a certain cap).

  In addition, there are a couple of todo/fixme that I left in the code as reminders of what's left to do beyond the obvious (error and success reporting, testing, etc..)
2024-03-03 19:33:24 +01:00
KtorZ
46c357df7b Fix Int/BigInt pivot
We've been wrongly representing large ints as BigInt, causing them to
  behave differently in the VM through builtins like 'serialise_data'.

  Indeed, we expect anything that fits in 8 bytes to be encoded as Major
  Type 0 or 1. But we were switching to encoding as Major type 6
  (tagged, PosBigInt, NegBigInt) for much smaller values! Anything
  outside of the range [-2^32, 2^32-1] would be treated as big int
  (positive or negative).

  Why? Because we checked whether a value i would fit in an i64, and if
  it didn't we treated it as big int. But the reality is more subtle...
  Fortunately, Rust has i128 and the minicbor library implements TryFrom
  which enforces that the value fits in a range of [-2^64, 2^64 - 1], so
  we're back on track easily.
2024-02-25 14:09:56 -05:00
rvcas
a15fead982 chore: remove unused import 2024-02-20 13:05:28 -05:00
rvcas
028528899c feat(runtime): implement byteStringToInteger and add conformance tests 2024-02-20 13:05:28 -05:00
rvcas
da6e5ec6d1 feat: implement integerToByteString
Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2024-02-20 13:05:28 -05:00
rvcas
fc3bc4d9ff feat(cost_model): add costing for integerToByteString and byteStringToInteger 2024-02-20 13:05:28 -05:00
rvcas
70d4d7fdeb feat(runtime): add force count and arity for integerToByteString and byteStringToInteger 2024-02-20 13:05:28 -05:00
rvcas
589bb9a4b3 chore: change how we depend on pallas 2024-01-24 21:26:48 -05:00
KtorZ
8a90e9eda0 Improve behavior and reporting of tests expected to fail
Fixes #786.
2024-01-19 18:20:58 +01:00
Niels Mündler
cda1716d47 Unify construction of PlutusData objects from int + fields 2024-01-13 13:23:58 -05:00
microproofs
4a8fecb70a fix: satisfy clippy's demands 2024-01-11 14:53:02 -05:00
Niels Mündler
b6acdde552 Use to_i64 for clarity 2023-12-19 12:20:10 -05:00
Niels Mündler
89e518f878 Deduplicate code 2023-12-19 12:20:10 -05:00
Niels Mündler
ba76c1d2cf Adjust acceptance tests and fix IData and UData 2023-12-19 12:20:10 -05:00
Niels Mündler
022503e254 Fix to_pallas_bigint 2023-12-19 12:20:10 -05:00
microproofs
1567e42875 chore: fill in machine todos and cost model for case and constr
This allows for several more tests to pass
**Had to remove case-7 since it was incorrectly passing before**
2023-11-17 19:52:03 -05:00
rvcas
0382e5ce12 chore: this comment doesn't make sense 2023-11-17 18:41:28 -05:00
rvcas
df992cba67 chore: remove check_type 2023-11-17 13:58:13 -05:00
rvcas
9ab458dcc6 feat: delay typemismatch errors in the machine runtime
to pass 2 of the conformance tests, we need to make sure
that we aren't typechecking builtin arguments as arguments
are applied. This switches push to by removing the call to check_type
and then reworking all the associated unwrap methods on Value
so that they return the same errors that were being returned before.
2023-11-17 13:58:13 -05:00
rvcas
90aea6476a feat: uplc g1 and g2 literal parsing 2023-11-15 15:55:56 -05:00
rvcas
318ae6aad4 feat(bls): finish cost model 2023-11-15 15:55:56 -05:00
rvcas
5243c36ed6 feat(bls): add default costs for the new functions 2023-11-15 15:55:56 -05:00
microproofs
18db1c394a feat: Implemented builtin semantic versioning
feat: impl flat serialization and deserialization for bls constants
feat: started on cost models for the new builtins

Co-authored-by: rvcas <x@rvcas.dev>
2023-11-15 15:55:56 -05:00
rvcas
f101581813 feat(bls): pretty printing for g1 and g1 element
Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-11-15 15:55:56 -05:00
microproofs
0d2ac952d0 feat: implemented the Bls381-12 builtins and types
also implemented Keccak256 and Blake2b_224

TODO: cost model, flat serialization, pretty

Co-authored-by: rvcas <x@rvcas.dev>
2023-11-15 15:55:56 -05:00
microproofs
596ce49327 fix: mixed up operators for ConstAboveDiagonal and ConstBelowDiagonal
Closes #618
2023-10-13 11:40:07 -04:00
KtorZ
9782c094b7 Fix clippy suggestions. 2023-09-08 16:21:07 +02:00
microproofs
819a0a20e6 add tests for case and constr
Fix a minor issue with decoding order
2023-09-03 11:52:49 -04:00
microproofs
c9b01ab365 chore: fill in cost model
test: Add case and constr eval tests
2023-09-03 11:52:49 -04:00
microproofs
85901dc141 chore: update cost model with placeholders for new terms to pass tests 2023-09-03 11:52:49 -04:00