KtorZ
014c7a3d73
Fix error display in tx simulate.
2023-02-15 09:42:46 +01:00
Kasey White
a24fc55993
Delay 2nd arg on trace in case it throws and prevents trace from printing
2023-02-15 03:06:58 -05:00
Kasey White
e15e725bfe
add one more test
2023-02-15 02:20:05 -05:00
Kasey White
5e5a9dd25f
quick fix for test 59
2023-02-15 02:20:05 -05:00
Kasey White
32b0200966
fixes: tuple clauses, zero args funcs, list clause named pattern
...
List Clauses patterns handle var cases
Fixed Tuple Clauses issue with last clause not being a tuple
Redid how zero arg functions and dependencies are handled. Tough one lol
2023-02-15 02:20:05 -05:00
Kasey White
b7fa57027a
scope is now properly handled in expect cases
2023-02-14 12:38:36 -05:00
KtorZ
428b5f2b37
Align output of `tx simulate` with other Aiken's commands.
...
And also return a structured output as JSON, so it's more easily used
by other tools.
```
Parsing script context
Simulating 78ec148ea647cf9969446891af31939c5d57b275a2455706782c6183ef0b62f1
Redeemer Spend → 0
{"mem":151993,"cpu":58180696}
```
2023-02-14 16:50:55 +01:00
KtorZ
34596b3084
Fix collecting withdrawal scripts in eval_phase_one
...
The current implementation assumed that ALL withdrawals present in a
transaction had to be locked by a script and failed otherwise. But a
transaction can actually be composed of both. So instead of failing,
we should rather just ignore withdrawals that can't be referenced by
redeemers.
2023-02-14 15:58:34 +01:00
Kasey White
3b3ec7d95c
format fix
2023-02-12 19:12:38 -05:00
Kasey White
765ceefd38
feat: add ability to downcast void to data
2023-02-12 18:56:38 -05:00
Kasey White
4c838defd1
fix issue with final clause producing clauseguard air
2023-02-12 18:43:11 -05:00
Kasey White
e9883adf12
fix: scope issue when using when with a function call subject
2023-02-12 18:43:11 -05:00
Kasey White
4b1015e0d4
change how expect works on lists and constructors
...
Add more coverage to acceptance test 40 on expect
2023-02-11 22:26:34 -05:00
Matthias Benkort
deb2ab8f80
Merge pull request #362 from aiken-lang/patterns-improvements
...
Patterns improvements
2023-02-11 22:46:04 +01:00
KtorZ
b83a247ff7
Add slightly more informative note for list pattern on int.
2023-02-11 17:00:32 +01:00
KtorZ
2e8fd6e1c2
Remove patterns on 'String'
...
There's arguably no use case ever for that in the context of on-chain
Plutus. Strings are really just meant to be used for tracing. They
aren't meant to be manipulated as heavily as in classic programming
languages.
2023-02-11 16:57:14 +01:00
KtorZ
6649821200
Add type-checker sanity tests for list patterns.
2023-02-11 16:54:49 +01:00
KtorZ
56e90fba21
Add missing newlines to 'join' in error messages.
2023-02-11 16:24:56 +01:00
KtorZ
3c7663cd3c
Basic exhaustivness check on list patterns
...
Before that commit, the type-checker would allow unsafe list patterns
such as:
```
let [x] = xs
when xs is {
[x] -> ...
[x, ..] -> ...
}
```
This is quite unsafe and can lead to confusing situations. Now at
least the compiler warns about this. It isn't perfect though,
especially in the presence of clause guards. But that's a start.
2023-02-11 16:20:28 +01:00
rvcas
831a37d094
feat: shouldn't use this warning on list
2023-02-11 09:42:39 -05:00
Kasey White
e92d9af3c2
fix: changed how list_access_to_uplc handles discards fixing unit test 55
...
Also fix incorrect error message in runtime in machine
2023-02-11 04:30:18 -05:00
Kasey White
ddef61a855
fix: blueprint tests
2023-02-10 19:45:44 -05:00
Kasey White
0269409fa1
case where removing a lam with 0 occurrences is not safe
...
Since a function call can have arbitrary other calls that lead to error and that is difficult to detect.
2023-02-10 19:24:47 -05:00
KtorZ
21fbd48b8d
Improve error on duplicate imports.
2023-02-10 17:07:08 +01:00
KtorZ
f747ee0aca
Improve error message when finding a non-exhaustive let-binding.
2023-02-10 11:01:13 +01:00
rvcas
c1d67e95e1
feat: fix errors and add tests for BigInt changes
2023-02-09 15:01:30 -05:00
KtorZ
bd4aeb779c
Implement integer_log2 on BigInt
...
Comparing it with the Haskell's implementation.
2023-02-09 18:14:00 +01:00
KtorZ
e76d26eb3c
Fixup: follow compiler.
2023-02-09 16:09:49 +01:00
rvcas
cfbe5fd3cc
feat: use BigInt in constant integer
2023-02-09 09:46:42 -05:00
rvcas
ec58279424
test(machine): integer overflow
2023-02-09 09:44:06 -05:00
Matthias Benkort
37bd22a0d2
Merge pull request #353 from aiken-lang/rvcas/assert_expect
...
Rename assert to expect
2023-02-09 15:17:14 +01:00
rvcas
461aaf14bd
chore: no more loose numbers for location offsets
2023-02-09 09:16:54 -05:00
KtorZ
b5cf8c78a5
Add Ordering data-type definition to prelude known constructors.
2023-02-09 14:36:39 +01:00
KtorZ
6be2a9ed80
Fix formatting of unary operators applied to binary operators.
...
Add crucial parenthesis...
2023-02-09 13:58:11 +01:00
KtorZ
83a86e6dc0
Fix logical operator precedence in parser.
...
Whoopsie... || and && were treated with the same precedence, causing very surprising behavior down the line.
I noticed this because of the auto-formatter adding parenthesis where it really shouldn't. The problem came actually from the parser and how it constructed the AST.
2023-02-09 13:57:12 +01:00
KtorZ
62fe321ddf
Add 'Ordering' data-type to the Prelude.
...
Useful to have around to build comparison functions.
2023-02-09 11:07:30 +01:00
Matthias Benkort
b803332f99
Update crates/aiken-lang/src/tipo/error.rs
2023-02-09 09:25:33 +01:00
rvcas
460da20e4a
feat: warn when using expect in a completely safe way
2023-02-09 02:10:22 -05:00
rvcas
e9caa710c4
chore: rename assert_parser to expect_parser
2023-02-09 01:05:11 -05:00
rvcas
9348caab2f
feat(expect): update formatter
...
* Token::Expect should format to expect
* since we still capture assert this means
we can help users update to the new syntax
2023-02-09 00:57:38 -05:00
rvcas
3f540c7c99
chore: rename assignment kind
2023-02-09 00:47:38 -05:00
rvcas
dbd162e985
feat: handle expect in parser
...
* map both assert/expect to Token::Expect
* use the new token in the parser
* new unit test to expect
2023-02-09 00:43:29 -05:00
rvcas
5a4a8df727
feat(token): add Token::Expect
2023-02-09 00:25:54 -05:00
rvcas
fd14da0720
chore: fix blueprint tests
2023-02-09 00:09:23 -05:00
Kasey White
f60b7d84c1
clippy fix
2023-02-09 00:09:23 -05:00
Kasey White
076871492b
fix: unwrap used in a reachable place. Replaced with alternative option
2023-02-09 00:09:23 -05:00
Kasey White
9ae28aaa88
all nebula tests pass. Had one more fix on listaccessor to finish
2023-02-09 00:09:23 -05:00
Kasey White
986a6009f7
fix: Various fixes for FieldsExpose, ListAccessor, TupleAccessor
2023-02-09 00:09:23 -05:00
KtorZ
95a62f7172
Fix oversights in blueprint / schema generation.
2023-02-08 19:04:50 +01:00
alessandrokonrad
221f1afbfe
Changed imports
2023-02-08 16:28:59 +01:00
alessandrokonrad
74b3507777
Added tag/constructor conversion tests
2023-02-08 16:26:58 +01:00
Ales
242eaa8b67
Merge pull request #347 from spacebudz/constr
...
Fix constructor tag range
2023-02-08 14:52:50 +01:00
alessandrokonrad
ce648b7483
Fixed schnorr and limiting it to 32 bytes messages for now
2023-02-08 08:04:24 -05:00
alessandrokonrad
3012a0b41d
Fix constructor tag range
2023-02-08 13:14:26 +01:00
alessandrokonrad
7c9443d87f
Changed to prehash function
2023-02-07 22:53:30 +01:00
KtorZ
6e554129e9
Fix blueprint validator tests.
2023-02-07 12:28:34 +01:00
Matthias Benkort
8feaefe073
Merge pull request #335 from aiken-lang/blueprint-parameters
...
Blueprint parameters
2023-02-07 11:43:01 +01:00
KtorZ
4aa92a6d5e
Use positional argument for blueprint 'apply' command
2023-02-07 11:42:42 +01:00
rvcas
08e8347317
chore: rename feature flag to native-secp256k1
2023-02-07 00:25:22 -05:00
rvcas
67a2674d27
feat: allow verify functions to build for wasm
2023-02-07 00:25:22 -05:00
Kasey White
5d0c5d2a5b
remove a redundant type replacement in build_ir
2023-02-05 23:56:44 -05:00
rvcas
3ff927d30a
feat: reset the generator when generate finishes
2023-02-05 20:35:39 -05:00
rvcas
501d667532
chore: fix tests
2023-02-05 20:35:39 -05:00
Kasey White
f1b24a5f6d
fix: the following issues
...
fix conversion from inner opaque type for when and assignment
This fixes Clause being used in cases where ListClause or TupleClause should be used
Reset defined and zero arg functions between each code gen
Fixes for optimizations when encountering shadowed variables
2023-02-05 20:35:39 -05:00
Kasey White
c32a9d7b6f
commit working changes so far
2023-02-05 20:35:39 -05:00
rvcas
31cd19f198
feat: use secp256k1 to implement verify for ecdsa and schnorr
2023-02-04 22:07:56 -05:00
rvcas
cde3e31723
feat: fill in todo for verify ecdsa and schnorr costing
2023-02-04 22:07:56 -05:00
rvcas
09d8d683b6
fix: switch to error from secp256k1
2023-02-04 22:07:56 -05:00
rvcas
fb69a2c8a9
fix: switch to rust bindings for bitcoin-secp256k1
2023-02-04 22:07:56 -05:00
rvcas
c2ff9389c5
feat(runtime): implement verifyEcdsaSecp256k1Signature
2023-02-04 22:07:56 -05:00
rvcas
d224fe5356
feat(runtime): set force count and arg typechecking for the elliptic curve builtins
2023-02-04 22:07:56 -05:00
rvcas
fb37521857
feat: make a transparent machine error for signature::Error
2023-02-04 22:07:56 -05:00
rvcas
175cd777d8
feat: enable elliptic curve verification builtins
2023-02-04 22:07:56 -05:00
rvcas
7bffb994fc
feat: add k256 for elliptic curve algos
2023-02-04 22:07:56 -05:00
dependabot[bot]
71b7ec6088
chore(deps): bump tokio from 1.23.1 to 1.24.2
...
Bumps [tokio](https://github.com/tokio-rs/tokio ) from 1.23.1 to 1.24.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases )
- [Commits](https://github.com/tokio-rs/tokio/commits )
---
updated-dependencies:
- dependency-name: tokio
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-02-04 20:06:54 -05:00
rvcas
ddad05bf51
chore: leave a comment for later
2023-02-04 15:33:18 -05:00
KtorZ
b04fb5962a
Do not compute addresses of parameterized validators
...
And leave a proper notice.
2023-02-04 11:49:56 +01:00
KtorZ
9b8ff590b8
Implement 'blueprint apply' command.
...
This is still a bit clunky as the interface is expecting parameters in UPLC form and we don't do any kind of verification. So it is easy to shoot oneself in the foot at the moment (for example, to apply an integer into something that should have received a data). To be improved later.
2023-02-04 11:39:55 +01:00
KtorZ
ea269b14a2
Fix deserialization issue when 'parameters' is missing.
...
Deserialize to an empty vector.
2023-02-04 11:38:09 +01:00
KtorZ
592d3d7a1c
Define 'apply_parameter' method on 'Project'
2023-02-04 10:44:33 +01:00
KtorZ
12f4768008
Write method to apply a UPLC term to an existing 'Validator'
2023-02-04 10:22:23 +01:00
KtorZ
9c71aab3db
Factor out reusable parts regarding blueprints from lib/project
...
So we can re-apply the same logic for applying arguments.
2023-02-04 10:21:45 +01:00
KtorZ
55ecc199d1
Add 'parameters' to blueprints for parameterized validators.
...
Without that, we have no way to distinguish between fully applied
validators and those that still require some hard-coded parameters.
Next steps is to make it easier to apply parameters to those, as well
as forbid the creation of addresses of validators that aren't fully
qualified.
2023-02-04 09:31:43 +01:00
Kasey White
4c8221e439
fix: add is data check to recursive_assert_tipo
2023-02-04 02:47:55 -05:00
Kasey White
86ca466807
feat: some code gen improvements
...
* fix assert on pattern Var
* fix tuple index unwrapping closes #334
* allow wrapping when casting with let
* allow wrapping when casting via function call
2023-02-04 02:33:10 -05:00
rvcas
c126f6acda
feat: invert how casting is controlled
...
I decided to invert how I'm doing it. I'm passing
in a new argument to unify in environment called
allow_cast: bool and essentially at various
unification sites I can control whether or not I
want to allow casting to even occur. So we can
assume it's false by default always and then we
turn it on in a few places vs. just opening the
flood gates and locking it down at various sites
as they come up# Please enter the commit message
for your changes. Lines starting
2023-02-04 02:33:10 -05:00
rvcas
2b554d105a
fix: when Data cast bypass
2023-02-04 02:33:10 -05:00
rvcas
a9ed04ef22
feat: newer rules around casting Data
...
* you cannot cast FROM Data with a `let`
* you cannot cast FROM Data by passing
Data to none Data when calling a function
* you MUST use `assert` to cast from data
* you can cast INTO Data with a `let`
* you can cast INTO Data by passing none Data
to Data when calling a function
* You cannot assert cast Data without an
annotation
2023-02-04 02:33:10 -05:00
Niels Mündler
700e9cab5b
Add missing carets when dumping builtin list
2023-02-02 17:32:03 -05:00
rvcas
ae42dc964a
fix: allow var and discard with data on right hand side
2023-02-02 01:16:53 -05:00
rvcas
39e0716f5f
feat: better rules around Data casting
...
* you cannot cast to Data ever
* you can cast from Data to ANY TYPE
* you cannot cast via a function call arg hack
2023-02-02 00:43:45 -05:00
rvcas
c9d0ce0392
chore: fmt
2023-02-01 23:49:33 -05:00
rvcas
50b5273967
fix(tests): validator hashs and cbor changed for blueprints
2023-02-01 23:49:33 -05:00
Kasey White
1843b7e73b
clippy fix and remove some prints
2023-02-01 23:49:33 -05:00
Kasey White
9dc2bac2c3
fix:minor optimization fixes
...
Unique only comparison for equals led to strange results
Fixed by interning in a different spot
2023-02-01 23:49:33 -05:00
Kasey White
fdf89b7326
implement optimizations
...
-Force usage on builtins
-Inline vars used once
-Lambdas that use a var as an arg
-Lambdas that use a const as an arg
2023-02-01 23:49:33 -05:00
rvcas
88ce8ba8b9
feat: remove check assignment
2023-02-01 23:03:35 -05:00
rvcas
21251d6499
fix: remove check from lexer
2023-02-01 20:44:58 -05:00
Kasey White
3123ad9079
change eval_builtin_app to return Rc so that ifthenelse and chooselist are faster
2023-02-01 18:53:11 -05:00
Kasey White
456b08a205
minor performance improvements
...
Changed a couple cases where the inner Rc object was cloned to use the Rc object instead
2023-02-01 18:53:11 -05:00