From 558c7f78d0428d7f385d25409952f6d5a59f1ef8 Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Tue, 14 Mar 2023 16:47:31 +0100 Subject: [PATCH 1/4] Use CompatMode::V0_34 when unsupported Tendermint version is detected --- crates/relayer-cli/src/commands/listen.rs | 5 ++++- crates/relayer/src/chain/cosmos.rs | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/relayer-cli/src/commands/listen.rs b/crates/relayer-cli/src/commands/listen.rs index da3bf3dc8d..3deed3a837 100644 --- a/crates/relayer-cli/src/commands/listen.rs +++ b/crates/relayer-cli/src/commands/listen.rs @@ -167,7 +167,10 @@ fn detect_compatibility_mode( ) -> eyre::Result { let client = HttpClient::new(config.rpc_addr.clone())?; let status = rt.block_on(client.status())?; - let compat_mode = CompatMode::from_version(status.node_info.version)?; + let compat_mode = CompatMode::from_version(status.node_info.version).unwrap_or_else(|e| { + warn!("Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: {e}"); + CompatMode::V0_34 + }); Ok(compat_mode) } diff --git a/crates/relayer/src/chain/cosmos.rs b/crates/relayer/src/chain/cosmos.rs index 6d95f36e1e..e6f85b8590 100644 --- a/crates/relayer/src/chain/cosmos.rs +++ b/crates/relayer/src/chain/cosmos.rs @@ -724,8 +724,10 @@ impl ChainEndpoint for CosmosSdkChain { let node_info = rt.block_on(fetch_node_info(&rpc_client, &config))?; - let compat_mode = CompatMode::from_version(node_info.version) - .map_err(|e| Error::rpc(config.rpc_addr.clone(), e))?; + let compat_mode = CompatMode::from_version(node_info.version).unwrap_or_else(|e| { + warn!("Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: {e}"); + CompatMode::V0_34 + }); rpc_client.set_compat_mode(compat_mode); let light_client = TmLightClient::from_config(&config, node_info.id)?; From 0e81a71a4a9941cd9bc71fff20a845e298bb14a6 Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Tue, 14 Mar 2023 16:49:10 +0100 Subject: [PATCH 2/4] Use CompatMode::V0_37 when unsupported Tendermint version is detected --- crates/relayer-cli/src/commands/listen.rs | 2 +- crates/relayer/src/chain/cosmos.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/relayer-cli/src/commands/listen.rs b/crates/relayer-cli/src/commands/listen.rs index 3deed3a837..7c26512ba4 100644 --- a/crates/relayer-cli/src/commands/listen.rs +++ b/crates/relayer-cli/src/commands/listen.rs @@ -169,7 +169,7 @@ fn detect_compatibility_mode( let status = rt.block_on(client.status())?; let compat_mode = CompatMode::from_version(status.node_info.version).unwrap_or_else(|e| { warn!("Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: {e}"); - CompatMode::V0_34 + CompatMode::V0_37 }); Ok(compat_mode) } diff --git a/crates/relayer/src/chain/cosmos.rs b/crates/relayer/src/chain/cosmos.rs index e6f85b8590..47b592ece8 100644 --- a/crates/relayer/src/chain/cosmos.rs +++ b/crates/relayer/src/chain/cosmos.rs @@ -726,7 +726,7 @@ impl ChainEndpoint for CosmosSdkChain { let compat_mode = CompatMode::from_version(node_info.version).unwrap_or_else(|e| { warn!("Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: {e}"); - CompatMode::V0_34 + CompatMode::V0_37 }); rpc_client.set_compat_mode(compat_mode); From 600add0da8600f386f5dd432a25e3ed0f95919fb Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Tue, 14 Mar 2023 16:55:55 +0100 Subject: [PATCH 3/4] Fix warning when using fallback v0.37 CompatMode for Tendermint --- crates/relayer-cli/src/commands/listen.rs | 2 +- crates/relayer/src/chain/cosmos.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/relayer-cli/src/commands/listen.rs b/crates/relayer-cli/src/commands/listen.rs index 7c26512ba4..22f9ca0725 100644 --- a/crates/relayer-cli/src/commands/listen.rs +++ b/crates/relayer-cli/src/commands/listen.rs @@ -168,7 +168,7 @@ fn detect_compatibility_mode( let client = HttpClient::new(config.rpc_addr.clone())?; let status = rt.block_on(client.status())?; let compat_mode = CompatMode::from_version(status.node_info.version).unwrap_or_else(|e| { - warn!("Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: {e}"); + warn!("Unsupported tendermint version, will use v0.37 compatibility mode but relaying might not work as desired: {e}"); CompatMode::V0_37 }); Ok(compat_mode) diff --git a/crates/relayer/src/chain/cosmos.rs b/crates/relayer/src/chain/cosmos.rs index 47b592ece8..728056e82b 100644 --- a/crates/relayer/src/chain/cosmos.rs +++ b/crates/relayer/src/chain/cosmos.rs @@ -725,7 +725,7 @@ impl ChainEndpoint for CosmosSdkChain { let node_info = rt.block_on(fetch_node_info(&rpc_client, &config))?; let compat_mode = CompatMode::from_version(node_info.version).unwrap_or_else(|e| { - warn!("Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: {e}"); + warn!("Unsupported tendermint version, will use v0.347 compatibility mode but relaying might not work as desired: {e}"); CompatMode::V0_37 }); rpc_client.set_compat_mode(compat_mode); From 8458b7be9c8d327d2ade7ecd7c1ca756fe6d2b2f Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Wed, 7 Jun 2023 15:06:29 +0200 Subject: [PATCH 4/4] Fix typo Signed-off-by: Romain Ruetschi --- crates/relayer/src/chain/cosmos.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/relayer/src/chain/cosmos.rs b/crates/relayer/src/chain/cosmos.rs index 943bd1359f..94bd7bf8dd 100644 --- a/crates/relayer/src/chain/cosmos.rs +++ b/crates/relayer/src/chain/cosmos.rs @@ -851,7 +851,7 @@ impl ChainEndpoint for CosmosSdkChain { let node_info = rt.block_on(fetch_node_info(&rpc_client, &config))?; let compat_mode = CompatMode::from_version(node_info.version).unwrap_or_else(|e| { - warn!("Unsupported tendermint version, will use v0.347 compatibility mode but relaying might not work as desired: {e}"); + warn!("Unsupported tendermint version, will use v0.37 compatibility mode but relaying might not work as desired: {e}"); CompatMode::V0_37 }); rpc_client.set_compat_mode(compat_mode);