Repository: paradigmxyz/reth (language: rust)

Issue:
Allow extending engine capabilities
### Describe the feature

currently this only stores an immutable list with a fixed set of features

https://github.com/paradigmxyz/reth/blob/16c3c5b733702f31daa4bf4e2c688ce37ccd5b58/crates/rpc/rpc-engine-api/src/capabilities.rs#L27-L27


we need this to be configurable for op and also customizable in case the engine API is extended with additional functions, for example for experimental caps.

## TODO
* add constructor
* add insert + remove

### Additional context

_No response_


Discussion / hints:
@mattsse can I take this one ? 
assigned

Fix patch:
diff --git a/crates/rpc/rpc-engine-api/src/capabilities.rs b/crates/rpc/rpc-engine-api/src/capabilities.rs
index af0609b0d1f0..3da055de697b 100644
--- a/crates/rpc/rpc-engine-api/src/capabilities.rs
+++ b/crates/rpc/rpc-engine-api/src/capabilities.rs
@@ -29,6 +29,11 @@ pub struct EngineCapabilities {
 }
 
 impl EngineCapabilities {
+    /// Creates a new `EngineCapabilities` instance with the given capabilities.
+    pub fn new(capabilities: impl IntoIterator<Item = impl Into<String>>) -> Self {
+        Self { inner: capabilities.into_iter().map(Into::into).collect() }
+    }
+
     /// Returns the list of all supported Engine capabilities for Prague spec.
     fn prague() -> Self {
         Self { inner: CAPABILITIES.iter().copied().map(str::to_owned).collect() }
@@ -38,6 +43,16 @@ impl EngineCapabilities {
     pub fn list(&self) -> Vec<String> {
         self.inner.iter().cloned().collect()
     }
+
+    /// Inserts a new capability.
+    pub fn add_capability(&mut self, capability: impl Into<String>) {
+        self.inner.insert(capability.into());
+    }
+
+    /// Removes a capability.
+    pub fn remove_capability(&mut self, capability: &str) -> Option<String> {
+        self.inner.take(capability)
+    }
 }
 
 impl Default for EngineCapabilities {


Test patch: