1313 rblib:: {
1414 pool:: * ,
1515 prelude:: * ,
16- reth:: optimism:: {
17- node:: { OpAddOns , OpEngineApiBuilder , OpEngineValidatorBuilder , OpNode } ,
18- rpc:: OpEthApiBuilder ,
16+ reth:: {
17+ builder:: { NodeBuilder , WithLaunchContext } ,
18+ cli:: commands:: launcher:: Launcher ,
19+ db:: DatabaseEnv ,
20+ optimism:: {
21+ chainspec:: OpChainSpec ,
22+ cli:: chainspec:: OpChainSpecParser ,
23+ node:: {
24+ OpAddOns ,
25+ OpEngineApiBuilder ,
26+ OpEngineValidatorBuilder ,
27+ OpNode ,
28+ } ,
29+ rpc:: OpEthApiBuilder ,
30+ } ,
1931 } ,
2032 steps:: * ,
2133 } ,
@@ -40,49 +52,73 @@ mod version;
4052mod tests;
4153
4254fn main ( ) {
43- #[ cfg( feature = "debug" ) ]
44- console_subscriber:: init ( ) ;
45-
46- Cli :: parsed ( )
47- . run ( |builder, cli_args| async move {
48- let pool = OrderPool :: < Flashblocks > :: default ( ) ;
49- let pipeline = build_pipeline ( & cli_args, & pool) ?;
50- let opnode = OpNode :: new ( cli_args. rollup_args . clone ( ) ) ;
51- let tx_status_rpc = TransactionStatusRpc :: new ( & pipeline) ;
52-
53- let addons: OpAddOns <
54- _ ,
55- OpEthApiBuilder ,
56- OpEngineValidatorBuilder ,
57- OpEngineApiBuilder < OpEngineValidatorBuilder > ,
58- > = opnode
59- . add_ons_builder :: < types:: RpcTypes < Flashblocks > > ( )
60- . build ( ) ;
61-
62- let handle = builder
63- . with_types :: < OpNode > ( )
64- . with_components (
65- opnode
66- . components ( )
67- . attach_pool ( & pool)
68- . payload ( pipeline. into_service ( ) ) ,
69- )
70- . with_add_ons ( addons)
71- . extend_rpc_modules ( move |mut rpc_ctx| {
72- pool. attach_rpc ( & mut rpc_ctx) ?;
73- tx_status_rpc. attach_rpc ( & mut rpc_ctx) ?;
74- Ok ( ( ) )
75- } )
76- . on_node_started ( move |_ctx| {
77- set_version_metric ( ) ;
78- Ok ( ( ) )
79- } )
80- . launch ( )
81- . await ?;
82-
83- handle. wait_for_node_exit ( ) . await
84- } )
85- . unwrap ( ) ;
55+ #[ cfg_attr( not( feature = "debug" ) , allow( unused_mut) ) ]
56+ let mut cli = Cli :: parsed ( ) . configure ( ) ;
57+
58+ // TODO: Re-enable once the devops build can set build-time flags
59+ // #[cfg(feature = "debug")]
60+ // {
61+ // let console_layer = console_subscriber::spawn();
62+ // cli
63+ // .access_tracing_layers()
64+ // .expect("failed to access tracing layers")
65+ // .add_layer(console_layer);
66+ // }
67+
68+ let console_layer = console_subscriber:: spawn ( ) ;
69+ cli
70+ . access_tracing_layers ( )
71+ . expect ( "failed to access tracing layers" )
72+ . add_layer ( console_layer) ;
73+
74+ cli. run ( LauncherImpl ) . unwrap ( ) ;
75+ }
76+
77+ struct LauncherImpl ;
78+
79+ impl Launcher < OpChainSpecParser , BuilderArgs > for LauncherImpl {
80+ async fn entrypoint (
81+ self ,
82+ builder : WithLaunchContext < NodeBuilder < Arc < DatabaseEnv > , OpChainSpec > > ,
83+ builder_args : BuilderArgs ,
84+ ) -> eyre:: Result < ( ) > {
85+ let pool = OrderPool :: < Flashblocks > :: default ( ) ;
86+ let pipeline = build_pipeline ( & builder_args, & pool) ?;
87+ let opnode = OpNode :: new ( builder_args. rollup_args . clone ( ) ) ;
88+ let tx_status_rpc = TransactionStatusRpc :: new ( & pipeline) ;
89+
90+ let addons: OpAddOns <
91+ _ ,
92+ OpEthApiBuilder ,
93+ OpEngineValidatorBuilder ,
94+ OpEngineApiBuilder < OpEngineValidatorBuilder > ,
95+ > = opnode
96+ . add_ons_builder :: < types:: RpcTypes < Flashblocks > > ( )
97+ . build ( ) ;
98+
99+ let handle = builder
100+ . with_types :: < OpNode > ( )
101+ . with_components (
102+ opnode
103+ . components ( )
104+ . attach_pool ( & pool)
105+ . payload ( pipeline. into_service ( ) ) ,
106+ )
107+ . with_add_ons ( addons)
108+ . extend_rpc_modules ( move |mut rpc_ctx| {
109+ pool. attach_rpc ( & mut rpc_ctx) ?;
110+ tx_status_rpc. attach_rpc ( & mut rpc_ctx) ?;
111+ Ok ( ( ) )
112+ } )
113+ . on_node_started ( move |_ctx| {
114+ set_version_metric ( ) ;
115+ Ok ( ( ) )
116+ } )
117+ . launch ( )
118+ . await ?;
119+
120+ handle. wait_for_node_exit ( ) . await
121+ }
86122}
87123
88124fn build_pipeline (
0 commit comments