diff --git a/src/tasks/cache/bundle.rs b/src/tasks/cache/bundle.rs index b27c568..85f006d 100644 --- a/src/tasks/cache/bundle.rs +++ b/src/tasks/cache/bundle.rs @@ -1,5 +1,6 @@ //! Bundler service responsible for fetching bundles and sending them to the simulator. use crate::config::BuilderConfig; +use alloy::{consensus::TxEnvelope, eips::eip2718::Decodable2718}; use init4_bin_base::perms::SharedToken; use reqwest::{Client, Url}; use signet_tx_cache::types::{TxCacheBundle, TxCacheBundlesResponse}; @@ -94,6 +95,9 @@ impl BundlePoller { let _guard = span.entered(); debug!(count = ?bundles.len(), "found bundles"); for bundle in bundles.into_iter() { + + decode_and_log_host_transactions(&bundle); + if let Err(err) = outbound.send(bundle) { error!(err = ?err, "Failed to send bundle - channel is dropped"); break; @@ -114,3 +118,29 @@ impl BundlePoller { (inbound, jh) } } + +fn decode_and_log_host_transactions(bundle: &TxCacheBundle) { + for (idx, bz) in bundle.bundle().host_txs.iter().enumerate() { + // Best-effort decode so we can surface the transaction type in logs. + let mut raw = bz.as_ref(); + match TxEnvelope::decode_2718(&mut raw) { + Ok(envelope) => { + trace!( + bundle_id = %bundle.id(), + host_tx_idx = idx, + tx_type = ?envelope.tx_type(), + leftover_bytes = raw.len(), + "decoded host transaction as eip-2718" + ); + } + Err(err) => { + debug!( + bundle_id = %bundle.id(), + host_tx_idx = idx, + err = %err, + "failed to decode host transaction as eip-2718" + ); + } + } + } +} diff --git a/src/tasks/env.rs b/src/tasks/env.rs index 91014e1..696deef 100644 --- a/src/tasks/env.rs +++ b/src/tasks/env.rs @@ -14,7 +14,7 @@ use signet_constants::SignetSystemConstants; use signet_sim::{HostEnv, RollupEnv}; use tokio::{sync::watch, task::JoinHandle}; use tokio_stream::StreamExt; -use tracing::{Instrument, Span, info_span}; +use tracing::{Instrument, Span, info_span, instrument}; use trevm::revm::{ context::BlockEnv, context_interface::block::BlobExcessGasAndPrice, @@ -138,6 +138,7 @@ impl SimEnv { /// # Panics /// /// This function will panic if not called within a Tokio runtime. + #[instrument(skip(self, provider), fields(rollup_block_number = %self.prev_rollup_block_number()))] pub fn rollup_db(&self, provider: RuProvider) -> RollupAlloyDatabaseProvider { WrapDatabaseAsync::new(self.rollup.alloy_db(provider)).expect("in tokio runtime") } @@ -147,6 +148,7 @@ impl SimEnv { /// # Panics /// /// This function will panic if not called within a Tokio runtime. + #[instrument(skip(self, provider), fields(host_block_number = %self.prev_host_block_number()))] pub fn host_db(&self, provider: HostProvider) -> HostAlloyDatabaseProvider { WrapDatabaseAsync::new(self.host.alloy_db(provider)).expect("in tokio runtime") } @@ -215,6 +217,7 @@ impl EnvTask { } /// Construct a [`BlockEnv`] for the next host block from the previous host header. + #[instrument(skip(self, previous), fields(previous_number = %previous.number))] fn construct_host_env(&self, previous: Header) -> Environment { let env = BlockEnv { number: U256::from(previous.number + 1), @@ -236,6 +239,7 @@ impl EnvTask { } /// Construct a [`BlockEnv`] for the next rollup block from the previous block header. + #[instrument(skip(self, previous), fields(previous_number = %previous.number))] fn construct_rollup_env(&self, previous: Header) -> Environment { let env = BlockEnv { number: U256::from(previous.number + 1), diff --git a/src/tasks/submit/flashbots.rs b/src/tasks/submit/flashbots.rs index 5002e6e..952f116 100644 --- a/src/tasks/submit/flashbots.rs +++ b/src/tasks/submit/flashbots.rs @@ -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, instrument}; /// Handles preparation and submission of simulated rollup blocks to the /// Flashbots relay as MEV bundles. @@ -95,6 +95,7 @@ impl FlashbotsTask { /// /// Creates a `SubmitPrep` instance to build the transaction, then fills /// and signs it using the host provider. + #[instrument(skip(self, sim_result), fields(sim_result_block_number = ?sim_result.block, sim_result_host_block_number = %sim_result.host_block_number()))] async fn prepare_signed_transaction( &self, sim_result: &SimResult,