serviceability: add feature flags to GlobalState#3062
Merged
Conversation
juan-malbeclabs
approved these changes
Feb 21, 2026
Contributor
juan-malbeclabs
left a comment
There was a problem hiding this comment.
LGTM overall, the changes look solid and aligned with the intended design. I’ve left a few comments and suggestions for consideration, mostly around structure and future scalability, but nothing blocking from my side.
smartcontract/programs/doublezero-serviceability/src/state/globalstate.rs
Outdated
Show resolved
Hide resolved
smartcontract/programs/doublezero-serviceability/src/state/globalstate.rs
Show resolved
Hide resolved
Add a feature flags mechanism to the serviceability program, enabling the foundation to toggle onchain features via a bitmask stored on GlobalState. The first flag is OnChainAllocation (bit 0). Onchain program: - Add `feature_flags: u128` field to GlobalState with backwards-compatible deserialization (unwrap_or_default for existing accounts) - Add FeatureFlag enum with FromStr/Display for "onchain-allocation" - Add helper functions: is_feature_enabled(), enabled_flags(), to_mask() - Add SetFeatureFlags instruction (variant 94) restricted to foundation_allowlist members - Integration tests: success path, non-foundation rejection, persistence Rust SDK: - Add SetFeatureFlagsCommand with mock-based unit test CLI: - Add `globalconfig feature-flags get` (prints enabled flag names + raw value) - Add `globalconfig feature-flags set --enable/disable onchain-allocation` - Unit tests for both commands including unknown flag rejection Read-only SDKs: - TypeScript: add featureFlags (bigint) to GlobalState deserialization - Go: add FeatureFlags (Uint128) to GlobalState deserialization - Python: add feature_flags (int) to GlobalState deserialization Fixtures: - Regenerate all SDK fixtures with feature_flags field - Also fix pre-existing missing Device fields in fixture generator (unicast_users_count, multicast_users_count, max_unicast_users, max_multicast_users)
9a6a332 to
0caea3a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a feature flags mechanism to the serviceability program, enabling the foundation to toggle onchain features via a bitmask stored on GlobalState. The first flag is OnChainAllocation (bit 0).
Onchain program:
feature_flags: u128field to GlobalState with backwards-compatible deserialization (unwrap_or_default for existing accounts)Rust SDK:
CLI:
globalconfig feature-flags get(prints enabled flag names + raw value)globalconfig feature-flags set --enable/disable onchain-allocationRead-only SDKs:
Fixtures: