@@ -6,10 +6,6 @@ module aptos_framework::account {
6
6
use std::signer;
7
7
use std::vector;
8
8
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;
13
9
use aptos_framework::chain_id;
14
10
use aptos_framework::create_signer::create_signer;
15
11
use aptos_framework::event::{Self , EventHandle };
@@ -259,34 +255,6 @@ module aptos_framework::account {
259
255
new_account
260
256
}
261
257
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
-
290
258
#[view]
291
259
public fun exists_at (addr: address ): bool {
292
260
exists <Account >(addr)
@@ -1000,53 +968,6 @@ module aptos_framework::account {
1000
968
);
1001
969
}
1002
970
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
-
1050
971
#[test_only]
1051
972
struct DummyResource has key {}
1052
973
@@ -1625,23 +1546,4 @@ module aptos_framework::account {
1625
1546
let event = CoinRegisterEvent { type_info: type_info::type_of <SadFakeCoin >() };
1626
1547
assert !(!event::was_event_emitted_by_handle (eventhandle, &event), 3 );
1627
1548
}
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
- }
1647
1549
}
0 commit comments