Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion crates/op-rbuilder/src/builders/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ impl OpPayloadBuilderCtx {
let mut num_txs_simulated = 0;
let mut num_txs_simulated_success = 0;
let mut num_txs_simulated_fail = 0;
let mut num_bundles_reverted = 0;
let base_fee = self.base_fee();
let tx_da_limit = self.da_config.max_da_tx_size();
let mut evm = self.evm_config.evm_with_env(&mut *db, self.evm_env.clone());
Expand Down Expand Up @@ -369,8 +370,9 @@ impl OpPayloadBuilderCtx {
// - the transaction comes from a bundle (is_some) and the hash **is not** in reverted hashes
// Note that we need to use the Option to signal whether the transaction comes from a bundle,
// otherwise, we would exclude all transactions that are not in the reverted hashes.
let is_bundle_tx = reverted_hashes.is_some();
let exclude_reverting_txs =
reverted_hashes.is_some() && !reverted_hashes.unwrap().contains(&tx_hash);
is_bundle_tx && !reverted_hashes.unwrap().contains(&tx_hash);

let log_txn = |result: TxnExecutionResult| {
debug!(
Expand Down Expand Up @@ -469,6 +471,9 @@ impl OpPayloadBuilderCtx {
num_txs_simulated_success += 1;
} else {
num_txs_simulated_fail += 1;
if is_bundle_tx {
num_bundles_reverted += 1;
}
if exclude_reverting_txs {
log_txn(TxnExecutionResult::RevertedAndExcluded);
info!(target: "payload_builder", tx_hash = ?tx.tx_hash(), "skipping reverted transaction");
Expand Down Expand Up @@ -525,13 +530,17 @@ impl OpPayloadBuilderCtx {
self.metrics
.payload_num_tx_simulated_fail
.record(num_txs_simulated_fail as f64);
self.metrics
.bundles_reverted
.record(num_bundles_reverted as f64);

debug!(
target: "payload_builder",
message = "Completed executing best transactions",
txs_executed = num_txs_considered,
txs_applied = num_txs_simulated_success,
txs_rejected = num_txs_simulated_fail,
bundles_reverted = num_bundles_reverted,
);
Ok(None)
}
Expand Down
2 changes: 2 additions & 0 deletions crates/op-rbuilder/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ pub struct OpRBuilderMetrics {
pub da_tx_size_limit: Gauge,
/// Number of valid bundles received at the eth_sendBundle endpoint
pub bundles_received: Counter,
/// Number of reverted bundles
pub bundles_reverted: Histogram,
}

/// Contains version information for the application.
Expand Down
Loading