Skip to content

Commit f10ff92

Browse files
authored
fix: remove vestigial non-Flashbots things from config (#172)
* fix: mark Flashbots URL non-optional, spawn Flashbots task directly in main * fix: remove vestigial URLs to broadcast txs directly (not via Flashbots
1 parent 7600937 commit f10ff92

File tree

3 files changed

+15
-58
lines changed

3 files changed

+15
-58
lines changed

bin/builder.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use builder::{
22
config::BuilderConfig,
33
service::serve_builder,
4-
tasks::{block::sim::Simulator, cache::CacheTasks, env::EnvTask, metrics::MetricsTask},
4+
tasks::{
5+
block::sim::Simulator, cache::CacheTasks, env::EnvTask, metrics::MetricsTask,
6+
submit::FlashbotsTask,
7+
},
58
};
69
use init4_bin_base::{
710
deps::tracing::{info, info_span},
@@ -33,13 +36,12 @@ async fn main() -> eyre::Result<()> {
3336
let cache_system = cache_tasks.spawn();
3437

3538
// Set up the metrics task
36-
let metrics = MetricsTask { host_provider };
39+
let metrics = MetricsTask::new(host_provider.clone());
3740
let (tx_channel, metrics_jh) = metrics.spawn();
3841

39-
// Set up the submit task. This will be either a Flashbots task or a
40-
// BuilderHelper task depending on whether a Flashbots endpoint is
41-
// configured.
42-
let (submit_channel, submit_jh) = config.spawn_submit_task(tx_channel).await?;
42+
// Spawn the Flashbots task
43+
let submit = FlashbotsTask::new(config.clone(), tx_channel).await?;
44+
let (submit_channel, submit_jh) = submit.spawn();
4345

4446
// Set up the simulator
4547
let sim = Simulator::new(&config, ru_provider.clone(), block_env);

src/config.rs

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
use crate::{
2-
quincey::Quincey,
3-
tasks::{
4-
block::{cfg::SignetCfgEnv, sim::SimResult},
5-
submit::FlashbotsTask,
6-
},
7-
};
1+
use crate::{quincey::Quincey, tasks::block::cfg::SignetCfgEnv};
82
use alloy::{
93
network::{Ethereum, EthereumWallet},
10-
primitives::{Address, TxHash},
4+
primitives::Address,
115
providers::{
126
self, Identity, ProviderBuilder, RootProvider,
137
fillers::{
@@ -29,8 +23,7 @@ use init4_bin_base::{
2923
use signet_constants::SignetSystemConstants;
3024
use signet_zenith::Zenith;
3125
use std::borrow::Cow;
32-
use tokio::{join, sync::mpsc::UnboundedSender, task::JoinHandle};
33-
use tracing::info;
26+
use tokio::join;
3427

3528
/// Type alias for the provider used to simulate against rollup state.
3629
pub type RuProvider = RootProvider<Ethereum>;
@@ -99,25 +92,12 @@ pub struct BuilderConfig {
9992
#[from_env(var = "TX_POOL_URL", desc = "URL of the tx pool to poll for incoming transactions")]
10093
pub tx_pool_url: url::Url,
10194

102-
/// Additional RPC URLs to which the builder should broadcast transactions.
103-
/// * Should not include the `HOST_RPC_URL` value, as that is already sent to by default.
104-
/// * Setting this can incur `already known` errors.
105-
#[from_env(
106-
var = "TX_BROADCAST_URLS",
107-
desc = "Additional RPC URLs to which the builder broadcasts transactions",
108-
optional
109-
)]
110-
pub tx_broadcast_urls: Vec<Cow<'static, str>>,
111-
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.
95+
/// Configuration for the Flashbots provider to submit
96+
/// SignetBundles and Rollup blocks to the Host chain
97+
/// as private MEV bundles via Flashbots.
11798
#[from_env(
11899
var = "FLASHBOTS_ENDPOINT",
119-
desc = "Flashbots endpoint for privately submitting rollup blocks",
120-
optional
100+
desc = "Flashbots endpoint for privately submitting Signet bundles"
121101
)]
122102
pub flashbots_endpoint: Option<url::Url>,
123103

@@ -258,17 +238,6 @@ impl BuilderConfig {
258238
Ok(flashbots)
259239
}
260240

261-
/// Connect additional broadcast providers.
262-
pub fn connect_additional_broadcast(&self) -> Vec<RootProvider> {
263-
self.tx_broadcast_urls
264-
.iter()
265-
.map(|url| {
266-
let url = url.parse::<url::Url>().expect("Invalid URL in tx_broadcast_urls");
267-
RootProvider::new_http(url)
268-
})
269-
.collect::<Vec<_>>()
270-
}
271-
272241
/// Connect to the Zenith instance, using the specified provider.
273242
pub const fn connect_zenith(&self, provider: HostProvider) -> ZenithInstance {
274243
Zenith::new(self.zenith_address, provider)
@@ -323,17 +292,4 @@ impl BuilderConfig {
323292
.unwrap_or(DEFAULT_CONCURRENCY_LIMIT)
324293
})
325294
}
326-
327-
/// Spawn a submit task, either Flashbots or BuilderHelper depending on
328-
/// configuration.
329-
pub async fn spawn_submit_task(
330-
&self,
331-
tx_channel: UnboundedSender<TxHash>,
332-
) -> eyre::Result<(UnboundedSender<SimResult>, JoinHandle<()>)> {
333-
let url = self.flashbots_endpoint.as_ref().expect("flashbots endpoint must be configured");
334-
info!(url = url.as_str(), "spawning flashbots submit task");
335-
let submit = FlashbotsTask::new(self.clone(), tx_channel).await?;
336-
let (submit_channel, submit_jh) = submit.spawn();
337-
Ok((submit_channel, submit_jh))
338-
}
339295
}

src/test_utils.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub fn setup_test_config() -> Result<BuilderConfig> {
3434
.unwrap()
3535
.try_into()
3636
.unwrap(),
37-
tx_broadcast_urls: vec!["http://localhost:9000".into()],
3837
flashbots_endpoint: Some("https://relay-sepolia.flashbots.net:443".parse().unwrap()),
3938
zenith_address: Address::default(),
4039
quincey_url: "http://localhost:8080".into(),

0 commit comments

Comments
 (0)