Skip to content

Commit

Permalink
fix ibc client query: use revision number and correct path
Browse files Browse the repository at this point in the history
  • Loading branch information
avahowell authored and conorsch committed Nov 2, 2023
1 parent c7abc54 commit 13f17be
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions crates/core/component/ibc/src/component/rpc/client_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ use ibc_proto::ibc::core::client::v1::{

use ibc_types::core::client::ClientId;
use ibc_types::lightclients::tendermint::client_state::ClientState as TendermintClientState;
use ibc_types::path::ClientStatePath;
use ibc_types::TypeUrl;
use penumbra_chain::component::StateReadExt;

use std::str::FromStr;
use tonic::{Response, Status};
Expand All @@ -34,13 +36,21 @@ impl ClientQuery for IbcQuery {
let client_id = ClientId::from_str(&request.get_ref().client_id)
.map_err(|e| tonic::Status::invalid_argument(format!("invalid client id: {e}")))?;
let height = Height {
revision_number: 0,
revision_number: snapshot
.get_revision_number()
.await
.map_err(|e| tonic::Status::aborted(e.to_string()))?,
revision_height: snapshot.version(),
};

// Query for client_state and associated proof.
let (cs_opt, proof) = snapshot
.get_with_proof(client_id.to_string().as_bytes().to_vec())
.get_with_proof(
ClientStatePath(client_id.clone())
.to_string()
.as_bytes()
.to_vec(),
)
.await
.map_err(|e| tonic::Status::aborted(format!("couldn't get client: {e}")))?;

Expand Down

0 comments on commit 13f17be

Please sign in to comment.