Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Module 0x1::features

Defines feature flags for Aptos. Those are used in Aptos specific implementations of features in the Move stdlib, the Aptos stdlib, and the Aptos framework.

============================================================================================ Feature Flag Definitions

Each feature flag should come with documentation which justifies the need of the flag. Introduction of a new feature flag requires approval of framework owners. Be frugal when introducing new feature flags, as too many can make it hard to understand the code.

Each feature flag should come with a specification of a lifetime:

  • a transient feature flag is only needed until a related code rollout has happened. This is typically associated with the introduction of new native Move functions, and is only used from Move code. The owner of this feature is obliged to remove it once this can be done.

  • a permanent feature flag is required to stay around forever. Typically, those flags guard behavior in native code, and the behavior with or without the feature need to be preserved for playback.

Note that removing a feature flag still requires the function which tests for the feature (like code_dependency_check_enabled below) to stay around for compatibility reasons, as it is a public function. However, once the feature flag is disabled, those functions can constantly return true.

use 0x1::error;
use 0x1::signer;
use 0x1::vector;

Resource Features

The enabled features, represented by a bitset stored on chain.

struct Features has key
Fields
features: vector<u8>

Resource PendingFeatures

This resource holds the feature vec updates received in the current epoch. On epoch change, the updates take effect and this buffer is cleared.

struct PendingFeatures has key
Fields
features: vector<u8>

Constants

Whether the multisig v2 fix is enabled. Once enabled, the multisig transaction execution will explicitly abort if the provided payload does not match the payload stored on-chain.

Lifetime: transient

const ABORT_IF_MULTISIG_PAYLOAD_MISMATCH: u64 = 70;

Whether the account abstraction is enabled.

Lifetime: transient

const ACCOUNT_ABSTRACTION: u64 = 85;

Whether the new aptos_stdlib::type_info::chain_id() native for fetching the chain ID is enabled. This is needed because of the introduction of a new native function. Lifetime: transient

const APTOS_STD_CHAIN_ID_NATIVES: u64 = 4;

Whether enable MOVE functions to call create_auid method to create AUIDs. Lifetime: transient

const APTOS_UNIQUE_IDENTIFIERS: u64 = 23;

Whether the new BLAKE2B-256 hash function native is enabled. This is needed because of the introduction of new native function(s). Lifetime: transient

const BLAKE2B_256_NATIVE: u64 = 8;

Whether the generic algebra implementation for BLS12381 operations are enabled.

Lifetime: transient

const BLS12_381_STRUCTURES: u64 = 13;

Whether the generic algebra implementation for BN254 operations are enabled.

Lifetime: transient

const BN254_STRUCTURES: u64 = 43;

Whether the batch Bulletproofs native functions are available. This is needed because of the introduction of a new native function. Lifetime: transient

const BULLETPROOFS_BATCH_NATIVES: u64 = 87;

Whether the Bulletproofs zero-knowledge range proof module is enabled, and the related native function is available. This is needed because of the introduction of a new native function. Lifetime: transient

const BULLETPROOFS_NATIVES: u64 = 24;

Whether to calculate the transaction fee for distribution.

const CALCULATE_TRANSACTION_FEE_FOR_DISTRIBUTION: u64 = 96;

Charge invariant violation error. Lifetime: transient

const CHARGE_INVARIANT_VIOLATION: u64 = 20;

Whether validation of package dependencies is enabled, and the related native function is available. This is needed because of introduction of a new native function. Lifetime: transient

const CODE_DEPENDENCY_CHECK: u64 = 1;

Whether migration from coin to fungible asset feature is enabled.

Lifetime: transient

const COIN_TO_FUNGIBLE_ASSET_MIGRATION: u64 = 60;

const COLLECTION_OWNER: u64 = 79;

Whether the operator commission rate change in delegation pool is enabled. Lifetime: transient

const COMMISSION_CHANGE_DELEGATION_POOL: u64 = 42;

Whether enable Fungible Asset creation to create higher throughput concurrent variants. Lifetime: transient

const CONCURRENT_FUNGIBLE_ASSETS: u64 = 50;

Whether enable concurent Fungible Balance to create higher throughput concurrent variants. Lifetime: transient

const CONCURRENT_FUNGIBLE_BALANCE: u64 = 67;

Whether generic algebra basic operation support in crypto_algebra.move are enabled.

Lifetime: permanent

const CRYPTOGRAPHY_ALGEBRA_NATIVES: u64 = 12;

Lifetime: transient

const DEFAULT_ACCOUNT_RESOURCE: u64 = 91;

Whether to default new Fungible Store to the concurrent variant. Lifetime: transient

const DEFAULT_TO_CONCURRENT_FUNGIBLE_BALANCE: u64 = 68;

Whether delegation pools are enabled. Lifetime: transient

const DELEGATION_POOLS: u64 = 11;

Whether delegators allowlisting for delegation pools is supported. Lifetime: transient

const DELEGATION_POOL_ALLOWLISTING: u64 = 56;

Whether enable paritial governance voting on delegation_pool. Lifetime: transient

const DELEGATION_POOL_PARTIAL_GOVERNANCE_VOTING: u64 = 21;

Whether the account abstraction is enabled.

Lifetime: transient

const DERIVABLE_ACCOUNT_ABSTRACTION: u64 = 88;

Whether to distribute transaction fee to validators.

const DISTRIBUTE_TRANSACTION_FEE: u64 = 97;

const EAPI_DISABLED: u64 = 2;

Whether native_public_key_validate aborts when a public key of the wrong length is given Lifetime: ephemeral

const ED25519_PUBKEY_VALIDATE_RETURN_FALSE_WRONG_LENGTH: u64 = 14;

Deployed to production, and disabling is deprecated.

const EFEATURE_CANNOT_BE_DISABLED: u64 = 3;

The provided signer has not a framework address.

const EFRAMEWORK_SIGNER_NEEDED: u64 = 1;

const EINVALID_FEATURE: u64 = 1;

Whether the encrypted mempool feature is enabled.

const ENCRYPTED_TRANSACTIONS: u64 = 108;

const FEE_PAYER_ACCOUNT_OPTIONAL: u64 = 35;

Whether alternate gas payer is supported Lifetime: transient

const FEE_PAYER_ENABLED: u64 = 22;

Whether function reflection is enabled.

const FUNCTION_REFLECTION: u64 = 105;

Deprecated by aptos_framework::jwk_consensus_config::JWKConsensusConfig.

const JWK_CONSENSUS: u64 = 49;

If enabled, JWK consensus should run in per-key mode, where:

  • The consensus is for key-level updates (e.g., “issuer A key 1 should be deleted”, “issuer B key 2 should be upserted”);
  • transaction type ValidatorTransaction::ObservedJWKUpdate is reused;
  • while a key-level update is mostly represented by a new type KeyLevelUpdate locally, For simplicity, it is represented by type ProviderJWKs (used to represent issuer-level update) in JWK Consensus messages, in validator transactions, and in Move.
const JWK_CONSENSUS_PER_KEY_MODE: u64 = 92;

Whether the OIDB feature is enabled, possibly with the ZK-less verification mode.

Lifetime: transient

const KEYLESS_ACCOUNTS: u64 = 46;

Whether keyless accounts support passkey-based ephemeral signatures.

Lifetime: transient

const KEYLESS_ACCOUNTS_WITH_PASSKEYS: u64 = 54;

Whether the ZK-less mode of the keyless accounts feature is enabled.

Lifetime: transient

const KEYLESS_BUT_ZKLESS_ACCOUNTS: u64 = 47;

Whether checking the maximum object nesting is enabled.

const MAX_OBJECT_NESTING_CHECK: u64 = 53;

Whether emit function in event.move are enabled for module events.

Lifetime: transient

const MODULE_EVENT: u64 = 26;

Whether aptos_framwork enables the behavior of module event migration.

Lifetime: transient

const MODULE_EVENT_MIGRATION: u64 = 57;

Whether multisig accounts (different from accounts with multi-ed25519 auth keys) are enabled.

const MULTISIG_ACCOUNTS: u64 = 10;

Whether the Multisig V2 enhancement feature is enabled.

Lifetime: transient

const MULTISIG_V2_ENHANCEMENT: u64 = 55;

Whether the new aptos_stdlib::multi_ed25519::public_key_validate_internal_v2() native is enabled. This is needed because of the introduction of a new native function. Lifetime: transient

const MULTI_ED25519_PK_VALIDATE_V2_NATIVES: u64 = 7;

const NATIVE_MEMORY_OPERATIONS: u64 = 80;

Whether new accounts default to the Fungible Asset store. Lifetime: transient

const NEW_ACCOUNTS_DEFAULT_TO_FA_STORE: u64 = 90;

Whether allow changing beneficiaries for operators. Lifetime: transient

const OPERATOR_BENEFICIARY_CHANGE: u64 = 39;

Whether orderless transactions are enabled. Lifetime: transient

const ORDERLESS_TRANSACTIONS: u64 = 94;

Whether enable paritial governance voting on aptos_governance. Lifetime: transient

const PARTIAL_GOVERNANCE_VOTING: u64 = 17;

Whether reward rate decreases periodically. Lifetime: transient

const PERIODICAL_REWARD_RATE_DECREASE: u64 = 16;

const PERMISSIONED_SIGNER: u64 = 84;

Deprecated by aptos_framework::randomness_config::RandomnessConfig.

const RECONFIGURE_WITH_DKG: u64 = 45;

Whether resource groups are enabled. This is needed because of new attributes for structs and a change in storage representation.

const RESOURCE_GROUPS: u64 = 9;

Whether the new SHA2-512, SHA3-512 and RIPEMD-160 hash function natives are enabled. This is needed because of the introduction of new native functions. Lifetime: transient

const SHA_512_AND_RIPEMD_160_NATIVES: u64 = 3;

Whether the fix for a counting bug in the script path of the signature checker pass is enabled. Lifetime: transient

const SIGNATURE_CHECKER_V2_SCRIPT_FIX: u64 = 29;

Fix the native formatter for signer. Lifetime: transient

const SIGNER_NATIVE_FORMAT_FIX: u64 = 25;

Whether SLH-DSA-SHA2-128s signature scheme is enabled for transaction authentication. Lifetime: transient

const SLH_DSA_SHA2_128S_SIGNATURE: u64 = 107;

Whether the automatic creation of accounts is enabled for sponsored transactions. Lifetime: transient

const SPONSORED_AUTOMATIC_ACCOUNT_CREATION: u64 = 34;

Whether the storage slot natives are enabled.

const STORAGE_SLOT_NATIVES: u64 = 113;

Whether struct constructors are enabled

Lifetime: transient

const STRUCT_CONSTRUCTORS: u64 = 15;

Whether the transaction context extension is enabled. This feature allows the module transaction_context to provide contextual information about the user transaction.

Lifetime: transient

const TRANSACTION_CONTEXT_EXTENSION: u64 = 59;

Whether the transaction limits feature is enabled. Allows transactions to request higher execution/IO gas limits backed by staking voting power.

const TRANSACTION_LIMITS: u64 = 111;

Whether the simulation enhancement is enabled. This enables the simulation without an authentication check, the sponsored transaction simulation when the fee payer is set to 0x0, and the multisig transaction simulation consistnet with the execution.

Lifetime: transient

const TRANSACTION_SIMULATION_ENHANCEMENT: u64 = 78;

Whether during upgrade compatibility checking, friend functions should be treated similar like private functions. Lifetime: permanent

const TREAT_FRIEND_AS_PRIVATE: u64 = 2;

Whether to allow the use of binary format version v6. Lifetime: transient

const VM_BINARY_FORMAT_V6: u64 = 5;

Whether bytecode version v8 is enabled. Lifetime: transient

We do not expect use from Move, so for now only for documentation purposes here

const VM_BINARY_FORMAT_V8: u64 = 86;

Function code_dependency_check_enabled

public fun code_dependency_check_enabled(): bool
Implementation
public fun code_dependency_check_enabled(): bool {
    is_enabled(CODE_DEPENDENCY_CHECK)
}

Function treat_friend_as_private

public fun treat_friend_as_private(): bool
Implementation
public fun treat_friend_as_private(): bool {
    is_enabled(TREAT_FRIEND_AS_PRIVATE)
}

Function get_sha_512_and_ripemd_160_feature

public fun get_sha_512_and_ripemd_160_feature(): u64
Implementation
public fun get_sha_512_and_ripemd_160_feature(): u64 {
    SHA_512_AND_RIPEMD_160_NATIVES
}

Function sha_512_and_ripemd_160_enabled

public fun sha_512_and_ripemd_160_enabled(): bool
Implementation
public fun sha_512_and_ripemd_160_enabled(): bool {
    is_enabled(SHA_512_AND_RIPEMD_160_NATIVES)
}

Function get_aptos_stdlib_chain_id_feature

public fun get_aptos_stdlib_chain_id_feature(): u64
Implementation
public fun get_aptos_stdlib_chain_id_feature(): u64 {
    APTOS_STD_CHAIN_ID_NATIVES
}

Function aptos_stdlib_chain_id_enabled

public fun aptos_stdlib_chain_id_enabled(): bool
Implementation
public fun aptos_stdlib_chain_id_enabled(): bool {
    is_enabled(APTOS_STD_CHAIN_ID_NATIVES)
}

Function get_vm_binary_format_v6

public fun get_vm_binary_format_v6(): u64
Implementation
public fun get_vm_binary_format_v6(): u64 {
    VM_BINARY_FORMAT_V6
}

Function allow_vm_binary_format_v6

public fun allow_vm_binary_format_v6(): bool
Implementation
public fun allow_vm_binary_format_v6(): bool {
    is_enabled(VM_BINARY_FORMAT_V6)
}

Function get_collect_and_distribute_gas_fees_feature

Deprecated feature

#[deprecated]
public fun get_collect_and_distribute_gas_fees_feature(): u64
Implementation
public fun get_collect_and_distribute_gas_fees_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function collect_and_distribute_gas_fees

#[deprecated]
public fun collect_and_distribute_gas_fees(): bool
Implementation
public fun collect_and_distribute_gas_fees(): bool {
    false
}

Function multi_ed25519_pk_validate_v2_feature

public fun multi_ed25519_pk_validate_v2_feature(): u64
Implementation
public fun multi_ed25519_pk_validate_v2_feature(): u64 {
    MULTI_ED25519_PK_VALIDATE_V2_NATIVES
}

Function multi_ed25519_pk_validate_v2_enabled

public fun multi_ed25519_pk_validate_v2_enabled(): bool
Implementation
public fun multi_ed25519_pk_validate_v2_enabled(): bool {
    is_enabled(MULTI_ED25519_PK_VALIDATE_V2_NATIVES)
}

Function get_blake2b_256_feature

public fun get_blake2b_256_feature(): u64
Implementation
public fun get_blake2b_256_feature(): u64 {
    BLAKE2B_256_NATIVE
}

Function blake2b_256_enabled

public fun blake2b_256_enabled(): bool
Implementation
public fun blake2b_256_enabled(): bool {
    is_enabled(BLAKE2B_256_NATIVE)
}

Function get_resource_groups_feature

public fun get_resource_groups_feature(): u64
Implementation
public fun get_resource_groups_feature(): u64 {
    RESOURCE_GROUPS
}

Function resource_groups_enabled

public fun resource_groups_enabled(): bool
Implementation
public fun resource_groups_enabled(): bool {
    is_enabled(RESOURCE_GROUPS)
}

Function get_multisig_accounts_feature

public fun get_multisig_accounts_feature(): u64
Implementation
public fun get_multisig_accounts_feature(): u64 {
    MULTISIG_ACCOUNTS
}

Function multisig_accounts_enabled

public fun multisig_accounts_enabled(): bool
Implementation
public fun multisig_accounts_enabled(): bool {
    is_enabled(MULTISIG_ACCOUNTS)
}

Function get_delegation_pools_feature

public fun get_delegation_pools_feature(): u64
Implementation
public fun get_delegation_pools_feature(): u64 {
    DELEGATION_POOLS
}

Function delegation_pools_enabled

public fun delegation_pools_enabled(): bool
Implementation
public fun delegation_pools_enabled(): bool {
    is_enabled(DELEGATION_POOLS)
}

Function get_cryptography_algebra_natives_feature

public fun get_cryptography_algebra_natives_feature(): u64
Implementation
public fun get_cryptography_algebra_natives_feature(): u64 {
    CRYPTOGRAPHY_ALGEBRA_NATIVES
}

Function cryptography_algebra_enabled

public fun cryptography_algebra_enabled(): bool
Implementation
public fun cryptography_algebra_enabled(): bool {
    is_enabled(CRYPTOGRAPHY_ALGEBRA_NATIVES)
}

Function get_bls12_381_strutures_feature

public fun get_bls12_381_strutures_feature(): u64
Implementation
public fun get_bls12_381_strutures_feature(): u64 {
    BLS12_381_STRUCTURES
}

Function bls12_381_structures_enabled

public fun bls12_381_structures_enabled(): bool
Implementation
public fun bls12_381_structures_enabled(): bool {
    is_enabled(BLS12_381_STRUCTURES)
}

Function get_periodical_reward_rate_decrease_feature

public fun get_periodical_reward_rate_decrease_feature(): u64
Implementation
public fun get_periodical_reward_rate_decrease_feature(): u64 {
    PERIODICAL_REWARD_RATE_DECREASE
}

Function periodical_reward_rate_decrease_enabled

public fun periodical_reward_rate_decrease_enabled(): bool
Implementation
public fun periodical_reward_rate_decrease_enabled(): bool {
    is_enabled(PERIODICAL_REWARD_RATE_DECREASE)
}

Function get_partial_governance_voting

public fun get_partial_governance_voting(): u64
Implementation
public fun get_partial_governance_voting(): u64 {
    PARTIAL_GOVERNANCE_VOTING
}

Function partial_governance_voting_enabled

public fun partial_governance_voting_enabled(): bool
Implementation
public fun partial_governance_voting_enabled(): bool {
    is_enabled(PARTIAL_GOVERNANCE_VOTING)
}

Function get_delegation_pool_partial_governance_voting

public fun get_delegation_pool_partial_governance_voting(): u64
Implementation
public fun get_delegation_pool_partial_governance_voting(): u64 {
    DELEGATION_POOL_PARTIAL_GOVERNANCE_VOTING
}

Function delegation_pool_partial_governance_voting_enabled

public fun delegation_pool_partial_governance_voting_enabled(): bool
Implementation
public fun delegation_pool_partial_governance_voting_enabled(): bool {
    is_enabled(DELEGATION_POOL_PARTIAL_GOVERNANCE_VOTING)
}

Function fee_payer_enabled

public fun fee_payer_enabled(): bool
Implementation
public fun fee_payer_enabled(): bool {
    is_enabled(FEE_PAYER_ENABLED)
}

Function get_auids

public fun get_auids(): u64
Implementation
public fun get_auids(): u64 {
    error::invalid_argument(EFEATURE_CANNOT_BE_DISABLED)
}

Function auids_enabled

public fun auids_enabled(): bool
Implementation
public fun auids_enabled(): bool {
    true
}

Function get_bulletproofs_feature

public fun get_bulletproofs_feature(): u64
Implementation
public fun get_bulletproofs_feature(): u64 {
    BULLETPROOFS_NATIVES
}

Function bulletproofs_enabled

public fun bulletproofs_enabled(): bool
Implementation
public fun bulletproofs_enabled(): bool {
    is_enabled(BULLETPROOFS_NATIVES)
}

Function get_signer_native_format_fix_feature

public fun get_signer_native_format_fix_feature(): u64
Implementation
public fun get_signer_native_format_fix_feature(): u64 {
    SIGNER_NATIVE_FORMAT_FIX
}

Function signer_native_format_fix_enabled

public fun signer_native_format_fix_enabled(): bool
Implementation
public fun signer_native_format_fix_enabled(): bool {
    is_enabled(SIGNER_NATIVE_FORMAT_FIX)
}

Function get_module_event_feature

public fun get_module_event_feature(): u64
Implementation
public fun get_module_event_feature(): u64 {
    MODULE_EVENT
}

Function module_event_enabled

public fun module_event_enabled(): bool
Implementation
public fun module_event_enabled(): bool {
    is_enabled(MODULE_EVENT)
}

Function get_aggregator_v2_api_feature

public fun get_aggregator_v2_api_feature(): u64
Implementation
public fun get_aggregator_v2_api_feature(): u64 {
    abort error::invalid_argument(EFEATURE_CANNOT_BE_DISABLED)
}

Function aggregator_v2_api_enabled

public fun aggregator_v2_api_enabled(): bool
Implementation
public fun aggregator_v2_api_enabled(): bool {
    true
}

Function get_aggregator_snapshots_feature

#[deprecated]
public fun get_aggregator_snapshots_feature(): u64
Implementation
public fun get_aggregator_snapshots_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function aggregator_snapshots_enabled

#[deprecated]
public fun aggregator_snapshots_enabled(): bool
Implementation
public fun aggregator_snapshots_enabled(): bool {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function get_sponsored_automatic_account_creation

public fun get_sponsored_automatic_account_creation(): u64
Implementation
public fun get_sponsored_automatic_account_creation(): u64 {
    SPONSORED_AUTOMATIC_ACCOUNT_CREATION
}

Function sponsored_automatic_account_creation_enabled

public fun sponsored_automatic_account_creation_enabled(): bool
Implementation
public fun sponsored_automatic_account_creation_enabled(): bool {
    is_enabled(SPONSORED_AUTOMATIC_ACCOUNT_CREATION)
}

Function get_concurrent_token_v2_feature

public fun get_concurrent_token_v2_feature(): u64
Implementation
public fun get_concurrent_token_v2_feature(): u64 {
    error::invalid_argument(EFEATURE_CANNOT_BE_DISABLED)
}

Function concurrent_token_v2_enabled

public fun concurrent_token_v2_enabled(): bool
Implementation
public fun concurrent_token_v2_enabled(): bool {
    true
}

Function get_concurrent_assets_feature

#[deprecated]
public fun get_concurrent_assets_feature(): u64
Implementation
public fun get_concurrent_assets_feature(): u64 {
    abort error::invalid_argument(EFEATURE_CANNOT_BE_DISABLED)
}

Function concurrent_assets_enabled

#[deprecated]
public fun concurrent_assets_enabled(): bool
Implementation
public fun concurrent_assets_enabled(): bool {
    abort error::invalid_argument(EFEATURE_CANNOT_BE_DISABLED)
}

Function get_operator_beneficiary_change_feature

public fun get_operator_beneficiary_change_feature(): u64
Implementation
public fun get_operator_beneficiary_change_feature(): u64 {
    OPERATOR_BENEFICIARY_CHANGE
}

Function operator_beneficiary_change_enabled

public fun operator_beneficiary_change_enabled(): bool
Implementation
public fun operator_beneficiary_change_enabled(): bool {
    is_enabled(OPERATOR_BENEFICIARY_CHANGE)
}

Function get_commission_change_delegation_pool_feature

public fun get_commission_change_delegation_pool_feature(): u64
Implementation
public fun get_commission_change_delegation_pool_feature(): u64 {
    COMMISSION_CHANGE_DELEGATION_POOL
}

Function commission_change_delegation_pool_enabled

public fun commission_change_delegation_pool_enabled(): bool
Implementation
public fun commission_change_delegation_pool_enabled(): bool {
    is_enabled(COMMISSION_CHANGE_DELEGATION_POOL)
}

Function get_bn254_strutures_feature

public fun get_bn254_strutures_feature(): u64
Implementation
public fun get_bn254_strutures_feature(): u64 {
    BN254_STRUCTURES
}

Function bn254_structures_enabled

public fun bn254_structures_enabled(): bool
Implementation
public fun bn254_structures_enabled(): bool {
    is_enabled(BN254_STRUCTURES)
}

Function get_reconfigure_with_dkg_feature

public fun get_reconfigure_with_dkg_feature(): u64
Implementation
public fun get_reconfigure_with_dkg_feature(): u64 {
    RECONFIGURE_WITH_DKG
}

Function reconfigure_with_dkg_enabled

public fun reconfigure_with_dkg_enabled(): bool
Implementation
public fun reconfigure_with_dkg_enabled(): bool {
    is_enabled(RECONFIGURE_WITH_DKG)
}

Function get_keyless_accounts_feature

public fun get_keyless_accounts_feature(): u64
Implementation
public fun get_keyless_accounts_feature(): u64 {
    KEYLESS_ACCOUNTS
}

Function keyless_accounts_enabled

public fun keyless_accounts_enabled(): bool
Implementation
public fun keyless_accounts_enabled(): bool {
    is_enabled(KEYLESS_ACCOUNTS)
}

Function get_keyless_but_zkless_accounts_feature

public fun get_keyless_but_zkless_accounts_feature(): u64
Implementation
public fun get_keyless_but_zkless_accounts_feature(): u64 {
    KEYLESS_BUT_ZKLESS_ACCOUNTS
}

Function keyless_but_zkless_accounts_feature_enabled

public fun keyless_but_zkless_accounts_feature_enabled(): bool
Implementation
public fun keyless_but_zkless_accounts_feature_enabled(): bool {
    is_enabled(KEYLESS_BUT_ZKLESS_ACCOUNTS)
}

Function get_jwk_consensus_feature

public fun get_jwk_consensus_feature(): u64
Implementation
public fun get_jwk_consensus_feature(): u64 {
    JWK_CONSENSUS
}

Function jwk_consensus_enabled

public fun jwk_consensus_enabled(): bool
Implementation
public fun jwk_consensus_enabled(): bool {
    is_enabled(JWK_CONSENSUS)
}

Function get_concurrent_fungible_assets_feature

public fun get_concurrent_fungible_assets_feature(): u64
Implementation
public fun get_concurrent_fungible_assets_feature(): u64 {
    CONCURRENT_FUNGIBLE_ASSETS
}

Function concurrent_fungible_assets_enabled

public fun concurrent_fungible_assets_enabled(): bool
Implementation
public fun concurrent_fungible_assets_enabled(): bool {
    is_enabled(CONCURRENT_FUNGIBLE_ASSETS)
}

Function is_object_code_deployment_enabled

#[deprecated]
public fun is_object_code_deployment_enabled(): bool
Implementation
public fun is_object_code_deployment_enabled(): bool {
    true
}

Function get_max_object_nesting_check_feature

public fun get_max_object_nesting_check_feature(): u64
Implementation
public fun get_max_object_nesting_check_feature(): u64 {
    MAX_OBJECT_NESTING_CHECK
}

Function max_object_nesting_check_enabled

public fun max_object_nesting_check_enabled(): bool
Implementation
public fun max_object_nesting_check_enabled(): bool {
    is_enabled(MAX_OBJECT_NESTING_CHECK)
}

Function get_keyless_accounts_with_passkeys_feature

public fun get_keyless_accounts_with_passkeys_feature(): u64
Implementation
public fun get_keyless_accounts_with_passkeys_feature(): u64 {
    KEYLESS_ACCOUNTS_WITH_PASSKEYS
}

Function keyless_accounts_with_passkeys_feature_enabled

public fun keyless_accounts_with_passkeys_feature_enabled(): bool
Implementation
public fun keyless_accounts_with_passkeys_feature_enabled(): bool {
    is_enabled(KEYLESS_ACCOUNTS_WITH_PASSKEYS)
}

Function get_multisig_v2_enhancement_feature

public fun get_multisig_v2_enhancement_feature(): u64
Implementation
public fun get_multisig_v2_enhancement_feature(): u64 {
    MULTISIG_V2_ENHANCEMENT
}

Function multisig_v2_enhancement_feature_enabled

public fun multisig_v2_enhancement_feature_enabled(): bool
Implementation
public fun multisig_v2_enhancement_feature_enabled(): bool {
    is_enabled(MULTISIG_V2_ENHANCEMENT)
}

Function get_delegation_pool_allowlisting_feature

public fun get_delegation_pool_allowlisting_feature(): u64
Implementation
public fun get_delegation_pool_allowlisting_feature(): u64 {
    DELEGATION_POOL_ALLOWLISTING
}

Function delegation_pool_allowlisting_enabled

public fun delegation_pool_allowlisting_enabled(): bool
Implementation
public fun delegation_pool_allowlisting_enabled(): bool {
    is_enabled(DELEGATION_POOL_ALLOWLISTING)
}

Function get_module_event_migration_feature

public fun get_module_event_migration_feature(): u64
Implementation
public fun get_module_event_migration_feature(): u64 {
    MODULE_EVENT_MIGRATION
}

Function module_event_migration_enabled

public fun module_event_migration_enabled(): bool
Implementation
public fun module_event_migration_enabled(): bool {
    is_enabled(MODULE_EVENT_MIGRATION)
}

Function get_transaction_context_extension_feature

public fun get_transaction_context_extension_feature(): u64
Implementation
public fun get_transaction_context_extension_feature(): u64 {
    TRANSACTION_CONTEXT_EXTENSION
}

Function transaction_context_extension_enabled

public fun transaction_context_extension_enabled(): bool
Implementation
public fun transaction_context_extension_enabled(): bool {
    is_enabled(TRANSACTION_CONTEXT_EXTENSION)
}

Function get_coin_to_fungible_asset_migration_feature

public fun get_coin_to_fungible_asset_migration_feature(): u64
Implementation
public fun get_coin_to_fungible_asset_migration_feature(): u64 {
    COIN_TO_FUNGIBLE_ASSET_MIGRATION
}

Function coin_to_fungible_asset_migration_feature_enabled

public fun coin_to_fungible_asset_migration_feature_enabled(): bool
Implementation
public fun coin_to_fungible_asset_migration_feature_enabled(): bool {
    is_enabled(COIN_TO_FUNGIBLE_ASSET_MIGRATION)
}

Function get_primary_apt_fungible_store_at_user_address_feature

#[deprecated]
public fun get_primary_apt_fungible_store_at_user_address_feature(): u64
Implementation
public fun get_primary_apt_fungible_store_at_user_address_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function primary_apt_fungible_store_at_user_address_enabled

#[deprecated]
public fun primary_apt_fungible_store_at_user_address_enabled(): bool
Implementation
public fun primary_apt_fungible_store_at_user_address_enabled(): bool {
    true
}

Function aggregator_v2_is_at_least_api_enabled

#[deprecated]
public fun aggregator_v2_is_at_least_api_enabled(): bool
Implementation
public fun aggregator_v2_is_at_least_api_enabled(): bool {
    true
}

Function get_object_native_derived_address_feature

#[deprecated]
public fun get_object_native_derived_address_feature(): u64
Implementation
public fun get_object_native_derived_address_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function object_native_derived_address_enabled

#[deprecated]
public fun object_native_derived_address_enabled(): bool
Implementation
public fun object_native_derived_address_enabled(): bool {
    true
}

Function get_dispatchable_fungible_asset_feature

#[deprecated]
public fun get_dispatchable_fungible_asset_feature(): u64
Implementation
public fun get_dispatchable_fungible_asset_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function dispatchable_fungible_asset_enabled

#[deprecated]
public fun dispatchable_fungible_asset_enabled(): bool
Implementation
public fun dispatchable_fungible_asset_enabled(): bool {
    true
}

Function get_new_accounts_default_to_fa_apt_store_feature

#[deprecated]
public fun get_new_accounts_default_to_fa_apt_store_feature(): u64
Implementation
public fun get_new_accounts_default_to_fa_apt_store_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function new_accounts_default_to_fa_apt_store_enabled

#[deprecated]
public fun new_accounts_default_to_fa_apt_store_enabled(): bool
Implementation
public fun new_accounts_default_to_fa_apt_store_enabled(): bool {
    true
}

Function get_operations_default_to_fa_apt_store_feature

#[deprecated]
public fun get_operations_default_to_fa_apt_store_feature(): u64
Implementation
public fun get_operations_default_to_fa_apt_store_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function operations_default_to_fa_apt_store_enabled

#[deprecated]
public fun operations_default_to_fa_apt_store_enabled(): bool
Implementation
public fun operations_default_to_fa_apt_store_enabled(): bool {
    true
}

Function get_concurrent_fungible_balance_feature

public fun get_concurrent_fungible_balance_feature(): u64
Implementation
public fun get_concurrent_fungible_balance_feature(): u64 {
    CONCURRENT_FUNGIBLE_BALANCE
}

Function concurrent_fungible_balance_enabled

public fun concurrent_fungible_balance_enabled(): bool
Implementation
public fun concurrent_fungible_balance_enabled(): bool {
    is_enabled(CONCURRENT_FUNGIBLE_BALANCE)
}

Function get_default_to_concurrent_fungible_balance_feature

public fun get_default_to_concurrent_fungible_balance_feature(): u64
Implementation
public fun get_default_to_concurrent_fungible_balance_feature(): u64 {
    DEFAULT_TO_CONCURRENT_FUNGIBLE_BALANCE
}

Function default_to_concurrent_fungible_balance_enabled

public fun default_to_concurrent_fungible_balance_enabled(): bool
Implementation
public fun default_to_concurrent_fungible_balance_enabled(): bool {
    is_enabled(DEFAULT_TO_CONCURRENT_FUNGIBLE_BALANCE)
}

Function get_abort_if_multisig_payload_mismatch_feature

public fun get_abort_if_multisig_payload_mismatch_feature(): u64
Implementation
public fun get_abort_if_multisig_payload_mismatch_feature(): u64 {
    ABORT_IF_MULTISIG_PAYLOAD_MISMATCH
}

Function abort_if_multisig_payload_mismatch_enabled

public fun abort_if_multisig_payload_mismatch_enabled(): bool
Implementation
public fun abort_if_multisig_payload_mismatch_enabled(): bool {
    is_enabled(ABORT_IF_MULTISIG_PAYLOAD_MISMATCH)
}

Function get_transaction_simulation_enhancement_feature

public fun get_transaction_simulation_enhancement_feature(): u64
Implementation
public fun get_transaction_simulation_enhancement_feature(): u64 {
    TRANSACTION_SIMULATION_ENHANCEMENT
}

Function transaction_simulation_enhancement_enabled

public fun transaction_simulation_enhancement_enabled(): bool
Implementation
public fun transaction_simulation_enhancement_enabled(): bool {
    is_enabled(TRANSACTION_SIMULATION_ENHANCEMENT)
}

Function get_collection_owner_feature

public fun get_collection_owner_feature(): u64
Implementation
public fun get_collection_owner_feature(): u64 {
    COLLECTION_OWNER
}

Function is_collection_owner_enabled

public fun is_collection_owner_enabled(): bool
Implementation
public fun is_collection_owner_enabled(): bool {
    is_enabled(COLLECTION_OWNER)
}

Function get_native_memory_operations_feature

public fun get_native_memory_operations_feature(): u64
Implementation
public fun get_native_memory_operations_feature(): u64 {
    NATIVE_MEMORY_OPERATIONS
}

Function is_native_memory_operations_enabled

public fun is_native_memory_operations_enabled(): bool
Implementation
public fun is_native_memory_operations_enabled(): bool {
    true
}

Function get_permissioned_signer_feature

public fun get_permissioned_signer_feature(): u64
Implementation
public fun get_permissioned_signer_feature(): u64 {
    PERMISSIONED_SIGNER
}

Function is_permissioned_signer_enabled

public fun is_permissioned_signer_enabled(): bool
Implementation
public fun is_permissioned_signer_enabled(): bool {
    is_enabled(PERMISSIONED_SIGNER)
}

Function get_account_abstraction_feature

public fun get_account_abstraction_feature(): u64
Implementation
public fun get_account_abstraction_feature(): u64 {
    ACCOUNT_ABSTRACTION
}

Function is_account_abstraction_enabled

public fun is_account_abstraction_enabled(): bool
Implementation
public fun is_account_abstraction_enabled(): bool {
    is_enabled(ACCOUNT_ABSTRACTION)
}

Function get_bulletproofs_batch_feature

public fun get_bulletproofs_batch_feature(): u64
Implementation
public fun get_bulletproofs_batch_feature(): u64 {
    BULLETPROOFS_BATCH_NATIVES
}

Function bulletproofs_batch_enabled

public fun bulletproofs_batch_enabled(): bool
Implementation
public fun bulletproofs_batch_enabled(): bool {
    is_enabled(BULLETPROOFS_BATCH_NATIVES)
}

Function is_derivable_account_abstraction_enabled

public fun is_derivable_account_abstraction_enabled(): bool
Implementation
public fun is_derivable_account_abstraction_enabled(): bool {
    is_enabled(DERIVABLE_ACCOUNT_ABSTRACTION)
}

Function is_domain_account_abstraction_enabled

#[deprecated]
public fun is_domain_account_abstraction_enabled(): bool
Implementation
public fun is_domain_account_abstraction_enabled(): bool {
    false
}

Function get_new_accounts_default_to_fa_store_feature

#[deprecated]
public fun get_new_accounts_default_to_fa_store_feature(): u64
Implementation
public fun get_new_accounts_default_to_fa_store_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function new_accounts_default_to_fa_store_enabled

#[deprecated]
public fun new_accounts_default_to_fa_store_enabled(): bool
Implementation
public fun new_accounts_default_to_fa_store_enabled(): bool {
    true
}

Function get_default_account_resource_feature

public fun get_default_account_resource_feature(): u64
Implementation
public fun get_default_account_resource_feature(): u64 {
    DEFAULT_ACCOUNT_RESOURCE
}

Function is_default_account_resource_enabled

public fun is_default_account_resource_enabled(): bool
Implementation
public fun is_default_account_resource_enabled(): bool {
    is_enabled(DEFAULT_ACCOUNT_RESOURCE)
}

Function get_jwk_consensus_per_key_mode_feature

public fun get_jwk_consensus_per_key_mode_feature(): u64
Implementation
public fun get_jwk_consensus_per_key_mode_feature(): u64 {
    JWK_CONSENSUS_PER_KEY_MODE
}

Function is_jwk_consensus_per_key_mode_enabled

public fun is_jwk_consensus_per_key_mode_enabled(): bool
Implementation
public fun is_jwk_consensus_per_key_mode_enabled(): bool {
    is_enabled(JWK_CONSENSUS_PER_KEY_MODE)
}

Function get_orderless_transactions_feature

public fun get_orderless_transactions_feature(): u64
Implementation
public fun get_orderless_transactions_feature(): u64 {
    ORDERLESS_TRANSACTIONS
}

Function orderless_transactions_enabled

public fun orderless_transactions_enabled(): bool
Implementation
public fun orderless_transactions_enabled(): bool {
    is_enabled(ORDERLESS_TRANSACTIONS)
}

Function get_calculate_transaction_fee_for_distribution_feature

public fun get_calculate_transaction_fee_for_distribution_feature(): u64
Implementation
public fun get_calculate_transaction_fee_for_distribution_feature(): u64 {
    CALCULATE_TRANSACTION_FEE_FOR_DISTRIBUTION
}

Function is_calculate_transaction_fee_for_distribution_enabled

public fun is_calculate_transaction_fee_for_distribution_enabled(): bool
Implementation
public fun is_calculate_transaction_fee_for_distribution_enabled(): bool {
    is_enabled(CALCULATE_TRANSACTION_FEE_FOR_DISTRIBUTION)
}

Function get_distribute_transaction_fee_feature

public fun get_distribute_transaction_fee_feature(): u64
Implementation
public fun get_distribute_transaction_fee_feature(): u64 {
    DISTRIBUTE_TRANSACTION_FEE
}

Function is_distribute_transaction_fee_enabled

public fun is_distribute_transaction_fee_enabled(): bool
Implementation
public fun is_distribute_transaction_fee_enabled(): bool {
    is_enabled(DISTRIBUTE_TRANSACTION_FEE)
}

Function get_monotonically_increasing_counter_feature

#[deprecated]
public fun get_monotonically_increasing_counter_feature(): u64
Implementation
public fun get_monotonically_increasing_counter_feature(): u64 {
    abort error::invalid_argument(EINVALID_FEATURE)
}

Function is_monotonically_increasing_counter_enabled

#[deprecated]
public fun is_monotonically_increasing_counter_enabled(): bool
Implementation
public fun is_monotonically_increasing_counter_enabled(): bool {
    true
}

Function get_function_reflection_feature

public fun get_function_reflection_feature(): u64
Implementation
public fun get_function_reflection_feature(): u64 {
    FUNCTION_REFLECTION
}

Function is_function_reflection_enabled

public fun is_function_reflection_enabled(): bool
Implementation
public fun is_function_reflection_enabled(): bool {
    is_enabled(FUNCTION_REFLECTION)
}

Function get_slh_dsa_sha2_128s_signature_feature

public fun get_slh_dsa_sha2_128s_signature_feature(): u64
Implementation
public fun get_slh_dsa_sha2_128s_signature_feature(): u64 {
    SLH_DSA_SHA2_128S_SIGNATURE
}

Function slh_dsa_sha2_128s_signature_enabled

public fun slh_dsa_sha2_128s_signature_enabled(): bool
Implementation
public fun slh_dsa_sha2_128s_signature_enabled(): bool {
    is_enabled(SLH_DSA_SHA2_128S_SIGNATURE)
}

Function get_encrypted_transactions_feature

public fun get_encrypted_transactions_feature(): u64
Implementation
public fun get_encrypted_transactions_feature(): u64 {
    ENCRYPTED_TRANSACTIONS
}

Function is_encrypted_transactions_enabled

public fun is_encrypted_transactions_enabled(): bool
Implementation
public fun is_encrypted_transactions_enabled(): bool {
    is_enabled(ENCRYPTED_TRANSACTIONS)
}

Function get_transaction_limits_feature

public fun get_transaction_limits_feature(): u64
Implementation
public fun get_transaction_limits_feature(): u64 {
    TRANSACTION_LIMITS
}

Function is_transaction_limits_enabled

public fun is_transaction_limits_enabled(): bool
Implementation
public fun is_transaction_limits_enabled(): bool {
    is_enabled(TRANSACTION_LIMITS)
}

Function is_storage_slot_natives_enabled

public fun is_storage_slot_natives_enabled(): bool
Implementation
public fun is_storage_slot_natives_enabled(): bool {
    is_enabled(STORAGE_SLOT_NATIVES)
}

Function change_feature_flags

Deprecated to prevent validator set changes during DKG.

Genesis/tests should use change_feature_flags_internal() for feature vec initialization.

Governance proposals should use change_feature_flags_for_next_epoch() to enable/disable features.

public fun change_feature_flags(_framework: &signer, _enable: vector<u64>, _disable: vector<u64>)
Implementation
public fun change_feature_flags(
    _framework: &signer, _enable: vector<u64>, _disable: vector<u64>
) {
    abort(error::invalid_state(EAPI_DISABLED))
}

Function change_feature_flags_internal

Update feature flags directly. Only used in genesis/tests.

fun change_feature_flags_internal(framework: &signer, enable: vector<u64>, disable: vector<u64>)
Implementation
fun change_feature_flags_internal(
    framework: &signer, enable: vector<u64>, disable: vector<u64>
) {
    assert!(
        signer::address_of(framework) == @std,
        error::permission_denied(EFRAMEWORK_SIGNER_NEEDED)
    );
    if (!exists<Features>(@std)) {
        move_to<Features>(framework, Features { features: vector[] })
    };
    let features = &mut Features[@std].features;
    enable.for_each_ref(|feature| {
        set(features, *feature, true);
    });
    disable.for_each_ref(|feature| {
        set(features, *feature, false);
    });
}

Function change_feature_flags_for_next_epoch

Enable and disable features for the next epoch.

public fun change_feature_flags_for_next_epoch(framework: &signer, enable: vector<u64>, disable: vector<u64>)
Implementation
public fun change_feature_flags_for_next_epoch(
    framework: &signer, enable: vector<u64>, disable: vector<u64>
) acquires PendingFeatures, Features {
    assert!(
        signer::address_of(framework) == @std,
        error::permission_denied(EFRAMEWORK_SIGNER_NEEDED)
    );

    // Figure out the baseline feature vec that the diff will be applied to.
    let new_feature_vec =
        if (exists<PendingFeatures>(@std)) {
            // If there is a buffered feature vec, use it as the baseline.
            let PendingFeatures { features } = move_from<PendingFeatures>(@std);
            features
        } else if (exists<Features>(@std)) {
            // Otherwise, use the currently effective feature flag vec as the baseline, if it exists.
            Features[@std].features
        } else {
            // Otherwise, use an empty feature vec.
            vector[]
        };

    // Apply the diff and save it to the buffer.
    apply_diff(&mut new_feature_vec, enable, disable);
    move_to(framework, PendingFeatures { features: new_feature_vec });
}

Function on_new_epoch

Apply all the pending feature flag changes. Should only be used at the end of a reconfiguration with DKG.

While the scope is public, it can only be usd in system transactions like block_prologue and governance proposals, who have permission to set the flag that’s checked in extract().

public fun on_new_epoch(framework: &signer)
Implementation
public fun on_new_epoch(framework: &signer) acquires Features, PendingFeatures {
    ensure_framework_signer(framework);
    if (exists<PendingFeatures>(@std)) {
        let PendingFeatures { features } = move_from<PendingFeatures>(@std);
        if (exists<Features>(@std)) {
            Features[@std].features = features;
        } else {
            move_to(framework, Features { features })
        }
    }
}

Function is_enabled

Check whether the feature is enabled.

#[view]
public fun is_enabled(feature: u64): bool
Implementation
public fun is_enabled(feature: u64): bool {
    exists<Features>(@std) && contains(&Features[@std].features, feature)
}

Function set

Helper to include or exclude a feature flag.

fun set(features: &mut vector<u8>, feature: u64, include: bool)
Implementation
fun set(features: &mut vector<u8>, feature: u64, include: bool) {
    let byte_index = feature / 8;
    let bit_mask = 1 << ((feature % 8) as u8);
    while (features.length() <= byte_index) { features.push_back(0) };

    if (include) features[byte_index] |= bit_mask
    else features[byte_index] &=(0xff ^ bit_mask)
}

Function contains

Helper to check whether a feature flag is enabled.

fun contains(features: &vector<u8>, feature: u64): bool
Implementation
fun contains(features: &vector<u8>, feature: u64): bool {
    let byte_index = feature / 8;
    let bit_mask = 1 << ((feature % 8) as u8);
    byte_index < features.length() && (features[byte_index] & bit_mask) != 0
}

Function apply_diff

fun apply_diff(features: &mut vector<u8>, enable: vector<u64>, disable: vector<u64>)
Implementation
fun apply_diff(
    features: &mut vector<u8>, enable: vector<u64>, disable: vector<u64>
) {
    enable.for_each(|feature| {
        set(features, feature, true);
    });
    disable.for_each(|feature| {
        set(features, feature, false);
    });
}

Function ensure_framework_signer

fun ensure_framework_signer(account: &signer)
Implementation
fun ensure_framework_signer(account: &signer) {
    let addr = signer::address_of(account);
    assert!(addr == @std, error::permission_denied(EFRAMEWORK_SIGNER_NEEDED));
}

Specification

Resource Features

struct Features has key
features: vector<u8>
pragma bv = b"0";

Resource PendingFeatures

struct PendingFeatures has key
features: vector<u8>
pragma bv = b"0";

Function periodical_reward_rate_decrease_enabled

public fun periodical_reward_rate_decrease_enabled(): bool
pragma opaque;
aborts_if [abstract] false;
ensures [abstract] result == spec_periodical_reward_rate_decrease_enabled();

fun spec_partial_governance_voting_enabled(): bool {
   spec_is_enabled(PARTIAL_GOVERNANCE_VOTING)
}

Function partial_governance_voting_enabled

public fun partial_governance_voting_enabled(): bool
pragma opaque;
aborts_if [abstract] false;
ensures [abstract] result == spec_partial_governance_voting_enabled();

Function module_event_enabled

public fun module_event_enabled(): bool
pragma opaque;
aborts_if [abstract] false;
ensures [abstract] result == spec_module_event_enabled();

fun spec_abort_if_multisig_payload_mismatch_enabled(): bool {
   spec_is_enabled(ABORT_IF_MULTISIG_PAYLOAD_MISMATCH)
}

fun spec_new_accounts_default_to_fa_store_enabled(): bool {
   spec_is_enabled(NEW_ACCOUNTS_DEFAULT_TO_FA_STORE)
}

fun spec_simulation_enhancement_enabled(): bool {
   spec_is_enabled(TRANSACTION_SIMULATION_ENHANCEMENT)
}

Function abort_if_multisig_payload_mismatch_enabled

public fun abort_if_multisig_payload_mismatch_enabled(): bool
pragma opaque;
aborts_if [abstract] false;
ensures [abstract] result == spec_abort_if_multisig_payload_mismatch_enabled();

Function is_default_account_resource_enabled

public fun is_default_account_resource_enabled(): bool
pragma opaque;
aborts_if [abstract] false;
ensures [abstract] result == spec_is_enabled(DEFAULT_ACCOUNT_RESOURCE);

Function is_storage_slot_natives_enabled

public fun is_storage_slot_natives_enabled(): bool
pragma opaque;
aborts_if [abstract] false;
ensures [abstract] result == spec_is_enabled(STORAGE_SLOT_NATIVES);

Function change_feature_flags_internal

fun change_feature_flags_internal(framework: &signer, enable: vector<u64>, disable: vector<u64>)
pragma opaque;
modifies global<Features>(@std);
aborts_if signer::address_of(framework) != @std;

Function change_feature_flags_for_next_epoch

public fun change_feature_flags_for_next_epoch(framework: &signer, enable: vector<u64>, disable: vector<u64>)
aborts_if signer::address_of(framework) != @std;
pragma opaque;
modifies global<Features>(@std);
modifies global<PendingFeatures>(@std);

fun spec_contains(features: vector<u8>, feature: u64): bool {
   ((int2bv(
       (((1 as u8) << ((feature % (8 as u64)) as u64)) as u8)
   ) as u8) & features[feature / 8] as u8) > (0 as u8)
       && (feature / 8) < len(features)
}

Function on_new_epoch

public fun on_new_epoch(framework: &signer)
requires @std == signer::address_of(framework);
let features_pending = global<PendingFeatures>(@std).features;
let post features_std = global<Features>(@std).features;
ensures exists<PendingFeatures>(@std) ==> features_std == features_pending;
aborts_if false;

fun spec_sha_512_and_ripemd_160_enabled(): bool {
   spec_is_enabled(SHA_512_AND_RIPEMD_160_NATIVES)
}

Function is_enabled

#[view]
public fun is_enabled(feature: u64): bool
pragma opaque;
aborts_if [abstract] false;
ensures [abstract] result == spec_is_enabled(feature);

fun spec_is_enabled(feature: u64): bool;

fun spec_periodical_reward_rate_decrease_enabled(): bool {
   spec_is_enabled(PERIODICAL_REWARD_RATE_DECREASE)
}

fun spec_fee_payer_enabled(): bool {
   spec_is_enabled(FEE_PAYER_ENABLED)
}

fun spec_module_event_enabled(): bool {
   spec_is_enabled(MODULE_EVENT)
}

Function set

fun set(features: &mut vector<u8>, feature: u64, include: bool)
pragma bv = b"0";
aborts_if false;
ensures feature / 8 < len(features);
ensures include == spec_contains(features, feature);

Function contains

fun contains(features: &vector<u8>, feature: u64): bool
pragma bv = b"0";
aborts_if false;
ensures result == spec_contains(features, feature);

Function apply_diff

fun apply_diff(features: &mut vector<u8>, enable: vector<u64>, disable: vector<u64>)
aborts_if [abstract] false;
ensures [abstract] forall i in disable: !spec_contains(features, i);
ensures [abstract] forall i in enable: !vector::spec_contains(disable, i)
    ==> spec_contains(features, i);
pragma opaque;