Skip to content

Commit face94b

Browse files
committed
decode and log host transactions
1 parent cda3f06 commit face94b

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/tasks/cache/bundle.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Bundler service responsible for fetching bundles and sending them to the simulator.
22
use crate::config::BuilderConfig;
3+
use alloy::{consensus::TxEnvelope, eips::eip2718::Decodable2718};
34
use init4_bin_base::perms::SharedToken;
45
use reqwest::{Client, Url};
56
use signet_tx_cache::types::{TxCacheBundle, TxCacheBundlesResponse};
@@ -94,6 +95,9 @@ impl BundlePoller {
9495
let _guard = span.entered();
9596
debug!(count = ?bundles.len(), "found bundles");
9697
for bundle in bundles.into_iter() {
98+
99+
decode_and_log_host_transactions(&bundle);
100+
97101
if let Err(err) = outbound.send(bundle) {
98102
error!(err = ?err, "Failed to send bundle - channel is dropped");
99103
break;
@@ -114,3 +118,29 @@ impl BundlePoller {
114118
(inbound, jh)
115119
}
116120
}
121+
122+
fn decode_and_log_host_transactions(bundle: &TxCacheBundle) {
123+
for (idx, bz) in bundle.bundle().host_txs.iter().enumerate() {
124+
// Best-effort decode so we can surface the transaction type in logs.
125+
let mut raw = bz.as_ref();
126+
match TxEnvelope::decode_2718(&mut raw) {
127+
Ok(envelope) => {
128+
trace!(
129+
bundle_id = %bundle.id(),
130+
host_tx_idx = idx,
131+
tx_type = ?envelope.tx_type(),
132+
leftover_bytes = raw.len(),
133+
"decoded host transaction as eip-2718"
134+
);
135+
}
136+
Err(err) => {
137+
debug!(
138+
bundle_id = %bundle.id(),
139+
host_tx_idx = idx,
140+
err = %err,
141+
"failed to decode host transaction as eip-2718"
142+
);
143+
}
144+
}
145+
}
146+
}

src/tasks/submit/flashbots.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl FlashbotsTask {
9595
///
9696
/// Creates a `SubmitPrep` instance to build the transaction, then fills
9797
/// and signs it using the host provider.
98-
#[instrument(skip(self), fields(sim_result_block_number = ?sim_result.block, sim_result_host_block_number = %sim_result.host_block_number()))]
98+
#[instrument(skip(self, sim_result), fields(sim_result_block_number = ?sim_result.block, sim_result_host_block_number = %sim_result.host_block_number()))]
9999
async fn prepare_signed_transaction(
100100
&self,
101101
sim_result: &SimResult,

0 commit comments

Comments
 (0)