Skip to content

Commit

Permalink
fix: retry on TransactionHashNotFound error (#1435)
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda-0x authored Jan 14, 2024
1 parent 7264619 commit 7a7daf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions crates/dojo-world/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ pub struct TransactionWaiter<'a, P: Provider> {
/// be considered when waiting for the transaction, meaning `REVERTED` transaction will not
/// return an error.
must_succeed: bool,
/// Poll the transaction every `interval` miliseconds. Miliseconds are used so that
/// Poll the transaction every `interval` milliseconds. Milliseconds are used so that
/// we can be more precise with the polling interval. Defaults to 2.5 seconds.
interval: Interval,
/// The maximum amount of time to wait for the transaction to achieve the desired status. An
/// error will be returned if it is unable to finish within the `timeout` duration. Defaults to
/// 60 seconds.
/// 300 seconds.
timeout: Duration,
/// The provider to use for polling the transaction.
provider: &'a P,
Expand Down Expand Up @@ -240,6 +240,10 @@ where
}

Poll::Ready(res) => match res {
Err(ProviderError::StarknetError(
StarknetError::TransactionHashNotFound,
)) => {}

Err(e) => {
return Poll::Ready(Err(TransactionWaitingError::Provider(e)));
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sozo/src/ops/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ where
.execute(calls)
.send()
.await
.map_err(|e| anyhow!("Failed to register models to World: {e}"))?;
.map_err(|e| anyhow!("Failed to register models to World: {e:?}"))?;

TransactionWaiter::new(transaction_hash, migrator.provider()).await?;

Expand Down

0 comments on commit 7a7daf8

Please sign in to comment.