Skip to content

fix(fortuna): Propagate submission errors correctly #2458

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

Merged
merged 1 commit into from
Mar 10, 2025
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
2 changes: 1 addition & 1 deletion apps/fortuna/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/fortuna/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fortuna"
version = "7.4.5"
version = "7.4.6"
edition = "2021"

[lib]
Expand Down
4 changes: 2 additions & 2 deletions apps/fortuna/src/eth_utils/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct SubmitTxResult {
pub gas_multiplier: u64,
pub fee_multiplier: u64,
pub duration: Duration,
pub receipt: Result<TransactionReceipt, anyhow::Error>,
pub receipt: TransactionReceipt,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -193,7 +193,7 @@ pub async fn submit_tx_with_backoff<T: Middleware + NonceManaged + 'static>(
num_retries.store(retry_number + 1, std::sync::atomic::Ordering::Relaxed);
},
)
.await;
.await?;

let duration = start_time.elapsed();
let num_retries = num_retries.load(std::sync::atomic::Ordering::Relaxed);
Expand Down
36 changes: 17 additions & 19 deletions apps/fortuna/src/keeper/process_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ pub async fn process_event_with_backoff(
.inc();

match success {
Ok(res) => {
tracing::info!("Processed event successfully in {:?}", res.duration);
Ok(result) => {
tracing::info!("Processed event successfully in {:?}", result.duration);

metrics
.requests_processed_success
Expand All @@ -73,39 +73,37 @@ pub async fn process_event_with_backoff(
metrics
.request_duration_ms
.get_or_create(&account_label)
.observe(res.duration.as_millis() as f64);
.observe(result.duration.as_millis() as f64);

// Track retry count, gas multiplier, and fee multiplier for successful transactions
metrics
.retry_count
.get_or_create(&account_label)
.observe(res.num_retries as f64);
.observe(result.num_retries as f64);

metrics
.final_gas_multiplier
.get_or_create(&account_label)
.observe(res.gas_multiplier as f64);
.observe(result.gas_multiplier as f64);

metrics
.final_fee_multiplier
.get_or_create(&account_label)
.observe(res.fee_multiplier as f64);
.observe(result.fee_multiplier as f64);

if let Ok(receipt) = res.receipt {
if let Some(gas_used) = receipt.gas_used {
let gas_used_float = gas_used.as_u128() as f64 / 1e18;
if let Some(gas_used) = result.receipt.gas_used {
let gas_used_float = gas_used.as_u128() as f64 / 1e18;
metrics
.total_gas_spent
.get_or_create(&account_label)
.inc_by(gas_used_float);

if let Some(gas_price) = result.receipt.effective_gas_price {
let gas_fee = (gas_used * gas_price).as_u128() as f64 / 1e18;
metrics
.total_gas_spent
.total_gas_fee_spent
.get_or_create(&account_label)
.inc_by(gas_used_float);

if let Some(gas_price) = receipt.effective_gas_price {
let gas_fee = (gas_used * gas_price).as_u128() as f64 / 1e18;
metrics
.total_gas_fee_spent
.get_or_create(&account_label)
.inc_by(gas_fee);
}
.inc_by(gas_fee);
}
}
metrics.reveals.get_or_create(&account_label).inc();
Expand Down
Loading