Skip to content

Commit

Permalink
deps: update ibc-proto-rs to v0.39.1 (#994)
Browse files Browse the repository at this point in the history
* Update ibc-proto-rs to v0.39.1

* Update ci/no-std-check to ibc-proto-rs v0.39.1

* Add changelog entry
  • Loading branch information
seanchen1991 authored Nov 28, 2023
1 parent 8f2ddfe commit f306667
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/993-bump-ibc-proto-rs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Bump ibc-proto-rs dependency to v0.39.1.
([\#993](https://github.com/cosmos/ibc-rs/issues/993))
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ibc-core-router-types = { version = "0.48.1", path = "./ibc-core/ics26-rou
ibc-client-tendermint-types = { version = "0.48.1", path = "./ibc-clients/ics07-tendermint/types", default-features = false }
ibc-app-transfer-types = { version = "0.48.1", path = "./ibc-apps/ics20-transfer/types", default-features = false }

ibc-proto = { version = "0.38.0", default-features = false }
ibc-proto = { version = "0.39.1", default-features = false }
ics23 = { version = "0.11", default-features = false }

# cosmos dependencies
Expand Down
12 changes: 6 additions & 6 deletions ci/no-std-check/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ci/no-std-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resolver = "2"

[dependencies]
ibc = { path = "../../ibc", default-features = false, features = ["serde"] }
ibc-proto = { version = "0.38.0", default-features = false, features = [
ibc-proto = { version = "0.39.1", default-features = false, features = [
"parity-scale-codec",
"borsh",
"serde",
Expand Down
54 changes: 41 additions & 13 deletions ibc-query/src/core/channel/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ibc::core::client::types::Height;
use ibc::core::host::types::identifiers::{ChannelId, ConnectionId, PortId, Sequence};
use ibc::core::host::types::path::{
AckPath, ChannelEndPath, ClientConsensusStatePath, ClientStatePath, CommitmentPath, Path,
ReceiptPath, SeqRecvPath,
ReceiptPath, SeqRecvPath, SeqSendPath,
};
use ibc::core::host::ValidationContext;
use ibc_proto::google::protobuf::Any;
Expand All @@ -17,12 +17,12 @@ use ibc_proto::ibc::core::channel::v1::{
QueryChannelResponse, QueryChannelsRequest, QueryChannelsResponse,
QueryConnectionChannelsRequest, QueryConnectionChannelsResponse,
QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponse,
QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponse,
QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponse,
QueryPacketCommitmentRequest, QueryPacketCommitmentResponse, QueryPacketCommitmentsRequest,
QueryPacketCommitmentsResponse, QueryPacketReceiptRequest, QueryPacketReceiptResponse,
QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponse, QueryUnreceivedPacketsRequest,
QueryUnreceivedPacketsResponse,
QueryNextSequenceSendRequest, QueryNextSequenceSendResponse, QueryPacketAcknowledgementRequest,
QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementsRequest,
QueryPacketAcknowledgementsResponse, QueryPacketCommitmentRequest,
QueryPacketCommitmentResponse, QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponse,
QueryPacketReceiptRequest, QueryPacketReceiptResponse, QueryUnreceivedAcksRequest,
QueryUnreceivedAcksResponse, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponse,
};
use ibc_proto::ibc::core::client::v1::IdentifiedClientState;

Expand Down Expand Up @@ -454,12 +454,40 @@ where
})
}

// NOTE: The [previous `query_next_sequence_send`
// method](https://github.com/cosmos/ibc-rs/blob/a4a5f78405bd3a28c060df6c65438edf0b02e9e2/crates/ibc-query/src/core/channel/query.rs#L472-L504)
// is currently not present in the generated protobuf from `ibc-go` v0.7.3.
// However, this method has been reintroduced through [this
// PR](https://github.com/cosmos/ibc-go/pull/3417) in ibc-go. Once included in a
// new release, we can implement this method call.
/// Queries for the next sequence to send for the channel specified
/// in the `request`.
pub fn query_next_sequence_send<I>(
ibc_ctx: &I,
request: &QueryNextSequenceSendRequest,
) -> Result<QueryNextSequenceSendResponse, QueryError>
where
I: ValidationContext + ProvableContext,
{
let channel_id = ChannelId::from_str(request.channel_id.as_str())?;

let port_id = PortId::from_str(request.port_id.as_str())?;

let next_seq_send_path = SeqSendPath::new(&port_id, &channel_id);

let next_sequence_send = ibc_ctx.get_next_sequence_send(&next_seq_send_path)?;

let current_height = ibc_ctx.host_height()?;

let proof = ibc_ctx
.get_proof(current_height, &Path::SeqSend(next_seq_send_path))
.ok_or(QueryError::ProofNotFound {
description: format!(
"Next sequence send proof not found for channel {}",
channel_id
),
})?;

Ok(QueryNextSequenceSendResponse {
next_sequence_send: next_sequence_send.into(),
proof,
proof_height: Some(current_height.into()),
})
}

/// Queries for the next sequence receive associated with a channel
pub fn query_next_sequence_receive<I>(
Expand Down
28 changes: 19 additions & 9 deletions ibc-query/src/core/channel/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@ use ibc_proto::ibc::core::channel::v1::{
QueryChannelResponse, QueryChannelsRequest, QueryChannelsResponse,
QueryConnectionChannelsRequest, QueryConnectionChannelsResponse,
QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponse,
QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponse,
QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponse,
QueryPacketCommitmentRequest, QueryPacketCommitmentResponse, QueryPacketCommitmentsRequest,
QueryPacketCommitmentsResponse, QueryPacketReceiptRequest, QueryPacketReceiptResponse,
QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponse, QueryUnreceivedPacketsRequest,
QueryUnreceivedPacketsResponse,
QueryNextSequenceSendRequest, QueryNextSequenceSendResponse, QueryPacketAcknowledgementRequest,
QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementsRequest,
QueryPacketAcknowledgementsResponse, QueryPacketCommitmentRequest,
QueryPacketCommitmentResponse, QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponse,
QueryPacketReceiptRequest, QueryPacketReceiptResponse, QueryUnreceivedAcksRequest,
QueryUnreceivedAcksResponse, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponse,
};
use tonic::{Request, Response, Status};

use super::{
query_channel, query_channel_client_state, query_channel_consensus_state, query_channels,
query_connection_channels, query_next_sequence_receive, query_packet_acknowledgement,
query_packet_acknowledgements, query_packet_commitment, query_packet_commitments,
query_packet_receipt, query_unreceived_acks, query_unreceived_packets,
query_connection_channels, query_next_sequence_receive, query_next_sequence_send,
query_packet_acknowledgement, query_packet_acknowledgements, query_packet_commitment,
query_packet_commitments, query_packet_receipt, query_unreceived_acks,
query_unreceived_packets,
};
use crate::core::context::QueryContext;

Expand Down Expand Up @@ -183,4 +184,13 @@ where

Ok(Response::new(response))
}

async fn next_sequence_send(
&self,
request: Request<QueryNextSequenceSendRequest>,
) -> Result<Response<QueryNextSequenceSendResponse>, Status> {
let response = query_next_sequence_send(&self.ibc_context, request.get_ref())?;

Ok(Response::new(response))
}
}

0 comments on commit f306667

Please sign in to comment.