ワンクリックで
protocol-config
// Safely modify or verify Sui protocol config changes, including version bumps, release-branch checks, guards, and snapshots.
// Safely modify or verify Sui protocol config changes, including version bumps, release-branch checks, guards, and snapshots.
Cherry-pick a commit from main to a Sui release branch, create the release PR, and report the PR URL.
Run Sui dual execution replay between base and tip commits, recover failed steps, build, and commit replay instrumentation.
Debug deterministic Sui simtest failures with structured experiments, logging-only changes, and NOTEBOOK.md observations.
Prepare, validate, and send or update a pull request with full due diligence
| name | protocol-config |
| description | Safely modify or verify Sui protocol config changes, including version bumps, release-branch checks, guards, and snapshots. |
Guides you through safely modifying the Sui protocol configuration, or verifies that existing changes were made correctly.
/protocol-config
This skill serves two purposes:
Making changes - Use this skill to guide you through adding new features or modifying protocol config settings.
Verifying changes - Use this skill to check that protocol config changes already made in a branch are correct. This includes verifying that:
When verifying existing work, follow steps 1-4 to confirm the changes are safe, then review the actual changes against the patterns in steps 5-7.
The protocol config is defined in crates/sui-protocol-config/src/lib.rs. It controls blockchain behavior across all Sui networks. The critical constraint is:
Once a protocol version has been released to a production network, its settings CANNOT be changed.
This means if mainnet or testnet is running protocol version N, the settings for version N (and all prior versions) are frozen forever.
Find the latest release branch:
git fetch origin
git branch -r | grep 'origin/releases/sui-v' | grep -E '\-release$' | sort -V | tail -1
This returns something like origin/releases/sui-v1.66.0-release.
git show <release-branch>:crates/sui-protocol-config/src/lib.rs | grep 'const MAX_PROTOCOL_VERSION'
For example:
git show origin/releases/sui-v1.66.0-release:crates/sui-protocol-config/src/lib.rs | grep 'const MAX_PROTOCOL_VERSION'
grep 'const MAX_PROTOCOL_VERSION' crates/sui-protocol-config/src/lib.rs
If the release branch and your feature branch have the SAME max version number, you MUST create a new protocol version in your feature branch before making changes.
If your feature branch already has a HIGHER max version number, you can add changes to the existing version block.
If you need a new version:
Increment MAX_PROTOCOL_VERSION at the top of the file (around line 27):
const MAX_PROTOCOL_VERSION: u64 = 113; // was 112
Add a version history comment (around line 299, after the last version comment):
// Version 113: <Brief description of your changes>
Add a new version match block in get_for_version_impl() (search for the last numbered version block, currently around line 4575):
113 => {
// Your changes here
}
Add your changes to the appropriate version block. Follow these patterns:
Modify an existing constant:
cfg.some_constant = Some(new_value);
Add a new constant (which is None in prior versions):
cfg.new_constant = Some(new_value);
Note: You must also add the field to the ProtocolConfig struct with type Option<T>. The ProtocolConfigAccessors derive macro automatically generates accessor methods (new_constant() and new_constant_as_option()).
Add a new feature flag:
cfg.feature_flags.new_feature = true;
Note: You must also add the field to the FeatureFlags struct with type bool. The ProtocolConfigFeatureFlagsGetters derive macro automatically generates the getter method.
Use the chain parameter to enable features on specific networks. Features typically roll out progressively: devnet -> testnet -> mainnet.
Enable on devnet only (Chain::Unknown):
if chain != Chain::Mainnet && chain != Chain::Testnet {
cfg.feature_flags.new_feature = true;
}
Enable on devnet and testnet:
if chain != Chain::Mainnet {
cfg.feature_flags.new_feature = true;
}
Enable everywhere (preferred for new features going to mainnet):
cfg.feature_flags.stable_feature = true;
This is the preferred pattern when enabling a feature for mainnet. Use unconditional enabling rather than chain == Chain::Mainnet.
Enable on mainnet only (rare - excludes devnet/testnet):
if chain == Chain::Mainnet {
cfg.feature_flags.some_mainnet_specific_thing = true;
}
This pattern is rarely needed. It enables a feature ONLY on mainnet while keeping it disabled on devnet and testnet. Only use this for mainnet-specific behavior that should not exist on other networks.
After making changes, update the protocol config snapshots:
cargo insta test -p sui-protocol-config --accept
| Target Networks | Pattern |
|---|---|
| Devnet only | if chain != Chain::Mainnet && chain != Chain::Testnet |
| Devnet + Testnet | if chain != Chain::Mainnet |
| All networks (including Mainnet) | No condition (preferred) |
| Mainnet only (rare) | if chain == Chain::Mainnet |
crates/sui-protocol-config/src/lib.rscrates/sui-protocol-config/src/snapshots/