diff --git a/Cargo.lock b/Cargo.lock index 8169b75..16ad714 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3309,7 +3309,6 @@ dependencies = [ "reqwest", "rustls 0.23.32", "serde", - "serde_json", "signet-constants", "signet-tx-cache", "thiserror 2.0.17", diff --git a/Cargo.toml b/Cargo.toml index 20fdc99..d472d97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ name = "zenith-builder-example" path = "bin/builder.rs" [dependencies] -init4-bin-base = { version = "0.13.1", features = ["perms", "aws", "flashbots"] } +init4-bin-base = { version = "0.13.1", features = ["perms", "aws" ] } signet-constants = { version = "0.11.2" } signet-sim = { version = "0.11.2" } diff --git a/src/config.rs b/src/config.rs index badf5fb..5f5b51e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -21,7 +21,6 @@ use init4_bin_base::{ perms::{Authenticator, OAuthConfig, SharedToken}, utils::{ calc::SlotCalculator, - flashbots::Flashbots, from_env::FromEnv, provider::{ProviderConfig, PubSubConfig}, signer::{LocalOrAws, SignerError}, @@ -110,8 +109,17 @@ pub struct BuilderConfig { )] pub tx_broadcast_urls: Vec>, - /// Flashbots configuration for privately submitting rollup blocks. - pub flashbots: init4_bin_base::utils::flashbots::FlashbotsConfig, + /// Configuration for the Flashbots provider. + /// * If set, the builder will submit blocks as MEV bundles to Flashbots instead of + /// submitting them directly to the Host chain. + /// * If not set, the builder defaults to submitting blocks directly to the Host chain + /// using the Builder Helper contract. + #[from_env( + var = "FLASHBOTS_ENDPOINT", + desc = "Flashbots endpoint for privately submitting rollup blocks", + optional + )] + pub flashbots_endpoint: Option, /// Address of the Zenith contract on Host. #[from_env(var = "ZENITH_ADDRESS", desc = "address of the Zenith contract on Host")] @@ -235,31 +243,13 @@ impl BuilderConfig { .connect_provider(provider?)) } - /// Connect to a Flashbots bundle provider + /// Connect to a Flashbots bundle provider. pub async fn connect_flashbots( &self, config: &BuilderConfig, - ) -> Result< - FillProvider< - JoinFill< - JoinFill< - Identity, - JoinFill< - GasFiller, - JoinFill>, - >, - >, - WalletFiller, - >, - providers::RootProvider, - >, - eyre::Error, - > { - let endpoint = config - .clone() - .flashbots - .flashbots_endpoint - .expect("flashbots endpoint must be configured"); + ) -> Result { + let endpoint = + config.clone().flashbots_endpoint.expect("flashbots endpoint must be configured"); let signer = config.connect_builder_signer().await?; let flashbots: FlashbotsProvider = ProviderBuilder::new().wallet(signer).connect_http(endpoint); @@ -332,13 +322,6 @@ impl BuilderConfig { }) } - /// Connect to a Flashbots provider. - pub async fn flashbots_provider(&self) -> eyre::Result { - self.flashbots - .build(self.connect_builder_signer().await?) - .ok_or_else(|| eyre::eyre!("Flashbots is not configured")) - } - /// Spawn a submit task, either Flashbots or BuilderHelper depending on /// configuration. pub async fn spawn_submit_task( @@ -346,7 +329,7 @@ impl BuilderConfig { tx_channel: UnboundedSender, ) -> eyre::Result<(UnboundedSender, JoinHandle<()>)> { // If we have a flashbots endpoint, use that - if self.flashbots.flashbots_endpoint.is_some() { + if self.flashbots_endpoint.is_some() { debug!("spawning flashbots submit task"); // Make a Flashbots submission task let submit = FlashbotsTask::new(self.clone(), tx_channel).await?; diff --git a/src/test_utils.rs b/src/test_utils.rs index ca3d7cc..c9684d9 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -12,7 +12,7 @@ use init4_bin_base::{ EnvFilter, Layer, fmt, layer::SubscriberExt, registry, util::SubscriberInitExt, }, perms::OAuthConfig, - utils::{calc::SlotCalculator, flashbots::FlashbotsConfig, provider::ProviderConfig}, + utils::{calc::SlotCalculator, provider::ProviderConfig}, }; use signet_constants::SignetSystemConstants; use std::env; @@ -35,9 +35,7 @@ pub fn setup_test_config() -> Result { .try_into() .unwrap(), tx_broadcast_urls: vec!["http://localhost:9000".into()], - flashbots: FlashbotsConfig { - flashbots_endpoint: Some("https://relay-sepolia.flashbots.net:443".parse().unwrap()), - }, // NB: Flashbots API default + flashbots_endpoint: Some("https://relay-sepolia.flashbots.net:443".parse().unwrap()), zenith_address: Address::default(), quincey_url: "http://localhost:8080".into(), sequencer_key: None,