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

Multi-hop protos #206

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
137 changes: 137 additions & 0 deletions multihop.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
diff --git a/proto/ibc/core/channel/v1/channel.proto b/proto/ibc/core/channel/v1/channel.proto
index 44c3240e2..b7596c72b 100644
--- a/proto/ibc/core/channel/v1/channel.proto
+++ b/proto/ibc/core/channel/v1/channel.proto
@@ -71,10 +71,12 @@
// A channel has been closed and can no longer be used to send or receive
// packets.
STATE_CLOSED = 4 [(gogoproto.enumvalue_customname) = "CLOSED"];
+ // A channel has been forced closed due to a frozen client in the connection path.
+ STATE_FROZEN = 5 [(gogoproto.enumvalue_customname) = "FROZEN"];
// A channel has just accepted the upgrade handshake attempt and is flushing in-flight packets.
- STATE_FLUSHING = 5 [(gogoproto.enumvalue_customname) = "FLUSHING"];
+ STATE_FLUSHING = 6 [(gogoproto.enumvalue_customname) = "FLUSHING"];
// A channel has just completed flushing any in-flight packets.
- STATE_FLUSHCOMPLETE = 6 [(gogoproto.enumvalue_customname) = "FLUSHCOMPLETE"];
+ STATE_FLUSHCOMPLETE = 7 [(gogoproto.enumvalue_customname) = "FLUSHCOMPLETE"];
}

// Order defines if a channel is ORDERED or UNORDERED
diff --git a/proto/ibc/core/channel/v1/tx.proto b/proto/ibc/core/channel/v1/tx.proto
index 4b9ad3d75..07ee7f08d 100644
--- a/proto/ibc/core/channel/v1/tx.proto
+++ b/proto/ibc/core/channel/v1/tx.proto
@@ -9,6 +9,7 @@
import "ibc/core/client/v1/client.proto";
import "ibc/core/channel/v1/channel.proto";
import "ibc/core/channel/v1/upgrade.proto";
+import "ibc/core/commitment/v1/commitment.proto";

// Msg defines the ibc/channel Msg service.
service Msg {
@@ -33,6 +34,9 @@
// MsgChannelCloseConfirm.
rpc ChannelCloseConfirm(MsgChannelCloseConfirm) returns (MsgChannelCloseConfirmResponse);

+ // ChannelCloseFrozen defines a rpc handler method for MsgChannelCloseFrozen.
+ rpc ChannelCloseFrozen(MsgChannelCloseFrozen) returns (MsgChannelCloseFrozenResponse);
+
// RecvPacket defines a rpc handler method for MsgRecvPacket.
rpc RecvPacket(MsgRecvPacket) returns (MsgRecvPacketResponse);

@@ -208,6 +212,25 @@
// type.
message MsgChannelCloseConfirmResponse {}

+// MsgChannelCloseFrozen defines a msg sent by a Relayer to force close
+// a channel due to a frozen client in a multi-hop channel path.
+message MsgChannelCloseFrozen {
+ option (gogoproto.equal) = false;
+ option (gogoproto.goproto_getters) = false;
+
+ string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
+ string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
+ bytes proof_connection = 3 [(gogoproto.moretags) = "yaml:\"proof_connection\""];
+ bytes proof_client_state = 4 [(gogoproto.moretags) = "yaml:\"proof_client_state\""];
+ ibc.core.client.v1.Height proof_height = 5
+ [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
+ string signer = 6;
+}
+
+// MsgChannelCloseFrozenResponse defines the Msg/ChannelFrozenConfirm response
+// type.
+message MsgChannelCloseFrozenResponse {}
+
// MsgRecvPacket receives incoming IBC packet
message MsgRecvPacket {
option (cosmos.msg.v1.signer) = "signer";
@@ -467,3 +490,23 @@
// Number of sequences left after pruning.
uint64 total_remaining_sequences = 2;
}
+
+// MultihopProof holds the information necessary to prove a multihop message
+message MultihopProof {
+ option (gogoproto.equal) = false;
+ option (gogoproto.goproto_getters) = false;
+
+ bytes proof = 2;
+ bytes value = 3;
+ ibc.core.commitment.v1.MerklePath prefixed_key = 4;
+}
+
+// MsgMultihopProofs holds the proof information for each intermediary hop for a multihop message
+message MsgMultihopProofs {
+ option (gogoproto.equal) = false;
+ option (gogoproto.goproto_getters) = false;
+
+ MultihopProof key_proof = 2;
+ repeated MultihopProof connection_proofs = 3;
+ repeated MultihopProof consensus_proofs = 4;
+}
diff --git a/proto/ibc/core/client/v1/query.proto b/proto/ibc/core/client/v1/query.proto
index 0032306ec..4bd66bfee 100644
--- a/proto/ibc/core/client/v1/query.proto
+++ b/proto/ibc/core/client/v1/query.proto
@@ -36,6 +36,14 @@ service Query {
option (google.api.http).get = "/ibc/core/client/v1/consensus_states/{client_id}";
}

+ // NextConsensusStateHeight queries for a consensus state height associated with
+ // a client state at a minimum height greater than a given height.
+ rpc NextConsensusStateHeight(QueryNextConsensusStateHeightRequest) returns (QueryNextConsensusStateHeightResponse) {
+ option (google.api.http).get = "/ibc/core/client/v1/next_height/consensus_states/"
+ "{client_id}/revision/{revision_number}/"
+ "height/{revision_height}";
+ }
+
// ConsensusStateHeights queries the height of every consensus states associated with a given client.
rpc ConsensusStateHeights(QueryConsensusStateHeightsRequest) returns (QueryConsensusStateHeightsResponse) {
option (google.api.http).get = "/ibc/core/client/v1/consensus_states/{client_id}/heights";
@@ -142,6 +150,26 @@ message QueryConsensusStatesResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

+// QueryNextConsensusStateRequest is the request type for the Query/ConsensusState
+// RPC method. Besides the consensus state, it includes a proof and the height
+// from which the proof was retrieved.
+message QueryNextConsensusStateHeightRequest {
+ // client identifier
+ string client_id = 1;
+ // consensus state revision number
+ uint64 revision_number = 2;
+ // consensus state revision height
+ uint64 revision_height = 3;
+}
+
+// QueryNextConsensusStateResponse is the response type for the Query/ConsensusState
+// RPC method
+message QueryNextConsensusStateHeightResponse {
+ // minimum consensus state height associated with the client identifier larger
+ // than the query height
+ ibc.core.client.v1.Height consensus_height = 1 [(gogoproto.nullable) = false];
+}
+
// QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights
// RPC method.
message QueryConsensusStateHeightsRequest {
2 changes: 2 additions & 0 deletions scripts/sync-protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ cd proto
buf export -v -o ../proto-include
popd

patch -d "$IBC_GO_DIR/proto-include" -p2 < multihop.patch

NFT_TRANSFER_DIR=$(mktemp -d /tmp/nft-transfer-XXXXXXXX)

pushd "$NFT_TRANSFER_DIR"
Expand Down
48 changes: 20 additions & 28 deletions src/prost/google.api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl ::prost::Name for Http {
"/google.api.Http".into()
}
}
/// # gRPC Transcoding
/// gRPC Transcoding
///
/// gRPC Transcoding is a feature for mapping between a gRPC method and one or
/// more HTTP REST endpoints. It allows developers to build a single API service
Expand Down Expand Up @@ -70,9 +70,8 @@ impl ::prost::Name for Http {
///
/// This enables an HTTP REST to gRPC mapping as below:
///
/// HTTP | gRPC
/// -----|-----
/// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
/// - HTTP: `GET /v1/messages/123456`
/// - gRPC: `GetMessage(name: "messages/123456")`
///
/// Any fields in the request message which are not bound by the path template
/// automatically become HTTP query parameters if there is no HTTP request body.
Expand All @@ -96,11 +95,9 @@ impl ::prost::Name for Http {
///
/// This enables a HTTP JSON to RPC mapping as below:
///
/// HTTP | gRPC
/// -----|-----
/// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
/// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
/// "foo"))`
/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
/// SubMessage(subfield: "foo"))`
///
/// Note that fields which are mapped to URL query parameters must have a
/// primitive type or a repeated primitive type or a non-repeated message type.
Expand Down Expand Up @@ -130,10 +127,8 @@ impl ::prost::Name for Http {
/// representation of the JSON in the request body is determined by
/// protos JSON encoding:
///
/// HTTP | gRPC
/// -----|-----
/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
/// "123456" message { text: "Hi!" })`
/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
///
/// The special name `*` can be used in the body mapping to define that
/// every field not bound by the path template should be mapped to the
Expand All @@ -156,10 +151,8 @@ impl ::prost::Name for Http {
///
/// The following HTTP JSON to RPC mapping is enabled:
///
/// HTTP | gRPC
/// -----|-----
/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
/// "123456" text: "Hi!")`
/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
///
/// Note that when using `*` in the body mapping, it is not possible to
/// have HTTP parameters, as all fields not bound by the path end in
Expand Down Expand Up @@ -187,13 +180,13 @@ impl ::prost::Name for Http {
///
/// This enables the following two alternative HTTP JSON to RPC mappings:
///
/// HTTP | gRPC
/// -----|-----
/// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
/// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
/// "123456")`
/// - HTTP: `GET /v1/messages/123456`
/// - gRPC: `GetMessage(message_id: "123456")`
///
/// ## Rules for HTTP mapping
/// - HTTP: `GET /v1/users/me/messages/123456`
/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
///
/// Rules for HTTP mapping
///
/// 1. Leaf request fields (recursive expansion nested messages in the request
/// message) are classified into three categories:
Expand All @@ -212,7 +205,7 @@ impl ::prost::Name for Http {
/// request body, all
/// fields are passed via URL path and URL query parameters.
///
/// ### Path template syntax
/// Path template syntax
///
/// Template = "/" Segments \[ Verb \] ;
/// Segments = Segment { "/" Segment } ;
Expand Down Expand Up @@ -251,7 +244,7 @@ impl ::prost::Name for Http {
/// Document](<https://developers.google.com/discovery/v1/reference/apis>) as
/// `{+var}`.
///
/// ## Using gRPC API Service Configuration
/// Using gRPC API Service Configuration
///
/// gRPC API Service Configuration (service config) is a configuration language
/// for configuring a gRPC service to become a user-facing product. The
Expand All @@ -266,15 +259,14 @@ impl ::prost::Name for Http {
/// specified in the service config will override any matching transcoding
/// configuration in the proto.
///
/// Example:
/// The following example selects a gRPC method and applies an `HttpRule` to it:
///
/// http:
/// rules:
/// # Selects a gRPC method and applies HttpRule to it.
/// - selector: example.v1.Messaging.GetMessage
/// get: /v1/messages/{message_id}/{sub.subfield}
///
/// ## Special notes
/// Special notes
///
/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
/// proto to JSON conversion must follow the [proto3
Expand Down
Loading
Loading