Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
noot committed Sep 17, 2024
1 parent 0ffda9b commit 0fb6449
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 55 deletions.
53 changes: 26 additions & 27 deletions crates/core/component/ibc/src/component/rpc/client_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,19 +54,19 @@ impl<HI: HostInterface + Send + Sync + 'static> ClientQuery for IbcQuery<HI> {
.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: 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}"))
})?,
}),
};
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))
}
Expand Down Expand Up @@ -139,19 +138,19 @@ impl<HI: HostInterface + Send + Sync + 'static> ClientQuery for IbcQuery<HI> {
.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: 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}"))
})?,
}),
};
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))
}
Expand Down
27 changes: 13 additions & 14 deletions crates/core/component/ibc/src/component/rpc/connection_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -59,19 +58,19 @@ impl<HI: HostInterface + Send + Sync + 'static> ConnectionQuery for IbcQuery<HI>
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: 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}"))
})?,
}),
};
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))
}
Expand Down
27 changes: 13 additions & 14 deletions crates/core/component/ibc/src/component/rpc/consensus_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -68,19 +67,19 @@ impl<HI: HostInterface + Send + Sync + 'static> ConsensusQuery for IbcQuery<HI>
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: 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}"))
})?,
}),
};
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))
}
Expand Down

0 comments on commit 0fb6449

Please sign in to comment.