1use std::path::PathBuf;
15use primitive_types::H256;
18use std::str::FromStr;
19
20pub use polkadot_omni_node_lib::cli::AuthoringPolicy;
21
22pub mod account_key;
23
24#[derive(Debug, Copy, Clone)]
26pub enum Sealing {
27 Instant,
29 Manual,
31 Interval(u64),
33}
34
35impl FromStr for Sealing {
36 type Err = String;
37
38 fn from_str(s: &str) -> Result<Self, Self::Err> {
39 Ok(match s {
40 "instant" => Self::Instant,
41 "manual" => Self::Manual,
42 s => {
43 let millis =
44 u64::from_str_radix(s, 10).map_err(|_| "couldn't decode sealing param")?;
45 Self::Interval(millis)
46 }
47 })
48 }
49}
50
51#[derive(Debug, PartialEq, Clone)]
52pub enum EthApi {
53 Txpool,
54 Debug,
55 Trace,
56}
57
58impl FromStr for EthApi {
59 type Err = String;
60
61 fn from_str(s: &str) -> Result<Self, Self::Err> {
62 Ok(match s {
63 "txpool" => Self::Txpool,
64 "debug" => Self::Debug,
65 "trace" => Self::Trace,
66 _ => {
67 return Err(format!(
68 "`{}` is not recognized as a supported Ethereum Api",
69 s
70 ))
71 }
72 })
73 }
74}
75
76#[derive(Debug, Copy, Clone, Default, clap::ValueEnum)]
78pub enum FrontierBackendType {
79 #[default]
81 KeyValue,
82 Sql,
84}
85
86pub enum FrontierBackendConfig {
88 KeyValue,
89 Sql {
90 pool_size: u32,
91 num_ops_timeout: u32,
92 thread_count: u32,
93 cache_size: u64,
94 },
95}
96
97impl Default for FrontierBackendConfig {
98 fn default() -> FrontierBackendConfig {
99 FrontierBackendConfig::KeyValue
100 }
101}
102
103pub struct RpcConfig {
104 pub ethapi: Vec<EthApi>,
105 pub ethapi_max_permits: u32,
106 pub ethapi_trace_max_count: u32,
107 pub ethapi_trace_cache_duration: u64,
108 pub eth_log_block_cache: usize,
109 pub eth_statuses_cache: usize,
110 pub fee_history_limit: u64,
111 pub max_past_logs: u32,
112 pub max_block_range: u32,
113 pub relay_chain_rpc_urls: Vec<url::Url>,
114 pub tracing_raw_max_memory_usage: usize,
115 pub frontier_backend_config: FrontierBackendConfig,
116 pub no_prometheus_prefix: bool,
117}
118
119#[derive(Clone)]
120pub struct LazyLoadingConfig {
121 pub state_rpc: url::Url,
122 pub from_block: Option<H256>,
123 pub state_overrides_path: Option<PathBuf>,
124 pub runtime_override: Option<PathBuf>,
125 pub delay_between_requests: u32,
126 pub max_retries_per_request: u32,
127}
128#[derive(Clone)]
130pub struct NodeExtraArgs {
131 pub authoring_policy: AuthoringPolicy,
135
136 pub export_pov: Option<PathBuf>,
138
139 pub max_pov_percentage: Option<u32>,
142
143 pub legacy_block_import_strategy: bool,
145}