Skip to content

Conversation

@AvhiMaz
Copy link
Contributor

@AvhiMaz AvhiMaz commented Nov 22, 2025

Implement comprehensive feature toggling system allowing users to experiment with different feature sets at runtime without restarting.

Changes:

  • Add Admin RPC methods: setInstructionProfiling, setMaxProfiles,
    setLogBytesLimit, getFeatureStates
  • Add CLI commands: surfpool feature and surfpool plugin for
    runtime management
  • Add runtime setters in SurfnetSvm and SurfnetSvmLocker for
    thread-safe state updates
  • Add FeatureStates struct to query current configuration
  • Support multiple input formats for boolean values (true/false,
    yes/no, on/off, 1/0)
  • Track log_bytes_limit in SurfnetSvm to make it queryable

Closes #308

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz
Copy link
Contributor Author

AvhiMaz commented Nov 22, 2025

hi @MicaiahReid let me know what you think about this implementation.

Ok(())
}
None => {
if let Some(error) = result.get("error") {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we push common RPC response handling into one helper ?

/// "params": [true]
/// }
/// ```
#[rpc(meta, name = "setInstructionProfiling")]
Copy link
Contributor

Choose a reason for hiding this comment

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

toggle is good can we get error codes/messages when meta is None too ?

Comment on lines 62 to 69
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct FeatureStates {
pub instruction_profiling_enabled: bool,
pub max_profiles: usize,
pub log_bytes_limit: Option<usize>,
pub loaded_plugins: Vec<PluginInfo>,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

looks good , maybe we can make it Default

}
}

fn rpc_call(
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure but maybe Don’t spawn curl Use a Rust HTTP client

/// RPC URL of the running surfpool instance
#[arg(long = "rpc-url", default_value = "http://localhost:8899")]
pub rpc_url: String,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we enabled a bool parsed by clap.Free form strings are error prone ?

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz AvhiMaz requested a review from tanmay4l November 23, 2025 09:59
@lgalabru
Copy link
Member

lgalabru commented Nov 25, 2025

Thanks for the energy you've put into this @AvhiMaz !
I'm realizing the spec was quite light to get the ball rolling on this feature request.
This is what I initially had in mind: #423

I don't have a strong opinion wether or not we should have a cheatcode to achieve this at runtime, I don't believe it's been requested at this point, but if you have a use case for this, could we be building off #423 instead?

Thanks, happy to breakdown specs further in the future if it's helpful 🙏

@AvhiMaz
Copy link
Contributor Author

AvhiMaz commented Nov 26, 2025

Thanks for the energy you've put into this @TanmayDhobale! I'm realizing the spec was quite light to get the ball rolling on this feature request. This is what I initially had in mind: #423

I don't have a strong opinion wether or not we should have a cheatcode to achieve this at runtime, I don't believe it's been requested at this point, but if you have a use case for this, could we be building off #423 instead?

Thanks, happy to breakdown specs further in the future if it's helpful 🙏

appreciate the clarity! i notice #423 is already merged - does that fully address what you had in mind, or are there gaps this issue should still cover?

if there's additional work needed, i'd love a bit more detailed spec, would love to contribute.

@lgalabru
Copy link
Member

lgalabru commented Dec 5, 2025

We should be good for now, let's reconsider this feature if we see some demand.
Thanks again @AvhiMaz 🙏

@lgalabru lgalabru closed this Dec 5, 2025
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.

Allow [de]activating feature sets via config/cli command

3 participants