Skip to content

fix(fortuna): Retry if receipt indicates failure #2522

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 26, 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.8"
version = "7.4.9"
edition = "2021"

[lib]
Expand Down
8 changes: 8 additions & 0 deletions apps/fortuna/src/eth_utils/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use ethabi::ethereum_types::U64;
use {
crate::eth_utils::nonce_manager::NonceManaged,
anyhow::{anyhow, Result},
Expand Down Expand Up @@ -315,5 +316,12 @@ pub async fn submit_tx<T: Middleware + NonceManaged + 'static>(
))
})?;

if receipt.status == Some(U64::from(0)) {
return Err(backoff::Error::transient(anyhow!(
"Reveal transaction reverted on-chain. Tx:{:?}",
transaction
)));
}

Ok(receipt)
}
7 changes: 6 additions & 1 deletion apps/fortuna/src/keeper/process_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ pub async fn process_event_with_backoff(

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

metrics
.requests_processed_success
Expand Down
Loading