Skip to content

Commit

Permalink
Use CometBFT 0.37 compatibility mode for unsupported Tendermint versi…
Browse files Browse the repository at this point in the history
…ons (eg. Tendermint 0.35 and 0.36) (#3404)

* Use CompatMode::V0_34 when unsupported Tendermint version is detected

* Use CompatMode::V0_37 when unsupported Tendermint version is detected

* Fix warning when using fallback v0.37 CompatMode for Tendermint

* Fix typo

Signed-off-by: Romain Ruetschi <romain.ruetschi@gmail.com>

---------

Signed-off-by: Romain Ruetschi <romain.ruetschi@gmail.com>
Co-authored-by: Luca Joss <luca@informal.systems>
Co-authored-by: Romain Ruetschi <romain@informal.systems>
  • Loading branch information
3 people authored Jun 8, 2023
1 parent 7266a8d commit dddd7fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion crates/relayer-cli/src/commands/listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ fn detect_compatibility_mode(
) -> eyre::Result<CompatMode> {
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.37 compatibility mode but relaying might not work as desired: {e}");
CompatMode::V0_37
});
Ok(compat_mode)
}

Expand Down
6 changes: 4 additions & 2 deletions crates/relayer/src/chain/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,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.37 compatibility mode but relaying might not work as desired: {e}");
CompatMode::V0_37
});
rpc_client.set_compat_mode(compat_mode);

let light_client = TmLightClient::from_config(&config, node_info.id)?;
Expand Down

0 comments on commit dddd7fa

Please sign in to comment.