Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ibc-proto-rs to v0.39.1 #994

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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::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 @@
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 @@
})
}

// 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())?;

Check warning on line 466 in ibc-query/src/core/channel/query.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/query.rs#L459-L466

Added lines #L459 - L466 were not covered by tests

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

Check warning on line 468 in ibc-query/src/core/channel/query.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/query.rs#L468

Added line #L468 was not covered by tests

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

Check warning on line 470 in ibc-query/src/core/channel/query.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/query.rs#L470

Added line #L470 was not covered by tests

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

Check warning on line 472 in ibc-query/src/core/channel/query.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/query.rs#L472

Added line #L472 was not covered by tests

let current_height = ibc_ctx.host_height()?;

Check warning on line 474 in ibc-query/src/core/channel/query.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/query.rs#L474

Added line #L474 was not covered by tests

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
),
})?;

Check warning on line 483 in ibc-query/src/core/channel/query.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/query.rs#L476-L483

Added lines #L476 - L483 were not covered by tests

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

Check warning on line 490 in ibc-query/src/core/channel/query.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/query.rs#L485-L490

Added lines #L485 - L490 were not covered by tests

/// 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 @@
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 @@

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())?;

Check warning on line 192 in ibc-query/src/core/channel/service.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/service.rs#L188-L192

Added lines #L188 - L192 were not covered by tests

Ok(Response::new(response))
}

Check warning on line 195 in ibc-query/src/core/channel/service.rs

View check run for this annotation

Codecov / codecov/patch

ibc-query/src/core/channel/service.rs#L194-L195

Added lines #L194 - L195 were not covered by tests
}
Loading