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 } ;
46use 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
4257impl 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
5089impl 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 }
0 commit comments