Skip to content

Commit 52152d7

Browse files
authored
chore: removes bin-base flashbots dependency (#160)
chore: removes bin-base flashbots dependency Removes the `bin-base`​ implementation of `flashbots`​ in favor of `alloy`​. Related to [ENG-1415](https://linear.app/initiates/issue/ENG-1415/remove-the-bin-base-implementation-of-flashbots)
1 parent 9fac4e0 commit 52152d7

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

β€ŽCargo.lockβ€Ž

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€ŽCargo.tomlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ name = "zenith-builder-example"
1818
path = "bin/builder.rs"
1919

2020
[dependencies]
21-
init4-bin-base = { version = "0.13.1", features = ["perms", "aws", "flashbots"] }
21+
init4-bin-base = { version = "0.13.1", features = ["perms", "aws" ] }
2222

2323
signet-constants = { version = "0.11.2" }
2424
signet-sim = { version = "0.11.2" }

β€Žsrc/config.rsβ€Ž

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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?;

β€Žsrc/test_utils.rsβ€Ž

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use init4_bin_base::{
1212
EnvFilter, Layer, fmt, layer::SubscriberExt, registry, util::SubscriberInitExt,
1313
},
1414
perms::OAuthConfig,
15-
utils::{calc::SlotCalculator, flashbots::FlashbotsConfig, provider::ProviderConfig},
15+
utils::{calc::SlotCalculator, provider::ProviderConfig},
1616
};
1717
use signet_constants::SignetSystemConstants;
1818
use std::env;
@@ -35,9 +35,7 @@ pub fn setup_test_config() -> Result<BuilderConfig> {
3535
.try_into()
3636
.unwrap(),
3737
tx_broadcast_urls: vec!["http://localhost:9000".into()],
38-
flashbots: FlashbotsConfig {
39-
flashbots_endpoint: Some("https://relay-sepolia.flashbots.net:443".parse().unwrap()),
40-
}, // NB: Flashbots API default
38+
flashbots_endpoint: Some("https://relay-sepolia.flashbots.net:443".parse().unwrap()),
4139
zenith_address: Address::default(),
4240
quincey_url: "http://localhost:8080".into(),
4341
sequencer_key: None,

0 commit comments

Comments
Β (0)