Skip to content

chore: misc improvements #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion src/tasks/cache/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion src/tasks/cache/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why not an env var? If we changed it once here, it seems likely we'll want/need to change it again in the future, so it would likely be useful to have this as an optional env var instead of a hardcoded value.


/// Models a response from the transaction pool.
#[derive(Debug, Clone, Serialize, Deserialize)]
struct TxPoolResponse {
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/tasks/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) => {
Expand Down