Skip to content

Commit

Permalink
Merge branch 'main' into teng/add-move-1-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
rahxephon89 authored Jan 8, 2025
2 parents 73280d7 + 8ff3aa1 commit 987f4de
Show file tree
Hide file tree
Showing 33 changed files with 493 additions and 225 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 33 additions & 35 deletions aptos-move/e2e-benchmark/data/calibration_values.tsv
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
Loop { loop_count: Some(100000), loop_type: NoOp } 60 0.960 1.119 42122.6
Loop { loop_count: Some(10000), loop_type: Arithmetic } 60 0.956 1.074 26240.7
CreateObjects { num_objects: 10, object_payload_size: 0 } 60 0.938 1.168 156.6
CreateObjects { num_objects: 10, object_payload_size: 10240 } 60 0.924 1.086 9713.2
CreateObjects { num_objects: 100, object_payload_size: 0 } 60 0.922 1.275 1577.0
CreateObjects { num_objects: 100, object_payload_size: 10240 } 60 0.935 1.070 11728.7
InitializeVectorPicture { length: 128 } 60 0.926 1.069 169.4
VectorPicture { length: 128 } 60 0.908 1.075 50.2
VectorPictureRead { length: 128 } 60 0.919 1.059 48.0
InitializeVectorPicture { length: 30720 } 60 0.939 1.127 28404.4
VectorPicture { length: 30720 } 60 0.936 1.095 6935.6
VectorPictureRead { length: 30720 } 60 0.939 1.093 6948.2
SmartTablePicture { length: 30720, num_points_per_txn: 200 } 60 0.947 1.080 43673.3
SmartTablePicture { length: 1048576, num_points_per_txn: 300 } 60 0.947 1.111 74145.8
ResourceGroupsSenderWriteTag { string_length: 1024 } 60 0.918 1.075 15.8
ResourceGroupsSenderMultiChange { string_length: 1024 } 60 0.909 1.169 32.9
TokenV1MintAndTransferFT 60 0.953 1.069 384.6
TokenV1MintAndTransferNFTSequential 60 0.938 1.064 600.3
TokenV2AmbassadorMint { numbered: true } 60 0.951 1.057 516.6
LiquidityPoolSwap { is_stable: true } 60 0.961 1.139 582.6
LiquidityPoolSwap { is_stable: false } 60 0.929 1.099 563.0
CoinInitAndMint 60 0.928 1.130 205.0
FungibleAssetMint 60 0.930 1.098 235.8
IncGlobalMilestoneAggV2 { milestone_every: 1 } 60 0.914 1.051 33.5
IncGlobalMilestoneAggV2 { milestone_every: 2 } 60 0.914 1.105 19.0
EmitEvents { count: 1000 } 60 0.937 1.158 8818.7
VectorTrimAppend { vec_len: 3000, element_len: 1, index: 0, repeats: 0 } 6 0.925 1.001 6058.1
VectorTrimAppend { vec_len: 3000, element_len: 1, index: 100, repeats: 1000 } 6 0.925 1.001 34000.0
VectorTrimAppend { vec_len: 3000, element_len: 1, index: 2990, repeats: 1000 } 6 0.925 1.001 17626.5
VectorRemoveInsert { vec_len: 3000, element_len: 1, index: 100, repeats: 1000 } 6 0.925 1.001 30870.3
VectorRemoveInsert { vec_len: 3000, element_len: 1, index: 2998, repeats: 1000 } 6 0.925 1.001 20343.2
VectorRangeMove { vec_len: 3000, element_len: 1, index: 1000, move_len: 500, repeats: 1000 } 6 0.925 1.001 65311
VectorTrimAppend { vec_len: 100, element_len: 100, index: 0, repeats: 0 } 6 0.925 1.001 277.0
VectorTrimAppend { vec_len: 100, element_len: 100, index: 10, repeats: 1000 } 6 0.925 1.001 12146.6
VectorRangeMove { vec_len: 100, element_len: 100, index: 50, move_len: 10, repeats: 1000 } 6 0.925 1.001 7098
Loop { loop_count: Some(100000), loop_type: NoOp } 119 0.958 1.423 42970.1
Loop { loop_count: Some(10000), loop_type: Arithmetic } 119 0.956 1.288 26571.1
CreateObjects { num_objects: 10, object_payload_size: 0 } 119 0.934 1.142 161.3
CreateObjects { num_objects: 10, object_payload_size: 10240 } 119 0.938 1.295 9803.9
CreateObjects { num_objects: 100, object_payload_size: 0 } 119 0.916 1.072 1619.7
CreateObjects { num_objects: 100, object_payload_size: 10240 } 119 0.936 1.275 11981.9
InitializeVectorPicture { length: 128 } 119 0.931 1.197 172.1
VectorPicture { length: 128 } 119 0.916 1.144 47.5
VectorPictureRead { length: 128 } 119 0.917 1.143 46.0
InitializeVectorPicture { length: 30720 } 119 0.939 1.261 28769.8
VectorPicture { length: 30720 } 119 0.922 1.241 6364.4
VectorPictureRead { length: 30720 } 119 0.929 1.145 6364.4
SmartTablePicture { length: 30720, num_points_per_txn: 200 } 119 0.952 1.215 44147.2
SmartTablePicture { length: 1048576, num_points_per_txn: 300 } 119 0.955 1.237 75415.5
ResourceGroupsSenderWriteTag { string_length: 1024 } 119 0.907 1.148 15.9
ResourceGroupsSenderMultiChange { string_length: 1024 } 119 0.904 1.217 33.5
TokenV1MintAndTransferFT 119 0.960 1.255 385.9
TokenV1MintAndTransferNFTSequential 119 0.945 1.218 594.7
TokenV2AmbassadorMint { numbered: true } 119 0.944 1.158 468.2
LiquidityPoolSwap { is_stable: true } 119 0.914 1.123 610.5
LiquidityPoolSwap { is_stable: false } 119 0.919 1.132 570.5
CoinInitAndMint 119 0.933 1.143 211.0
FungibleAssetMint 119 0.931 1.185 231.9
IncGlobalMilestoneAggV2 { milestone_every: 1 } 119 0.892 1.100 34.1
IncGlobalMilestoneAggV2 { milestone_every: 2 } 119 0.899 1.167 19.3
EmitEvents { count: 1000 } 119 0.941 1.126 9007.3
VectorTrimAppend { vec_len: 3000, element_len: 1, index: 0, repeats: 0 } 119 0.934 1.152 6490.3
VectorTrimAppend { vec_len: 3000, element_len: 1, index: 100, repeats: 1000 } 119 0.931 1.256 30762.7
VectorTrimAppend { vec_len: 3000, element_len: 1, index: 2990, repeats: 1000 } 119 0.947 1.093 18431.4
VectorRemoveInsert { vec_len: 3000, element_len: 1, index: 100, repeats: 1000 } 119 0.943 1.107 29034.8
VectorRemoveInsert { vec_len: 3000, element_len: 1, index: 2998, repeats: 1000 } 119 0.954 1.149 20047.3
VectorTrimAppend { vec_len: 100, element_len: 100, index: 0, repeats: 0 } 119 0.909 1.201 293.5
VectorTrimAppend { vec_len: 100, element_len: 100, index: 10, repeats: 1000 } 119 0.951 1.143 12571.2
24 changes: 12 additions & 12 deletions aptos-move/framework/aptos-framework/doc/aptos_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- [Function `register_apt`](#0x1_aptos_account_register_apt)
- [Function `fungible_transfer_only`](#0x1_aptos_account_fungible_transfer_only)
- [Function `is_fungible_balance_at_least`](#0x1_aptos_account_is_fungible_balance_at_least)
- [Function `burn_from_fungible_store`](#0x1_aptos_account_burn_from_fungible_store)
- [Function `burn_from_fungible_store_for_gas`](#0x1_aptos_account_burn_from_fungible_store_for_gas)
- [Function `ensure_primary_fungible_store_exists`](#0x1_aptos_account_ensure_primary_fungible_store_exists)
- [Function `primary_fungible_store_address`](#0x1_aptos_account_primary_fungible_store_address)
- [Specification](#@Specification_1)
Expand All @@ -47,7 +47,7 @@
- [Function `register_apt`](#@Specification_1_register_apt)
- [Function `fungible_transfer_only`](#@Specification_1_fungible_transfer_only)
- [Function `is_fungible_balance_at_least`](#@Specification_1_is_fungible_balance_at_least)
- [Function `burn_from_fungible_store`](#@Specification_1_burn_from_fungible_store)
- [Function `burn_from_fungible_store_for_gas`](#@Specification_1_burn_from_fungible_store_for_gas)


<pre><code><b>use</b> <a href="account.md#0x1_account">0x1::account</a>;
Expand Down Expand Up @@ -707,7 +707,7 @@ to transfer APT) - if we want to allow APT PFS without account itself
// <b>as</b> APT cannot be frozen or have dispatch, and PFS cannot be transfered
// (PFS could potentially be burned. regular transfer would permanently unburn the store.
// Ignoring the check here <b>has</b> the equivalent of unburning, transfers, and then burning again)
<a href="fungible_asset.md#0x1_fungible_asset_deposit_internal">fungible_asset::deposit_internal</a>(recipient_store, <a href="fungible_asset.md#0x1_fungible_asset_withdraw_internal">fungible_asset::withdraw_internal</a>(sender_store, amount));
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_deposit">fungible_asset::unchecked_deposit</a>(recipient_store, <a href="fungible_asset.md#0x1_fungible_asset_unchecked_withdraw">fungible_asset::unchecked_withdraw</a>(sender_store, amount));
}
</code></pre>

Expand Down Expand Up @@ -741,14 +741,14 @@ Is balance from APT Primary FungibleStore at least the given amount

</details>

<a id="0x1_aptos_account_burn_from_fungible_store"></a>
<a id="0x1_aptos_account_burn_from_fungible_store_for_gas"></a>

## Function `burn_from_fungible_store`
## Function `burn_from_fungible_store_for_gas`

Burn from APT Primary FungibleStore
Burn from APT Primary FungibleStore for gas charge


<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store">burn_from_fungible_store</a>(ref: &<a href="fungible_asset.md#0x1_fungible_asset_BurnRef">fungible_asset::BurnRef</a>, <a href="account.md#0x1_account">account</a>: <b>address</b>, amount: u64)
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store_for_gas">burn_from_fungible_store_for_gas</a>(ref: &<a href="fungible_asset.md#0x1_fungible_asset_BurnRef">fungible_asset::BurnRef</a>, <a href="account.md#0x1_account">account</a>: <b>address</b>, amount: u64)
</code></pre>


Expand All @@ -757,15 +757,15 @@ Burn from APT Primary FungibleStore
<summary>Implementation</summary>


<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store">burn_from_fungible_store</a>(
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store_for_gas">burn_from_fungible_store_for_gas</a>(
ref: &BurnRef,
<a href="account.md#0x1_account">account</a>: <b>address</b>,
amount: u64,
) {
// Skip burning <b>if</b> amount is zero. This shouldn't <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error">error</a> out <b>as</b> it's called <b>as</b> part of transaction fee burning.
<b>if</b> (amount != 0) {
<b>let</b> store_addr = <a href="aptos_account.md#0x1_aptos_account_primary_fungible_store_address">primary_fungible_store_address</a>(<a href="account.md#0x1_account">account</a>);
<a href="fungible_asset.md#0x1_fungible_asset_address_burn_from">fungible_asset::address_burn_from</a>(ref, store_addr, amount);
<a href="fungible_asset.md#0x1_fungible_asset_address_burn_from_for_gas">fungible_asset::address_burn_from_for_gas</a>(ref, store_addr, amount);
};
}
</code></pre>
Expand Down Expand Up @@ -1294,12 +1294,12 @@ Check if the AptosCoin under the address existed.



<a id="@Specification_1_burn_from_fungible_store"></a>
<a id="@Specification_1_burn_from_fungible_store_for_gas"></a>

### Function `burn_from_fungible_store`
### Function `burn_from_fungible_store_for_gas`


<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store">burn_from_fungible_store</a>(ref: &<a href="fungible_asset.md#0x1_fungible_asset_BurnRef">fungible_asset::BurnRef</a>, <a href="account.md#0x1_account">account</a>: <b>address</b>, amount: u64)
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="aptos_account.md#0x1_aptos_account_burn_from_fungible_store_for_gas">burn_from_fungible_store_for_gas</a>(ref: &<a href="fungible_asset.md#0x1_fungible_asset_BurnRef">fungible_asset::BurnRef</a>, <a href="account.md#0x1_account">account</a>: <b>address</b>, amount: u64)
</code></pre>


Expand Down
12 changes: 2 additions & 10 deletions aptos-move/framework/aptos-framework/doc/coin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2057,15 +2057,7 @@ or disallow upgradability of total supply.
<b>if</b> (<a href="coin.md#0x1_coin">coin</a>.value == 0) {
<a href="coin.md#0x1_coin_destroy_zero">destroy_zero</a>(<a href="coin.md#0x1_coin">coin</a>);
} <b>else</b> {
<b>if</b> (std::features::module_event_migration_enabled()) {
<a href="event.md#0x1_event_emit">event::emit</a>(<a href="coin.md#0x1_coin_CoinWithdraw">CoinWithdraw</a> { coin_type: type_name&lt;CoinType&gt;(), <a href="account.md#0x1_account">account</a>, amount: <a href="coin.md#0x1_coin">coin</a>.value });
} <b>else</b> {
<a href="event.md#0x1_event_emit_event">event::emit_event</a>&lt;<a href="coin.md#0x1_coin_WithdrawEvent">WithdrawEvent</a>&gt;(
&<b>mut</b> withdraw_events,
<a href="coin.md#0x1_coin_WithdrawEvent">WithdrawEvent</a> { amount: <a href="coin.md#0x1_coin">coin</a>.value },
);
};
<a href="fungible_asset.md#0x1_fungible_asset_deposit_internal">fungible_asset::deposit_internal</a>(object_address(&store), <a href="coin.md#0x1_coin_coin_to_fungible_asset">coin_to_fungible_asset</a>(<a href="coin.md#0x1_coin">coin</a>));
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_deposit_with_no_events">fungible_asset::unchecked_deposit_with_no_events</a>(object_address(&store), <a href="coin.md#0x1_coin_coin_to_fungible_asset">coin_to_fungible_asset</a>(<a href="coin.md#0x1_coin">coin</a>));
};
<a href="event.md#0x1_event_destroy_handle">event::destroy_handle</a>(deposit_events);
<a href="event.md#0x1_event_destroy_handle">event::destroy_handle</a>(withdraw_events);
Expand Down Expand Up @@ -2710,7 +2702,7 @@ This is for internal use only and doesn't emit an DepositEvent.
<b>let</b> fa = <a href="coin.md#0x1_coin_coin_to_fungible_asset">coin_to_fungible_asset</a>(<a href="coin.md#0x1_coin">coin</a>);
<b>let</b> metadata = <a href="fungible_asset.md#0x1_fungible_asset_asset_metadata">fungible_asset::asset_metadata</a>(&fa);
<b>let</b> store = <a href="primary_fungible_store.md#0x1_primary_fungible_store_ensure_primary_store_exists">primary_fungible_store::ensure_primary_store_exists</a>(account_addr, metadata);
<a href="fungible_asset.md#0x1_fungible_asset_deposit_internal">fungible_asset::deposit_internal</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa);
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_deposit_with_no_events">fungible_asset::unchecked_deposit_with_no_events</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa);
} <b>else</b> {
<b>abort</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_not_found">error::not_found</a>(<a href="coin.md#0x1_coin_ECOIN_STORE_NOT_PUBLISHED">ECOIN_STORE_NOT_PUBLISHED</a>)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ The semantics of deposit will be governed by the function specified in DispatchF
<b>assert</b>!(amount &lt;= start_balance - end_balance, <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_aborted">error::aborted</a>(<a href="dispatchable_fungible_asset.md#0x1_dispatchable_fungible_asset_EAMOUNT_MISMATCH">EAMOUNT_MISMATCH</a>));
fa
} <b>else</b> {
<a href="fungible_asset.md#0x1_fungible_asset_withdraw_internal">fungible_asset::withdraw_internal</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), amount)
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_withdraw">fungible_asset::unchecked_withdraw</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), amount)
}
}
</code></pre>
Expand Down Expand Up @@ -283,7 +283,7 @@ The semantics of deposit will be governed by the function specified in DispatchF
func
)
} <b>else</b> {
<a href="fungible_asset.md#0x1_fungible_asset_deposit_internal">fungible_asset::deposit_internal</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa)
<a href="fungible_asset.md#0x1_fungible_asset_unchecked_deposit">fungible_asset::unchecked_deposit</a>(<a href="object.md#0x1_object_object_address">object::object_address</a>(&store), fa)
}
}
</code></pre>
Expand Down
Loading

0 comments on commit 987f4de

Please sign in to comment.