Skip to content

Commit 522b07e

Browse files
committed
fix: signer needs to be aptos_framework
1 parent f8f6fb5 commit 522b07e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

aptos-move/framework/aptos-framework/sources/account.move

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ module aptos_framework::account {
88
use std::features::get_decommission_core_resources_enabled;
99
#[test_only]
1010
use std::features::change_feature_flags_for_testing;
11+
#[test_only]
12+
use aptos_framework::aptos_governance;
1113
use aptos_framework::chain_id;
1214
use aptos_framework::create_signer::create_signer;
1315
use aptos_framework::event::{Self, EventHandle};
@@ -259,8 +261,8 @@ module aptos_framework::account {
259261

260262
/// Destroy the Account resource from a given account.
261263
/// Used to destroy the core resources account on mainnet.
262-
public entry fun destroy_account_from(account: &signer, from: address) acquires Account {
263-
system_addresses::assert_core_resource(account);
264+
public entry fun destroy_account_from(aptos_framework: &signer, from: address) acquires Account {
265+
system_addresses::assert_aptos_framework(aptos_framework);
264266

265267
// Assert that the feature flag for decommissioning core resources is enabled
266268
assert!(
@@ -998,10 +1000,9 @@ module aptos_framework::account {
9981000
);
9991001
}
10001002

1001-
#[test(aptos_framework = @aptos_framework, core_resources = @0xa550c18, from = @0xdead)]
1003+
#[test(aptos_framework = @aptos_framework, from = @0xdead)]
10021004
public entry fun test_destroy_account_from_with_flag_enabled(
10031005
aptos_framework: &signer,
1004-
core_resources: &signer,
10051006
from: &signer,
10061007
) acquires Account {
10071008
// Enable the feature flag for testing
@@ -1016,17 +1017,16 @@ module aptos_framework::account {
10161017
assert!(exists<Account>(signer::address_of(from)), 1);
10171018

10181019
// Destroy the Account resource
1019-
destroy_account_from(core_resources, signer::address_of(from));
1020+
destroy_account_from(aptos_framework, signer::address_of(from));
10201021

10211022
// Confirm the resource has been removed
10221023
assert!(!exists<Account>(signer::address_of(from)), 2);
10231024
}
10241025

1025-
#[test(aptos_framework = @aptos_framework, core_resources = @0xa550c18, from = @0xdead)]
1026+
#[test(aptos_framework = @aptos_framework, from = @0xdead)]
10261027
#[expected_failure(abort_code = 21, location = Self)]
10271028
public entry fun test_destroy_account_from_with_flag_disabled(
10281029
aptos_framework: &signer,
1029-
core_resources: &signer,
10301030
from: &signer,
10311031
) acquires Account {
10321032
// Disable the feature flag for testing
@@ -1041,7 +1041,10 @@ module aptos_framework::account {
10411041
assert!(exists<Account>(signer::address_of(from)), 1);
10421042

10431043
// Attempt to destroy the Account resource (should fail)
1044-
destroy_account_from(core_resources, signer::address_of(from));
1044+
destroy_account_from(aptos_framework, signer::address_of(from));
1045+
1046+
// Confirm the resource has been removed
1047+
assert!(!exists<Account>(signer::address_of(from)), 2);
10451048
}
10461049

10471050
#[test_only]

0 commit comments

Comments
 (0)