Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compiler-v2] fixed all unittest for starcoin-framework #4323

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions vm/framework/move-stdlib/doc/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,12 @@ Lifetime: transient



<a id="0x1_features_NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE"></a>
<a id="0x1_features_NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE"></a>

Lifetime: transient


<pre><code><b>const</b> <a href="features.md#0x1_features_NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE">NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE</a>: u64 = 64;
<pre><code><b>const</b> <a href="features.md#0x1_features_NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE">NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE</a>: u64 = 64;
</code></pre>


Expand Down Expand Up @@ -2729,8 +2729,10 @@ Lifetime: transient
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_transaction_context_extension_enabled">transaction_context_extension_enabled</a>(): bool <b>acquires</b> <a href="features.md#0x1_features_Features">Features</a> {
<a href="features.md#0x1_features_is_enabled">is_enabled</a>(<a href="features.md#0x1_features_TRANSACTION_CONTEXT_EXTENSION">TRANSACTION_CONTEXT_EXTENSION</a>)
<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_transaction_context_extension_enabled">transaction_context_extension_enabled</a>(): bool {
// <a href="features.md#0x1_features_is_enabled">is_enabled</a>(<a href="features.md#0x1_features_TRANSACTION_CONTEXT_EXTENSION">TRANSACTION_CONTEXT_EXTENSION</a>)
// TODO(BobOng): [framework-upgrade] <b>to</b> confirm which feature flag should be used here
<b>true</b>
}
</code></pre>

Expand Down Expand Up @@ -2775,8 +2777,10 @@ Lifetime: transient
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_coin_to_fungible_asset_migration_feature_enabled">coin_to_fungible_asset_migration_feature_enabled</a>(): bool <b>acquires</b> <a href="features.md#0x1_features_Features">Features</a> {
<a href="features.md#0x1_features_is_enabled">is_enabled</a>(<a href="features.md#0x1_features_COIN_TO_FUNGIBLE_ASSET_MIGRATION">COIN_TO_FUNGIBLE_ASSET_MIGRATION</a>)
<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_coin_to_fungible_asset_migration_feature_enabled">coin_to_fungible_asset_migration_feature_enabled</a>(): bool {
// <a href="features.md#0x1_features_is_enabled">is_enabled</a>(<a href="features.md#0x1_features_COIN_TO_FUNGIBLE_ASSET_MIGRATION">COIN_TO_FUNGIBLE_ASSET_MIGRATION</a>)
// TODO(BobOng): [framework-upgrade] <b>to</b> confirm which feature flag should be used here
<b>true</b>
}
</code></pre>

Expand Down Expand Up @@ -2942,8 +2946,10 @@ Lifetime: transient
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_dispatchable_fungible_asset_enabled">dispatchable_fungible_asset_enabled</a>(): bool <b>acquires</b> <a href="features.md#0x1_features_Features">Features</a> {
<a href="features.md#0x1_features_is_enabled">is_enabled</a>(<a href="features.md#0x1_features_DISPATCHABLE_FUNGIBLE_ASSET">DISPATCHABLE_FUNGIBLE_ASSET</a>)
<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_dispatchable_fungible_asset_enabled">dispatchable_fungible_asset_enabled</a>(): bool {
// TODO(BobOng): [framework-upgrade] <b>to</b> confirm which feature flag should be used here
// <a href="features.md#0x1_features_is_enabled">is_enabled</a>(<a href="features.md#0x1_features_DISPATCHABLE_FUNGIBLE_ASSET">DISPATCHABLE_FUNGIBLE_ASSET</a>)
<b>true</b>
}
</code></pre>

Expand All @@ -2966,7 +2972,7 @@ Lifetime: transient
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_get_new_accounts_default_to_fa_apt_store_feature">get_new_accounts_default_to_fa_apt_store_feature</a>(): u64 { <a href="features.md#0x1_features_NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE">NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE</a> }
<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_get_new_accounts_default_to_fa_apt_store_feature">get_new_accounts_default_to_fa_apt_store_feature</a>(): u64 { <a href="features.md#0x1_features_NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE">NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE</a> }
</code></pre>


Expand All @@ -2989,7 +2995,8 @@ Lifetime: transient


<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_new_accounts_default_to_fa_stc_store_enabled">new_accounts_default_to_fa_stc_store_enabled</a>(): bool <b>acquires</b> <a href="features.md#0x1_features_Features">Features</a> {
<a href="features.md#0x1_features_is_enabled">is_enabled</a>(<a href="features.md#0x1_features_NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE">NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE</a>)
// TODO(BobOng): [framework-upgrade] <b>to</b> confirm which feature flag should be used here
<a href="features.md#0x1_features_is_enabled">is_enabled</a>(<a href="features.md#0x1_features_NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE">NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE</a>)
}
</code></pre>

Expand Down Expand Up @@ -3437,10 +3444,8 @@ Check whether the feature is enabled.


<pre><code><b>public</b> <b>fun</b> <a href="features.md#0x1_features_is_enabled">is_enabled</a>(feature: u64): bool <b>acquires</b> <a href="features.md#0x1_features_Features">Features</a> {
<b>let</b> _ret = <b>exists</b>&lt;<a href="features.md#0x1_features_Features">Features</a>&gt;(@std) &&
<a href="features.md#0x1_features_contains">contains</a>(&<b>borrow_global</b>&lt;<a href="features.md#0x1_features_Features">Features</a>&gt;(@std).<a href="features.md#0x1_features">features</a>, feature);
// TODO(BobOng): [framework-upgrade] To initialize this feature
<b>true</b>
<b>exists</b>&lt;<a href="features.md#0x1_features_Features">Features</a>&gt;(@std) &&
<a href="features.md#0x1_features_contains">contains</a>(&<b>borrow_global</b>&lt;<a href="features.md#0x1_features_Features">Features</a>&gt;(@std).<a href="features.md#0x1_features">features</a>, feature)
}
</code></pre>

Expand Down
31 changes: 18 additions & 13 deletions vm/framework/move-stdlib/sources/configs/features.move
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,10 @@ module std::features {

public fun get_transaction_context_extension_feature(): u64 { TRANSACTION_CONTEXT_EXTENSION }

public fun transaction_context_extension_enabled(): bool acquires Features {
is_enabled(TRANSACTION_CONTEXT_EXTENSION)
public fun transaction_context_extension_enabled(): bool {
// is_enabled(TRANSACTION_CONTEXT_EXTENSION)
// TODO(BobOng): [framework-upgrade] to confirm which feature flag should be used here
true
}

/// Whether migration from coin to fungible asset feature is enabled.
Expand All @@ -488,8 +490,10 @@ module std::features {

public fun get_coin_to_fungible_asset_migration_feature(): u64 { COIN_TO_FUNGIBLE_ASSET_MIGRATION }

public fun coin_to_fungible_asset_migration_feature_enabled(): bool acquires Features {
is_enabled(COIN_TO_FUNGIBLE_ASSET_MIGRATION)
public fun coin_to_fungible_asset_migration_feature_enabled(): bool {
// is_enabled(COIN_TO_FUNGIBLE_ASSET_MIGRATION)
// TODO(BobOng): [framework-upgrade] to confirm which feature flag should be used here
true
}

const PRIMARY_APT_FUNGIBLE_STORE_AT_USER_ADDRESS: u64 = 61;
Expand Down Expand Up @@ -527,17 +531,20 @@ module std::features {

public fun get_dispatchable_fungible_asset_feature(): u64 { DISPATCHABLE_FUNGIBLE_ASSET }

public fun dispatchable_fungible_asset_enabled(): bool acquires Features {
is_enabled(DISPATCHABLE_FUNGIBLE_ASSET)
public fun dispatchable_fungible_asset_enabled(): bool {
// TODO(BobOng): [framework-upgrade] to confirm which feature flag should be used here
// is_enabled(DISPATCHABLE_FUNGIBLE_ASSET)
true
}

/// Lifetime: transient
const NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE: u64 = 64;
const NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE: u64 = 64;

public fun get_new_accounts_default_to_fa_apt_store_feature(): u64 { NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE }
public fun get_new_accounts_default_to_fa_apt_store_feature(): u64 { NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE }

public fun new_accounts_default_to_fa_stc_store_enabled(): bool acquires Features {
is_enabled(NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE)
// TODO(BobOng): [framework-upgrade] to confirm which feature flag should be used here
is_enabled(NEW_ACCOUNTS_DEFAULT_TO_FA_STC_STORE)
}

/// Lifetime: transient
Expand Down Expand Up @@ -689,10 +696,8 @@ module std::features {
#[view]
/// Check whether the feature is enabled.
public fun is_enabled(feature: u64): bool acquires Features {
let _ret = exists<Features>(@std) &&
contains(&borrow_global<Features>(@std).features, feature);
// TODO(BobOng): [framework-upgrade] To initialize this feature
true
exists<Features>(@std) &&
contains(&borrow_global<Features>(@std).features, feature)
}

/// Helper to include or exclude a feature flag.
Expand Down
Loading
Loading