diff --git a/crates/core/component/ibc/src/component/rpc/client_query.rs b/crates/core/component/ibc/src/component/rpc/client_query.rs index 2c4d66ec0a..3c7fa28fb3 100644 --- a/crates/core/component/ibc/src/component/rpc/client_query.rs +++ b/crates/core/component/ibc/src/component/rpc/client_query.rs @@ -11,7 +11,6 @@ use ibc_proto::ibc::core::client::v1::{ QueryUpgradedClientStateResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse, }; -use penumbra_sct::component::clock::EpochRead; use prost::Message; use ibc_types::core::client::ClientId; @@ -55,19 +54,19 @@ impl ClientQuery for IbcQuery { .transpose() .map_err(|e| tonic::Status::aborted(format!("couldn't decode client state: {e}")))?; - let res = - QueryClientStateResponse { - client_state, - proof: proof.encode_to_vec(), - proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot.get_block_height().await.map_err(|e| { - tonic::Status::aborted(format!("couldn't decode height: {e}")) - })? + 1, - revision_number: HI::get_revision_number(&snapshot).await.map_err(|e| { - tonic::Status::aborted(format!("couldn't decode height: {e}")) - })?, - }), - }; + let res = QueryClientStateResponse { + client_state, + proof: proof.encode_to_vec(), + proof_height: Some(ibc_proto::ibc::core::client::v1::Height { + revision_height: HI::get_block_height(&snapshot) + .await + .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + + 1, + revision_number: HI::get_revision_number(&snapshot) + .await + .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))?, + }), + }; Ok(tonic::Response::new(res)) } @@ -139,19 +138,19 @@ impl ClientQuery for IbcQuery { .transpose() .map_err(|e| tonic::Status::aborted(format!("couldn't decode consensus state: {e}")))?; - let res = - QueryConsensusStateResponse { - consensus_state, - proof: proof.encode_to_vec(), - proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot.get_block_height().await.map_err(|e| { - tonic::Status::aborted(format!("couldn't decode height: {e}")) - })? + 1, - revision_number: HI::get_revision_number(&snapshot).await.map_err(|e| { - tonic::Status::aborted(format!("couldn't decode height: {e}")) - })?, - }), - }; + let res = QueryConsensusStateResponse { + consensus_state, + proof: proof.encode_to_vec(), + proof_height: Some(ibc_proto::ibc::core::client::v1::Height { + revision_height: HI::get_block_height(&snapshot) + .await + .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + + 1, + revision_number: HI::get_revision_number(&snapshot) + .await + .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))?, + }), + }; Ok(tonic::Response::new(res)) } diff --git a/crates/core/component/ibc/src/component/rpc/connection_query.rs b/crates/core/component/ibc/src/component/rpc/connection_query.rs index 4f653fc755..70ed5dbd2e 100644 --- a/crates/core/component/ibc/src/component/rpc/connection_query.rs +++ b/crates/core/component/ibc/src/component/rpc/connection_query.rs @@ -16,7 +16,6 @@ use ibc_types::path::{ ClientConnectionPath, ClientConsensusStatePath, ClientStatePath, ConnectionPath, }; use ibc_types::DomainType; -use penumbra_sct::component::clock::EpochRead as _; use prost::Message; use std::str::FromStr; @@ -59,19 +58,19 @@ impl ConnectionQuery for IbcQuery let conn = conn.map_err(|e| tonic::Status::aborted(format!("couldn't decode connection: {e}")))?; - let res = - QueryConnectionResponse { - connection: conn, - proof: proof.encode_to_vec(), - proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot.get_block_height().await.map_err(|e| { - tonic::Status::aborted(format!("couldn't decode height: {e}")) - })? + 1, - revision_number: HI::get_revision_number(&snapshot).await.map_err(|e| { - tonic::Status::aborted(format!("couldn't decode height: {e}")) - })?, - }), - }; + let res = QueryConnectionResponse { + connection: conn, + proof: proof.encode_to_vec(), + proof_height: Some(ibc_proto::ibc::core::client::v1::Height { + revision_height: HI::get_block_height(&snapshot) + .await + .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + + 1, + revision_number: HI::get_revision_number(&snapshot) + .await + .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))?, + }), + }; Ok(tonic::Response::new(res)) } @@ -168,8 +167,7 @@ impl ConnectionQuery for IbcQuery connection_paths, proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1, @@ -222,8 +220,7 @@ impl ConnectionQuery for IbcQuery identified_client_state: Some(identified_client_state), proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1, @@ -280,7 +277,7 @@ impl ConnectionQuery for IbcQuery client_id: client_id.to_string(), proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot.get_block_height().await.map_err(|e| { + revision_height: HI::get_block_height(&snapshot).await.map_err(|e| { tonic::Status::aborted(format!("couldn't decode height: {e}")) })? + 1, revision_number: HI::get_revision_number(&snapshot).await.map_err(|e| { diff --git a/crates/core/component/ibc/src/component/rpc/consensus_query.rs b/crates/core/component/ibc/src/component/rpc/consensus_query.rs index c37d654de4..4d67297416 100644 --- a/crates/core/component/ibc/src/component/rpc/consensus_query.rs +++ b/crates/core/component/ibc/src/component/rpc/consensus_query.rs @@ -25,7 +25,6 @@ use ibc_types::DomainType; use ibc_types::core::channel::{ChannelId, IdentifiedChannelEnd, PortId}; use ibc_types::core::connection::ConnectionId; -use penumbra_sct::component::clock::EpochRead as _; use prost::Message; use std::str::FromStr; @@ -68,19 +67,19 @@ impl ConsensusQuery for IbcQuery let channel = channel.map_err(|e| tonic::Status::aborted(format!("couldn't decode channel: {e}")))?; - let res = - QueryChannelResponse { - channel, - proof: proof.encode_to_vec(), - proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot.get_block_height().await.map_err(|e| { - tonic::Status::aborted(format!("couldn't decode height: {e}")) - })? + 1, - revision_number: HI::get_revision_number(&snapshot).await.map_err(|e| { - tonic::Status::aborted(format!("couldn't decode height: {e}")) - })?, - }), - }; + let res = QueryChannelResponse { + channel, + proof: proof.encode_to_vec(), + proof_height: Some(ibc_proto::ibc::core::client::v1::Height { + revision_height: HI::get_block_height(&snapshot) + .await + .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + + 1, + revision_number: HI::get_revision_number(&snapshot) + .await + .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))?, + }), + }; Ok(tonic::Response::new(res)) } @@ -258,8 +257,7 @@ impl ConsensusQuery for IbcQuery identified_client_state: Some(identified_client_state), proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1, @@ -351,8 +349,7 @@ impl ConsensusQuery for IbcQuery client_id: connection.client_id.clone().to_string(), proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1, @@ -398,8 +395,7 @@ impl ConsensusQuery for IbcQuery commitment, proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1, @@ -501,8 +497,7 @@ impl ConsensusQuery for IbcQuery received: receipt.is_some(), proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1, @@ -546,8 +541,7 @@ impl ConsensusQuery for IbcQuery acknowledgement, proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1, @@ -745,8 +739,7 @@ impl ConsensusQuery for IbcQuery next_sequence_receive: next_recv_sequence, proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1, @@ -787,8 +780,7 @@ impl ConsensusQuery for IbcQuery next_sequence_send: next_send_sequence, proof: proof.encode_to_vec(), proof_height: Some(ibc_proto::ibc::core::client::v1::Height { - revision_height: snapshot - .get_block_height() + revision_height: HI::get_block_height(&snapshot) .await .map_err(|e| tonic::Status::aborted(format!("couldn't decode height: {e}")))? + 1,