From 1407629b4c11a593c08acbd218e1b284ba30ae43 Mon Sep 17 00:00:00 2001 From: evalir Date: Thu, 24 Jul 2025 17:19:42 -0400 Subject: [PATCH] chore: misc improvements --- src/tasks/cache/bundle.rs | 10 +++++++++- src/tasks/cache/tx.rs | 5 ++++- src/tasks/env.rs | 2 +- src/tasks/metrics.rs | 6 +++--- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/tasks/cache/bundle.rs b/src/tasks/cache/bundle.rs index e9dfe76e..9f3e8840 100644 --- a/src/tasks/cache/bundle.rs +++ b/src/tasks/cache/bundle.rs @@ -12,6 +12,9 @@ use tokio::{ time::{self, Duration}, }; +/// Poll interval for the bundle poller in milliseconds. +const POLL_INTERVAL_MS: u64 = 1000; + /// The BundlePoller polls the tx-pool for bundles. #[derive(Debug)] pub struct BundlePoller { @@ -29,7 +32,12 @@ pub struct BundlePoller { impl BundlePoller { /// Creates a new BundlePoller from the provided builder config. pub fn new(config: &BuilderConfig, token: SharedToken) -> Self { - Self { config: config.clone(), token, client: Client::new(), poll_interval_ms: 1000 } + Self { + config: config.clone(), + token, + client: Client::new(), + poll_interval_ms: POLL_INTERVAL_MS, + } } /// Creates a new BundlePoller from the provided builder config and with the specified poll interval in ms. diff --git a/src/tasks/cache/tx.rs b/src/tasks/cache/tx.rs index d86dbb17..e7b1cc02 100644 --- a/src/tasks/cache/tx.rs +++ b/src/tasks/cache/tx.rs @@ -8,6 +8,9 @@ use serde::{Deserialize, Serialize}; use std::time::Duration; use tokio::{sync::mpsc, task::JoinHandle, time}; +/// Poll interval for the transaction poller in milliseconds. +const POLL_INTERVAL_MS: u64 = 1000; + /// Models a response from the transaction pool. #[derive(Debug, Clone, Serialize, Deserialize)] struct TxPoolResponse { @@ -32,7 +35,7 @@ impl TxPoller { /// Returns a new [`TxPoller`] with the given config. /// * Defaults to 1000ms poll interval (1s). pub fn new(config: &BuilderConfig) -> Self { - Self { config: config.clone(), client: Client::new(), poll_interval_ms: 1000 } + Self { config: config.clone(), client: Client::new(), poll_interval_ms: POLL_INTERVAL_MS } } /// Returns a new [`TxPoller`] with the given config and cache polling interval in milliseconds. diff --git a/src/tasks/env.rs b/src/tasks/env.rs index 023cc8fc..b1327cd0 100644 --- a/src/tasks/env.rs +++ b/src/tasks/env.rs @@ -90,7 +90,7 @@ impl EnvTask { Some(value) => value, None => { // If we failed to get the rollup header, we skip this iteration. - debug!(%block_hash, "failed to get rollup header - continuint to next block"); + debug!(%block_hash, "failed to get rollup header - continuing to next block"); continue; } }; diff --git a/src/tasks/metrics.rs b/src/tasks/metrics.rs index 8d099ec3..0118c967 100644 --- a/src/tasks/metrics.rs +++ b/src/tasks/metrics.rs @@ -53,11 +53,11 @@ impl MetricsTask { // log whether the transaction reverted if receipt.status() { - counter!("metrics.tx_reverted").increment(1); - debug!("tx reverted"); - } else { counter!("metrics.tx_succeeded").increment(1); debug!("tx succeeded"); + } else { + counter!("metrics.tx_reverted").increment(1); + debug!("tx reverted"); } } Err(PendingTransactionError::TxWatcher(WatchTxError::Timeout)) => {