diff --git a/.changelog/unreleased/993-bump-ibc-proto-rs.md b/.changelog/unreleased/993-bump-ibc-proto-rs.md new file mode 100644 index 000000000..bc4fa551d --- /dev/null +++ b/.changelog/unreleased/993-bump-ibc-proto-rs.md @@ -0,0 +1,2 @@ +- Bump ibc-proto-rs dependency to v0.39.1. + ([\#993](https://github.com/cosmos/ibc-rs/issues/993)) diff --git a/Cargo.toml b/Cargo.toml index 4f98ba81c..2bfc3974a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/ci/no-std-check/Cargo.lock b/ci/no-std-check/Cargo.lock index 6ab592ccc..ff8c1e715 100644 --- a/ci/no-std-check/Cargo.lock +++ b/ci/no-std-check/Cargo.lock @@ -1570,9 +1570,9 @@ dependencies = [ [[package]] name = "ibc-proto" -version = "0.38.0" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93cbf4cbe9e5113cc7c70f3208a7029b2205c629502cbb2ae7ea0a09a97d3005" +checksum = "c8a8b1356652b9f160f5a010dd6b084675b8a28e163bf2b41ca5abecf27d9701" dependencies = [ "base64 0.21.4", "borsh", @@ -2181,9 +2181,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" +checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", "prost-derive", @@ -2191,9 +2191,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" +checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", "itertools 0.11.0", diff --git a/ci/no-std-check/Cargo.toml b/ci/no-std-check/Cargo.toml index 3dd20003e..d62e2a3a8 100644 --- a/ci/no-std-check/Cargo.toml +++ b/ci/no-std-check/Cargo.toml @@ -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", diff --git a/ibc-query/src/core/channel/query.rs b/ibc-query/src/core/channel/query.rs index 5d9e22681..d14a5621c 100644 --- a/ibc-query/src/core/channel/query.rs +++ b/ibc-query/src/core/channel/query.rs @@ -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; @@ -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; @@ -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( + ibc_ctx: &I, + request: &QueryNextSequenceSendRequest, +) -> Result +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( diff --git a/ibc-query/src/core/channel/service.rs b/ibc-query/src/core/channel/service.rs index 4aeb18ddc..3279c1b2f 100644 --- a/ibc-query/src/core/channel/service.rs +++ b/ibc-query/src/core/channel/service.rs @@ -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; @@ -183,4 +184,13 @@ where Ok(Response::new(response)) } + + async fn next_sequence_send( + &self, + request: Request, + ) -> Result, Status> { + let response = query_next_sequence_send(&self.ibc_context, request.get_ref())?; + + Ok(Response::new(response)) + } }