Skip to content

features - [mainnet]

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;

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;
const AGGREGATOR_V2_IS_AT_LEAST_API: u64 = 66;

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;

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;

Deprecated feature Lifetime: transient

const COLLECT_AND_DISTRIBUTE_GAS_FEES: u64 = 6;

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: transient

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 the dispatchable fungible asset standard feature is enabled.

Lifetime: transient

const DISPATCHABLE_FUNGIBLE_ASSET: u64 = 63;
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 function values are enabled. Lifetime: transient

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

const ENABLE_FUNCTION_VALUES: u64 = 89;
const FEE_PAYER_ACCOUNT_OPTIONAL: u64 = 35;

Whether alternate gas payer is supported Lifetime: transient

const FEE_PAYER_ENABLED: u64 = 22;

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;
const LIMIT_MAX_IDENTIFIER_LENGTH: u64 = 38;

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;

Lifetime: transient

const NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE: u64 = 64;

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

const NEW_ACCOUNTS_DEFAULT_TO_FA_STORE: u64 = 90;

Whether deploying to objects is enabled.

const OBJECT_CODE_DEPLOYMENT: u64 = 52;

Whether we use more efficient native implementation of computing object derived address

const OBJECT_NATIVE_DERIVED_ADDRESS: u64 = 62;

Lifetime: transient

const OPERATIONS_DEFAULT_TO_FA_APT_STORE: u64 = 65;

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;
const PRIMARY_APT_FUNGIBLE_STORE_AT_USER_ADDRESS: u64 = 61;

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;
const RESOURCE_GROUPS_SPLIT_IN_VM_CHANGE_SET: u64 = 41;
const SAFER_METADATA: u64 = 32;
const SAFER_RESOURCE_GROUPS: u64 = 31;

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;
const SINGLE_SENDER_AUTHENTICATOR: u64 = 33;

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

const SPONSORED_AUTOMATIC_ACCOUNT_CREATION: u64 = 34;

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 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;
const VM_BINARY_FORMAT_V7: u64 = 40;

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;

Resources

Features

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

struct Features has key
Fields
features: vector<u8>

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>

Functions

code_dependency_check_enabled

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

treat_friend_as_private

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

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 }

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 acquires Features {
is_enabled(SHA_512_AND_RIPEMD_160_NATIVES)
}

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 }

aptos_stdlib_chain_id_enabled

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

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 }

allow_vm_binary_format_v6

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

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 { COLLECT_AND_DISTRIBUTE_GAS_FEES }

collect_and_distribute_gas_fees

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

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 }

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 acquires Features {
is_enabled(MULTI_ED25519_PK_VALIDATE_V2_NATIVES)
}

get_blake2b_256_feature

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

blake2b_256_enabled

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

get_resource_groups_feature

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

resource_groups_enabled

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

get_multisig_accounts_feature

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

multisig_accounts_enabled

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

get_delegation_pools_feature

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

delegation_pools_enabled

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

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 }

cryptography_algebra_enabled

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

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 }

bls12_381_structures_enabled

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

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 }

periodical_reward_rate_decrease_enabled

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

get_partial_governance_voting

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

partial_governance_voting_enabled

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

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 }

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 acquires Features {
is_enabled(DELEGATION_POOL_PARTIAL_GOVERNANCE_VOTING)
}

fee_payer_enabled

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

get_auids

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

auids_enabled

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

get_bulletproofs_feature

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

bulletproofs_enabled

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

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 }

signer_native_format_fix_enabled

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

get_module_event_feature

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

module_event_enabled

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

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)
}

aggregator_v2_api_enabled

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

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)
}

aggregator_snapshots_enabled

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

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 }
public fun sponsored_automatic_account_creation_enabled(): bool
Implementation
public fun sponsored_automatic_account_creation_enabled(): bool acquires Features {
is_enabled(SPONSORED_AUTOMATIC_ACCOUNT_CREATION)
}

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)
}

concurrent_token_v2_enabled

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

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)
}

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)
}

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 }

operator_beneficiary_change_enabled

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

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 }

commission_change_delegation_pool_enabled

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

get_bn254_strutures_feature

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

bn254_structures_enabled

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

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 }

reconfigure_with_dkg_enabled

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

get_keyless_accounts_feature

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

keyless_accounts_enabled

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

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 }

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 acquires Features {
is_enabled(KEYLESS_BUT_ZKLESS_ACCOUNTS)
}

get_jwk_consensus_feature

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

jwk_consensus_enabled

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

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 }

concurrent_fungible_assets_enabled

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

is_object_code_deployment_enabled

public fun is_object_code_deployment_enabled(): bool
Implementation
public fun is_object_code_deployment_enabled(): bool acquires Features {
is_enabled(OBJECT_CODE_DEPLOYMENT)
}

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 }

max_object_nesting_check_enabled

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

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 }

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 acquires Features {
is_enabled(KEYLESS_ACCOUNTS_WITH_PASSKEYS)
}

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 }

multisig_v2_enhancement_feature_enabled

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

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 }

delegation_pool_allowlisting_enabled

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

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 }

module_event_migration_enabled

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

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 }

transaction_context_extension_enabled

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

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 }

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 acquires Features {
is_enabled(COIN_TO_FUNGIBLE_ASSET_MIGRATION)
}

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)
}

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 acquires Features {
is_enabled(PRIMARY_APT_FUNGIBLE_STORE_AT_USER_ADDRESS)
}

aggregator_v2_is_at_least_api_enabled

public fun aggregator_v2_is_at_least_api_enabled(): bool
Implementation
public fun aggregator_v2_is_at_least_api_enabled(): bool acquires Features {
is_enabled(AGGREGATOR_V2_IS_AT_LEAST_API)
}

get_object_native_derived_address_feature

public fun get_object_native_derived_address_feature(): u64
Implementation
public fun get_object_native_derived_address_feature(): u64 { OBJECT_NATIVE_DERIVED_ADDRESS }

object_native_derived_address_enabled

public fun object_native_derived_address_enabled(): bool
Implementation
public fun object_native_derived_address_enabled(): bool acquires Features {
is_enabled(OBJECT_NATIVE_DERIVED_ADDRESS)
}

get_dispatchable_fungible_asset_feature

public fun get_dispatchable_fungible_asset_feature(): u64
Implementation
public fun get_dispatchable_fungible_asset_feature(): u64 { DISPATCHABLE_FUNGIBLE_ASSET }

dispatchable_fungible_asset_enabled

public fun dispatchable_fungible_asset_enabled(): bool
Implementation
public fun dispatchable_fungible_asset_enabled(): bool acquires Features {
is_enabled(DISPATCHABLE_FUNGIBLE_ASSET)
}

get_new_accounts_default_to_fa_apt_store_feature

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 { NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE }

new_accounts_default_to_fa_apt_store_enabled

public fun new_accounts_default_to_fa_apt_store_enabled(): bool
Implementation
public fun new_accounts_default_to_fa_apt_store_enabled(): bool acquires Features {
is_enabled(NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE)
}

get_operations_default_to_fa_apt_store_feature

public fun get_operations_default_to_fa_apt_store_feature(): u64
Implementation
public fun get_operations_default_to_fa_apt_store_feature(): u64 { OPERATIONS_DEFAULT_TO_FA_APT_STORE }

operations_default_to_fa_apt_store_enabled

public fun operations_default_to_fa_apt_store_enabled(): bool
Implementation
public fun operations_default_to_fa_apt_store_enabled(): bool acquires Features {
is_enabled(OPERATIONS_DEFAULT_TO_FA_APT_STORE)
}

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 }

concurrent_fungible_balance_enabled

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

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 }

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 acquires Features {
is_enabled(DEFAULT_TO_CONCURRENT_FUNGIBLE_BALANCE)
}

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 }

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 acquires Features {
is_enabled(ABORT_IF_MULTISIG_PAYLOAD_MISMATCH)
}

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 }

transaction_simulation_enhancement_enabled

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

get_collection_owner_feature

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

is_collection_owner_enabled

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

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 }

is_native_memory_operations_enabled

public fun is_native_memory_operations_enabled(): bool
Implementation
public fun is_native_memory_operations_enabled(): bool acquires Features {
is_enabled(NATIVE_MEMORY_OPERATIONS)
}

get_permissioned_signer_feature

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

is_permissioned_signer_enabled

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

get_account_abstraction_feature

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

is_account_abstraction_enabled

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

get_bulletproofs_batch_feature

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

bulletproofs_batch_enabled

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

is_derivable_account_abstraction_enabled

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

is_domain_account_abstraction_enabled

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

get_new_accounts_default_to_fa_store_feature

public fun get_new_accounts_default_to_fa_store_feature(): u64
Implementation
public fun get_new_accounts_default_to_fa_store_feature(): u64 { NEW_ACCOUNTS_DEFAULT_TO_FA_STORE }

new_accounts_default_to_fa_store_enabled

public fun new_accounts_default_to_fa_store_enabled(): bool
Implementation
public fun new_accounts_default_to_fa_store_enabled(): bool acquires Features {
is_enabled(NEW_ACCOUNTS_DEFAULT_TO_FA_STORE)
}

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 }

is_default_account_resource_enabled

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

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 }

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 acquires Features {
is_enabled(JWK_CONSENSUS_PER_KEY_MODE)
}

get_orderless_transactions_feature

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

orderless_transactions_enabled

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

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))
}

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>) acquires Features {
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);
});
}

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 });
}

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 })
}
}
}

is_enabled

Check whether the feature is enabled.

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

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)
}

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
}

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);
});
}

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

Features

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

PendingFeatures

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

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)
}

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();

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_apt_store_enabled(): bool {
spec_is_enabled(NEW_ACCOUNTS_DEFAULT_TO_FA_APT_STORE)
}
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)
}

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();

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);

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;

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)
}

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)
}

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)
}

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);

contains

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

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;