Commit Graph

146 Commits

Author SHA1 Message Date
KtorZ 067e39286d
Bump versions to 1.0.0-alpha, update CHANGELOG. 2023-04-13 17:35:21 +02:00
KtorZ 00550f8ddb
Add myself as co-authors for some of the project's crate
Forgot to do it before, and noticing now :D
2023-04-13 17:25:21 +02:00
KtorZ e2c78bdd3b
Add min rust-version to crates
So that people runs into better errors if they try installing from source with an 'obsolete' rust compiler.
2023-04-13 17:24:44 +02:00
rvcas 70f12d3fc5 chore: new branch with some things from the bumpalo branch 2023-04-13 01:28:27 -04:00
Kasey White 02d57cc076 tests pass now after adding in final wrapper as air elements 2023-04-09 17:43:56 -04:00
Kasey White 9e95e24624 now tests are passing 2023-04-09 17:43:56 -04:00
Kasey White 4d97719e6d update blueprint tests with new hashes and script outputs 2023-04-09 17:43:56 -04:00
Kasey White abd97f0ade changed assert_on_list from being defined at uplc level to being defined at air level to enable proper hoisting 2023-04-09 17:43:56 -04:00
KtorZ 4799af3242
Rework 'blueprint apply' command and wrap up wiring up validation.
The apply command now works only from a serialized CBOR data (instead of a UPLC syntax). So it is no longer possible to specify arbitrary cbor terms through the CLI. I believe it to be an acceptable limitation for now; especially given that Aiken will never generate blueprints with non-data terms at the interface boundary.
2023-04-08 08:57:40 +02:00
KtorZ bf222a3ea2
Fix reference JSON deserialization. 2023-04-08 08:57:40 +02:00
KtorZ c18deecdc8
Show slightly better schema mismatch errors
Display terms as CBOR diagnostic when they are Plutus data.
2023-04-08 08:57:38 +02:00
KtorZ 176cb45524
Factor out error (schema mismatch) creation during blueprint validation. 2023-04-08 08:57:04 +02:00
KtorZ 7d6612b108
Rework parameter validation to work from 'Constant' instead of 'Term'
This simplifies the code and makes it more efficient as we no longer need to wrap and unwrap constant terms constantly.
2023-04-08 08:57:03 +02:00
KtorZ d58ef1a079
Implement blueprint schema & data validations. 2023-04-08 08:57:03 +02:00
KtorZ ee220881b6
Generalize schema definition to work from inline schema or reference. 2023-04-08 08:57:03 +02:00
KtorZ d620f6367c
Bootstrap schema validation for simple constants. 2023-04-08 08:57:03 +02:00
KtorZ f311e048b7
Improve error message on 'ParameterizedValidator'. 2023-04-08 08:57:01 +02:00
KtorZ cdc7ebf9a0
Remove now-unnecessary blueprint generics.
These were needed before as a way to _partially deserialize_
  blueprints. Indeed, some commands required accessing information of
  the blueprint, but not necessarily the schema. So out of laziness (or
  cleverness?), we only deserialized validators as serde::Value and
  achieved that through the use of generics.

  Now that validators and schemas have proper deserialisers, we can
  simply deserialize a blueprint.

  TODO: Our serialisation/deserialisation is safe with regards to
  itself; i.e. it roundtrips. However, we only supports a subset of the
  specified blueprint format. For example, we would fail to deserialize
  blueprints that have inline data-schemas (we only use references).
2023-04-08 08:53:51 +02:00
KtorZ f0d2d20a4c
Impl JSON deserialization for blueprint's 'Schema'. 2023-04-08 08:53:51 +02:00
KtorZ 565c0bea74
Write JSON deserializers for Reference, Constructors, Items and Data.
This is needed in order to deserialize a JSON blueprint and use it to perform validation.
  Still TODO:

  - [ ] Write JSON deserializer for 'Schema'

  Which should now be relatively straightforward.
2023-04-08 08:53:49 +02:00
rvcas 1444c9328d
fix some typos 2023-04-07 16:51:18 -04:00
rvcas 3e6f688e2d feat: refactor some methods and modules
* move uplc::ast::builder to uplc::builder
* rename aiken_lang::uplc to aiken_lang::gen_uplc
* move aiken_lang::air and aiken_lang::builder to aiken_lang::gen_uplc
  as submodules

Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-03-27 20:00:32 -04:00
rvcas 2dbc50f098
feat: generate_test doesn't need arguments 2023-03-17 18:41:22 -04:00
KtorZ bc690c5410
Generated wrapped schemas for multi-validators' redeemers 2023-03-17 18:40:49 -04:00
Kasey White bb6fc76971
start on registering redeemer wrapper type in definitions 2023-03-17 18:40:49 -04:00
KtorZ 7e1403a3b2
Complete generation of blueprint multi-validators. 2023-03-17 18:40:49 -04:00
Kasey White fe92b27d50
start on refactoring validator to support multi-validators in blueprint 2023-03-17 18:40:49 -04:00
KtorZ 61113cd7b9
distinguish between multi vs single validator case in blueprint schema generation. 2023-03-17 18:40:48 -04:00
rvcas c3870e340e
feat(codegen): support multi-validators
* rename force_wrap to force
* add a bunch of builder methods to Term<Name>
* refactor one tiny location to show off builder methods
* split generate into `generate` and `generate_test`
* create wrap_as_multi_validator function

Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-03-17 18:40:44 -04:00
rvcas ed92869fb9
feat(validator): parsing and typechecking for double validators 2023-03-17 18:38:24 -04:00
KtorZ 660d2199d4
Make blueprint generation deterministic
Sort validators before iterating on them.
2023-03-17 14:57:39 +01:00
rvcas 2a00ef281b
chore: bow to the clippy 2023-03-14 17:03:28 -04:00
KtorZ ae981403c6 Re-introduce field title & description in referenced schemas. 2023-03-12 12:44:49 -04:00
KtorZ 451737237e Fix blueprint generation for recursive types.
This was a bit tricky and I ended up breaking things down a lot and
  trying different path. This commit is the result of the most
  satisfying one.

  It introduces a new 'concept' and types: Definitions and Reference.
  These elements are meant to reflect JSON pointers and JSON-schema
  definitions which we now use for pretty much all user-defined
  data-types.

  In fact, Schemas are no longer inlined, but are always referencing
  some schema under "definitions".

  This indirection is necessary in order to cope with recursive types.
  And while it's only truly necessary for recursive types, using it
  consistently makes it both easier to produce and easier to consume.

  ---

  The blueprint generation for recursive types here also works thanks to
  the 'Definitions' data-structure wrapper around a BTreeMap. This uses
  a strategy where:

  (1) schemas are only generated if they haven't been seen before
  (2) schemas are marked as seen BEFORE actually being generated (to
  effectively stop a recursive generation).

  This relies on one important aspect: the key must be uniquely
  identifying a given schema. Which means that we have to monomorphize
  data-types with generic parameters also here, and use keys that are
  specialized in one data-type.

  ---

  In this large overhaul we've also lost one thing which I didn't bother
  re-introducing yet to keep the work manageable: title for record
  fields. Before, we use to pull those from record constructor when
  available, yet now, every record constructor has been replaced by a
  `$ref`. We could theoritically attach a title to the reference. I'll
  try to quickly add that in a later commit.
2023-03-12 12:44:49 -04:00
KtorZ f67e049dc2 Introduce indirection for fields. 2023-03-12 12:44:49 -04:00
KtorZ 3a7aac0a33 Make blueprint code slightly more resilient to changes.
Leverage traits instead of hard-coded type parameters.
2023-03-12 12:44:49 -04:00
KtorZ e44f18bae5 Add failing test scenario for recursive types. 2023-03-12 12:44:49 -04:00
rvcas 6cde0628a7 fix(check): filter tests before code gen
Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-03-08 20:58:27 -05:00
KtorZ a66c9bd2c3
Remove redundant match on tuple blueprint generation. 2023-03-08 16:40:03 +01:00
KtorZ 2c987e289d
Fix 'find_modules_prefix' when generating docs. 2023-03-08 12:28:01 +01:00
KtorZ ab32302117
Only generate documentation of current package with 'docs'
This was generating documentation for ALL packages including dependencies.
2023-03-08 12:00:59 +01:00
rvcas bd7b8792bf
feat: introduce EvalResult type 2023-03-08 10:19:36 +01:00
rvcas 79c2cb3062
fix: toml now have a better way to capture error spans 2023-03-06 13:15:48 -05:00
rvcas 1902a2d56c
chore: update all deps 2023-03-06 13:13:59 -05:00
rvcas 1f8535e76e
chore: update some deps 2023-03-06 11:09:44 -05:00
rvcas e2dc4ec6c8 feat: implement convert command 2023-03-03 20:57:20 -05:00
KtorZ 6d098a4571 Fix blueprint generation for nested fields with Data
Having the data's schema be optional at the level of the 'Schema' did not allow to represent cases where there would be an opaque data at an arbitrary nesting. So I introduced a new variant 'Opaque' on 'Data' to fill that gap.
2023-03-02 15:25:17 -05:00
rvcas a40f88b918 fix: test never used Foo 2023-03-02 15:25:17 -05:00
KtorZ 65c336cb82
Update blueprint outputs to reflect latest specification.
Schemas of datums, redeemers and parameters are now nested under a field 'schema'. This allows to define a field 'purpose' at the same level.
2023-03-02 17:17:27 +01:00
KtorZ 70cdf3cb26
Add 'exported_data' test and revert 413a056 2023-03-02 16:09:08 +01:00