Commit Graph

501 Commits

Author SHA1 Message Date
Matthias Benkort
a1045352d7 Merge pull request #1018 from solidsnakedev/main
fix: Plutus V3 NoDatum
2024-09-13 09:29:55 +02:00
microproofs
8d13b0b706 Add acceptance test 112 2024-09-12 19:06:46 -04:00
KtorZ
6413f2c1cc Make 'simple_spend_no_datum' acceptance test more to-the-point
This new acceptance test is really meant to check for the behavior surrounding the optional datum. So I've added an extra expect on the received datum, and kept only assertions that were about or related to the datum.
2024-09-12 17:21:09 +02:00
solidsnakedev
defce9be4e fix: Plutus V3 NoDatum - Error: missing required inline datum or datum hash in script input 2024-09-11 15:25:20 -06:00
KtorZ
7741be64f8 Fix validator's fallback handler generation
Fixes #1015.
2024-09-10 10:48:06 +02:00
KtorZ
8db4a60986 (re)format aiken sources in the repository. 2024-09-07 18:25:21 +02:00
KtorZ
9f6daa8cd5 Refresh gift_card and hello_world examples. 2024-09-01 18:22:43 +02:00
KtorZ
8d60f08f65 Add acceptance test 111
Seems like nested tuples are inferred wrongly when type-casted.

  ```
  type mismatch
     Expected (list a)
          Got integer
  ```
2024-08-31 00:03:46 +02:00
KtorZ
e3e889f875 Update benchmarks. 2024-08-30 15:45:00 +02:00
microproofs
e772ff1787 Missed some zero parameter check 2024-08-29 16:30:30 +02:00
KtorZ
a909e9eb0a Add acceptance_tests/109 to illustrate new config/constants capabilities. 2024-08-29 16:25:12 +02:00
KtorZ
8bccbd9e00 Update acceptance tests and script context tests to latest stdlib. 2024-08-28 17:41:32 +02:00
rvcas
6bbc6a8f2f chore: fix the issue in gift card 2024-08-27 19:12:44 -04:00
rvcas
d337e601cb chore: add a test for by name with params 2024-08-27 18:10:46 -04:00
KtorZ
48535636ed Fix remaining acceptance tests to be V3-compatible 2024-08-27 19:19:25 +02:00
KtorZ
d74e36d0bc Introduce 'Never' type as a safe alternative to always None options
Unfortunately, as documented in:

  https://github.com/IntersectMBO/cardano-ledger/issues/4571

  Some Option fields in the script context certificates are going to
  remain set to None, at least until the next Hard fork. There's a risk
  that people permanently lock their funds if they expect deposits on
  registration credentials to ever be `Some`.

  So, we introduce a special type that emulate an `Option` that can only
  ever be `None`. We call it `Never` and it is the first type of this
  kind (i.e. with constructors indexes not starting at 0).
2024-08-27 14:40:39 +02:00
rvcas
ff25fbd970 chore: acceptance tests v3 syntax 2024-08-26 15:56:49 -04:00
rvcas
b57f840cad chore: use correct arguments in gift card validators 2024-08-26 15:45:37 -04:00
rvcas
c87f459ce7 chore: convert gift card tutorial to v3 2024-08-26 15:41:01 -04:00
KtorZ
3521a8c921 Start adjusting acceptance tests to the new Plutus V3 syntax. 2024-08-25 17:12:36 +02:00
KtorZ
1198d7a5ae Adjust hello world example to new Plutus V3 syntax. 2024-08-25 16:29:24 +02:00
KtorZ
8c2fdf9ad4 Use dot to separate purpose from validator name in blueprint
The rationale is two folds:

  1. It's more consistent with how we already separate the validator
  name from its module.

  2. Because `_` may be present in Aiken's validator's name, it is hard
     to read and I am afraid it could potentially conflict later on. So
     it's better to use a separator that cannot appear in validator
     names.
2024-08-25 16:20:08 +02:00
KtorZ
f9acbd3bcb DRY handlers generation from validator 2024-08-25 16:20:07 +02:00
KtorZ
047f422d0d remove v2 script contexts acceptance tests.
V2 is dead. Long live V3.
2024-08-25 16:20:07 +02:00
KtorZ
fe205e360f Update remaining script context e2e tests. 2024-08-25 16:20:06 +02:00
rvcas
be7c0c8012 fix: withdraw kinda 2024-08-25 16:20:06 +02:00
rvcas
3aa9e0c4b7 chore: run fmt on mint 2024-08-25 16:20:05 +02:00
rvcas
3fac7002d4 feat: switch mint to new def 2024-08-25 16:20:05 +02:00
microproofs
953ee6b5d1 Fix ordering for ScriptInfo type 2024-08-25 16:20:05 +02:00
KtorZ
823492c27b Adjust v3 script context end-to-end tests to work with new syntax. 2024-08-25 16:20:04 +02:00
rvcas
03a348040b chore: convert hello_world to v3 2024-08-25 16:20:04 +02:00
KtorZ
35b7066163 Introduce acceptance test 107 illustrating compiler crash
```
  crates/aiken-lang/src/gen_uplc.rs:4515:30

      internal error: entered unreachable code: Shouldn't call anything other than var or apply

      Lambda {
          parameter_name: Name {
              text: "__no_inline__",
              unique: Unique(
                  0,
              ),
          },
          body: Var(
              Name {
                  text: "tests_new_list_unbound",
                  unique: Unique(
                      0,
                  ),
              },
          ),
      }
  ```
2024-08-21 14:43:08 +02:00
KtorZ
520ceff83d Do not ignore ctx/inputs.cbor; it is used/needed by the test runner. 2024-08-14 03:09:45 +02:00
KtorZ
b104356fb9 (temporarily) make script context tests more verbose. 2024-08-14 03:02:40 +02:00
KtorZ
f879f6d183 Fix script context translations for withdrawals and validity intervals. 2024-08-13 23:43:47 +02:00
KtorZ
5067aad0d8 Fix 'Pair' formatter inside forced unbroken components. 2024-08-13 17:05:41 +02:00
KtorZ
7501538053 Add script context translations for voting purpose. 2024-08-13 16:24:01 +02:00
KtorZ
bfc93bf076 Add script context translation for new Conway certificates 2024-08-13 10:56:29 +02:00
KtorZ
f244b9c496 Add support for protocol parameters (except cost models)
We can now simulate transactions with protocol parameters voting
  procedures. Cost models remain to be done, though.
2024-08-13 10:56:29 +02:00
KtorZ
50dad1fdfe Test proposal procedures through Aiken. 2024-08-13 10:56:29 +02:00
KtorZ
6b6bace8a5 test 'mint' purpose and script context creation.
Alongside a bunch of other stuff from the coverage list. In
  particular, the mint transaction contains:

  - reference inputs
  - multiple outputs, with assets, and type-0, type-1 and type-6
    addresses.
  - an output with a datum hash
  - an output with an inline script
  - carries an extra datum witness, preimage of the embedded hash
  - mint, with 2 policies purposely ordered wrongly, with 1 and 2
    assets purposely ordered wrong. One of the mint is actually a
    burn (i.e. negative quantity)
2024-08-13 10:56:29 +02:00
KtorZ
eea8dc7d0a Support multi-validator in script context accept test. 2024-08-13 10:56:28 +02:00
KtorZ
62b1b932f9 Write down first e2e script context test for v3. 2024-08-13 10:56:28 +02:00
KtorZ
821f7bd8c7 Fix ToPlutusData serializer for V3
This is intense, as we still want to preserve the serializer for V1 &
  V2, and I've tried as much as possible to avoid polluting the
  application layer with many enum types such as:

  ```
  pub enum TxOut {
    V1(TransactionOutput),
    V2(TransactionOutput),
    V3(TransactionOutput),
  }
  ```

  Those types make working with the script context cumbersome, and are
  only truly required to provide different serialisation strategies. So
  instead, we keep one top-level `TxInfo V1/V2/V3` type, and we ensure
  to pass serialization strategies as type wrappers.

  This way, the strategy propagates through the structure up until it's
  eliminated when it reaches the relevant types.

  All-in-all, this strikes a correct balance between maintainability and
  repetition; and it makes it possible to define _different but mostly
  identical_ encoders for the various versions.

  With it, I've been able to successfully encode a V3 script context and
  match it against one produced using the Haskell libraries. More to
  come.
2024-08-13 10:55:23 +02:00
KtorZ
0dec4dc533 Move script context e2e tests under a nested 'v2' directory.
And rework scripts to run them in anticipation of new v3 contexts.
2024-08-13 10:55:21 +02:00
microproofs
72059eacee Fix: Recursion issue where the static param optimization on recursive functions that were passed as arguments to other functions 2024-08-08 19:36:16 -04:00
KtorZ
6e4a16d8e0 Illustrate new failing scenario with multi-arg function identifiers
As far as I could tell, this behavior is only observed when the arity
  of the function is higher than 1. It's fine for single-arg functions
  somehow.
2024-08-08 14:52:19 -04:00
microproofs
53c461294b Fix example that was throwing an error 2024-08-08 00:39:44 -04:00
microproofs
0a1992acd2 Run acceptance tests 2024-08-08 00:39:44 -04:00
microproofs
8a461d5bd5 Few minor changes, clippy fixes, and test fixes 2024-08-08 00:39:44 -04:00