diff --git a/clients/runtime/src/error.rs b/clients/runtime/src/error.rs index bf3461e6a..dd96d6c47 100644 --- a/clients/runtime/src/error.rs +++ b/clients/runtime/src/error.rs @@ -200,6 +200,22 @@ impl Error { &format!("{:?}", SecurityPalletError::ParachainNotRunning), ) } + + pub fn is_timeout_error(&self) -> bool { + match self { + Error::SubxtRuntimeError(SubxtError::Rpc(RpcError::ClientError(e))) => + match e.downcast_ref::() { + Some(e) => matches!(e, JsonRpseeError::RequestTimeout), + None => { + log::error!( + "Failed to downcast RPC error; this is a bug please file an issue" + ); + false + }, + }, + _ => false, + } + } } impl RecoverableError { diff --git a/clients/runtime/src/rpc.rs b/clients/runtime/src/rpc.rs index 54018c2c3..f3ea338fb 100644 --- a/clients/runtime/src/rpc.rs +++ b/clients/runtime/src/rpc.rs @@ -247,6 +247,8 @@ impl SpacewalkParachain { } else if err.is_block_hash_not_found_error() { log::info!("Re-sending transaction after apparent fork"); Err(RetryPolicy::Skip(Error::BlockHashNotFound)) + } else if err.is_timeout_error() { + Err(RetryPolicy::Skip(Error::Timeout)) } else { Err(RetryPolicy::Throw(err)) } diff --git a/clients/vault/src/oracle/storage/traits.rs b/clients/vault/src/oracle/storage/traits.rs index 0b4839922..1eaf648e8 100644 --- a/clients/vault/src/oracle/storage/traits.rs +++ b/clients/vault/src/oracle/storage/traits.rs @@ -141,7 +141,9 @@ pub trait ArchiveStorage { fn remove_file(&self, target_slot: Slot) { let (_, file) = self.get_url_and_file_name(target_slot); if let Err(e) = fs::remove_file(&file) { - tracing::warn!("remove_file(): failed to remove file {file} for slot {target_slot}: {e:?}"); + tracing::warn!( + "remove_file(): failed to remove file {file} for slot {target_slot}: {e:?}" + ); } } diff --git a/clients/vault/src/requests/structs.rs b/clients/vault/src/requests/structs.rs index edf190bf8..196a1325b 100644 --- a/clients/vault/src/requests/structs.rs +++ b/clients/vault/src/requests/structs.rs @@ -210,6 +210,8 @@ impl Request { Err(RetryPolicy::Throw(err)) } else if err.is_block_hash_not_found_error() { Err(RetryPolicy::Skip(EnrichedError::BlockHashNotFound)) + } else if err.is_timeout_error() { + Err(RetryPolicy::Skip(EnrichedError::Timeout)) } else { Err(RetryPolicy::Throw(err)) }