Skip to content

Commit b38d94c

Browse files
committed
feat(bin/node): support proofs exex cli flags
1 parent c5e105d commit b38d94c

File tree

3 files changed

+56
-12
lines changed

3 files changed

+56
-12
lines changed

bin/node/src/cli.rs

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Contains the CLI arguments
22
3-
use base_reth_runner::{BaseNodeConfig, FlashblocksConfig, TracingConfig};
3+
use std::path::PathBuf;
4+
5+
use base_reth_runner::{BaseNodeConfig, FlashblocksConfig, ProofsConfig, TracingConfig};
46
use reth_optimism_node::args::RollupArgs;
57

68
/// CLI Arguments
@@ -37,6 +39,19 @@ pub struct Args {
3739
/// Enable metering RPC for transaction bundle simulation
3840
#[arg(long = "enable-metering", value_name = "ENABLE_METERING")]
3941
pub enable_metering: bool,
42+
43+
/// If true, initialize external-proofs exex to save and serve trie nodes to provide proofs
44+
/// faster.
45+
#[arg(long = "proofs-history", value_name = "PROOFS_HISTORY", default_value = "false")]
46+
pub proofs_history: bool,
47+
48+
/// The path to the storage DB for proofs history.
49+
#[arg(
50+
long = "proofs-history.storage-path",
51+
value_name = "PROOFS_HISTORY_STORAGE_PATH",
52+
required_if_eq("proofs_history", "true")
53+
)]
54+
pub proofs_history_storage_path: Option<PathBuf>,
4055
}
4156

4257
impl Args {
@@ -45,22 +60,39 @@ impl Args {
4560
pub const fn flashblocks_enabled(&self) -> bool {
4661
self.websocket_url.is_some()
4762
}
63+
64+
/// Returns the [`FlashblocksConfig`] if flashblocks is enabled.
65+
pub fn flashblocks_config(&self) -> Option<FlashblocksConfig> {
66+
self.websocket_url.as_ref().map(|websocket_url| FlashblocksConfig {
67+
websocket_url: websocket_url.clone(),
68+
max_pending_blocks_depth: self.max_pending_blocks_depth,
69+
})
70+
}
71+
72+
/// Returns the [`ProofsConfig`].
73+
pub fn proofs_config(&self) -> ProofsConfig {
74+
ProofsConfig {
75+
enabled: self.proofs_history,
76+
storage_path: self.proofs_history_storage_path.clone(),
77+
}
78+
}
79+
80+
/// Returns the [`TracingConfig`].
81+
pub const fn tracing_config(&self) -> TracingConfig {
82+
TracingConfig {
83+
enabled: self.enable_transaction_tracing,
84+
logs_enabled: self.enable_transaction_tracing_logs,
85+
}
86+
}
4887
}
4988

5089
impl From<Args> for BaseNodeConfig {
5190
fn from(args: Args) -> Self {
52-
let flashblocks = args.websocket_url.map(|websocket_url| FlashblocksConfig {
53-
websocket_url,
54-
max_pending_blocks_depth: args.max_pending_blocks_depth,
55-
});
56-
5791
Self {
92+
flashblocks: args.flashblocks_config(),
93+
proofs: args.proofs_config(),
94+
tracing: args.tracing_config(),
5895
rollup_args: args.rollup_args,
59-
flashblocks,
60-
tracing: TracingConfig {
61-
enabled: args.enable_transaction_tracing,
62-
logs_enabled: args.enable_transaction_tracing_logs,
63-
},
6496
metering_enabled: args.enable_metering,
6597
}
6698
}

crates/runner/src/config.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ pub struct BaseNodeConfig {
1111
pub flashblocks: Option<FlashblocksConfig>,
1212
/// Execution extension tracing toggles.
1313
pub tracing: TracingConfig,
14+
/// Proofs extension configuration.
15+
pub proofs: ProofsConfig,
1416
/// Indicates whether the metering RPC surface should be installed.
1517
pub metering_enabled: bool,
1618
}
@@ -31,6 +33,16 @@ pub struct FlashblocksConfig {
3133
pub max_pending_blocks_depth: u64,
3234
}
3335

36+
/// Proofs Extension Configuration.
37+
#[derive(Debug, Clone)]
38+
pub struct ProofsConfig {
39+
/// If true, initializes external-proofs ExEx to save and serve trie nodes to provide proofs
40+
/// faster.
41+
pub enabled: bool,
42+
/// The path to the storage DB for proofs history.
43+
pub storage_path: Option<std::path::PathBuf>,
44+
}
45+
3446
/// Transaction tracing toggles.
3547
#[derive(Debug, Clone, Copy)]
3648
pub struct TracingConfig {

crates/runner/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ mod runner;
1010
pub use runner::BaseNodeRunner;
1111

1212
mod config;
13-
pub use config::{BaseNodeConfig, FlashblocksConfig, TracingConfig};
13+
pub use config::{BaseNodeConfig, FlashblocksConfig, ProofsConfig, TracingConfig};
1414

1515
mod extensions;
1616
pub use extensions::{

0 commit comments

Comments
 (0)