reth_rpc_engine_api/
capabilities.rs

1use std::collections::HashSet;
2
3/// The list of all supported Engine capabilities available over the engine endpoint.
4pub const CAPABILITIES: &[&str] = &[
5    "engine_forkchoiceUpdatedV1",
6    "engine_forkchoiceUpdatedV2",
7    "engine_forkchoiceUpdatedV3",
8    "engine_exchangeTransitionConfigurationV1",
9    "engine_getClientVersionV1",
10    "engine_getPayloadV1",
11    "engine_getPayloadV2",
12    "engine_getPayloadV3",
13    "engine_getPayloadV4",
14    "engine_newPayloadV1",
15    "engine_newPayloadV2",
16    "engine_newPayloadV3",
17    "engine_newPayloadV4",
18    "engine_getPayloadBodiesByHashV1",
19    "engine_getPayloadBodiesByRangeV1",
20    "engine_getBlobsV1",
21];
22
23// The list of all supported Engine capabilities available over the engine endpoint.
24///
25/// Latest spec: Prague
26#[derive(Debug, Clone)]
27pub struct EngineCapabilities {
28    inner: HashSet<String>,
29}
30
31impl EngineCapabilities {
32    /// Returns the list of all supported Engine capabilities for Prague spec.
33    fn prague() -> Self {
34        Self { inner: CAPABILITIES.iter().copied().map(str::to_owned).collect() }
35    }
36
37    /// Returns the list of all supported Engine capabilities.
38    pub fn list(&self) -> Vec<String> {
39        self.inner.iter().cloned().collect()
40    }
41}
42
43impl Default for EngineCapabilities {
44    fn default() -> Self {
45        Self::prague()
46    }
47}