Module sui::protocol_config
This module provides access to protocol configuration feature flags. Feature flags control the availability of various protocol features and are enabled/disabled at specific protocol versions during epoch changes.
Function is_feature_enabled
Checks if a specific protocol feature flag is enabled.
Restricted to internal use within the sui-framework package only. If we need to use it in sui-system, we can add friend declarations. We should never need to expose this to user packages.
Arguments
feature_flag_name- The name of the feature flag as bytes (e.g., b"enable_vdf")
- It is expected to be a valid UTF-8 string
- The flag should exist in the protocol config
Returns
if the feature is enabled in the current protocol versiontrue
if the feature is disabledfalse
Example (for framework use only)
use sui::protocol_config;
if (protocol_config::is_feature_enabled(b"enable_accumulators")) {
// Accumulators are available
};
public(package) fun is_feature_enabled(feature_flag_name: vector<u8>): bool
Click to open
Implementation
public(package) native fun is_feature_enabled(feature_flag_name: vector<u8>): bool;