From b38d94c6ee03fecd634d122809944a38b77d2ddb Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 5 Dec 2025 14:22:28 -0500 Subject: [PATCH 1/4] feat(bin/node): support proofs exex cli flags --- bin/node/src/cli.rs | 54 +++++++++++++++++++++++++++++-------- crates/runner/src/config.rs | 12 +++++++++ crates/runner/src/lib.rs | 2 +- 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/bin/node/src/cli.rs b/bin/node/src/cli.rs index 40b3cbd7..4ae92dc5 100644 --- a/bin/node/src/cli.rs +++ b/bin/node/src/cli.rs @@ -1,6 +1,8 @@ //! Contains the CLI arguments -use base_reth_runner::{BaseNodeConfig, FlashblocksConfig, TracingConfig}; +use std::path::PathBuf; + +use base_reth_runner::{BaseNodeConfig, FlashblocksConfig, ProofsConfig, TracingConfig}; use reth_optimism_node::args::RollupArgs; /// CLI Arguments @@ -37,6 +39,19 @@ pub struct Args { /// Enable metering RPC for transaction bundle simulation #[arg(long = "enable-metering", value_name = "ENABLE_METERING")] pub enable_metering: bool, + + /// If true, initialize external-proofs exex to save and serve trie nodes to provide proofs + /// faster. + #[arg(long = "proofs-history", value_name = "PROOFS_HISTORY", default_value = "false")] + pub proofs_history: bool, + + /// The path to the storage DB for proofs history. + #[arg( + long = "proofs-history.storage-path", + value_name = "PROOFS_HISTORY_STORAGE_PATH", + required_if_eq("proofs_history", "true") + )] + pub proofs_history_storage_path: Option, } impl Args { @@ -45,22 +60,39 @@ impl Args { pub const fn flashblocks_enabled(&self) -> bool { self.websocket_url.is_some() } + + /// Returns the [`FlashblocksConfig`] if flashblocks is enabled. + pub fn flashblocks_config(&self) -> Option { + self.websocket_url.as_ref().map(|websocket_url| FlashblocksConfig { + websocket_url: websocket_url.clone(), + max_pending_blocks_depth: self.max_pending_blocks_depth, + }) + } + + /// Returns the [`ProofsConfig`]. + pub fn proofs_config(&self) -> ProofsConfig { + ProofsConfig { + enabled: self.proofs_history, + storage_path: self.proofs_history_storage_path.clone(), + } + } + + /// Returns the [`TracingConfig`]. + pub const fn tracing_config(&self) -> TracingConfig { + TracingConfig { + enabled: self.enable_transaction_tracing, + logs_enabled: self.enable_transaction_tracing_logs, + } + } } impl From for BaseNodeConfig { fn from(args: Args) -> Self { - let flashblocks = args.websocket_url.map(|websocket_url| FlashblocksConfig { - websocket_url, - max_pending_blocks_depth: args.max_pending_blocks_depth, - }); - Self { + flashblocks: args.flashblocks_config(), + proofs: args.proofs_config(), + tracing: args.tracing_config(), rollup_args: args.rollup_args, - flashblocks, - tracing: TracingConfig { - enabled: args.enable_transaction_tracing, - logs_enabled: args.enable_transaction_tracing_logs, - }, metering_enabled: args.enable_metering, } } diff --git a/crates/runner/src/config.rs b/crates/runner/src/config.rs index 56029c6b..b83abfe0 100644 --- a/crates/runner/src/config.rs +++ b/crates/runner/src/config.rs @@ -11,6 +11,8 @@ pub struct BaseNodeConfig { pub flashblocks: Option, /// Execution extension tracing toggles. pub tracing: TracingConfig, + /// Proofs extension configuration. + pub proofs: ProofsConfig, /// Indicates whether the metering RPC surface should be installed. pub metering_enabled: bool, } @@ -31,6 +33,16 @@ pub struct FlashblocksConfig { pub max_pending_blocks_depth: u64, } +/// Proofs Extension Configuration. +#[derive(Debug, Clone)] +pub struct ProofsConfig { + /// If true, initializes external-proofs ExEx to save and serve trie nodes to provide proofs + /// faster. + pub enabled: bool, + /// The path to the storage DB for proofs history. + pub storage_path: Option, +} + /// Transaction tracing toggles. #[derive(Debug, Clone, Copy)] pub struct TracingConfig { diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 82025faf..124ba04f 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -10,7 +10,7 @@ mod runner; pub use runner::BaseNodeRunner; mod config; -pub use config::{BaseNodeConfig, FlashblocksConfig, TracingConfig}; +pub use config::{BaseNodeConfig, FlashblocksConfig, ProofsConfig, TracingConfig}; mod extensions; pub use extensions::{ From 96036dd9705163fa3f54e9e708db84eab7949723 Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 5 Dec 2025 14:22:28 -0500 Subject: [PATCH 2/4] feat(bin/node): support proofs exex cli flags From eb87d0975007bb6d1cbf75875b1d42c1e11c6614 Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 5 Dec 2025 14:39:11 -0500 Subject: [PATCH 3/4] feat(runner): proofs extension skeleton --- crates/runner/src/extensions/mod.rs | 5 ++++- crates/runner/src/extensions/proofs.rs | 24 ++++++++++++++++++++++++ crates/runner/src/extensions/types.rs | 3 +++ crates/runner/src/lib.rs | 2 +- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 crates/runner/src/extensions/proofs.rs diff --git a/crates/runner/src/extensions/mod.rs b/crates/runner/src/extensions/mod.rs index f9204126..2094d952 100644 --- a/crates/runner/src/extensions/mod.rs +++ b/crates/runner/src/extensions/mod.rs @@ -3,6 +3,9 @@ //! Builder extensions for the node nicely modularizes parts //! of the node building process. +mod proofs; +pub use proofs::ProofsExtension; + mod canon; pub use canon::FlashblocksCanonExtension; @@ -13,4 +16,4 @@ mod tracing; pub use tracing::TransactionTracingExtension; mod types; -pub use types::{FlashblocksCell, OpBuilder, OpProvider}; +pub use types::{FlashblocksCell, OpBuilder, OpProvider, ProofsCell}; diff --git a/crates/runner/src/extensions/proofs.rs b/crates/runner/src/extensions/proofs.rs new file mode 100644 index 00000000..d7b7a804 --- /dev/null +++ b/crates/runner/src/extensions/proofs.rs @@ -0,0 +1,24 @@ +//! Contains a [`ProofsExtensions`] which stores intermediate storage updates. + +use crate::{ProofsCell, ProofsConfig, extensions::OpBuilder}; + +/// Proofs Extension. +#[derive(Debug, Clone)] +pub struct ProofsExtension { + /// Shared state. + pub cell: ProofsCell, + /// Proofs config. + pub config: ProofsConfig, +} + +impl ProofsExtension { + /// Create a new Proofs extension helper. + pub const fn new(cell: ProofsCell, config: ProofsConfig) -> Self { + Self { cell, config } + } + + /// Applies the extension to the supplied builder. + pub fn apply(&self, _builder: OpBuilder) -> OpBuilder { + unimplemented!("ProofsExtension::apply is not yet implemented") + } +} diff --git a/crates/runner/src/extensions/types.rs b/crates/runner/src/extensions/types.rs index 444dc56c..33208de0 100644 --- a/crates/runner/src/extensions/types.rs +++ b/crates/runner/src/extensions/types.rs @@ -25,3 +25,6 @@ pub type OpBuilder = /// The flashblocks cell holds the [`FlashblocksState`]. pub type FlashblocksCell = Arc>>>; + +/// A cell holding the proofs state. +pub type ProofsCell = Arc>; diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 124ba04f..fe35c31d 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -15,5 +15,5 @@ pub use config::{BaseNodeConfig, FlashblocksConfig, ProofsConfig, TracingConfig} mod extensions; pub use extensions::{ BaseRpcExtension, FlashblocksCanonExtension, FlashblocksCell, OpBuilder, OpProvider, - TransactionTracingExtension, + ProofsCell, ProofsExtension, TransactionTracingExtension, }; From 5cbdbac2f5a1660960f2ca31de713a69e1b31729 Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 5 Dec 2025 15:11:21 -0500 Subject: [PATCH 4/4] feat(runner): proofs extension wiring --- crates/runner/src/extensions/proofs.rs | 8 ++++---- crates/runner/src/extensions/types.rs | 2 +- crates/runner/src/runner.rs | 11 +++++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/crates/runner/src/extensions/proofs.rs b/crates/runner/src/extensions/proofs.rs index d7b7a804..511597c8 100644 --- a/crates/runner/src/extensions/proofs.rs +++ b/crates/runner/src/extensions/proofs.rs @@ -4,16 +4,16 @@ use crate::{ProofsCell, ProofsConfig, extensions::OpBuilder}; /// Proofs Extension. #[derive(Debug, Clone)] -pub struct ProofsExtension { +pub struct ProofsExtension { /// Shared state. - pub cell: ProofsCell, + pub cell: ProofsCell, /// Proofs config. pub config: ProofsConfig, } -impl ProofsExtension { +impl ProofsExtension { /// Create a new Proofs extension helper. - pub const fn new(cell: ProofsCell, config: ProofsConfig) -> Self { + pub const fn new(cell: ProofsCell, config: ProofsConfig) -> Self { Self { cell, config } } diff --git a/crates/runner/src/extensions/types.rs b/crates/runner/src/extensions/types.rs index 33208de0..e0165744 100644 --- a/crates/runner/src/extensions/types.rs +++ b/crates/runner/src/extensions/types.rs @@ -27,4 +27,4 @@ pub type OpBuilder = pub type FlashblocksCell = Arc>>>; /// A cell holding the proofs state. -pub type ProofsCell = Arc>; +pub type ProofsCell = Arc>>; diff --git a/crates/runner/src/runner.rs b/crates/runner/src/runner.rs index e4574036..7377f87d 100644 --- a/crates/runner/src/runner.rs +++ b/crates/runner/src/runner.rs @@ -12,8 +12,8 @@ use reth_optimism_node::OpNode; use tracing::info; use crate::{ - BaseNodeBuilder, BaseNodeConfig, BaseRpcExtension, FlashblocksCanonExtension, - TransactionTracingExtension, + BaseNodeBuilder, BaseNodeConfig, BaseRpcExtension, FlashblocksCanonExtension, ProofsCell, + ProofsExtension, TransactionTracingExtension, }; /// Wraps the Base node configuration and orchestrates builder wiring. @@ -54,10 +54,17 @@ impl BaseNodeRunner { FlashblocksCanonExtension::new(flashblocks_cell.clone(), flashblocks_config.clone()); let builder = flashblocks_extension.apply(builder); + // Apply the Proofs extension + let proofs_cell: ProofsCell<()> = Arc::new(OnceCell::new()); + let proofs_extension = + ProofsExtension::new(proofs_cell.clone(), self.config.proofs.clone()); + let builder = ProofsExtension::apply(&proofs_extension, builder); + // Apply the Transaction Tracing extension let tracing_extension = TransactionTracingExtension::new(self.config.tracing); let builder = tracing_extension.apply(builder); + // Apply the Base RPC extension let rpc_extension = BaseRpcExtension::new( flashblocks_cell.clone(), flashblocks_config.clone(),