Module iota::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.
Module Functions
pub(pkg) get_attr
Returns the value of a protocol config parameter.
Aborts if the parameter is not defined in the current protocol version,
if T does not match the parameter's actual type, or if param_name is
not valid UTF-8 — all three are programming errors.
Restricted to internal use within the iota-framework package.
Arguments
param_name- The name of the config parameter as bytes (e.g., b"max_arguments")
Type parameter
T- Must be one ofu16,u32,u64, orbool— the concrete type of the parameter.
Example (framework use only)
let max_args: u32 = protocol_config::get_attr<u32>(b"max_arguments");
public(package) fun get_attr<T: copy, drop, store>(param_name: vector<u8>): T
Implementation
pub(pkg) is_feature_enabled
Checks if a specific protocol feature flag is enabled.
Restricted to internal use within the iota-framework package only. If we need to use it in iota-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
trueif the feature is enabled in the current protocol versionfalseif the feature is disabled
Example (for framework use only)
use iota::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
Implementation
public(package) native fun is_feature_enabled(feature_flag_name: vector<u8>): bool;