Skip to content

Commit

Permalink
Improve error message when scanning unsupported client (#3567)
Browse files Browse the repository at this point in the history
* Update pretty module in Cosmos chain implementation

* Create 3531-fix-3531.md

* Fix tracing level and add debug log for parsing client state
  • Loading branch information
DaviRain-Su authored Aug 29, 2023
1 parent 430c180 commit eeea24f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Improve error message when scanning unsupported client
([\#3531](https://github.com/informalsystems/hermes/issues/3531))
10 changes: 4 additions & 6 deletions crates/relayer/src/chain/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{cmp::Ordering, thread};
use tokio::runtime::Runtime as TokioRuntime;
use tonic::codegen::http::Uri;
use tonic::metadata::AsciiMetadataValue;
use tracing::{error, info, instrument, trace, warn};
use tracing::{debug, error, info, instrument, trace, warn};

use ibc_proto::cosmos::{
base::node::v1beta1::ConfigResponse, staking::v1beta1::Params as StakingParams,
Expand Down Expand Up @@ -1184,11 +1184,9 @@ impl ChainEndpoint for CosmosSdkChain {
.filter_map(|cs| {
IdentifiedAnyClientState::try_from(cs.clone())
.map_err(|e| {
warn!(
"failed to parse client state {}. Error: {}",
PrettyIdentifiedClientState(&cs),
e
)
let (client_type, client_id) = (if let Some(client_state) = &cs.client_state { client_state.type_url.clone() } else { "None".to_string() }, &cs.client_id);
warn!("encountered unsupported client type `{}` while scanning client `{}`, skipping the client", client_type, client_id);
debug!("failed to parse client state {}. Error: {}", PrettyIdentifiedClientState(&cs), e)
})
.ok()
})
Expand Down

0 comments on commit eeea24f

Please sign in to comment.