Skip to content

Commit 793514e

Browse files
committed
chore: remove account::destroy_account_from
1 parent dd038ea commit 793514e

File tree

1 file changed

+0
-98
lines changed

1 file changed

+0
-98
lines changed

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

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ module aptos_framework::account {
66
use std::signer;
77
use std::vector;
88
use std::features::get_decommission_core_resources_enabled;
9-
#[test_only]
10-
use std::features::change_feature_flags_for_testing;
11-
#[test_only]
12-
use aptos_framework::aptos_governance;
139
use aptos_framework::chain_id;
1410
use aptos_framework::create_signer::create_signer;
1511
use aptos_framework::event::{Self, EventHandle};
@@ -259,34 +255,6 @@ module aptos_framework::account {
259255
new_account
260256
}
261257

262-
/// Destroy the Account resource from a given account.
263-
/// Used to destroy the core resources account on mainnet.
264-
public entry fun destroy_account_from(aptos_framework: &signer, from: address) acquires Account {
265-
system_addresses::assert_aptos_framework(aptos_framework);
266-
267-
// Assert that the feature flag for decommissioning core resources is enabled
268-
assert!(
269-
std::features::get_decommission_core_resources_enabled(),
270-
EFLAG_NOT_ENABLED
271-
);
272-
273-
let Account {
274-
authentication_key: _,
275-
sequence_number: _,
276-
guid_creation_num: _,
277-
coin_register_events,
278-
key_rotation_events,
279-
rotation_capability_offer,
280-
signer_capability_offer,
281-
} = move_from<Account>(from);
282-
283-
event::destroy_handle<CoinRegisterEvent>(coin_register_events);
284-
event::destroy_handle<KeyRotationEvent>(key_rotation_events);
285-
286-
let CapabilityOffer { for: _ } = rotation_capability_offer;
287-
let CapabilityOffer { for: _ } = signer_capability_offer;
288-
}
289-
290258
#[view]
291259
public fun exists_at(addr: address): bool {
292260
exists<Account>(addr)
@@ -1000,53 +968,6 @@ module aptos_framework::account {
1000968
);
1001969
}
1002970

1003-
#[test(aptos_framework = @aptos_framework, from = @0xdead)]
1004-
public entry fun test_destroy_account_from_with_flag_enabled(
1005-
aptos_framework: &signer,
1006-
from: &signer,
1007-
) acquires Account {
1008-
// Enable the feature flag for testing
1009-
std::features::change_feature_flags_for_testing(aptos_framework, vector[222], vector[]);
1010-
1011-
// Ensure the Account resource exists under the from account
1012-
if (!exists<Account>(signer::address_of(from))) {
1013-
create_account(signer::address_of(from));
1014-
};
1015-
1016-
// Confirm it now exists
1017-
assert!(exists<Account>(signer::address_of(from)), 1);
1018-
1019-
// Destroy the Account resource
1020-
destroy_account_from(aptos_framework, signer::address_of(from));
1021-
1022-
// Confirm the resource has been removed
1023-
assert!(!exists<Account>(signer::address_of(from)), 2);
1024-
}
1025-
1026-
#[test(aptos_framework = @aptos_framework, from = @0xdead)]
1027-
#[expected_failure(abort_code = 21, location = Self)]
1028-
public entry fun test_destroy_account_from_with_flag_disabled(
1029-
aptos_framework: &signer,
1030-
from: &signer,
1031-
) acquires Account {
1032-
// Disable the feature flag for testing
1033-
std::features::change_feature_flags_for_testing(aptos_framework, vector[], vector[222]);
1034-
1035-
// Ensure the Account resource exists under the from account
1036-
if (!exists<Account>(signer::address_of(from))) {
1037-
create_account(signer::address_of(from));
1038-
};
1039-
1040-
// Confirm it now exists
1041-
assert!(exists<Account>(signer::address_of(from)), 1);
1042-
1043-
// Attempt to destroy the Account resource (should fail)
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);
1048-
}
1049-
1050971
#[test_only]
1051972
struct DummyResource has key {}
1052973

@@ -1625,23 +1546,4 @@ module aptos_framework::account {
16251546
let event = CoinRegisterEvent { type_info: type_info::type_of<SadFakeCoin>() };
16261547
assert!(!event::was_event_emitted_by_handle(eventhandle, &event), 3);
16271548
}
1628-
1629-
#[test(framework = @0x1)]
1630-
#[expected_failure(abort_code = 65541, location = Self)]
1631-
public entry fun test_cannot_create_account_at_core_resources_address_with_feature_flag(framework: signer) {
1632-
// Enable the feature flag for testing
1633-
change_feature_flags_for_testing(&framework, vector[222], vector[]);
1634-
1635-
// Attempt to create an account at the core resources address
1636-
create_account(@0xa550c18);
1637-
}
1638-
1639-
#[test(framework = @0x1)]
1640-
public entry fun test_can_create_account_at_core_resources_address_without_feature_flag(framework: signer) {
1641-
// Disable the feature flag for testing
1642-
change_feature_flags_for_testing(&framework, vector[], vector[222]);
1643-
1644-
// Attempt to create an account at the core resources address
1645-
create_account(@0xa550c18);
1646-
}
16471549
}

0 commit comments

Comments
 (0)