Commit Graph

540 Commits

Author SHA1 Message Date
KtorZ
007b85b864 Warn for any ignored file during source parsing
Not only for files with a .ak extension.
2024-09-03 15:28:09 +02:00
KtorZ
038f6ecbfd Detect and report duplicate module names during parsing
Funny enough, we thought about that but only across packages. Now, the
  situation gets a little tricky because of folder structure, it's easy
  to define a module "foo" in `env`, `lib` and/or `validators`. From the
  compiler's perspective, they all have the same name.
2024-09-03 15:24:01 +02:00
KtorZ
a06383d333 Use const instead of zero-arg functions in few code-gen tests. 2024-08-30 14:47:22 +02:00
KtorZ
ef89691331 Ensure code-gen's Program version/semantic matches Plutus version 2024-08-30 14:45:02 +02:00
microproofs
4a8bec4caa Fixing gen uplc tests 2024-08-29 16:30:31 +02:00
KtorZ
38e8c6264d Do not trigger warnings for exported configurations. 2024-08-29 16:25:12 +02:00
microproofs
f35afe8d65 Implement SimpleExpr logic for configuration parsing
We can now use boolean, lists & all in configuration.
2024-08-29 16:25:10 +02:00
KtorZ
cd0a9440e8 Allow any expression as constants
This is only a start. It compiles, but with a few TODOs left open. In particular, it doesn't currently handle constants depending on other constants or functions; nor does it hoist constants.
2024-08-29 16:24:12 +02:00
KtorZ
79cf0b8d97 Fix test_framework tests trying to implement function on foreign type. 2024-08-29 13:49:09 +02:00
KtorZ
c21466831c Bump versions to 1.1.0, in anticipation. 2024-08-29 09:12:37 +02:00
KtorZ
e31c6de04e Adjust module organization to facilitate resurrection of the playground.
The playground doesn't / cannot depend on aiken-project because that becomes a gigantic pain. So instead, we try to keep essential stuff inside aiken-lang when possible.
2024-08-29 09:12:37 +02:00
KtorZ
745f14ccb2 Adjust doc to support blockquote alerts. 2024-08-28 15:28:49 +02:00
KtorZ
d615b4f889 Fix incongruous panic when annotation is missing from Datum.
It's fine for the argument to not be annotated; in which case we
  simply default back to an `Option<Data>`.
2024-08-27 18:55:18 +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
KtorZ
e9edd20c21 Fix gen_uplc tests revolving around validators.
Fucking hell.

  I got rid of the 'opaque_value_in_datum' test since it is no longer
  relevant (we now forbid the presence of opaque types in the ABI).
2024-08-25 16:20:09 +02:00
KtorZ
52a39629b7 Add UPLC test for always_true mint validator.
Mainly to have a trivial example with just the validator boilerplate code.
2024-08-25 16:20:08 +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
ed55f03aa2 Fix remaining blueprint test.
Probably an oversight when we reworked them.
2024-08-25 16:20:08 +02:00
KtorZ
442010d056 Fix generation of fallback validator
This must only happen in case all other validator succeed; otherwise
  we might generate invalid validators.
2024-08-25 16:20:08 +02:00
rvcas
73522296aa chore: accept updated snapshot 2024-08-25 16:20:08 +02:00
rvcas
ff1464b462 feat: annotated data for option datum 2024-08-25 16:20:08 +02:00
rvcas
d8723c5497 feat: use __fallback in bluprint for the else 2024-08-25 16:20:07 +02:00
rvcas
c57009bf99 chore: fix some tests that now correctly fail due to arity checks 2024-08-25 16:20:07 +02:00
KtorZ
c706d6072d Fix few blueprint generation tests
Some remains invalid, in particular:

  - We need to handle the annotated Data case, which we still parse
    correctly but do nothing about any longer.

  - There's also a strange behavior with opaque type turned public?
2024-08-25 16:20:07 +02:00
KtorZ
7ec3f2e8df DRY builtins types creation to ensure proper consistency. 2024-08-25 16:20:06 +02:00
rvcas
c2c4bddfb3 feat: new check for valid purpose names 2024-08-25 16:20:05 +02:00
KtorZ
5cf0a4d294 Fix validator arity check
For now, this panics, but ideally, we should return a "unknown
  purpose" error when we cannot map the name to an arity.
2024-08-25 16:20:04 +02:00
KtorZ
972e9bd763 Define ScriptPurpose & ScriptContext types in prelude, fix codegen new v3 wrapper. 2024-08-25 16:20:04 +02:00
rvcas
90d75d4a13 fix: redeemer could be missing 2024-08-25 16:20:04 +02:00
rvcas
00b8a39236 fix: private type leaks 2024-08-25 16:20:04 +02:00
rvcas
79840248c0 fix: more parse errors in some tests 2024-08-25 16:20:04 +02:00
rvcas
f94e40daf4 fix: more test and issues with scoping/names 2024-08-25 16:20:03 +02:00
rvcas
0d8d80e5a7 feat: transform TypedValidator in a function of handlers 2024-08-25 16:20:03 +02:00
rvcas
466a4f0b39 feat: adjust blueprint stuff to be aware of handlers 2024-08-25 16:20:02 +02:00
KtorZ
a71d7c260c Fix doc_test examples for 'common_prefix' 2024-08-23 16:17:54 +02:00
KtorZ
c92b260260 Fix gen_uplc tests following: 0f905045 2024-08-23 16:17:27 +02:00
KtorZ
c3b287507e Fix link_tree test following 0ff12b92 2024-08-23 16:10:07 +02:00
KtorZ
6e67fe837b Keep constants and types sorted; only functions are unsorted. 2024-08-23 10:30:18 +02:00
KtorZ
c3e39301e2 Re-format source code using cargo fmt. 2024-08-22 16:42:41 +02:00
KtorZ
b479a289cf Implement source linker and add URL to source code in generated docs.
Long overdue.
2024-08-22 16:37:48 +02:00
KtorZ
44e42d608d Allow hidden modules, not generating any documentation.
This is useful when splitting module for dependencies, yet without the desire to expose internal constructors and types. This merely skips the documentation generation; but doesn't prevent the hidden module from being accessible.
2024-08-22 15:47:00 +02:00
KtorZ
7eee3ce63c Fix CLI output colors when generating documentation. 2024-08-22 15:47:00 +02:00
KtorZ
10c829edfa Parse and display documentation section headers.
The idea is pretty simple, we'll just look for lines starting with Markdown heading sections, and render them in the documentation. They appear both in the sidebar, and within the generated docs themselves in between functions. This, coupled with the order preservation of the declaration in a module should make the generated docs significantly more elegant to organize and present.
2024-08-22 15:47:00 +02:00
KtorZ
0ff12b9246 Better module hierarchy and style for generated docs.
This commit also reverse the order of the sections in the sidebar such
  that modules are now placed last.
2024-08-22 15:43:55 +02:00
KtorZ
8b869c0a32 Do not sort functions, types and constants in generated docs
The rationale is to let them in the order they are defined, so that
  library authors have some freedom in how they present information. On
  top of that, we'll also now parse specifi comments as section headers
  that will be inserted in the sidebar when present.
2024-08-22 15:08:46 +02:00
KtorZ
802e8272c5 Properly display constructor arguments documentation, if any. 2024-08-20 09:31:41 +02:00
KtorZ
508d88035b Fix Plutus v3 validator hash calculation in blueprint. 2024-08-13 10:55:22 +02:00
microproofs
0800901135 Fix clippy 2024-08-08 00:39:44 -04:00
microproofs
224f31b1d7 Fixed last gen_uplc test 2024-08-08 00:39:44 -04:00
microproofs
56ff4ec678 Fixing other tests 2024-08-08 00:39:44 -04:00