Commit Graph

527 Commits

Author SHA1 Message Date
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
microproofs
7ad5491ea9 Fix major uplc test 2024-08-08 00:39:44 -04:00
microproofs
33370b8637 Fix minor issues found when testing 2024-08-08 00:39:44 -04:00
microproofs
4249ef2509 Fix extra delay in a test 2024-08-08 00:39:44 -04:00
KtorZ
f5c4e185d4 Redact compiledCode & hash in generated blueprint tests
The point of those tests is to ensure that blueprints are generated
  properly, irrespective of the generated code. It is annoying to
  constantly get those test failing every time we introduce an
  optimization or something that would slightly change the generated
  UPLC.
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
microproofs
4cf81a19b1 Update most of the tests and builder functions to use the new delay_branch_functions 2024-08-08 00:39:44 -04:00
microproofs
d7e9fef4d3 Create new helper functions to take care of force and delaying branch terms 2024-08-08 00:39:44 -04:00
microproofs
d23a5b2f11 Fix test for expect_head_cast_data_with_tail 2024-08-08 00:39:44 -04:00
KtorZ
8b30f064a2 Make gen_uplc test output more readable + start debugging expect_head_cast_with_tail 2024-08-08 00:39:44 -04:00
microproofs
a132a2e486 Fix unwrap issues 2024-08-08 00:39:44 -04:00
microproofs
05504b9762 Fix out of order expect check. Also fix no_inline error in code gen. @acceptance_107 2024-08-08 00:39:44 -04:00
KtorZ
aa872846bb Re-generate insta snapshots, remove obsolete snapshots. 2024-08-06 19:25:35 +02:00
KtorZ
9d8fdf787c Improve formatter on long-lines, in particular bin-ops. 2024-08-06 19:25:35 +02:00