@@ -83,64 +83,6 @@ fn build_pipeline(
8383 cli_args : & BuilderArgs ,
8484 pool : & OrderPool < Flashblocks > ,
8585) -> eyre:: Result < Pipeline < Flashblocks > > {
86- let pipeline = if cli_args. flashblocks_args . enabled ( ) {
87- build_flashblocks_pipeline ( cli_args, pool) ?
88- } else {
89- build_classic_pipeline ( cli_args, pool)
90- } ;
91- pool. attach_pipeline ( & pipeline) ;
92-
93- Ok ( pipeline)
94- }
95-
96- /// Classic block builder
97- ///
98- /// Block building strategy that builds blocks using the classic approach by
99- /// producing one block payload per CL payload job.
100- fn build_classic_pipeline (
101- cli_args : & BuilderArgs ,
102- pool : & OrderPool < Flashblocks > ,
103- ) -> Pipeline < Flashblocks > {
104- let pipeline = if cli_args. revert_protection {
105- Pipeline :: < Flashblocks > :: named ( "classic" )
106- . with_prologue ( OptimismPrologue )
107- . with_pipeline (
108- Loop ,
109- (
110- AppendOrders :: from_pool ( pool) ,
111- OrderByPriorityFee :: default ( ) ,
112- RemoveRevertedTransactions :: default ( ) ,
113- ) ,
114- )
115- } else {
116- Pipeline :: < Flashblocks > :: named ( "classic" )
117- . with_prologue ( OptimismPrologue )
118- . with_pipeline (
119- Loop ,
120- ( AppendOrders :: from_pool ( pool) , OrderByPriorityFee :: default ( ) ) ,
121- )
122- } ;
123-
124- if let Some ( ref signer) = cli_args. builder_signer {
125- pipeline. with_epilogue (
126- BuilderEpilogue :: with_signer ( signer. clone ( ) . into ( ) )
127- . with_message ( |block| format ! ( "Block Number: {}" , block. number( ) ) ) ,
128- )
129- } else {
130- warn ! ( "BUILDER_SECRET_KEY is not specified, skipping builder transactions" ) ;
131- pipeline
132- }
133- }
134-
135- fn build_flashblocks_pipeline (
136- cli_args : & BuilderArgs ,
137- pool : & OrderPool < Flashblocks > ,
138- ) -> eyre:: Result < Pipeline < Flashblocks > > {
139- let socket_address = cli_args
140- . flashblocks_args
141- . ws_address ( )
142- . expect ( "WebSocket address must be set for Flashblocks" ) ;
143-
14486 // how often a flashblock is published
14587 let interval = cli_args. flashblocks_args . interval ;
14688
@@ -152,7 +94,7 @@ fn build_flashblocks_pipeline(
15294 // building and the payload job deadline that is given by the CL.
15395 let total_building_time = Minus ( leeway_time) ;
15496
155- let ws = Arc :: new ( WebSocketSink :: new ( socket_address ) ?) ;
97+ let ws = Arc :: new ( WebSocketSink :: new ( cli_args . flashblocks_args . ws_address ) ?) ;
15698
15799 let flashblock_building_pipeline_steps = (
158100 AppendOrders :: from_pool ( pool) . with_ok_on_limit ( ) ,
@@ -208,7 +150,9 @@ fn build_flashblocks_pipeline(
208150 . with_step ( BreakAfterMaxFlashblocks :: new ( flashblock_number) ) ,
209151 )
210152 . with_limits ( Scaled :: default ( ) . deadline ( total_building_time) ) ;
153+
211154 ws. watch_shutdown ( & pipeline) ;
155+ pool. attach_pipeline ( & pipeline) ;
212156
213157 Ok ( pipeline)
214158}
0 commit comments