Skip to content

Commit c136519

Browse files
authored
Retry if receipt indicates failure (#2522)
1 parent a0c2567 commit c136519

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

apps/fortuna/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/fortuna/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fortuna"
3-
version = "7.4.8"
3+
version = "7.4.9"
44
edition = "2021"
55

66
[lib]

apps/fortuna/src/eth_utils/utils.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use ethabi::ethereum_types::U64;
12
use {
23
crate::eth_utils::nonce_manager::NonceManaged,
34
anyhow::{anyhow, Result},
@@ -315,5 +316,12 @@ pub async fn submit_tx<T: Middleware + NonceManaged + 'static>(
315316
))
316317
})?;
317318

319+
if receipt.status == Some(U64::from(0)) {
320+
return Err(backoff::Error::transient(anyhow!(
321+
"Reveal transaction reverted on-chain. Tx:{:?}",
322+
transaction
323+
)));
324+
}
325+
318326
Ok(receipt)
319327
}

apps/fortuna/src/keeper/process_event.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ pub async fn process_event_with_backoff(
6363

6464
match success {
6565
Ok(result) => {
66-
tracing::info!("Processed event successfully in {:?}", result.duration);
66+
tracing::info!(
67+
"Processed event successfully in {:?} after {} retries. Receipt: {:?}",
68+
result.duration,
69+
result.num_retries,
70+
result.receipt
71+
);
6772

6873
metrics
6974
.requests_processed_success

0 commit comments

Comments
 (0)