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?
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\ntype Either<left, right> {\n Left(left)\n Right(right)\n}\n\ntype Interval<a> {\n Finite(a)\n Infinite\n}\n\nvalidator {\n fn generics(redeemer: Either<ByteArray, Interval<Int>>, ctx: Void) {\n True\n }\n}\n"
|
||||
description: "Code:\n\npub type Either<left, right> {\n Left(left)\n Right(right)\n}\n\npub type Interval<a> {\n Finite(a)\n Infinite\n}\n\nvalidator generics {\n spend(datum: Option<Data>, redeemer: Either<ByteArray, Interval<Int>>, output_reference: Data, transaction: Data) {\n True\n }\n}\n"
|
||||
---
|
||||
{
|
||||
"title": "test_module.generics",
|
||||
"title": "test_module.generics_spend",
|
||||
"datum": {
|
||||
"title": "datum",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Data"
|
||||
}
|
||||
},
|
||||
"redeemer": {
|
||||
"title": "redeemer",
|
||||
"schema": {
|
||||
@@ -16,6 +22,10 @@ description: "Code:\n\ntype Either<left, right> {\n Left(left)\n Right(rig
|
||||
"ByteArray": {
|
||||
"dataType": "bytes"
|
||||
},
|
||||
"Data": {
|
||||
"title": "Data",
|
||||
"description": "Any Plutus data."
|
||||
},
|
||||
"Int": {
|
||||
"dataType": "integer"
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\ntype Dict<key, value> {\n inner: List<(ByteArray, value)>\n}\n\ntype UUID { UUID }\n\nvalidator {\n fn list_2_tuples_as_list(redeemer: Dict<UUID, Int>, ctx: Void) {\n True\n }\n}\n"
|
||||
description: "Code:\n\npub type Dict<key, value> {\n inner: List<(ByteArray, value)>\n}\n\npub type UUID { UUID }\n\nvalidator list_2_tuples_as_list {\n mint(redeemer: Dict<UUID, Int>, policy_id: ByteArray, transaction: Data) {\n True\n }\n}\n"
|
||||
---
|
||||
{
|
||||
"title": "test_module.list_2_tuples_as_list",
|
||||
"title": "test_module.list_2_tuples_as_list_mint",
|
||||
"redeemer": {
|
||||
"title": "redeemer",
|
||||
"schema": {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\nvalidator(utxo_ref: Int) {\n fn mint(redeemer: Data, ctx: Data) {\n True\n }\n}\n// "
|
||||
description: "Code:\n\nvalidator thing(utxo_ref: Int) {\n mint(redeemer: Data, policy_id: ByteArray, transaction: Data) {\n True\n }\n}\n// "
|
||||
---
|
||||
{
|
||||
"title": "test_module.mint",
|
||||
"title": "test_module.thing_mint",
|
||||
"redeemer": {
|
||||
"title": "redeemer",
|
||||
"schema": {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\npub type Foo {\n foo: Data\n}\n\nvalidator {\n fn nested_data(datum: Foo, redeemer: Int, ctx: Void) {\n True\n }\n}\n"
|
||||
description: "Code:\n\npub type Foo {\n foo: Data\n}\n\nvalidator nested_data {\n spend(datum: Option<Foo>, redeemer: Int, output_reference: Data, transaction: Data) {\n True\n }\n}\n"
|
||||
---
|
||||
{
|
||||
"title": "test_module.nested_data",
|
||||
"title": "test_module.nested_data_spend",
|
||||
"datum": {
|
||||
"title": "datum",
|
||||
"schema": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\npub opaque type Rational {\n numerator: Int,\n denominator: Int,\n}\n\nvalidator opaque_singleton_multi_variants {\n spend(redeemer: Rational, oref: Data, ctx: Void) {\n True\n }\n}\n"
|
||||
description: "Code:\n\npub opaque type Rational {\n numerator: Int,\n denominator: Int,\n}\n\nvalidator opaque_singleton_multi_variants {\n spend(datum: Option<Data>, redeemer: Rational, oref: Data, transaction: Data) {\n True\n }\n}\n"
|
||||
---
|
||||
Schema {
|
||||
error: Error {
|
||||
@@ -16,7 +16,7 @@ Schema {
|
||||
},
|
||||
],
|
||||
},
|
||||
location: 120..138,
|
||||
location: 141..159,
|
||||
source_code: NamedSource {
|
||||
name: "",
|
||||
source: "<redacted>",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\npub type LinkedList<a> {\n Cons(a, LinkedList<a>)\n Nil\n}\n\npub type Foo {\n Foo {\n foo: LinkedList<Bool>,\n }\n Bar {\n bar: Int,\n baz: (ByteArray, List<LinkedList<Int>>)\n }\n}\n\nvalidator {\n fn recursive_generic_types(datum: Foo, redeemer: LinkedList<Int>, ctx: Void) {\n True\n }\n}\n"
|
||||
description: "Code:\n\npub type LinkedList<a> {\n Cons(a, LinkedList<a>)\n Nil\n}\n\npub type Foo {\n Foo {\n foo: LinkedList<Bool>,\n }\n Bar {\n bar: Int,\n baz: (ByteArray, List<LinkedList<Int>>)\n }\n}\n\nvalidator recursive_generic_types {\n spend(datum: Option<Foo>, redeemer: LinkedList<Int>, output_reference: Data, transaction: Data) {\n True\n }\n}\n"
|
||||
---
|
||||
{
|
||||
"title": "test_module.recursive_generic_types",
|
||||
"title": "test_module.recursive_generic_types_spend",
|
||||
"datum": {
|
||||
"title": "datum",
|
||||
"schema": {
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\npub type Expr {\n Val(Int)\n Sum(Expr, Expr)\n Mul(Expr, Expr)\n}\n\nvalidator {\n fn recursive_types(redeemer: Expr, ctx: Void) {\n True\n }\n}\n"
|
||||
description: "Code:\n\npub type Expr {\n Val(Int)\n Sum(Expr, Expr)\n Mul(Expr, Expr)\n}\n\nvalidator recursive_types {\n spend(datum: Option<Data>, redeemer: Expr, output_reference: Data, transaction: Data) {\n True\n }\n}\n"
|
||||
---
|
||||
{
|
||||
"title": "test_module.recursive_types",
|
||||
"title": "test_module.recursive_types_spend",
|
||||
"datum": {
|
||||
"title": "datum",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Data"
|
||||
}
|
||||
},
|
||||
"redeemer": {
|
||||
"title": "redeemer",
|
||||
"schema": {
|
||||
@@ -13,6 +19,10 @@ description: "Code:\n\npub type Expr {\n Val(Int)\n Sum(Expr, Expr)\n Mul(Exp
|
||||
"compiledCode": "<redacted>",
|
||||
"hash": "<redacted>",
|
||||
"definitions": {
|
||||
"Data": {
|
||||
"title": "Data",
|
||||
"description": "Any Plutus data."
|
||||
},
|
||||
"Int": {
|
||||
"dataType": "integer"
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\n/// On-chain state\ntype State {\n /// The contestation period as a number of seconds\n contestationPeriod: ContestationPeriod,\n /// List of public key hashes of all participants\n parties: List<Party>,\n utxoHash: Hash<Blake2b_256>,\n}\n\n/// A Hash digest for a given algorithm.\ntype Hash<alg> = ByteArray\n\ntype Blake2b_256 { Blake2b_256 }\n\n/// Whatever\ntype ContestationPeriod {\n /// A positive, non-zero number of seconds.\n ContestationPeriod(Int)\n}\n\ntype Party =\n ByteArray\n\ntype Input {\n CollectCom\n Close\n /// Abort a transaction\n Abort\n}\n\nvalidator {\n fn simplified_hydra(datum: State, redeemer: Input, ctx: Data) {\n True\n }\n}\n"
|
||||
description: "Code:\n\n/// On-chain state\npub type State {\n /// The contestation period as a number of seconds\n contestationPeriod: ContestationPeriod,\n /// List of public key hashes of all participants\n parties: List<Party>,\n utxoHash: Hash<Blake2b_256>,\n}\n\n/// A Hash digest for a given algorithm.\npub type Hash<alg> = ByteArray\n\npub type Blake2b_256 { Blake2b_256 }\n\n/// Whatever\npub type ContestationPeriod {\n /// A positive, non-zero number of seconds.\n ContestationPeriod(Int)\n}\n\npub type Party =\n ByteArray\n\npub type Input {\n CollectCom\n Close\n /// Abort a transaction\n Abort\n}\n\nvalidator simplified_hydra {\n spend(datum: Option<State>, redeemer: Input, output_reference: Data, transaction: Data) {\n True\n }\n}\n"
|
||||
---
|
||||
{
|
||||
"title": "test_module.simplified_hydra",
|
||||
"title": "test_module.simplified_hydra_spend",
|
||||
"datum": {
|
||||
"title": "datum",
|
||||
"schema": {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
source: crates/aiken-project/src/blueprint/validator.rs
|
||||
description: "Code:\n\nvalidator {\n fn tuples(datum: (Int, ByteArray), redeemer: (Int, Int, Int), ctx: Void) {\n True\n }\n}\n"
|
||||
description: "Code:\n\nvalidator tuples {\n spend(datum: Option<(Int, ByteArray)>, redeemer: (Int, Int, Int), output_reference: Data, transaction: Data) {\n True\n }\n}\n"
|
||||
---
|
||||
{
|
||||
"title": "test_module.tuples",
|
||||
"title": "test_module.tuples_spend",
|
||||
"datum": {
|
||||
"title": "datum",
|
||||
"schema": {
|
||||
|
||||
Reference in New Issue
Block a user