Skip to content

Commit

Permalink
Fix remaining acceptance tests to be V3-compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Aug 27, 2024
1 parent d615b4f commit 4853563
Show file tree
Hide file tree
Showing 59 changed files with 357 additions and 277 deletions.
5 changes: 3 additions & 2 deletions examples/acceptance_tests/012/lib/tests.ak
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub fn filter(xs: List<a>, f: fn(a) -> Bool) -> List<a> {
}

test filter_1() {
filter([1,
2, 3, 4, 5, 6], fn(x) { builtin.mod_integer(x, 2) == 0 }) == [2, 4, 6]
filter([1, 2, 3, 4, 5, 6], fn(x) { builtin.mod_integer(x, 2) == 0 }) == [
2, 4, 6,
]
}
6 changes: 3 additions & 3 deletions examples/acceptance_tests/036/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

[[requirements]]
name = "aiken-lang/stdlib"
version = "main"
version = "v2"
source = "github"

[[packages]]
name = "aiken-lang/stdlib"
version = "main"
version = "v2"
requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158432, nanos_since_epoch = 10066000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724777134, nanos_since_epoch = 232157000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/036/aiken.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ version = "0.0.0"

[[dependencies]]
name = 'aiken-lang/stdlib'
version = 'main'
version = 'v2'
source = 'github'
55 changes: 28 additions & 27 deletions examples/acceptance_tests/036/plutus.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"plutusVersion": "v2",
"compiler": {
"name": "Aiken",
"version": "v1.0.31-alpha+6e4a16d"
"version": "v1.0.31-alpha+4003343"
}
},
"validators": [
{
"title": "spend.mint",
"title": "spend.bar.mint",
"redeemer": {
"title": "_redeemer",
"schema": {
Expand All @@ -21,15 +21,28 @@
{
"title": "output_reference",
"schema": {
"$ref": "#/definitions/aiken~1transaction~1OutputReference"
"$ref": "#/definitions/cardano~1transaction~1OutputReference"
}
}
],
"compiledCode": "589e0100003232323232323222322533300553330053370e900018031baa3232330010013758600460126ea8c008c024dd50019129998058008a6103d87a800013232533300a3375e600a60186ea80080244cdd2a40006601c00497ae0133004004001300f002300d0012300b00114a229405261365653330033370e900018021baa00115333006300537540022930b0b2b9a5573aaae7955cfaba05742ae881",
"hash": "0241f73ef186e53566d1b5a81eca50049b0d86833e6b88fe26b1e4bc"
"compiledCode": "58c90100003232323232323222533300332323232325332330093001300a375400426464a666016600660186ea8c8c8cc004004dd6180118079baa00922533301100114c0103d87a80001323253330103375e600a60246ea800803c4cdd2a40006602800497ae0133004004001301500230130012301100114a229414ccc028c008c02cdd50020a99980698061baa00414985858dd7180718059baa002370e90000b1806180680118058009805801180480098029baa00114984d9595cd2ab9d5573caae7d5d02ba157441",
"hash": "2edaecec5a072cd65b12395410ce6da7cafaffdf70506cbcb40b4df8"
},
{
"title": "spend.spend",
"title": "spend.bar.else",
"parameters": [
{
"title": "output_reference",
"schema": {
"$ref": "#/definitions/cardano~1transaction~1OutputReference"
}
}
],
"compiledCode": "58c90100003232323232323222533300332323232325332330093001300a375400426464a666016600660186ea8c8c8cc004004dd6180118079baa00922533301100114c0103d87a80001323253330103375e600a60246ea800803c4cdd2a40006602800497ae0133004004001301500230130012301100114a229414ccc028c008c02cdd50020a99980698061baa00414985858dd7180718059baa002370e90000b1806180680118058009805801180480098029baa00114984d9595cd2ab9d5573caae7d5d02ba157441",
"hash": "2edaecec5a072cd65b12395410ce6da7cafaffdf70506cbcb40b4df8"
},
{
"title": "spend.foo.spend",
"datum": {
"title": "_datum",
"schema": {
Expand All @@ -42,8 +55,13 @@
"$ref": "#/definitions/Data"
}
},
"compiledCode": "58ef01000032323232323232222533300432330010013758601460166016600e6ea8c028c01cdd50011129998048008a501325333007333007533300a3253330083370e900118049baa00114bd6f7b63009bab300d300a375400264660020026eacc034c038c028dd518068019129998060008a60103d87a8000132323232533300d33722911050000000000000021533300d3371e91010500000000000000213374a9000198089ba60014bd700a6103d87a80001330060060033756601c0066eb8c030008c040008c0380045288a504a094452889980180180098060008a4c26cacae6955ceaab9e5573eae815d0aba21",
"hash": "f56561e01063b11146809755d9907147e79d3166aa5c65fba4040fd1"
"compiledCode": "5901230100003232323232323225333002323232323253330073370e900118041baa001132323232330010013758602060226022601a6ea8020894ccc03c0045280992999806999806a99980819299980719b8748008c03cdd50008a5eb7bdb1804dd5980998081baa001323300100137566026602860206ea8c04c00c894ccc048004530103d87a800013232323253330133372291105000000000000002153330133371e91010500000000000000213374a90001980b9ba60014bd700a6103d87a8000133006006003375660280066eb8c048008c058008c0500045288a504a0944528899801801800980900098071807801180680098049baa00116300b300c002300a001300a00230080013004375400229309b2b2b9a5573aaae7955cfaba05742ae881",
"hash": "cf024265a1ff4ab129cef178c64b8c4cab25d62129242e01e29bb3d1"
},
{
"title": "spend.foo.else",
"compiledCode": "5901230100003232323232323225333002323232323253330073370e900118041baa001132323232330010013758602060226022601a6ea8020894ccc03c0045280992999806999806a99980819299980719b8748008c03cdd50008a5eb7bdb1804dd5980998081baa001323300100137566026602860206ea8c04c00c894ccc048004530103d87a800013232323253330133372291105000000000000002153330133371e91010500000000000000213374a90001980b9ba60014bd700a6103d87a8000133006006003375660280066eb8c048008c058008c0500045288a504a0944528899801801800980900098071807801180680098049baa00116300b300c002300a001300a00230080013004375400229309b2b2b9a5573aaae7955cfaba05742ae881",
"hash": "cf024265a1ff4ab129cef178c64b8c4cab25d62129242e01e29bb3d1"
}
],
"definitions": {
Expand All @@ -68,7 +86,7 @@
}
]
},
"aiken/transaction/OutputReference": {
"cardano/transaction/OutputReference": {
"title": "OutputReference",
"description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output",
"anyOf": [
Expand All @@ -79,7 +97,7 @@
"fields": [
{
"title": "transaction_id",
"$ref": "#/definitions/aiken~1transaction~1TransactionId"
"$ref": "#/definitions/ByteArray"
},
{
"title": "output_index",
Expand All @@ -88,23 +106,6 @@
]
}
]
},
"aiken/transaction/TransactionId": {
"title": "TransactionId",
"description": "A unique transaction identifier, as the hash of a transaction body. Note that the transaction id\n isn't a direct hash of the `Transaction` as visible on-chain. Rather, they correspond to hash\n digests of transaction body as they are serialized on the network.",
"anyOf": [
{
"title": "TransactionId",
"dataType": "constructor",
"index": 0,
"fields": [
{
"title": "hash",
"$ref": "#/definitions/ByteArray"
}
]
}
]
}
}
}
26 changes: 17 additions & 9 deletions examples/acceptance_tests/036/validators/spend.ak
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
use aiken/dict
use aiken/list
use aiken/transaction.{Output, OutputReference, ScriptContext}
use aiken/transaction/value.{PolicyId}
use aiken/collection/dict
use aiken/collection/list
use cardano/assets.{PolicyId}
use cardano/transaction.{Output, OutputReference, Transaction}

const my_policy_id: PolicyId = #"0000000000"

pub fn has_policy_id(self: Output, policy_id: PolicyId) -> Bool {
self.value
|> value.tokens(policy_id)
|> assets.tokens(policy_id)
|> dict.is_empty
|> not
}

validator foo {
spend(_datum: Data, _redeemer: Data, o_ref: Data, tx: Transaction) -> Bool {
ctx.transaction.outputs
spend(_datum: Option<Data>, _redeemer: Data, _o_ref: Data, self: Transaction) {
self.outputs
|> list.any(has_policy_id(_, my_policy_id))
}

else(_) {
fail
}
}

validator bar(output_reference: OutputReference) {
mint(_redeemer: Void, _policy_id: Data, tx: Transaction) -> Bool {
mint(_redeemer: Void, _policy_id, self: Transaction) {
when
list.find(
ctx.transaction.inputs,
self.inputs,
fn(input) { input.output_reference == output_reference },
)
is {
Some(_) -> True
None -> False
}
}

else(_) {
fail
}
}
6 changes: 3 additions & 3 deletions examples/acceptance_tests/040/lib/tests.ak
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test expect_ford1() {
],
)
expect Ford { owner, wheels, truck_bed_limit, .. }: Car = initial_car
owner == #"" && ( wheels == 4 && truck_bed_limit == 10000 )
owner == #"" && wheels == 4 && truck_bed_limit == 10000
}

test expect_ford2() {
Expand All @@ -42,14 +42,14 @@ test expect_ford2() {
car_doors: [],
}
expect Ford { owner, wheels, remote_connect, .. } = initial_car
owner == #"2222222222" && ( wheels == 6 && remote_connect == #"" )
owner == #"2222222222" && wheels == 6 && remote_connect == #""
}

test expect_list1() {
let initial_car =
[5, 6, 7]
expect [a, b, c] = initial_car
a == 5 && ( b == 6 && c == 7 )
a == 5 && b == 6 && c == 7
}

test expect_list2() {
Expand Down
13 changes: 9 additions & 4 deletions examples/acceptance_tests/047/plutus.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"plutusVersion": "v2",
"compiler": {
"name": "Aiken",
"version": "v1.0.31-alpha+6e4a16d"
"version": "v1.0.31-alpha+4003343"
}
},
"validators": [
{
"title": "foo.spend",
"title": "foo.foo.spend",
"datum": {
"title": "_datum",
"schema": {
Expand All @@ -23,8 +23,13 @@
"$ref": "#/definitions/Void"
}
},
"compiledCode": "585201000032323232232232253330064a229309b2b299980219b8748000c014dd50008a99980398031baa001149858594ccc008cdc3a400060066ea800454ccc014c010dd50008a4c2c2cae6955ceaab9e5573f",
"hash": "84a516ff1f146f698164b5e64ff813e4e22ba2fa35491f2dc3d70935"
"compiledCode": "587601000032323232323225333002323232323253330073370e900118041baa0011323232324a2a66601466e1d2000300b375400a2a66601a60186ea80145261616300d300e002300c001300937540022c6014601600460120026012004600e00260086ea8004526136565734aae7555cf2ab9f5742ae89",
"hash": "c613c8326fea00dff179b7108f248b60c155881bbce544d84fe573e1"
},
{
"title": "foo.foo.else",
"compiledCode": "587601000032323232323225333002323232323253330073370e900118041baa0011323232324a2a66601466e1d2000300b375400a2a66601a60186ea80145261616300d300e002300c001300937540022c6014601600460120026012004600e00260086ea8004526136565734aae7555cf2ab9f5742ae89",
"hash": "c613c8326fea00dff179b7108f248b60c155881bbce544d84fe573e1"
}
],
"definitions": {
Expand Down
6 changes: 5 additions & 1 deletion examples/acceptance_tests/047/validators/foo.ak
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
validator foo {
spend(_datum: Void, _redeemer: Void, oref: Data, _tx: Void) -> Bool {
spend(_datum: Option<Void>, _redeemer: Void, oref: Data, _tx: Void) {
True
}

else(_) {
fail
}
}

test foo() {
Expand Down
2 changes: 1 addition & 1 deletion examples/acceptance_tests/054/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596650, nanos_since_epoch = 294733000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776969, nanos_since_epoch = 835808000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/055/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596651, nanos_since_epoch = 984539000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776974, nanos_since_epoch = 866167000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/061/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596658, nanos_since_epoch = 893017000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776995, nanos_since_epoch = 750600000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/063/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596651, nanos_since_epoch = 968695000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776974, nanos_since_epoch = 455232000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/067/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596660, nanos_since_epoch = 748574000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724777001, nanos_since_epoch = 587403000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/067/lib/tests.ak
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ test get_proof_4() {
let h1: ByteArray = get_proof_item_value(p1)
let h2: ByteArray = get_proof_item_value(p2)

size_match && ( h1 == hash_fn(cat) && h2 == right_node_hash )
size_match && h1 == hash_fn(cat) && h2 == right_node_hash
}

fn do_from_list(
Expand Down
2 changes: 1 addition & 1 deletion examples/acceptance_tests/068/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596659, nanos_since_epoch = 760789000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776997, nanos_since_epoch = 900786000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/069/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596660, nanos_since_epoch = 681097000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724777000, nanos_since_epoch = 47370000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/070/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724596647, nanos_since_epoch = 155791000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1724776959, nanos_since_epoch = 949879000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
6 changes: 3 additions & 3 deletions examples/acceptance_tests/071/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

[[requirements]]
name = "aiken-lang/stdlib"
version = "main"
version = "v2"
source = "github"

[[packages]]
name = "aiken-lang/stdlib"
version = "main"
version = "v2"
requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158434, nanos_since_epoch = 487166000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1724776963, nanos_since_epoch = 265617000 }, "cdbbce58b61deb385e7ea787a2e0fc2dc8fe94db9999e0e6275bc9c70e5796be"]
Loading

0 comments on commit 4853563

Please sign in to comment.