-
Notifications
You must be signed in to change notification settings - Fork 51
feat(iota-e2e-tests): Provide e2e tests for create_auth_info feature #8539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TheMrAI
merged 7 commits into
vm-lang/aa-auth/8116-feature-branch
from
vm-lang/aa-auth/8414-e2e-for-create-auth-info
Oct 1, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d01fff0
feat(iota-e2e-tests): Provide e2e tests for create_auth_info feature
TheMrAI 48ad690
Fix clippy
TheMrAI fe7384f
fix(iota-e2e-tests): Fix abstract account vector tests
TheMrAI c4d58f5
Add commits indicating test outcome expectations
TheMrAI 86a3bfb
Add missing licence declarations
TheMrAI 541d836
Update manifest.json
TheMrAI 6f7cfd6
Revert "Update manifest.json"
TheMrAI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
crates/iota-e2e-tests/tests/abstract_account/authenticate/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/* |
13 changes: 13 additions & 0 deletions
13
crates/iota-e2e-tests/tests/abstract_account/authenticate/Move.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "authenticate" | ||
edition = "2024" | ||
|
||
[dependencies] | ||
Iota = { local = "../../../../iota-framework/packages/iota-framework" } | ||
|
||
[addresses] | ||
authenticate = "0x0" | ||
|
||
[dev-dependencies] | ||
|
||
[dev-addresses] |
32 changes: 32 additions & 0 deletions
32
crates/iota-e2e-tests/tests/abstract_account/authenticate/sources/object.move
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2025 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module authenticate::object; | ||
|
||
use iota::auth_context::AuthContext; | ||
|
||
// Object | ||
|
||
public struct Object has key, store { | ||
id: iota::object::UID, | ||
} | ||
|
||
// PASS | ||
public fun immutable_ref( | ||
_object: &Object, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
#[allow(lint(share_owned))] | ||
public fun by_value(object: Object, _auth_ctx: &AuthContext, _ctx: &TxContext) { | ||
transfer::public_share_object(object); | ||
} | ||
|
||
// FAIL | ||
public fun by_mutable_ref( | ||
_object: &mut Object, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} |
179 changes: 179 additions & 0 deletions
179
crates/iota-e2e-tests/tests/abstract_account/authenticate/sources/option.move
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
// Copyright (c) 2025 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module authenticate::option; | ||
|
||
use iota::auth_context::AuthContext; | ||
|
||
public struct Object has key, store { | ||
id: iota::object::UID, | ||
} | ||
|
||
#[allow(unused_field)] | ||
public struct ObjectTemplated<T: key + store> has copy, drop, store { | ||
TheMrAI marked this conversation as resolved.
Show resolved
Hide resolved
|
||
t: T, | ||
} | ||
|
||
#[allow(unused_field)] | ||
public struct NonObjectTemplated<T: copy + drop + store> has copy, drop, store { | ||
t: T, | ||
} | ||
|
||
public struct NonObject has copy, drop, store {} | ||
|
||
// Option | ||
|
||
// PASS | ||
public fun primitive_immutable_reference( | ||
_arg: &Option<u8>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun primitive_mutable_reference( | ||
_arg: &mut Option<u8>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// PASS | ||
public fun primitive_by_value(_arg: Option<u8>, _auth_ctx: &AuthContext, _ctx: &TxContext) {} | ||
|
||
// FAIL | ||
public fun non_object_immutable_ref( | ||
_arg: &Option<NonObject>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun non_object_mutable_ref( | ||
_arg: &mut Option<NonObject>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun non_object_by_value( | ||
_arg: Option<NonObject>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// Option and object | ||
|
||
// PASS | ||
public fun object_immutable_ref( | ||
_objects: &Option<Object>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun object_mutable_ref( | ||
_objects: &mut Option<Object>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
#[allow(lint(share_owned))] | ||
public fun object_by_value(objects: Option<Object>, _auth_ctx: &AuthContext, _ctx: &TxContext) { | ||
objects.do!(|object| transfer::public_share_object(object)); | ||
} | ||
|
||
// Option and template | ||
|
||
// error[E06001]: unused value without 'drop' | ||
//public fun template_non_object_by_value<T>( | ||
// _arg: Option<T>, | ||
// _auth_ctx: &AuthContext, | ||
// _ctx: &TxContext, | ||
//) {} | ||
|
||
// PASS | ||
public fun template_non_object_immutable_ref<T>( | ||
_arg: &Option<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun template_non_object_mutable_ref<T>( | ||
_arg: &mut Option<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun templated_non_object_by_value<T: copy + drop + store>( | ||
_arg: Option<NonObjectTemplated<T>>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// PASS | ||
public fun templated_non_object_immutable_ref<T: copy + drop + store>( | ||
_arg: &Option<NonObjectTemplated<T>>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun templated_non_object_mutable_ref<T: copy + drop + store>( | ||
_arg: &mut Option<NonObjectTemplated<T>>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// Option, template and object | ||
|
||
// PASS | ||
public fun template_object_immutable_reference<T: key>( | ||
_objects: &Option<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun template_object_by_value<T: key + store>( | ||
objects: Option<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) { | ||
objects.do!(|object| transfer::public_share_object(object)); | ||
} | ||
|
||
// FAIL | ||
public fun template_object_mutable_reference<T: key>( | ||
_objects: &mut Option<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// PASS | ||
public fun templated_object_immutable_ref<T: key + store>( | ||
_objects: &Option<ObjectTemplated<T>>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun templated_object_by_value<T: key + store>( | ||
objects: Option<ObjectTemplated<T>>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) { | ||
objects.do!(|object| { | ||
let ObjectTemplated { t } = object; | ||
transfer::public_share_object(t); | ||
}); | ||
} | ||
|
||
// FAIL | ||
public fun templated_object_mutable_ref<T: key + store>( | ||
_objects: &mut Option<ObjectTemplated<T>>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} |
43 changes: 43 additions & 0 deletions
43
crates/iota-e2e-tests/tests/abstract_account/authenticate/sources/signature.move
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) 2025 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module authenticate::signature; | ||
|
||
use iota::auth_context::AuthContext; | ||
|
||
// PASS | ||
public fun minimally_viable_auth_function(_auth_ctx: &AuthContext, _ctx: &TxContext) {} | ||
|
||
// FAIL | ||
#[allow(unused_function)] | ||
fun has_to_be_public_auth_function(_auth_ctx: &AuthContext, _ctx: &TxContext) {} | ||
TheMrAI marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// FAIL | ||
public fun at_least_two_args(_ctx: &TxContext) {} | ||
|
||
// FAIL | ||
public fun auth_context_cant_be_value(_auth_ctx: AuthContext, _ctx: &TxContext) {} | ||
|
||
// FAIL | ||
public fun auth_context_cant_be_mutable_ref(_auth_ctx: &mut AuthContext, _ctx: &TxContext) {} | ||
|
||
// FAIL | ||
public fun tx_context_cant_be_value(_auth_ctx: &AuthContext, _ctx: TxContext) {} | ||
|
||
// FAIL | ||
public fun tx_context_cant_be_mutable_ref(_auth_ctx: &AuthContext, _ctx: &mut TxContext) {} | ||
|
||
// FAIL | ||
public fun auth_context_isnt_struct(_auth_ctx: u64, _ctx: &TxContext) {} | ||
|
||
// FAIL | ||
public fun tx_context_isnt_struct(_auth_ctx: &AuthContext, _ctx: u64) {} | ||
|
||
// PASS | ||
public fun arg_value(_val: u8, _auth_ctx: &AuthContext, _ctx: &TxContext) {} | ||
|
||
// PASS | ||
public fun arg_mutable_value(mut _val: u8, _auth_ctx: &AuthContext, _ctx: &TxContext) {} | ||
|
||
// FAIL | ||
public fun with_signer(_s: signer, _auth_ctx: &AuthContext, _ctx: &TxContext) {} |
99 changes: 99 additions & 0 deletions
99
crates/iota-e2e-tests/tests/abstract_account/authenticate/sources/template.move
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Copyright (c) 2025 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module authenticate::template; | ||
|
||
use iota::auth_context::AuthContext; | ||
|
||
public struct Object has key, store { | ||
id: iota::object::UID, | ||
} | ||
|
||
// Template | ||
|
||
#[allow(unused_field)] | ||
public struct NonObjectTemplated<T: copy + drop + store> has copy, drop, store { | ||
t: T, | ||
} | ||
|
||
// PASS | ||
public fun primitive<T: copy + drop + store>( | ||
_arg: T, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// PASS | ||
public fun templated_non_object_immutable_ref<T: copy + drop + store>( | ||
_arg: &NonObjectTemplated<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun templated_non_object_mutable_ref<T: copy + drop + store>( | ||
_arg: &mut NonObjectTemplated<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun templated_non_object_by_value<T: copy + drop + store>( | ||
_arg: NonObjectTemplated<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// Template and object | ||
|
||
// PASS | ||
public fun object_immutable_ref<T: key>( | ||
_object: &T, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun object_by_value<T: key + store>( | ||
object: T, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) { | ||
transfer::public_share_object(object); | ||
} | ||
|
||
// FAIL | ||
public fun object_mutable_ref<T: key>( | ||
_object: &mut T, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
#[allow(unused_field)] | ||
public struct ObjectTemplated<T: key + store> has copy, drop, store { | ||
t: T, | ||
} | ||
|
||
// PASS | ||
public fun templated_object_immutable_ref<T: key + store>( | ||
_object: &ObjectTemplated<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} | ||
|
||
// FAIL | ||
public fun templated_object_by_value<T: key + store>( | ||
object: ObjectTemplated<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) { | ||
let ObjectTemplated { t } = object; | ||
transfer::public_share_object(t); | ||
} | ||
|
||
// FAIL | ||
public fun templated_object_mutable_ref<T: key + store>( | ||
_object: &mut ObjectTemplated<T>, | ||
_auth_ctx: &AuthContext, | ||
_ctx: &TxContext, | ||
) {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.