@@ -14,22 +14,47 @@ use crate::{
1414} ;
1515use crate :: { FlashblocksService , RpcClient } ;
1616
17- #[ derive( Clone , Parser , Debug ) ]
18- #[ clap( author, version = get_version( ) , about) ]
19- pub struct RollupBoostArgs {
17+ #[ derive( Clone , Debug , clap:: Args ) ]
18+ pub struct RollupBoostLibArgs {
2019 #[ clap( flatten) ]
2120 pub builder : BuilderArgs ,
2221
2322 #[ clap( flatten) ]
2423 pub l2_client : L2ClientArgs ,
2524
25+ /// Execution mode to start rollup boost with
26+ #[ arg( long, env, default_value = "enabled" ) ]
27+ pub execution_mode : ExecutionMode ,
28+
29+ #[ arg( long, env) ]
30+ pub block_selection_policy : Option < BlockSelectionPolicy > ,
31+
32+ /// Should we use the l2 client for computing state root
33+ #[ arg( long, env, default_value = "false" ) ]
34+ pub external_state_root : bool ,
35+
36+ /// Allow all engine API calls to builder even when marked as unhealthy
37+ /// This is default true assuming no builder CL set up
38+ #[ arg( long, env, default_value = "false" ) ]
39+ pub ignore_unhealthy_builders : bool ,
40+
41+ #[ clap( flatten) ]
42+ pub flashblocks : FlashblocksArgs ,
43+
2644 /// Duration in seconds between async health checks on the builder
2745 #[ arg( long, env, default_value = "60" ) ]
2846 pub health_check_interval : u64 ,
2947
3048 /// Max duration in seconds between the unsafe head block of the builder and the current time
3149 #[ arg( long, env, default_value = "10" ) ]
3250 pub max_unsafe_interval : u64 ,
51+ }
52+
53+ #[ derive( Clone , Parser , Debug ) ]
54+ #[ clap( author, version = get_version( ) , about) ]
55+ pub struct RollupBoostServiceArgs {
56+ #[ clap( flatten) ]
57+ pub lib : RollupBoostLibArgs ,
3358
3459 /// Host to run the server on
3560 #[ arg( long, env, default_value = "127.0.0.1" ) ]
@@ -78,57 +103,38 @@ pub struct RollupBoostArgs {
78103 /// Debug server port
79104 #[ arg( long, env, default_value = "5555" ) ]
80105 pub debug_server_port : u16 ,
81-
82- /// Execution mode to start rollup boost with
83- #[ arg( long, env, default_value = "enabled" ) ]
84- pub execution_mode : ExecutionMode ,
85-
86- #[ arg( long, env) ]
87- pub block_selection_policy : Option < BlockSelectionPolicy > ,
88-
89- /// Should we use the l2 client for computing state root
90- #[ arg( long, env, default_value = "false" ) ]
91- pub external_state_root : bool ,
92-
93- /// Allow all engine API calls to builder even when marked as unhealthy
94- /// This is default true assuming no builder CL set up
95- #[ arg( long, env, default_value = "false" ) ]
96- pub ignore_unhealthy_builders : bool ,
97-
98- #[ clap( flatten) ]
99- pub flashblocks : FlashblocksArgs ,
100106}
101107
102- impl RollupBoostArgs {
108+ impl RollupBoostServiceArgs {
103109 pub async fn run ( self ) -> eyre:: Result < ( ) > {
104110 let _ = rustls:: crypto:: ring:: default_provider ( ) . install_default ( ) ;
105111 init_metrics ( & self ) ?;
106112
107113 let debug_addr = format ! ( "{}:{}" , self . debug_host, self . debug_server_port) ;
108- let l2_client_args: ClientArgs = self . l2_client . clone ( ) . into ( ) ;
114+ let l2_client_args: ClientArgs = self . lib . l2_client . clone ( ) . into ( ) ;
109115 let l2_http_client = l2_client_args. new_http_client ( PayloadSource :: L2 ) ?;
110116
111- let builder_client_args: ClientArgs = self . builder . clone ( ) . into ( ) ;
117+ let builder_client_args: ClientArgs = self . lib . builder . clone ( ) . into ( ) ;
112118 let builder_http_client = builder_client_args. new_http_client ( PayloadSource :: Builder ) ?;
113119
114120 let ( probe_layer, probes) = ProbeLayer :: new ( ) ;
115121
116- let ( health_handle, rpc_module) = if self . flashblocks . flashblocks {
122+ let ( health_handle, rpc_module) = if self . lib . flashblocks . flashblocks {
117123 let rollup_boost = RollupBoostServer :: < FlashblocksService > :: new_from_args (
118- self . clone ( ) ,
124+ self . lib . clone ( ) ,
119125 probes. clone ( ) ,
120126 ) ?;
121127 let health_handle = rollup_boost
122- . spawn_health_check ( self . health_check_interval , self . max_unsafe_interval ) ;
128+ . spawn_health_check ( self . lib . health_check_interval , self . lib . max_unsafe_interval ) ;
123129 let debug_server = DebugServer :: new ( rollup_boost. execution_mode . clone ( ) ) ;
124130 debug_server. run ( & debug_addr) . await ?;
125131 let rpc_module: RpcModule < ( ) > = rollup_boost. try_into ( ) ?;
126132 ( health_handle, rpc_module)
127133 } else {
128134 let rollup_boost =
129- RollupBoostServer :: < RpcClient > :: new_from_args ( self . clone ( ) , probes. clone ( ) ) ?;
135+ RollupBoostServer :: < RpcClient > :: new_from_args ( self . lib . clone ( ) , probes. clone ( ) ) ?;
130136 let health_handle = rollup_boost
131- . spawn_health_check ( self . health_check_interval , self . max_unsafe_interval ) ;
137+ . spawn_health_check ( self . lib . health_check_interval , self . lib . max_unsafe_interval ) ;
132138 let debug_server = DebugServer :: new ( rollup_boost. execution_mode . clone ( ) ) ;
133139 debug_server. run ( & debug_addr) . await ?;
134140 let rpc_module: RpcModule < ( ) > = rollup_boost. try_into ( ) ?;
@@ -180,7 +186,7 @@ impl RollupBoostArgs {
180186 }
181187}
182188
183- impl Default for RollupBoostArgs {
189+ impl Default for RollupBoostServiceArgs {
184190 fn default ( ) -> Self {
185191 Self :: parse_from :: < _ , & str > ( std:: iter:: empty ( ) )
186192 }
0 commit comments