Skip to content

Commit 0be2220

Browse files
committed
fix: add all files
1 parent ed810be commit 0be2220

File tree

3 files changed

+22
-136
lines changed

3 files changed

+22
-136
lines changed

aptos-move/framework/aptos-framework/doc/account.md

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
- [Function `create_account_if_does_not_exist`](#0x1_account_create_account_if_does_not_exist)
2424
- [Function `create_account`](#0x1_account_create_account)
2525
- [Function `create_account_unchecked`](#0x1_account_create_account_unchecked)
26-
- [Function `destroy_account_from`](#0x1_account_destroy_account_from)
2726
- [Function `exists_at`](#0x1_account_exists_at)
2827
- [Function `get_guid_next_creation_num`](#0x1_account_get_guid_next_creation_num)
2928
- [Function `get_sequence_number`](#0x1_account_get_sequence_number)
@@ -617,16 +616,6 @@ This V2 struct adds the <code><a href="chain_id.md#0x1_chain_id">chain_id</a></c
617616

618617

619618

620-
<a id="0x1_account_DECOMMISSION_CORE_RESOURCES"></a>
621-
622-
Feature flag for decommissioning core resources.
623-
624-
625-
<pre><code><b>const</b> <a href="account.md#0x1_account_DECOMMISSION_CORE_RESOURCES">DECOMMISSION_CORE_RESOURCES</a>: u64 = 222;
626-
</code></pre>
627-
628-
629-
630619
<a id="0x1_account_DERIVE_RESOURCE_ACCOUNT_SCHEME"></a>
631620

632621
Scheme identifier used when hashing an account's address together with a seed to derive the address (not the
@@ -963,16 +952,7 @@ is returned. This way, the caller of this function can publish additional resour
963952
// there cannot be an <a href="account.md#0x1_account_Account">Account</a> resource under new_addr already.
964953
<b>assert</b>!(!<b>exists</b>&lt;<a href="account.md#0x1_account_Account">Account</a>&gt;(new_address), <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_already_exists">error::already_exists</a>(<a href="account.md#0x1_account_EACCOUNT_ALREADY_EXISTS">EACCOUNT_ALREADY_EXISTS</a>));
965954

966-
// Check <b>if</b> the feature flag for decommissioning core resources is enabled.
967-
<b>if</b> (get_decommission_core_resources_enabled()) {
968-
// Assert separately for the core resources <b>address</b> <b>if</b> the feature flag is enabled.
969-
<b>assert</b>!(
970-
new_address != @0xa550c18,
971-
<a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="account.md#0x1_account_ECANNOT_RESERVED_ADDRESS">ECANNOT_RESERVED_ADDRESS</a>)
972-
);
973-
};
974-
975-
// Assert for other reserved addresses.
955+
// NOTE: @core_resources gets created via a `create_account` call, so we do not <b>include</b> it below.
976956
<b>assert</b>!(
977957
new_address != @vm_reserved && new_address != @aptos_framework && new_address != @aptos_token,
978958
<a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="account.md#0x1_account_ECANNOT_RESERVED_ADDRESS">ECANNOT_RESERVED_ADDRESS</a>)
@@ -1036,54 +1016,6 @@ is returned. This way, the caller of this function can publish additional resour
10361016

10371017

10381018

1039-
</details>
1040-
1041-
<a id="0x1_account_destroy_account_from"></a>
1042-
1043-
## Function `destroy_account_from`
1044-
1045-
Destroy the Account resource from a given account.
1046-
Used to destroy the core resources account on mainnet.
1047-
1048-
1049-
<pre><code><b>public</b> entry <b>fun</b> <a href="account.md#0x1_account_destroy_account_from">destroy_account_from</a>(<a href="account.md#0x1_account">account</a>: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, from: <b>address</b>)
1050-
</code></pre>
1051-
1052-
1053-
1054-
<details>
1055-
<summary>Implementation</summary>
1056-
1057-
1058-
<pre><code><b>public</b> entry <b>fun</b> <a href="account.md#0x1_account_destroy_account_from">destroy_account_from</a>(<a href="account.md#0x1_account">account</a>: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, from: <b>address</b>) <b>acquires</b> <a href="account.md#0x1_account_Account">Account</a> {
1059-
<a href="system_addresses.md#0x1_system_addresses_assert_core_resource">system_addresses::assert_core_resource</a>(<a href="account.md#0x1_account">account</a>);
1060-
1061-
// Assert that the feature flag for decommissioning core resources is enabled
1062-
<b>assert</b>!(
1063-
std::features::get_decommission_core_resources_enabled(),
1064-
<a href="account.md#0x1_account_EFLAG_NOT_ENABLED">EFLAG_NOT_ENABLED</a>
1065-
);
1066-
1067-
<b>let</b> <a href="account.md#0x1_account_Account">Account</a> {
1068-
authentication_key: _,
1069-
sequence_number: _,
1070-
guid_creation_num: _,
1071-
coin_register_events,
1072-
key_rotation_events,
1073-
rotation_capability_offer,
1074-
signer_capability_offer,
1075-
} = <b>move_from</b>&lt;<a href="account.md#0x1_account_Account">Account</a>&gt;(from);
1076-
1077-
<a href="event.md#0x1_event_destroy_handle">event::destroy_handle</a>&lt;<a href="account.md#0x1_account_CoinRegisterEvent">CoinRegisterEvent</a>&gt;(coin_register_events);
1078-
<a href="event.md#0x1_event_destroy_handle">event::destroy_handle</a>&lt;<a href="account.md#0x1_account_KeyRotationEvent">KeyRotationEvent</a>&gt;(key_rotation_events);
1079-
1080-
<b>let</b> <a href="account.md#0x1_account_CapabilityOffer">CapabilityOffer</a> { for: _ } = rotation_capability_offer;
1081-
<b>let</b> <a href="account.md#0x1_account_CapabilityOffer">CapabilityOffer</a> { for: _ } = signer_capability_offer;
1082-
}
1083-
</code></pre>
1084-
1085-
1086-
10871019
</details>
10881020

10891021
<a id="0x1_account_exists_at"></a>

aptos-move/framework/aptos-framework/doc/system_addresses.md

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232

3333
<pre><code><b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error">0x1::error</a>;
34+
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/features.md#0x1_features">0x1::features</a>;
3435
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">0x1::signer</a>;
3536
</code></pre>
3637

@@ -145,7 +146,12 @@ The operation can only be performed by the VM
145146

146147

147148
<pre><code><b>public</b> <b>fun</b> <a href="system_addresses.md#0x1_system_addresses_is_core_resource_address">is_core_resource_address</a>(addr: <b>address</b>): bool {
148-
addr == @core_resources
149+
// Check <b>if</b> the feature flag for decommissioning core resources is enabled.
150+
<b>if</b> (get_decommission_core_resources_enabled()) {
151+
<b>false</b>
152+
} <b>else</b> {
153+
addr == @core_resources
154+
}
149155
}
150156
</code></pre>
151157

@@ -497,6 +503,20 @@ Return true if <code>addr</code> is either the VM address or an Aptos Framework
497503
</code></pre>
498504

499505

506+
Specifies that a function aborts if the account does not have the root address.
507+
508+
509+
<a id="0x1_system_addresses_AbortsIfNotCoreResource"></a>
510+
511+
512+
<pre><code><b>schema</b> <a href="system_addresses.md#0x1_system_addresses_AbortsIfNotCoreResource">AbortsIfNotCoreResource</a> {
513+
addr: <b>address</b>;
514+
// This enforces <a id="high-level-req-1" href="#high-level-req">high-level requirement 1</a>:
515+
<b>aborts_if</b> addr != @core_resources <b>with</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_PERMISSION_DENIED">error::PERMISSION_DENIED</a>;
516+
}
517+
</code></pre>
518+
519+
500520

501521
<a id="@Specification_1_assert_aptos_framework"></a>
502522

@@ -546,20 +566,6 @@ Return true if <code>addr</code> is either the VM address or an Aptos Framework
546566
</code></pre>
547567

548568

549-
Specifies that a function aborts if the account does not have the aptos framework address.
550-
551-
552-
<a id="0x1_system_addresses_AbortsIfNotAptosFramework"></a>
553-
554-
555-
<pre><code><b>schema</b> <a href="system_addresses.md#0x1_system_addresses_AbortsIfNotAptosFramework">AbortsIfNotAptosFramework</a> {
556-
<a href="account.md#0x1_account">account</a>: <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>;
557-
// This enforces <a id="high-level-req-2" href="#high-level-req">high-level requirement 2</a>:
558-
<b>aborts_if</b> <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of">signer::address_of</a>(<a href="account.md#0x1_account">account</a>) != @aptos_framework <b>with</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_PERMISSION_DENIED">error::PERMISSION_DENIED</a>;
559-
}
560-
</code></pre>
561-
562-
563569

564570
<a id="@Specification_1_assert_vm"></a>
565571

@@ -577,18 +583,4 @@ Specifies that a function aborts if the account does not have the aptos framewor
577583
</code></pre>
578584

579585

580-
Specifies that a function aborts if the account does not have the VM reserved address.
581-
582-
583-
<a id="0x1_system_addresses_AbortsIfNotVM"></a>
584-
585-
586-
<pre><code><b>schema</b> <a href="system_addresses.md#0x1_system_addresses_AbortsIfNotVM">AbortsIfNotVM</a> {
587-
<a href="account.md#0x1_account">account</a>: <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>;
588-
// This enforces <a id="high-level-req-3" href="#high-level-req">high-level requirement 3</a>:
589-
<b>aborts_if</b> <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of">signer::address_of</a>(<a href="account.md#0x1_account">account</a>) != @vm_reserved <b>with</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_PERMISSION_DENIED">error::PERMISSION_DENIED</a>;
590-
}
591-
</code></pre>
592-
593-
594586
[move-book]: https://aptos.dev/move/book/SUMMARY

aptos-move/framework/cached-packages/src/aptos_framework_sdk_builder.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ type Bytes = Vec<u8>;
3737
#[cfg_attr(feature = "fuzzing", derive(proptest_derive::Arbitrary))]
3838
#[cfg_attr(feature = "fuzzing", proptest(no_params))]
3939
pub enum EntryFunctionCall {
40-
/// Destroy the Account resource from a given account.
41-
/// Used to destroy the core resources account on mainnet.
42-
AccountDestroyAccountFrom {
43-
from: AccountAddress,
44-
},
45-
4640
/// Offers rotation capability on behalf of `account` to the account at address `recipient_address`.
4741
/// An account can delegate its rotation capability to only one other address at one time. If the account
4842
/// has an existing rotation capability offer, calling this function will update the rotation capability offer with
@@ -1136,7 +1130,6 @@ impl EntryFunctionCall {
11361130
pub fn encode(self) -> TransactionPayload {
11371131
use EntryFunctionCall::*;
11381132
match self {
1139-
AccountDestroyAccountFrom { from } => account_destroy_account_from(from),
11401133
AccountOfferRotationCapability {
11411134
rotation_capability_sig_bytes,
11421135
account_scheme,
@@ -1811,23 +1804,6 @@ impl EntryFunctionCall {
18111804
}
18121805
}
18131806

1814-
/// Destroy the Account resource from a given account.
1815-
/// Used to destroy the core resources account on mainnet.
1816-
pub fn account_destroy_account_from(from: AccountAddress) -> TransactionPayload {
1817-
TransactionPayload::EntryFunction(EntryFunction::new(
1818-
ModuleId::new(
1819-
AccountAddress::new([
1820-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1821-
0, 0, 0, 1,
1822-
]),
1823-
ident_str!("account").to_owned(),
1824-
),
1825-
ident_str!("destroy_account_from").to_owned(),
1826-
vec![],
1827-
vec![bcs::to_bytes(&from).unwrap()],
1828-
))
1829-
}
1830-
18311807
/// Offers rotation capability on behalf of `account` to the account at address `recipient_address`.
18321808
/// An account can delegate its rotation capability to only one other address at one time. If the account
18331809
/// has an existing rotation capability offer, calling this function will update the rotation capability offer with
@@ -5058,16 +5034,6 @@ pub fn vesting_vest_many(contract_addresses: Vec<AccountAddress>) -> Transaction
50585034
}
50595035
mod decoder {
50605036
use super::*;
5061-
pub fn account_destroy_account_from(payload: &TransactionPayload) -> Option<EntryFunctionCall> {
5062-
if let TransactionPayload::EntryFunction(script) = payload {
5063-
Some(EntryFunctionCall::AccountDestroyAccountFrom {
5064-
from: bcs::from_bytes(script.args().get(0)?).ok()?,
5065-
})
5066-
} else {
5067-
None
5068-
}
5069-
}
5070-
50715037
pub fn account_offer_rotation_capability(
50725038
payload: &TransactionPayload,
50735039
) -> Option<EntryFunctionCall> {
@@ -6950,10 +6916,6 @@ type EntryFunctionDecoderMap = std::collections::HashMap<
69506916
static SCRIPT_FUNCTION_DECODER_MAP: once_cell::sync::Lazy<EntryFunctionDecoderMap> =
69516917
once_cell::sync::Lazy::new(|| {
69526918
let mut map: EntryFunctionDecoderMap = std::collections::HashMap::new();
6953-
map.insert(
6954-
"account_destroy_account_from".to_string(),
6955-
Box::new(decoder::account_destroy_account_from),
6956-
);
69576919
map.insert(
69586920
"account_offer_rotation_capability".to_string(),
69596921
Box::new(decoder::account_offer_rotation_capability),

0 commit comments

Comments
 (0)