Skip to content

Commit 9e26d1c

Browse files
authored
feat: span flashbots so we can check timings (#200)
1 parent abecdb6 commit 9e26d1c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/tasks/submit/flashbots.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use alloy::{
1414
use eyre::OptionExt;
1515
use init4_bin_base::{deps::metrics::counter, utils::signer::LocalOrAws};
1616
use tokio::{sync::mpsc, task::JoinHandle};
17-
use tracing::{Instrument, debug, debug_span, error};
17+
use tracing::{Instrument, debug, debug_span, error, instrument};
1818

1919
/// Handles preparation and submission of simulated rollup blocks to the
2020
/// Flashbots relay as MEV bundles.
@@ -69,6 +69,7 @@ impl FlashbotsTask {
6969
/// 2. Tracking the transaction hash for monitoring
7070
/// 3. Encoding the transaction for bundle inclusion
7171
/// 4. Constructing the complete bundle body
72+
#[instrument(skip_all, level = "debug")]
7273
async fn prepare_bundle(&self, sim_result: &SimResult) -> eyre::Result<MevSendBundle> {
7374
// Prepare and sign the transaction
7475
let block_tx = self.prepare_signed_transaction(sim_result).await?;
@@ -95,6 +96,7 @@ impl FlashbotsTask {
9596
///
9697
/// Creates a `SubmitPrep` instance to build the transaction, then fills
9798
/// and signs it using the host provider.
99+
#[instrument(skip_all, level = "debug")]
98100
async fn prepare_signed_transaction(
99101
&self,
100102
sim_result: &SimResult,
@@ -107,7 +109,11 @@ impl FlashbotsTask {
107109
);
108110

109111
let tx = prep.prep_transaction(sim_result.prev_host()).await?;
110-
let sendable = self.host_provider().fill(tx.into_request()).await?;
112+
let sendable = self
113+
.host_provider()
114+
.fill(tx.into_request())
115+
.instrument(tracing::debug_span!("fill_tx").or_current())
116+
.await?;
111117

112118
sendable.as_envelope().ok_or_eyre("failed to get envelope from filled tx").cloned()
113119
}
@@ -159,7 +165,7 @@ impl FlashbotsTask {
159165
break;
160166
};
161167

162-
let span = sim_result.sim_env.clone_span();
168+
let span = sim_result.clone_span();
163169

164170
// Don't submit empty blocks
165171
if sim_result.block.is_empty() {

src/tasks/submit/prep.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use init4_bin_base::deps::metrics::counter;
1515
use signet_sim::BuiltBlock;
1616
use signet_types::{SignRequest, SignResponse};
1717
use signet_zenith::Zenith;
18-
use tracing::{Instrument, debug};
18+
use tracing::{Instrument, debug, instrument};
1919

2020
/// Preparation logic for transactions issued to the host chain by the
2121
/// [`SubmitTask`].
@@ -129,6 +129,7 @@ impl<'a> SubmitPrep<'a> {
129129
}
130130

131131
/// Prepares a transaction for submission to the host chain.
132+
#[instrument(skip_all, level = "debug")]
132133
pub async fn prep_transaction(self, prev_host: &Header) -> eyre::Result<Bumpable> {
133134
let req = self.new_tx_request().in_current_span().await?;
134135
Ok(Bumpable::new(req, prev_host))

0 commit comments

Comments
 (0)