@@ -21,7 +21,6 @@ use init4_bin_base::{
2121 perms:: { Authenticator , OAuthConfig , SharedToken } ,
2222 utils:: {
2323 calc:: SlotCalculator ,
24- flashbots:: Flashbots ,
2524 from_env:: FromEnv ,
2625 provider:: { ProviderConfig , PubSubConfig } ,
2726 signer:: LocalOrAws ,
@@ -110,8 +109,17 @@ pub struct BuilderConfig {
110109 ) ]
111110 pub tx_broadcast_urls : Vec < Cow < ' static , str > > ,
112111
113- /// Flashbots configuration for privately submitting rollup blocks.
114- pub flashbots : init4_bin_base:: utils:: flashbots:: FlashbotsConfig ,
112+ /// Configuration for the Flashbots provider.
113+ /// * If set, the builder will submit blocks as MEV bundles to Flashbots instead of
114+ /// submitting them directly to the Host chain.
115+ /// * If not set, the builder defaults to submitting blocks directly to the Host chain
116+ /// using the Builder Helper contract.
117+ #[ from_env(
118+ var = "FLASHBOTS_ENDPOINT" ,
119+ desc = "Flashbots endpoint for privately submitting rollup blocks" ,
120+ optional
121+ ) ]
122+ pub flashbots_endpoint : Option < url:: Url > ,
115123
116124 /// Address of the Zenith contract on Host.
117125 #[ from_env( var = "ZENITH_ADDRESS" , desc = "address of the Zenith contract on Host" ) ]
@@ -236,16 +244,13 @@ impl BuilderConfig {
236244 . connect_provider ( provider?) )
237245 }
238246
239- /// Connect to a Flashbots bundle provider
247+ /// Connect to a Flashbots bundle provider.
240248 pub async fn connect_flashbots (
241249 & self ,
242250 config : & BuilderConfig ,
243251 ) -> Result < FlashbotsProvider , eyre:: Error > {
244- let endpoint = config
245- . flashbots
246- . flashbots_endpoint
247- . clone ( )
248- . expect ( "flashbots endpoint must be configured" ) ;
252+ let endpoint =
253+ config. flashbots_endpoint . clone ( ) . expect ( "flashbots endpoint must be configured" ) ;
249254 let signer = config. connect_builder_signer ( ) . await ?;
250255 let flashbots: FlashbotsProvider =
251256 ProviderBuilder :: new ( ) . wallet ( signer) . connect_http ( endpoint) ;
@@ -318,20 +323,13 @@ impl BuilderConfig {
318323 } )
319324 }
320325
321- /// Connect to a Flashbots provider.
322- pub async fn flashbots_provider ( & self ) -> eyre:: Result < Flashbots > {
323- self . flashbots
324- . build ( self . connect_builder_signer ( ) . await ?)
325- . ok_or_else ( || eyre:: eyre!( "Flashbots is not configured" ) )
326- }
327-
328326 /// Spawn a submit task, either Flashbots or BuilderHelper depending on
329327 /// configuration.
330328 pub async fn spawn_submit_task (
331329 & self ,
332330 tx_channel : UnboundedSender < TxHash > ,
333331 ) -> eyre:: Result < ( UnboundedSender < SimResult > , JoinHandle < ( ) > ) > {
334- match & self . flashbots . flashbots_endpoint {
332+ match & self . flashbots_endpoint {
335333 Some ( url) => {
336334 info ! ( url = url. as_str( ) , "spawning flashbots submit task" ) ;
337335 let submit = FlashbotsTask :: new ( self . clone ( ) , tx_channel) . await ?;
0 commit comments