Skip to content

serviceability: add feature flags to GlobalState#3062

Merged
elitegreg merged 4 commits intomainfrom
gm/feature_flags
Feb 22, 2026
Merged

serviceability: add feature flags to GlobalState#3062
elitegreg merged 4 commits intomainfrom
gm/feature_flags

Conversation

@elitegreg
Copy link
Contributor

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)

@elitegreg elitegreg enabled auto-merge (squash) February 20, 2026 20:33
Copy link
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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)
@elitegreg elitegreg merged commit e3f2ef2 into main Feb 22, 2026
36 of 37 checks passed
@elitegreg elitegreg deleted the gm/feature_flags branch February 22, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants