Skip to content

Commit 2d4a719

Browse files
committed
feat: add verifier transactional tests
1 parent dbdd4dd commit 2d4a719

File tree

14 files changed

+680
-0
lines changed

14 files changed

+680
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Mysten Labs, Inc.
2+
// Modifications Copyright (c) 2025 IOTA Stiftung
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
// tests calling private account functions
6+
7+
//# init --addresses test=0x0 --accounts A
8+
9+
//# publish
10+
module test::m1;
11+
12+
public struct Account has key { id: UID }
13+
14+
public fun account(ctx: &mut TxContext): Account { Account { id: object::new(ctx) } }
15+
16+
//# programmable --inputs @test "module" "function"
17+
//> 0: test::m1::account();
18+
//> 1: iota::account::create_auth_info_v1_for_testing(Input(0), Input(1), Input(2));
19+
//> iota::account::create_shared_account_v1<test::m1::Account>(Result(0), Result(1));
20+
21+
//# programmable --inputs @test "module" "function"
22+
//> 0: test::m1::account();
23+
//> 1: iota::account::create_auth_info_v1_for_testing(Input(0), Input(1), Input(2));
24+
//> iota::account::create_immutable_account_v1<test::m1::Account>(Result(0));
25+
26+
//# programmable --inputs @test "module" "function"
27+
//> 0: test::m1::account();
28+
//> 1: iota::account::create_auth_info_v1_for_testing(Input(0), Input(1), Input(2));
29+
//> iota::account::rotate_auth_info_v1<test::m1::Account>(Result(0));
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
source: external-crates/move/crates/move-transactional-test-runner/src/framework.rs
3+
---
4+
processed 5 tasks
5+
6+
init:
7+
A: object(0,0)
8+
9+
task 1, lines 9-14:
10+
//# publish
11+
created: object(1,0)
12+
mutated: object(0,1)
13+
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 4712000, storage_rebate: 0, non_refundable_storage_fee: 0
14+
15+
task 2, lines 16-19:
16+
//# programmable --inputs @test "module" "function"
17+
//> 0: test::m1::account();
18+
//> 1: iota::account::create_auth_info_v1_for_testing(Input(0), Input(1), Input(2));
19+
//> iota::account::create_shared_account_v1<test::m1::Account>(Result(0), Result(1));
20+
Error: Transaction Effects Status: Function Not Found.
21+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: FunctionNotFound, source: Some("Could not resolve function 'create_auth_info_v1_for_testing' in module iota::account"), command: Some(1) } }
22+
23+
task 3, lines 21-24:
24+
//# programmable --inputs @test "module" "function"
25+
//> 0: test::m1::account();
26+
//> 1: iota::account::create_auth_info_v1_for_testing(Input(0), Input(1), Input(2));
27+
//> iota::account::create_immutable_account_v1<test::m1::Account>(Result(0));
28+
Error: Transaction Effects Status: Function Not Found.
29+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: FunctionNotFound, source: Some("Could not resolve function 'create_auth_info_v1_for_testing' in module iota::account"), command: Some(1) } }
30+
31+
task 4, lines 26-29:
32+
//# programmable --inputs @test "module" "function"
33+
//> 0: test::m1::account();
34+
//> 1: iota::account::create_auth_info_v1_for_testing(Input(0), Input(1), Input(2));
35+
//> iota::account::rotate_auth_info_v1<test::m1::Account>(Result(0));
36+
Error: Transaction Effects Status: Function Not Found.
37+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: FunctionNotFound, source: Some("Could not resolve function 'create_auth_info_v1_for_testing' in module iota::account"), command: Some(1) } }
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright (c) 2025 IOTA Stiftung
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//# publish
5+
module 0x0.m {
6+
import 0x2.account;
7+
import 0x2.object;
8+
import 0x2.package_metadata;
9+
import 0x1.ascii;
10+
11+
struct Account has key {
12+
id: object.UID,
13+
}
14+
15+
t1(
16+
package_metadata: &package_metadata.PackageMetadataV1,
17+
module_name: ascii.String,
18+
function_name: ascii.String,
19+
): account.AuthenticatorInfoV1<Self.Account> {
20+
let a: account.AuthenticatorInfoV1<Self.Account>;
21+
label l0:
22+
a = account.create_auth_info_v1<Self.Account>(move(package_metadata), move(module_name), move(function_name));
23+
return move(a);
24+
}
25+
26+
t2(account: &Self.Account): &account.AuthenticatorInfoV1<Self.Account> {
27+
let a: &account.AuthenticatorInfoV1<Self.Account>;
28+
let id: &object.UID;
29+
label l0:
30+
id = &move(account).Account::id;
31+
a = account.borrow_auth_info_v1<Self.Account>(move(id));
32+
return move(a);
33+
}
34+
35+
t3(account: &Self.Account): bool {
36+
let b: bool;
37+
let id: &object.UID;
38+
label l0:
39+
id = &move(account).Account::id;
40+
b = account.has_auth_info_v1(move(id));
41+
return move(b);
42+
}
43+
44+
t4(account: Self.Account, authenticator: account.AuthenticatorInfoV1<Self.Account>) {
45+
label l0:
46+
account.create_shared_account_v1<Self.Account>(move(account), move(authenticator));
47+
return;
48+
}
49+
50+
t5(account: Self.Account, authenticator: account.AuthenticatorInfoV1<Self.Account>) {
51+
label l0:
52+
account.create_immutable_account_v1<Self.Account>(move(account), move(authenticator));
53+
return;
54+
}
55+
56+
t6(account: &mut Self.Account, authenticator: account.AuthenticatorInfoV1<Self.Account>): account.AuthenticatorInfoV1<Self.Account> {
57+
let a: account.AuthenticatorInfoV1<Self.Account>;
58+
label l0:
59+
a = account.rotate_auth_info_v1<Self.Account>(move(account), move(authenticator));
60+
return move(a);
61+
}
62+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
source: external-crates/move/crates/move-transactional-test-runner/src/framework.rs
3+
---
4+
processed 1 task
5+
6+
task 0, lines 4-62:
7+
//# publish
8+
created: object(1,0)
9+
mutated: object(0,0)
10+
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 8420800, storage_rebate: 0, non_refundable_storage_fee: 0
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) 2025 IOTA Stiftung
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//# publish
5+
module 0x0.m {
6+
import 0x2.account;
7+
import 0x2.package_metadata;
8+
import 0x1.ascii;
9+
10+
t1<T0: key>(
11+
package_metadata: &package_metadata.PackageMetadataV1,
12+
module_name: ascii.String,
13+
function_name: ascii.String,
14+
): account.AuthenticatorInfoV1<T0> {
15+
let a: account.AuthenticatorInfoV1<T0>;
16+
label l0:
17+
a = account.create_auth_info_v1<T0>(move(package_metadata), move(module_name), move(function_name));
18+
return move(a);
19+
}
20+
}
21+
22+
23+
//# publish
24+
module 0x0.m {
25+
import 0x2.account;
26+
27+
t2<T0: key>(account: T0, authenticator: account.AuthenticatorInfoV1<T0>) {
28+
label l0:
29+
account.create_shared_account_v1<T0>(move(account), move(authenticator));
30+
return;
31+
}
32+
}
33+
34+
35+
//# publish
36+
module 0x0.m {
37+
import 0x2.account;
38+
39+
t3<T0: key>(account: T0, authenticator: account.AuthenticatorInfoV1<T0>) {
40+
label l0:
41+
account.create_immutable_account_v1<T0>(move(account), move(authenticator));
42+
return;
43+
}
44+
}
45+
46+
//# publish
47+
module 0x0.m {
48+
import 0x2.account;
49+
50+
t4<T0: key>(account: &mut T0, authenticator: account.AuthenticatorInfoV1<T0>): account.AuthenticatorInfoV1<T0> {
51+
let a: account.AuthenticatorInfoV1<T0>;
52+
label l0:
53+
a = account.rotate_auth_info_v1<T0>(move(account), move(authenticator));
54+
return move(a);
55+
}
56+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
source: external-crates/move/crates/move-transactional-test-runner/src/framework.rs
3+
---
4+
processed 4 tasks
5+
6+
task 0, lines 4-20:
7+
//# publish
8+
created: object(1,0)
9+
mutated: object(0,0)
10+
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 5069200, storage_rebate: 0, non_refundable_storage_fee: 0
11+
12+
task 1, lines 23-32:
13+
//# publish
14+
Error: Transaction Effects Status: IOTA Move Bytecode Verification Error. Please run the IOTA Move Verifier for more information.
15+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: IotaMoveVerificationError, source: Some("_::m::t2. Invalid call to 'iota::account::create_shared_account_v1' on an object of type 'T0'. The account object's type must be defined in the current module."), command: Some(0) } }
16+
17+
task 2, lines 35-44:
18+
//# publish
19+
Error: Transaction Effects Status: IOTA Move Bytecode Verification Error. Please run the IOTA Move Verifier for more information.
20+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: IotaMoveVerificationError, source: Some("_::m::t3. Invalid call to 'iota::account::create_immutable_account_v1' on an object of type 'T0'. The account object's type must be defined in the current module."), command: Some(0) } }
21+
22+
task 3, lines 46-56:
23+
//# publish
24+
Error: Transaction Effects Status: IOTA Move Bytecode Verification Error. Please run the IOTA Move Verifier for more information.
25+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: IotaMoveVerificationError, source: Some("_::m::t4. Invalid call to 'iota::account::rotate_auth_info_v1' on an object of type 'T0'. The account object's type must be defined in the current module."), command: Some(0) } }
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright (c) 2025 IOTA Stiftung
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//# publish
5+
module 0x0.m {
6+
import 0x2.account;
7+
import 0x2.object;
8+
import 0x2.package_metadata;
9+
import 0x1.ascii;
10+
11+
struct Account has key, store {
12+
id: object.UID,
13+
}
14+
15+
t1(
16+
package_metadata: &package_metadata.PackageMetadataV1,
17+
module_name: ascii.String,
18+
function_name: ascii.String,
19+
): account.AuthenticatorInfoV1<Self.Account> {
20+
let a: account.AuthenticatorInfoV1<Self.Account>;
21+
label l0:
22+
a = account.create_auth_info_v1<Self.Account>(move(package_metadata), move(module_name), move(function_name));
23+
return move(a);
24+
}
25+
26+
t2(account: &Self.Account): &account.AuthenticatorInfoV1<Self.Account> {
27+
let a: &account.AuthenticatorInfoV1<Self.Account>;
28+
let id: &object.UID;
29+
label l0:
30+
id = &move(account).Account::id;
31+
a = account.borrow_auth_info_v1<Self.Account>(move(id));
32+
return move(a);
33+
}
34+
35+
t3(account: &Self.Account): bool {
36+
let b: bool;
37+
let id: &object.UID;
38+
label l0:
39+
id = &move(account).Account::id;
40+
b = account.has_auth_info_v1(move(id));
41+
return move(b);
42+
}
43+
44+
t4(account: Self.Account, authenticator: account.AuthenticatorInfoV1<Self.Account>) {
45+
label l0:
46+
account.create_shared_account_v1<Self.Account>(move(account), move(authenticator));
47+
return;
48+
}
49+
50+
t5(account: Self.Account, authenticator: account.AuthenticatorInfoV1<Self.Account>) {
51+
label l0:
52+
account.create_immutable_account_v1<Self.Account>(move(account), move(authenticator));
53+
return;
54+
}
55+
56+
t6(account: &mut Self.Account, authenticator: account.AuthenticatorInfoV1<Self.Account>): account.AuthenticatorInfoV1<Self.Account> {
57+
let a: account.AuthenticatorInfoV1<Self.Account>;
58+
label l0:
59+
a = account.rotate_auth_info_v1<Self.Account>(move(account), move(authenticator));
60+
return move(a);
61+
}
62+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
source: external-crates/move/crates/move-transactional-test-runner/src/framework.rs
3+
---
4+
processed 1 task
5+
6+
task 0, lines 4-62:
7+
//# publish
8+
created: object(1,0)
9+
mutated: object(0,0)
10+
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 8420800, storage_rebate: 0, non_refundable_storage_fee: 0
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) 2025 IOTA Stiftung
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//# publish
5+
module 0x0.m {
6+
import 0x2.account;
7+
import 0x2.package_metadata;
8+
import 0x1.ascii;
9+
10+
t1<T0: key + store>(
11+
package_metadata: &package_metadata.PackageMetadataV1,
12+
module_name: ascii.String,
13+
function_name: ascii.String,
14+
): account.AuthenticatorInfoV1<T0> {
15+
let a: account.AuthenticatorInfoV1<T0>;
16+
label l0:
17+
a = account.create_auth_info_v1<T0>(move(package_metadata), move(module_name), move(function_name));
18+
return move(a);
19+
}
20+
}
21+
22+
23+
//# publish
24+
module 0x0.m {
25+
import 0x2.account;
26+
27+
t2<T0: key + store>(account: T0, authenticator: account.AuthenticatorInfoV1<T0>) {
28+
label l0:
29+
account.create_shared_account_v1<T0>(move(account), move(authenticator));
30+
return;
31+
}
32+
}
33+
34+
35+
//# publish
36+
module 0x0.m {
37+
import 0x2.account;
38+
39+
t3<T0: key + store>(account: T0, authenticator: account.AuthenticatorInfoV1<T0>) {
40+
label l0:
41+
account.create_immutable_account_v1<T0>(move(account), move(authenticator));
42+
return;
43+
}
44+
}
45+
46+
//# publish
47+
module 0x0.m {
48+
import 0x2.account;
49+
50+
t4<T0: key + store>(account: &mut T0, authenticator: account.AuthenticatorInfoV1<T0>): account.AuthenticatorInfoV1<T0> {
51+
let a: account.AuthenticatorInfoV1<T0>;
52+
label l0:
53+
a = account.rotate_auth_info_v1<T0>(move(account), move(authenticator));
54+
return move(a);
55+
}
56+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
source: external-crates/move/crates/move-transactional-test-runner/src/framework.rs
3+
---
4+
processed 4 tasks
5+
6+
task 0, lines 4-20:
7+
//# publish
8+
created: object(1,0)
9+
mutated: object(0,0)
10+
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 5069200, storage_rebate: 0, non_refundable_storage_fee: 0
11+
12+
task 1, lines 23-32:
13+
//# publish
14+
Error: Transaction Effects Status: IOTA Move Bytecode Verification Error. Please run the IOTA Move Verifier for more information.
15+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: IotaMoveVerificationError, source: Some("_::m::t2. Invalid call to 'iota::account::create_shared_account_v1' on an object of type 'T0'. The account object's type must be defined in the current module."), command: Some(0) } }
16+
17+
task 2, lines 35-44:
18+
//# publish
19+
Error: Transaction Effects Status: IOTA Move Bytecode Verification Error. Please run the IOTA Move Verifier for more information.
20+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: IotaMoveVerificationError, source: Some("_::m::t3. Invalid call to 'iota::account::create_immutable_account_v1' on an object of type 'T0'. The account object's type must be defined in the current module."), command: Some(0) } }
21+
22+
task 3, lines 46-56:
23+
//# publish
24+
Error: Transaction Effects Status: IOTA Move Bytecode Verification Error. Please run the IOTA Move Verifier for more information.
25+
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: IotaMoveVerificationError, source: Some("_::m::t4. Invalid call to 'iota::account::rotate_auth_info_v1' on an object of type 'T0'. The account object's type must be defined in the current module."), command: Some(0) } }

0 commit comments

Comments
 (0)