Skip to content
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

fix: retry on TransactionHashNotFound error #1435

Merged
merged 1 commit into from
Jan 14, 2024
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
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
Loading