@@ -7,9 +7,9 @@ use crate::{
77} ;
88use alloy:: {
99 eips:: Encodable2718 ,
10- primitives:: TxHash ,
10+ primitives:: { Bytes , TxHash } ,
1111 providers:: ext:: MevApi ,
12- rpc:: types:: mev:: { BundleItem , MevSendBundle , ProtocolVersion } ,
12+ rpc:: types:: mev:: EthSendBundle ,
1313} ;
1414use eyre:: OptionExt ;
1515use init4_bin_base:: { deps:: metrics:: counter, utils:: signer:: LocalOrAws } ;
@@ -56,7 +56,7 @@ impl FlashbotsTask {
5656 ///
5757 /// This function serves as an entry point for bundle preparation and is left
5858 /// for forward compatibility when adding different bundle preparation methods.
59- pub async fn prepare ( & self , sim_result : & SimResult ) -> eyre:: Result < MevSendBundle > {
59+ pub async fn prepare ( & self , sim_result : & SimResult ) -> eyre:: Result < EthSendBundle > {
6060 // This function is left for forwards compatibility when we want to add
6161 // different bundle preparation methods in the future.
6262 self . prepare_bundle ( sim_result) . await
@@ -70,7 +70,7 @@ impl FlashbotsTask {
7070 /// 3. Encoding the transaction for bundle inclusion
7171 /// 4. Constructing the complete bundle body
7272 #[ instrument( skip_all, level = "debug" ) ]
73- async fn prepare_bundle ( & self , sim_result : & SimResult ) -> eyre:: Result < MevSendBundle > {
73+ async fn prepare_bundle ( & self , sim_result : & SimResult ) -> eyre:: Result < EthSendBundle > {
7474 // Prepare and sign the transaction
7575 let block_tx = self . prepare_signed_transaction ( sim_result) . await ?;
7676
@@ -81,15 +81,15 @@ impl FlashbotsTask {
8181 let tx_bytes = block_tx. encoded_2718 ( ) . into ( ) ;
8282
8383 // Build the bundle body with the block_tx bytes as the last transaction in the bundle.
84- let bundle_body = self . build_bundle_body ( sim_result, tx_bytes) ;
84+ let txs = self . build_bundle_body ( sim_result, tx_bytes) ;
8585
8686 // Create the MEV bundle (valid only in the specific host block)
87- Ok ( MevSendBundle :: new (
88- sim_result . host_block_number ( ) ,
89- Some ( sim_result . host_block_number ( ) ) ,
90- ProtocolVersion :: V0_1 ,
91- bundle_body ,
92- ) )
87+
88+ Ok ( EthSendBundle {
89+ txs ,
90+ block_number : sim_result . host_block_number ( ) ,
91+ .. Default :: default ( )
92+ } )
9393 }
9494
9595 /// Prepares and signs the submission transaction for the rollup block.
@@ -140,14 +140,13 @@ impl FlashbotsTask {
140140 & self ,
141141 sim_result : & SimResult ,
142142 tx_bytes : alloy:: primitives:: Bytes ,
143- ) -> Vec < BundleItem > {
143+ ) -> Vec < Bytes > {
144144 sim_result
145145 . block
146146 . host_transactions ( )
147147 . iter ( )
148148 . cloned ( )
149149 . chain ( std:: iter:: once ( tx_bytes) )
150- . map ( |tx| BundleItem :: Tx { tx, can_revert : false } )
151150 . collect ( )
152151 }
153152
@@ -176,25 +175,21 @@ impl FlashbotsTask {
176175 span_debug ! ( span, "flashbots task received block" ) ;
177176
178177 // Prepare a MEV bundle with the configured call type from the sim result
179- let result =
180- self . prepare ( & sim_result) . instrument ( span. clone ( ) ) . await . inspect_err ( |error| {
181- counter ! ( "signet.builder.flashbots.bundle_prep_failures" ) . increment ( 1 ) ;
182- span_debug ! ( span, %error, "bundle preparation failed" ) ;
183- } ) ;
178+ let result = self . prepare ( & sim_result) . instrument ( span. clone ( ) ) . await ;
184179
185180 let bundle = match result {
186181 Ok ( bundle) => bundle,
187- Err ( _) => continue ,
182+ Err ( error) => {
183+ counter ! ( "signet.builder.flashbots.bundle_prep_failures" ) . increment ( 1 ) ;
184+ span_debug ! ( span, %error, "bundle preparation failed" ) ;
185+ continue ;
186+ }
188187 } ;
189188
190189 // Make a child span to cover submission, or use the current span
191190 // if debug is not enabled.
192191 let _guard = span. enter ( ) ;
193- let submit_span = debug_span ! (
194- parent: & span,
195- "flashbots.submit" ,
196- )
197- . or_current ( ) ;
192+ let submit_span = debug_span ! ( "flashbots.submit" , ) . or_current ( ) ;
198193
199194 // Send the bundle to Flashbots, instrumenting the send future so
200195 // all events inside the async send are attributed to the submit
@@ -204,11 +199,8 @@ impl FlashbotsTask {
204199
205200 tokio:: spawn (
206201 async move {
207- let response = flashbots
208- . send_mev_bundle ( bundle. clone ( ) )
209- . with_auth ( signer. clone ( ) )
210- . into_future ( )
211- . await ;
202+ let response =
203+ flashbots. send_bundle ( bundle) . with_auth ( signer. clone ( ) ) . into_future ( ) . await ;
212204
213205 match response {
214206 Ok ( resp) => {
0 commit comments