Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions src/tasks/submit/flashbots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use alloy::{
use eyre::OptionExt;
use init4_bin_base::{deps::metrics::counter, utils::signer::LocalOrAws};
use tokio::{sync::mpsc, task::JoinHandle};
use tracing::{Instrument, debug, debug_span};
use tracing::{Instrument, debug, debug_span, error};

/// Handles preparation and submission of simulated rollup blocks to the
/// Flashbots relay as MEV bundles.
Expand Down Expand Up @@ -191,28 +191,33 @@ impl FlashbotsTask {

// Send the bundle to Flashbots, instrumenting the send future so all
// events inside the async send are attributed to the submit span.
let response = self
.flashbots()
.send_mev_bundle(bundle.clone())
.with_auth(self.signer.clone())
.into_future()
.instrument(submit_span.clone())
.await;

match response {
Ok(resp) => {
counter!("signet.builder.flashbots.bundles_submitted").increment(1);
span_debug!(
submit_span,
hash = resp.map(|r| r.bundle_hash.to_string()),
"received bundle hash after submitted to flashbots"
);
let flashbots = self.flashbots().to_owned();
let signer = self.signer.clone();

tokio::spawn(
async move {
let response = flashbots
.send_mev_bundle(bundle.clone())
.with_auth(signer.clone())
.into_future()
.await;

match response {
Ok(resp) => {
counter!("signet.builder.flashbots.bundles_submitted").increment(1);
debug!(
hash = resp.map(|r| r.bundle_hash.to_string()),
"received bundle hash after submitted to flashbots"
);
}
Err(err) => {
counter!("signet.builder.flashbots.submission_failures").increment(1);
error!(%err, "MEV bundle submission failed - error returned");
}
}
}
Err(err) => {
counter!("signet.builder.flashbots.submission_failures").increment(1);
span_error!(submit_span, %err, "MEV bundle submission failed - error returned");
}
}
.instrument(submit_span.clone()),
);
}
}

Expand Down