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")
Returns
if the feature is enabled in the current protocol versiontrue
if the feature is disabledfalse
Aborts
- Error code 0: Feature flag name not found
- Error code 1: Invalid feature flag name (not valid UTF-8)
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;