From 7fd032baba4fa9119c1a98549c27db0fd430c0a0 Mon Sep 17 00:00:00 2001 From: Adi Seredinschi Date: Wed, 4 May 2022 12:13:23 +0200 Subject: [PATCH] Added workaround to tonic::code inconsistencies. Ref: https://github.com/informalsystems/ibc-rs/issues/1971#issuecomment-1117135293 --- relayer/src/chain/cosmos/estimate.rs | 2 +- relayer/src/error.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/relayer/src/chain/cosmos/estimate.rs b/relayer/src/chain/cosmos/estimate.rs index 22faf937ea..55ecbd9146 100644 --- a/relayer/src/chain/cosmos/estimate.rs +++ b/relayer/src/chain/cosmos/estimate.rs @@ -121,7 +121,7 @@ async fn estimate_gas_with_tx( } // If there is a chance that the tx will be accepted once actually submitted, we fall - // back on the max gas and will attempt to send it anyway. + // back on the default gas and will attempt to send it anyway. // See `can_recover_from_simulation_failure` for more info. Err(e) if can_recover_from_simulation_failure(&e) => { warn!( diff --git a/relayer/src/error.rs b/relayer/src/error.rs index 9fa4b1601d..237ddf8201 100644 --- a/relayer/src/error.rs +++ b/relayer/src/error.rs @@ -510,19 +510,20 @@ impl Error { impl GrpcStatusSubdetail { /// Check whether this gRPC error matches - /// - status: InvalidArgument /// - message: verification failed: ... failed packet acknowledgement verification for client: client state height < proof height ... pub fn is_client_state_height_too_low(&self) -> bool { - if self.status.code() != tonic::Code::InvalidArgument { - return false; - } + // Gaia v6.0.1 (SDK 0.44.5) returns code`InvalidArgument`, whereas gaia v6.0.4 + // (SDK 0.44.6, and potentially others) returns code `Unknown`. + // Workaround by matching strictly on the status message. + // if self.status.code() != tonic::Code::InvalidArgument + // return false; + // } let msg = self.status.message(); msg.contains("verification failed") && msg.contains("client state height < proof height") } /// Check whether this gRPC error matches - /// - status: InvalidArgument /// - message: "account sequence mismatch, expected 166791, got 166793: incorrect account sequence: invalid request" /// /// # Note: