Skip to content

Commit

Permalink
fix: use the consensus state at client latest height in status CLI (#…
Browse files Browse the repository at this point in the history
…3829)

* Use the consensus state at client latest height in status CLI

* Add changelog
  • Loading branch information
ancazamfir authored Feb 2, 2024
1 parent 8217d10 commit fae5132
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Use the consensus state at client latest height in status CLI ([#3814])

[#3814]: https://github.com/informalsystems/ibc-rs/issues/3814
17 changes: 1 addition & 16 deletions crates/relayer-cli/src/commands/query/client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use abscissa_core::clap::Parser;
use abscissa_core::{Command, Runnable};
use color_eyre::eyre::eyre;

use ibc_relayer::chain::handle::ChainHandle;
use ibc_relayer::chain::requests::{
Expand Down Expand Up @@ -318,24 +317,10 @@ fn client_status(
return Ok(Status::Frozen);
}

let consensus_state_heights =
chain.query_consensus_state_heights(QueryConsensusStateHeightsRequest {
client_id: client_id.clone(),
pagination: Some(PageRequest::all()),
})?;

let latest_consensus_height = consensus_state_heights.last().copied().ok_or_else(|| {
eyre!(
"no consensus state found for client '{}' on chain '{}'",
client_id,
chain.id()
)
})?;

let (latest_consensus_state, _) = chain.query_consensus_state(
QueryConsensusStateRequest {
client_id: client_id.clone(),
consensus_height: latest_consensus_height,
consensus_height: client_state.latest_height(),
query_height: QueryHeight::Latest,
},
IncludeProof::No,
Expand Down

0 comments on commit fae5132

Please sign in to comment.