From 01626c94207f1121b414d539bf768753ede89984 Mon Sep 17 00:00:00 2001 From: Martin Dyring-Andersen Date: Thu, 18 Jan 2024 09:02:58 +0100 Subject: [PATCH] Recover from gas simulation failures on legacy chains (#3792) --- .../ibc-relayer-cli/3792-legacy-simulation.md | 2 ++ crates/relayer/src/chain/cosmos/estimate.rs | 1 + crates/relayer/src/error.rs | 8 ++++++++ 3 files changed, 11 insertions(+) create mode 100644 .changelog/unreleased/improvements/ibc-relayer-cli/3792-legacy-simulation.md diff --git a/.changelog/unreleased/improvements/ibc-relayer-cli/3792-legacy-simulation.md b/.changelog/unreleased/improvements/ibc-relayer-cli/3792-legacy-simulation.md new file mode 100644 index 0000000000..f09d5088c1 --- /dev/null +++ b/.changelog/unreleased/improvements/ibc-relayer-cli/3792-legacy-simulation.md @@ -0,0 +1,2 @@ +- Recover from gas simulation failures on legacy chains. + ([\#3792](https://github.com/informalsystems/hermes/issues/3792)) diff --git a/crates/relayer/src/chain/cosmos/estimate.rs b/crates/relayer/src/chain/cosmos/estimate.rs index 35c76a92ad..13bbb42e29 100644 --- a/crates/relayer/src/chain/cosmos/estimate.rs +++ b/crates/relayer/src/chain/cosmos/estimate.rs @@ -163,6 +163,7 @@ fn can_recover_from_simulation_failure(e: &Error) -> bool { detail.is_client_state_height_too_low() || detail.is_account_sequence_mismatch_that_can_be_ignored() || detail.is_out_of_order_packet_sequence_error() + || detail.is_empty_tx_error() } _ => false, } diff --git a/crates/relayer/src/error.rs b/crates/relayer/src/error.rs index e16a1c4e75..db7ba618f0 100644 --- a/crates/relayer/src/error.rs +++ b/crates/relayer/src/error.rs @@ -677,6 +677,14 @@ impl GrpcStatusSubdetail { Some((expected, got)) => expected < got, } } + + /// Check whether this gRPC error message contains the string "invalid empty tx". + /// + /// ## Note + /// This error may happen for older chains that does not properly support simulation. + pub fn is_empty_tx_error(&self) -> bool { + self.status.message().contains("invalid empty tx") + } } /// Assumes that the cosmos-sdk account sequence mismatch error message, that may be seen