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

add protobuf files #557

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 17 additions & 0 deletions proto/ibc/apps/transfer/v1/transfer.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package ibc.apps.transfer.v1;

// FungibleTokenPacketData defines a struct for the packet payload
// See FungibleTokenPacketData spec:
// https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures
message FungibleTokenPacketData {
// the token denomination to be transferred
string denom = 1;
// the token amount to be transferred
uint64 amount = 2;
// the sender address
string sender = 3;
// the recipient address on the destination chain
string receiver = 4;
}
18 changes: 18 additions & 0 deletions proto/ibc/core/channel/v1/ack.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
syntax = "proto3";

package ibc.core.channel.v1;

// 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/ics/tree/master/spec/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;
}
}
67 changes: 67 additions & 0 deletions proto/ibc/core/channel/v1/channel.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
syntax = "proto3";

package ibc.core.channel.v1;

import "gogoproto/gogo.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 [(gogoproto.moretags) = "yaml:\"connection_hops\""];
// opaque channel version, which is agreed upon during the handshake
string version = 5;
}

// State defines if a channel is in one of the following states:
// CLOSED, INIT, TRYOPEN, OPEN 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"];
}

// 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 [(gogoproto.moretags) = "yaml:\"port_id\""];
// channel end on the counterparty chain
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
}

32 changes: 32 additions & 0 deletions proto/ibc/core/channel/v1/packet.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";

package ibc.core.channel.v1;

import "gogoproto/gogo.proto";
import "ibc/core/client/v1/height.proto";

// Packet defines a type that carries data across different chains through IBC
message Packet {
option (gogoproto.goproto_getters) = false;

// sequence 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 [(gogoproto.moretags) = "yaml:\"source_port\""];
// identifies the channel end on the sending chain.
string source_channel = 3 [(gogoproto.moretags) = "yaml:\"source_channel\""];
// identifies the port on the receiving chain.
string destination_port = 4 [(gogoproto.moretags) = "yaml:\"destination_port\""];
// identifies the channel end on the receiving chain.
string destination_channel = 5 [(gogoproto.moretags) = "yaml:\"destination_channel\""];
// actual opaque bytes transferred directly to the application module
bytes data = 6;
// block height after which the packet times out
ibc.core.height.v1.Height timeout_height = 7
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];
// block timestamp (in nanoseconds) after which the packet times out
uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
}

25 changes: 25 additions & 0 deletions proto/ibc/core/client/v1/height.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

package ibc.core.client.v1;

import "gogoproto/gogo.proto";

// Height is a monotonically increasing data type
// that can be compared against another Height for the purposes of updating and
// freezing clients
//
// Normally the RevisionHeight is incremented at each height while keeping RevisionNumber
// the same. However some consensus algorithms may choose to reset the
// height in certain conditions e.g. hard forks, state-machine breaking changes
// In these cases, the RevisionNumber is incremented so that height continues to
// be monitonically increasing even as the RevisionHeight gets reset
message Height {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

// the revision that the client is currently on
uint64 revision_number = 1 [(gogoproto.moretags) = "yaml:\"revision_number\""];
// the height within the given revision
uint64 revision_height = 2 [(gogoproto.moretags) = "yaml:\"revision_height\""];
}

38 changes: 38 additions & 0 deletions proto/ibc/core/commitment/v1/commitment.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
syntax = "proto3";

package ibc.core.commitment.v1;

import "gogoproto/gogo.proto";

// MerkleRoot defines a merkle root hash.
// In the Cosmos SDK, the AppHash of a block header becomes the root.
message MerkleRoot {
option (gogoproto.goproto_getters) = false;

bytes hash = 1;
}

// MerklePrefix is merkle path prefixed to the key.
// The constructed key from the Path and the key will be append(Path.KeyPath,
// append(Path.KeyPrefix, key...))
message MerklePrefix {
bytes key_prefix = 1 [(gogoproto.moretags) = "yaml:\"key_prefix\""];
}

// MerklePath is the path used to verify commitment proofs, which can be an
// arbitrary structured object (defined by a commitment type).
// MerklePath is represented from root-to-leaf
message MerklePath {
option (gogoproto.goproto_stringer) = false;

repeated string key_path = 1 [(gogoproto.moretags) = "yaml:\"key_path\""];
}

// MerkleProof is a wrapper type over a chain of CommitmentProofs.
// It demonstrates membership or non-membership for an element or set of
// elements, verifiable in conjunction with a known commitment root. Proofs
// should be succinct.
// MerkleProofs are ordered from leaf-to-root
message MerkleProof {
repeated ics23.CommitmentProof proofs = 1;
}
70 changes: 70 additions & 0 deletions proto/ibc/core/connection/v1/connection.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
syntax = "proto3";

package ibc.core.connection.v1;

import "gogoproto/gogo.proto";
import "ibc/core/commitment/v1/commitment.proto";

// ICS03 - Connection Data Structures as defined in
// https://github.com/cosmos/ics/tree/master/spec/ics-003-connection-semantics#data-structures

// ConnectionEnd defines a stateful object on a chain connected to another
// separate one.
// NOTE: there must only be 2 defined ConnectionEnds to establish
// a connection between two chains.
message ConnectionEnd {
option (gogoproto.goproto_getters) = false;
// client associated with this connection.
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
// IBC version which can be utilised to determine encodings or protocols for
// channels or packets utilising this connection.
repeated Version versions = 2;
// current state of the connection end.
State state = 3;
// counterparty chain associated with this connection.
Counterparty counterparty = 4 [(gogoproto.nullable) = false];
// delay period that must pass before a consensus state can be used for packet-verification
// NOTE: delay period logic is only implemented by some clients.
uint64 delay_period = 5 [(gogoproto.moretags) = "yaml:\"delay_period\""];
}

// State defines if a connection is in one of the following states:
// INIT, TRYOPEN, OPEN or UNINITIALIZED.
enum State {
option (gogoproto.goproto_enum_prefix) = false;

// Default State
STATE_UNINITIALIZED_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNINITIALIZED"];
// A connection end has just started the opening handshake.
STATE_INIT = 1 [(gogoproto.enumvalue_customname) = "INIT"];
// A connection end has acknowledged the handshake step on the counterparty
// chain.
STATE_TRYOPEN = 2 [(gogoproto.enumvalue_customname) = "TRYOPEN"];
// A connection end has completed the handshake.
STATE_OPEN = 3 [(gogoproto.enumvalue_customname) = "OPEN"];
}

// Counterparty defines the counterparty chain associated with a connection end.
message Counterparty {
option (gogoproto.goproto_getters) = false;

// identifies the client on the counterparty chain associated with a given
// connection.
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
// identifies the connection end on the counterparty chain associated with a
// given connection.
string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""];
// commitment merkle prefix of the counterparty chain.
ibc.core.commitment.v1.MerklePrefix prefix = 3 [(gogoproto.nullable) = false];
}

// Version defines the versioning scheme used to negotiate the IBC verison in
// the connection handshake.
message Version {
option (gogoproto.goproto_getters) = false;

// unique version identifier
string identifier = 1;
// list of features compatible with the specified identifier
repeated string features = 2;
}
16 changes: 16 additions & 0 deletions proto/ibc/core/connection/v1/version.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

package ibc.core.connection.v1;

import "gogoproto/gogo.proto";

// Version defines the versioning scheme used to negotiate the IBC verison in
// the connection handshake.
message Version {
option (gogoproto.goproto_getters) = false;

// unique version identifier
string identifier = 1;
// list of features compatible with the specified identifier
repeated string features = 2;
}
16 changes: 16 additions & 0 deletions proto/ibc/lightclients/localhost/v1/localhost.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

package ibc.lightclients.localhost.v1;

import "gogoproto/gogo.proto";
import "ibc/core/client/v1/height.proto";

// ClientState defines a loopback (localhost) client. It requires (read-only)
// access to keys outside the client prefix.
message ClientState {
option (gogoproto.goproto_getters) = false;
// self chain ID
string chain_id = 1 [(gogoproto.moretags) = "yaml:\"chain_id\""];
// self latest block height
ibc.core.client.v1.Height height = 2 [(gogoproto.nullable) = false];
}
Loading