kona_engine/
kinds.rs

1//! Contains the different kinds of execution engine clients that can be used.
2
3use derive_more::{Display, FromStr};
4
5/// Identifies the type of execution layer client for behavior customization.
6///
7/// Different execution clients may have slight variations in API behavior
8/// or supported features. This enum allows the engine to adapt its behavior
9/// accordingly, though as of v0.1.0, behavior is equivalent across all types.
10///
11/// # Examples
12///
13/// ```rust
14/// use kona_engine::EngineKind;
15/// use std::str::FromStr;
16///
17/// // Parse from string
18/// let kind = EngineKind::from_str("geth").unwrap();
19/// assert_eq!(kind, EngineKind::Geth);
20///
21/// // Display as string
22/// assert_eq!(EngineKind::Reth.to_string(), "reth");
23/// ```
24#[derive(Debug, Display, FromStr, Clone, Copy, PartialEq, Eq)]
25pub enum EngineKind {
26    /// Geth execution client.
27    #[display("geth")]
28    Geth,
29    /// Reth execution client.
30    #[display("reth")]
31    Reth,
32    /// Erigon execution client.
33    #[display("erigon")]
34    Erigon,
35}
36
37impl EngineKind {
38    /// Contains all valid engine client kinds.
39    pub const KINDS: [Self; 3] = [Self::Geth, Self::Reth, Self::Erigon];
40
41    /// Returns whether the engine client kind supports post finalization EL sync.
42    #[deprecated(
43        since = "0.1.0",
44        note = "Node behavior is now equivalent across all engine client types."
45    )]
46    pub const fn supports_post_finalization_elsync(self) -> bool {
47        match self {
48            Self::Geth => false,
49            Self::Erigon | Self::Reth => true,
50        }
51    }
52}