Skip to content

Commit 0357005

Browse files
committed
fix: disallow account creation for core resources address
1 parent dbc9689 commit 0357005

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ module aptos_framework::account {
201201

202202
// NOTE: @core_resources gets created via a `create_account` call, so we do not include it below.
203203
assert!(
204-
new_address != @vm_reserved && new_address != @aptos_framework && new_address != @aptos_token,
204+
new_address != @vm_reserved && new_address != @aptos_framework && new_address != @aptos_token && new_address != @0xa550c18,
205205
error::invalid_argument(ECANNOT_RESERVED_ADDRESS)
206206
);
207207

@@ -1573,4 +1573,10 @@ module aptos_framework::account {
15731573
let event = CoinRegisterEvent { type_info: type_info::type_of<SadFakeCoin>() };
15741574
assert!(!event::was_event_emitted_by_handle(eventhandle, &event), 3);
15751575
}
1576+
1577+
#[test]
1578+
#[expected_failure(abort_code = 65541, location = Self)]
1579+
public entry fun test_cannot_create_account_at_core_resources_address() {
1580+
create_account(@0xa550c18);
1581+
}
15761582
}

aptos-move/framework/aptos-framework/sources/genesis.move

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,9 @@ module aptos_framework::genesis {
529529
assert!(coin::balance<AptosCoin>(addr0) == 12345, 2);
530530
}
531531

532+
/// Expected to fail after post-l1-merge release; it's okay because we will not regenesis.
532533
#[test(aptos_framework = @0x1, root = @0xabcd)]
534+
#[expected_failure(abort_code = 65541, location = aptos_framework::account)]
533535
fun test_create_root_account(aptos_framework: &signer) {
534536
use aptos_framework::aggregator_factory;
535537
use aptos_framework::object;

0 commit comments

Comments
 (0)