Skip to content

Commit 0e7bc84

Browse files
committed
feat(iota-e2e-tests): Provide e2e tests for create_auth_info feature
Vector related tests are partially turned off for now until we figure out why they break. Ticket: #8525
1 parent 458aa71 commit 0e7bc84

File tree

11 files changed

+744
-0
lines changed

11 files changed

+744
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/*
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "authenticate"
3+
edition = "2024"
4+
5+
[dependencies]
6+
Iota = { local = "../../../../iota-framework/packages/iota-framework" }
7+
8+
[addresses]
9+
authenticate = "0x0"
10+
11+
[dev-dependencies]
12+
13+
[dev-addresses]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module authenticate::call_site;
2+
3+
use iota::account;
4+
use std::ascii;
5+
6+
// Temporary intermediate function until AuthenticatorInfoV1 can be converted to BSC.
7+
// Until then, a function which may return it as a value can't be called by the user.
8+
public fun call_create_auth_info_using(
9+
package: address,
10+
module_name: ascii::String,
11+
function_name: ascii::String,
12+
) {
13+
let _ = account::create_auth_info_v1(package, module_name, function_name);
14+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module authenticate::object;
2+
3+
use iota::auth_context::AuthContext;
4+
5+
// Object
6+
7+
public struct Object has key, store {
8+
id: iota::object::UID,
9+
}
10+
11+
public fun immutable_ref(
12+
_object: &Object,
13+
_auth_ctx: &AuthContext,
14+
_ctx: &TxContext,
15+
) {}
16+
17+
#[allow(lint(share_owned))]
18+
public fun by_value(object: Object, _auth_ctx: &AuthContext, _ctx: &TxContext) {
19+
transfer::public_share_object(object);
20+
}
21+
22+
public fun by_mutable_ref(
23+
_object: &mut Object,
24+
_auth_ctx: &AuthContext,
25+
_ctx: &TxContext,
26+
) {}
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
module authenticate::option;
2+
3+
use iota::auth_context::AuthContext;
4+
5+
public struct Object has key, store {
6+
id: iota::object::UID,
7+
}
8+
9+
#[allow(unused_field)]
10+
public struct ObjectTemplated<T: key + store> has copy, drop, store {
11+
t: T,
12+
}
13+
14+
#[allow(unused_field)]
15+
public struct NonObjectTemplated<T: copy + drop + store> has copy, drop, store {
16+
t: T,
17+
}
18+
19+
public struct NonObject has copy, drop, store {}
20+
21+
// Option
22+
23+
public fun primitive_immutable_reference(
24+
_arg: &Option<u8>,
25+
_auth_ctx: &AuthContext,
26+
_ctx: &TxContext,
27+
) {}
28+
29+
public fun primitive_mutable_reference(
30+
_arg: &mut Option<u8>,
31+
_auth_ctx: &AuthContext,
32+
_ctx: &TxContext,
33+
) {}
34+
35+
public fun primitive_by_value(_arg: Option<u8>, _auth_ctx: &AuthContext, _ctx: &TxContext) {}
36+
37+
public fun non_object_immutable_ref(
38+
_arg: &Option<NonObject>,
39+
_auth_ctx: &AuthContext,
40+
_ctx: &TxContext,
41+
) {}
42+
43+
public fun non_object_mutable_ref(
44+
_arg: &mut Option<NonObject>,
45+
_auth_ctx: &AuthContext,
46+
_ctx: &TxContext,
47+
) {}
48+
49+
public fun non_object_by_value(
50+
_arg: Option<NonObject>,
51+
_auth_ctx: &AuthContext,
52+
_ctx: &TxContext,
53+
) {}
54+
55+
// Option and object
56+
57+
public fun object_immutable_ref(
58+
_objects: &Option<Object>,
59+
_auth_ctx: &AuthContext,
60+
_ctx: &TxContext,
61+
) {}
62+
63+
public fun object_mutable_ref(
64+
_objects: &mut Option<Object>,
65+
_auth_ctx: &AuthContext,
66+
_ctx: &TxContext,
67+
) {}
68+
69+
#[allow(lint(share_owned))]
70+
public fun object_by_value(objects: Option<Object>, _auth_ctx: &AuthContext, _ctx: &TxContext) {
71+
objects.do!(|object| transfer::public_share_object(object));
72+
}
73+
74+
// Option and template
75+
76+
// error[E06001]: unused value without 'drop'
77+
//public fun template_non_object_by_value<T>(
78+
// _arg: Option<T>,
79+
// _auth_ctx: &AuthContext,
80+
// _ctx: &TxContext,
81+
//) {}
82+
83+
public fun template_non_object_immutable_ref<T>(
84+
_arg: &Option<T>,
85+
_auth_ctx: &AuthContext,
86+
_ctx: &TxContext,
87+
) {}
88+
89+
public fun template_non_object_mutable_ref<T>(
90+
_arg: &mut Option<T>,
91+
_auth_ctx: &AuthContext,
92+
_ctx: &TxContext,
93+
) {}
94+
95+
public fun templated_non_object_by_value<T: copy + drop + store>(
96+
_arg: Option<NonObjectTemplated<T>>,
97+
_auth_ctx: &AuthContext,
98+
_ctx: &TxContext,
99+
) {}
100+
101+
public fun templated_non_object_immutable_ref<T: copy + drop + store>(
102+
_arg: &Option<NonObjectTemplated<T>>,
103+
_auth_ctx: &AuthContext,
104+
_ctx: &TxContext,
105+
) {}
106+
107+
public fun templated_non_object_mutable_ref<T: copy + drop + store>(
108+
_arg: &mut Option<NonObjectTemplated<T>>,
109+
_auth_ctx: &AuthContext,
110+
_ctx: &TxContext,
111+
) {}
112+
113+
// Option, template and object
114+
115+
public fun template_object_immutable_reference<T: key>(
116+
_objects: &Option<T>,
117+
_auth_ctx: &AuthContext,
118+
_ctx: &TxContext,
119+
) {}
120+
121+
public fun template_object_by_value<T: key + store>(
122+
objects: Option<T>,
123+
_auth_ctx: &AuthContext,
124+
_ctx: &TxContext,
125+
) {
126+
objects.do!(|object| transfer::public_share_object(object));
127+
}
128+
129+
public fun template_object_mutable_reference<T: key>(
130+
_objects: &mut Option<T>,
131+
_auth_ctx: &AuthContext,
132+
_ctx: &TxContext,
133+
) {}
134+
135+
public fun templated_object_immutable_ref<T: key + store>(
136+
_objects: &Option<ObjectTemplated<T>>,
137+
_auth_ctx: &AuthContext,
138+
_ctx: &TxContext,
139+
) {}
140+
141+
public fun templated_object_by_value<T: key + store>(
142+
objects: Option<ObjectTemplated<T>>,
143+
_auth_ctx: &AuthContext,
144+
_ctx: &TxContext,
145+
) {
146+
objects.do!(|object| {
147+
let ObjectTemplated { t } = object;
148+
transfer::public_share_object(t);
149+
});
150+
}
151+
152+
public fun templated_object_mutable_ref<T: key + store>(
153+
_objects: &mut Option<ObjectTemplated<T>>,
154+
_auth_ctx: &AuthContext,
155+
_ctx: &TxContext,
156+
) {}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module authenticate::signature;
2+
3+
use iota::auth_context::AuthContext;
4+
5+
public fun minimally_viable_auth_function(_auth_ctx: &AuthContext, _ctx: &TxContext) {}
6+
7+
#[allow(unused_function)]
8+
fun has_to_be_public_auth_function(_auth_ctx: &AuthContext, _ctx: &TxContext) {}
9+
10+
public fun at_least_two_args(_ctx: &TxContext) {}
11+
12+
public fun auth_context_cant_be_value(_auth_ctx: AuthContext, _ctx: &TxContext) {}
13+
14+
public fun auth_context_cant_be_mutable_ref(_auth_ctx: &mut AuthContext, _ctx: &TxContext) {}
15+
16+
public fun tx_context_cant_be_value(_auth_ctx: &AuthContext, _ctx: TxContext) {}
17+
18+
public fun tx_context_cant_be_mutable_ref(_auth_ctx: &AuthContext, _ctx: &mut TxContext) {}
19+
20+
public fun auth_context_isnt_struct(_auth_ctx: u64, _ctx: &TxContext) {}
21+
22+
public fun tx_context_isnt_struct(_auth_ctx: &AuthContext, _ctx: u64) {}
23+
24+
public fun arg_value(_val: u8, _auth_ctx: &AuthContext, _ctx: &TxContext) {}
25+
26+
public fun arg_mutable_value(mut _val: u8, _auth_ctx: &AuthContext, _ctx: &TxContext) {}
27+
28+
public fun with_signer(_s: signer, _auth_ctx: &AuthContext, _ctx: &TxContext) {}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
module authenticate::template;
2+
3+
use iota::auth_context::AuthContext;
4+
5+
public struct Object has key, store {
6+
id: iota::object::UID,
7+
}
8+
9+
// Template
10+
11+
#[allow(unused_field)]
12+
public struct NonObjectTemplated<T: copy + drop + store> has copy, drop, store {
13+
t: T,
14+
}
15+
16+
public fun primitive<T: copy + drop + store>(
17+
_arg: T,
18+
_auth_ctx: &AuthContext,
19+
_ctx: &TxContext,
20+
) {}
21+
22+
public fun templated_non_object_immutable_ref<T: copy + drop + store>(
23+
_arg: &NonObjectTemplated<T>,
24+
_auth_ctx: &AuthContext,
25+
_ctx: &TxContext,
26+
) {}
27+
28+
public fun templated_non_object_mutable_ref<T: copy + drop + store>(
29+
_arg: &mut NonObjectTemplated<T>,
30+
_auth_ctx: &AuthContext,
31+
_ctx: &TxContext,
32+
) {}
33+
34+
public fun templated_non_object_by_value<T: copy + drop + store>(
35+
_arg: NonObjectTemplated<T>,
36+
_auth_ctx: &AuthContext,
37+
_ctx: &TxContext,
38+
) {}
39+
40+
// Template and object
41+
42+
public fun object_immutable_ref<T: key>(
43+
_object: &T,
44+
_auth_ctx: &AuthContext,
45+
_ctx: &TxContext,
46+
) {}
47+
48+
public fun object_by_value<T: key + store>(
49+
object: T,
50+
_auth_ctx: &AuthContext,
51+
_ctx: &TxContext,
52+
) {
53+
transfer::public_share_object(object);
54+
}
55+
56+
public fun object_mutable_ref<T: key>(
57+
_object: &mut T,
58+
_auth_ctx: &AuthContext,
59+
_ctx: &TxContext,
60+
) {}
61+
62+
#[allow(unused_field)]
63+
public struct ObjectTemplated<T: key + store> has copy, drop, store {
64+
t: T,
65+
}
66+
67+
public fun templated_object_immutable_ref<T: key + store>(
68+
_object: &ObjectTemplated<T>,
69+
_auth_ctx: &AuthContext,
70+
_ctx: &TxContext,
71+
) {}
72+
73+
public fun templated_object_by_value<T: key + store>(
74+
object: ObjectTemplated<T>,
75+
_auth_ctx: &AuthContext,
76+
_ctx: &TxContext,
77+
) {
78+
let ObjectTemplated { t } = object;
79+
transfer::public_share_object(t);
80+
}
81+
82+
public fun templated_object_mutable_ref<T: key + store>(
83+
_object: &mut ObjectTemplated<T>,
84+
_auth_ctx: &AuthContext,
85+
_ctx: &TxContext,
86+
) {}

0 commit comments

Comments
 (0)