@@ -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
@@ -69,7 +69,7 @@ impl FlashbotsTask {
6969 /// 2. Tracking the transaction hash for monitoring
7070 /// 3. Encoding the transaction for bundle inclusion
7171 /// 4. Constructing the complete bundle body
72- async fn prepare_bundle ( & self , sim_result : & SimResult ) -> eyre:: Result < MevSendBundle > {
72+ async fn prepare_bundle ( & self , sim_result : & SimResult ) -> eyre:: Result < EthSendBundle > {
7373 // Prepare and sign the transaction
7474 let block_tx = self . prepare_signed_transaction ( sim_result) . await ?;
7575
@@ -80,15 +80,15 @@ impl FlashbotsTask {
8080 let tx_bytes = block_tx. encoded_2718 ( ) . into ( ) ;
8181
8282 // Build the bundle body with the block_tx bytes as the last transaction in the bundle.
83- let bundle_body = self . build_bundle_body ( sim_result, tx_bytes) ;
83+ let txs = self . build_bundle_body ( sim_result, tx_bytes) ;
8484
8585 // Create the MEV bundle (valid only in the specific host block)
86- Ok ( MevSendBundle :: new (
87- sim_result . host_block_number ( ) ,
88- Some ( sim_result . host_block_number ( ) ) ,
89- ProtocolVersion :: V0_1 ,
90- bundle_body ,
91- ) )
86+
87+ Ok ( EthSendBundle {
88+ txs ,
89+ block_number : sim_result . host_block_number ( ) ,
90+ .. Default :: default ( )
91+ } )
9292 }
9393
9494 /// Prepares and signs the submission transaction for the rollup block.
@@ -134,14 +134,13 @@ impl FlashbotsTask {
134134 & self ,
135135 sim_result : & SimResult ,
136136 tx_bytes : alloy:: primitives:: Bytes ,
137- ) -> Vec < BundleItem > {
137+ ) -> Vec < Bytes > {
138138 sim_result
139139 . block
140140 . host_transactions ( )
141141 . iter ( )
142142 . cloned ( )
143143 . chain ( std:: iter:: once ( tx_bytes) )
144- . map ( |tx| BundleItem :: Tx { tx, can_revert : false } )
145144 . collect ( )
146145 }
147146
@@ -170,25 +169,21 @@ impl FlashbotsTask {
170169 span_debug ! ( span, "flashbots task received block" ) ;
171170
172171 // Prepare a MEV bundle with the configured call type from the sim result
173- let result =
174- self . prepare ( & sim_result) . instrument ( span. clone ( ) ) . await . inspect_err ( |error| {
175- counter ! ( "signet.builder.flashbots.bundle_prep_failures" ) . increment ( 1 ) ;
176- span_debug ! ( span, %error, "bundle preparation failed" ) ;
177- } ) ;
172+ let result = self . prepare ( & sim_result) . instrument ( span. clone ( ) ) . await ;
178173
179174 let bundle = match result {
180175 Ok ( bundle) => bundle,
181- Err ( _) => continue ,
176+ Err ( error) => {
177+ counter ! ( "signet.builder.flashbots.bundle_prep_failures" ) . increment ( 1 ) ;
178+ span_debug ! ( span, %error, "bundle preparation failed" ) ;
179+ continue ;
180+ }
182181 } ;
183182
184183 // Make a child span to cover submission, or use the current span
185184 // if debug is not enabled.
186185 let _guard = span. enter ( ) ;
187- let submit_span = debug_span ! (
188- parent: & span,
189- "flashbots.submit" ,
190- )
191- . or_current ( ) ;
186+ let submit_span = debug_span ! ( "flashbots.submit" , ) . or_current ( ) ;
192187
193188 // Send the bundle to Flashbots, instrumenting the send future so
194189 // all events inside the async send are attributed to the submit
@@ -198,11 +193,8 @@ impl FlashbotsTask {
198193
199194 tokio:: spawn (
200195 async move {
201- let response = flashbots
202- . send_mev_bundle ( bundle. clone ( ) )
203- . with_auth ( signer. clone ( ) )
204- . into_future ( )
205- . await ;
196+ let response =
197+ flashbots. send_bundle ( bundle) . with_auth ( signer. clone ( ) ) . into_future ( ) . await ;
206198
207199 match response {
208200 Ok ( resp) => {
0 commit comments