-
Notifications
You must be signed in to change notification settings - Fork 655
/
Copy pathchannel.proto
187 lines (165 loc) · 7.28 KB
/
channel.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
syntax = "proto3";
package ibc.core.channel.v1;
option go_package = "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types";
import "gogoproto/gogo.proto";
import "ibc/core/client/v1/client.proto";
// Channel defines pipeline for exactly-once packet delivery between specific
// modules on separate blockchains, which has at least one end capable of
// sending packets and one end capable of receiving packets.
message Channel {
option (gogoproto.goproto_getters) = false;
// current state of the channel end
State state = 1;
// whether the channel is ordered or unordered
Order ordering = 2;
// counterparty channel end
Counterparty counterparty = 3 [(gogoproto.nullable) = false];
// list of connection identifiers, in order, along which packets sent on
// this channel will travel
repeated string connection_hops = 4;
// opaque channel version, which is agreed upon during the handshake
string version = 5;
// upgrade sequence indicates the latest upgrade attempt performed by this channel
// the value of 0 indicates the channel has never been upgraded
uint64 upgrade_sequence = 6;
}
// IdentifiedChannel defines a channel with additional port and channel
// identifier fields.
message IdentifiedChannel {
option (gogoproto.goproto_getters) = false;
// current state of the channel end
State state = 1;
// whether the channel is ordered or unordered
Order ordering = 2;
// counterparty channel end
Counterparty counterparty = 3 [(gogoproto.nullable) = false];
// list of connection identifiers, in order, along which packets sent on
// this channel will travel
repeated string connection_hops = 4;
// opaque channel version, which is agreed upon during the handshake
string version = 5;
// port identifier
string port_id = 6;
// channel identifier
string channel_id = 7;
// upgrade sequence indicates the latest upgrade attempt performed by this channel
// the value of 0 indicates the channel has never been upgraded
uint64 upgrade_sequence = 8;
}
// State defines if a channel is in one of the following states:
// CLOSED, INIT, TRYOPEN, OPEN, FLUSHING, FLUSHCOMPLETE or UNINITIALIZED.
enum State {
option (gogoproto.goproto_enum_prefix) = false;
// Default State
STATE_UNINITIALIZED_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNINITIALIZED"];
// A channel has just started the opening handshake.
STATE_INIT = 1 [(gogoproto.enumvalue_customname) = "INIT"];
// A channel has acknowledged the handshake step on the counterparty chain.
STATE_TRYOPEN = 2 [(gogoproto.enumvalue_customname) = "TRYOPEN"];
// A channel has completed the handshake. Open channels are
// ready to send and receive packets.
STATE_OPEN = 3 [(gogoproto.enumvalue_customname) = "OPEN"];
// 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 just accepted the upgrade handshake attempt and is flushing in-flight packets.
STATE_FLUSHING = 5 [(gogoproto.enumvalue_customname) = "FLUSHING"];
// A channel has just completed flushing any in-flight packets.
STATE_FLUSHCOMPLETE = 6 [(gogoproto.enumvalue_customname) = "FLUSHCOMPLETE"];
}
// Order defines if a channel is ORDERED or UNORDERED
enum Order {
option (gogoproto.goproto_enum_prefix) = false;
// zero-value for channel ordering
ORDER_NONE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "NONE"];
// packets can be delivered in any order, which may differ from the order in
// which they were sent.
ORDER_UNORDERED = 1 [(gogoproto.enumvalue_customname) = "UNORDERED"];
// packets are delivered exactly in the order which they were sent
ORDER_ORDERED = 2 [(gogoproto.enumvalue_customname) = "ORDERED"];
}
// Counterparty defines a channel end counterparty
message Counterparty {
option (gogoproto.goproto_getters) = false;
// port on the counterparty chain which owns the other end of the channel.
string port_id = 1;
// channel end on the counterparty chain
string channel_id = 2;
}
// Packet defines a type that carries data across different chains through IBC
message Packet {
option (gogoproto.goproto_getters) = false;
// number corresponds to the order of sends and receives, where a Packet
// with an earlier sequence number must be sent and received before a Packet
// with a later sequence number.
uint64 sequence = 1;
// identifies the port on the sending chain.
string source_port = 2;
// identifies the channel end on the sending chain.
string source_channel = 3;
// identifies the port on the receiving chain.
string destination_port = 4;
// identifies the channel end on the receiving chain.
string destination_channel = 5;
// actual opaque bytes transferred directly to the application module
bytes data = 6;
// block height after which the packet times out
ibc.core.client.v1.Height timeout_height = 7 [(gogoproto.nullable) = false];
// block timestamp (in nanoseconds) after which the packet times out
uint64 timeout_timestamp = 8;
}
// PacketState defines the generic type necessary to retrieve and store
// packet commitments, acknowledgements, and receipts.
// Caller is responsible for knowing the context necessary to interpret this
// state as a commitment, acknowledgement, or a receipt.
message PacketState {
option (gogoproto.goproto_getters) = false;
// channel port identifier.
string port_id = 1;
// channel unique identifier.
string channel_id = 2;
// packet sequence.
uint64 sequence = 3;
// embedded data that represents packet state.
bytes data = 4;
}
// PacketId is an identifier for a unique Packet
// Source chains refer to packets by source port/channel
// Destination chains refer to packets by destination port/channel
message PacketId {
option (gogoproto.goproto_getters) = false;
// channel port identifier
string port_id = 1;
// channel unique identifier
string channel_id = 2;
// packet sequence
uint64 sequence = 3;
}
// Acknowledgement is the recommended acknowledgement format to be used by
// app-specific protocols.
// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental
// conflicts with other protobuf message formats used for acknowledgements.
// The first byte of any message with this format will be the non-ASCII values
// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS:
// https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope
message Acknowledgement {
// response contains either a result or an error and must be non-empty
oneof response {
bytes result = 21;
string error = 22;
}
}
// Timeout defines an execution deadline structure for 04-channel handlers.
// This includes packet lifecycle handlers as well as the upgrade handshake handlers.
// A valid Timeout contains either one or both of a timestamp and block height (sequence).
message Timeout {
// block height after which the packet or upgrade times out
ibc.core.client.v1.Height height = 1 [(gogoproto.nullable) = false];
// block timestamp (in nanoseconds) after which the packet or upgrade times out
uint64 timestamp = 2;
}
// Params defines the set of IBC channel parameters.
message Params {
// the relative timeout after which channel upgrades will time out.
Timeout upgrade_timeout = 1 [(gogoproto.nullable) = false];
}