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

x/ibc: implement ADR 032 typed events #7762

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5b539e7
Add EmitTypedEvent in events
akhilkumarpilli Oct 3, 2020
ed85dd7
Add parseTypedEvent method
akhilkumarpilli Oct 5, 2020
7d9919b
Use jsonpb
anilcse Oct 6, 2020
deb1e3c
Modify unmarshal proto in events
akhilkumarpilli Oct 6, 2020
5e11d14
Merge branch 'events-adr' of github.com:akhilkumarpilli/cosmos-sdk in…
akhilkumarpilli Oct 6, 2020
171f362
Add a test for typed events
anilcse Oct 6, 2020
f158344
Fix reflect issue in parseTypedEvent
akhilkumarpilli Oct 7, 2020
faeab07
Modify event tests and add comments
akhilkumarpilli Oct 15, 2020
fe5f8ca
Merge remote-tracking branch 'upstream/master' into events-adr
akhilkumarpilli Oct 15, 2020
50f3f1f
Add EmitTypedEvents and refactor other methods
akhilkumarpilli Oct 15, 2020
45f32f8
Merge remote-tracking branch 'upstream/master' into events-adr
akhilkumarpilli Oct 15, 2020
fa6a618
Fix golangci-lint issues
akhilkumarpilli Oct 15, 2020
625501d
Merge remote-tracking branch 'upstream/master' into events-adr
akhilkumarpilli Oct 15, 2020
526d942
Update ProtoMarshalJSON params
akhilkumarpilli Oct 16, 2020
6719759
Merge remote-tracking branch 'upstream/master' into events-adr
akhilkumarpilli Oct 16, 2020
d8b6883
Merge branch 'master' into events-adr
jackzampolin Oct 23, 2020
5f472bf
Address PR comments
akhilkumarpilli Oct 27, 2020
a79c878
Merge remote-tracking branch 'upstream/master' into events-adr
akhilkumarpilli Oct 27, 2020
ebb07e3
Add typed events in ibc transfer
akhilkumarpilli Oct 27, 2020
b16fcd0
Merge branch 'master' into events-adr
jackzampolin Oct 27, 2020
700f504
x/ibc: migrate EmitEvent to EmitTypedEvents
akhilkumarpilli Oct 28, 2020
62be11a
Merge branch 'events-adr' into ibc-typed-events
akhilkumarpilli Oct 28, 2020
7f98f3f
Merge remote-tracking branch 'upstream/master' into ibc-typed-events
akhilkumarpilli Oct 29, 2020
3324f28
Merge branch 'master' into ibc-typed-events
jackzampolin Oct 29, 2020
2a7b622
Merge branch 'master' into ibc-typed-events
akhilkumarpilli Oct 30, 2020
8d7747e
Add TestPackHeight
akhilkumarpilli Oct 30, 2020
123f0c2
Merge branch 'master' into ibc-typed-events
jackzampolin Oct 30, 2020
d998bd9
Use *Height instead of Height
akhilkumarpilli Nov 3, 2020
5efe687
Merge branch 'master' into akhil/7563-ibc-typed-events
akhilkumarpilli Nov 3, 2020
d8c41cf
Merge branch 'master' into akhil/7563-ibc-typed-events
akhilkumarpilli Nov 3, 2020
f0212b1
Merge branch 'master' into akhil/7563-ibc-typed-events
jackzampolin Nov 6, 2020
a4d9034
Fix tendermint abci query txs issue
akhilkumarpilli Nov 11, 2020
5a4d5dc
Merge branch 'master' into akhil/7563-ibc-typed-events
akhilkumarpilli Nov 11, 2020
f609c7e
Add ResultEventToABCIEvent
akhilkumarpilli Nov 11, 2020
6d92028
Fix golangci lint issues
akhilkumarpilli Nov 11, 2020
344614b
Update attribute value encoding
akhilkumarpilli Nov 18, 2020
dfe947b
Merge branch 'master' into akhil/7563-ibc-typed-events
akhilkumarpilli Nov 19, 2020
3e9169c
Revert EventTypeMessage events
akhilkumarpilli Nov 19, 2020
f9eb795
Revert Height changes
akhilkumarpilli Nov 30, 2020
f3fa0c7
Address PR comments
akhilkumarpilli Nov 30, 2020
d0192c8
Merge branch 'master' into akhil/7563-ibc-typed-events
akhilkumarpilli Nov 30, 2020
c00f98d
Fix error
akhilkumarpilli Nov 30, 2020
7e85d4e
Address few PR comments
akhilkumarpilli Dec 1, 2020
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
62 changes: 62 additions & 0 deletions proto/ibc/applications/transfer/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
syntax = "proto3";
package ibc.applications.transfer.v1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit, but can we rename these proto files to events.proto?


option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types";

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

// EventOnRecvPacket is a typed event emitted on receiving packet
message EventOnRecvPacket {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a feeling this might want to be a channel event? cc @AdityaSripal @cwgoes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea this should be under proto/ibc/core/channel

string receiver = 1;

string denom = 2;

uint64 amount = 3;

bool success = 4;
}

// EventOnAcknowledgementPacket is a typed event emitted on packet acknowledgement
message EventOnAcknowledgementPacket {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a feeling this might want to be a channel event? cc @AdityaSripal @cwgoes

string receiver = 1;

string denom = 2;

uint64 amount = 3;

ibc.core.channel.v1.Acknowledgement acknowledgement = 4 [(gogoproto.nullable) = false];
}

// EventAcknowledgementSuccess is a typed event emitted on packet acknowledgement success
message EventAcknowledgementSuccess {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a feeling this might want to be a channel event? cc @AdityaSripal @cwgoes

bytes success = 1;
}

// EventAcknowledgementError is a typed event emitted on packet acknowledgement error
message EventAcknowledgementError {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a feeling this might want to be a channel event? cc @AdityaSripal @cwgoes

string error = 1;
}

// EventOnTimeoutPacket is a typed event emitted on packet timeout
message EventOnTimeoutPacket {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in channel along with all the events above

string refund_receiver = 1;

string refund_denom = 2;

uint64 refund_amount = 3;
}

// EventTransfer is a typed event emitted on ibc transfer
message EventTransfer {
string sender = 1;

string receiver = 2;
}

// EventDenominationTrace is a typed event for denomination trace
message EventDenominationTrace {
bytes trace_hash = 1 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"];

string denom = 2;
}
2 changes: 1 addition & 1 deletion proto/ibc/applications/transfer/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message MsgTransfer {
// Timeout height relative to the current block height.
// The timeout is disabled when set to 0.
ibc.core.client.v1.Height timeout_height = 6
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
[(gogoproto.moretags) = "yaml:\"timeout_height\""];
// Timeout timestamp (in nanoseconds) relative to the current block timestamp.
// The timeout is disabled when set to 0.
uint64 timeout_timestamp = 7 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
Expand Down
2 changes: 1 addition & 1 deletion proto/ibc/core/channel/v1/channel.proto
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ message Packet {
bytes data = 6;
// block height after which the packet times out
ibc.core.client.v1.Height timeout_height = 7
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];
[(gogoproto.moretags) = "yaml:\"timeout_height\""];
// block timestamp (in nanoseconds) after which the packet times out
uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
}
Expand Down
187 changes: 187 additions & 0 deletions proto/ibc/core/channel/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
syntax = "proto3";
package ibc.core.channel.v1;

option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types";

import "ibc/core/channel/v1/channel.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";

// EventChannelOpenInit is a typed event emitted on channel open init
message EventChannelOpenInit {
string port_id = 1;
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

string channel_id = 2;

string counterparty_port_id = 3;

string counterparty_channel_id = 4;

string connection_id = 5;
}

// EventChannelOpenTry is a typed event emitted on channel open try
message EventChannelOpenTry {
string port_id = 1;

string channel_id = 2;

string counterparty_port_id = 3;

string counterparty_channel_id = 4;

string connection_id = 5;
}

// EventChannelOpenAck is a typed event emitted on channel open acknowledgement
message EventChannelOpenAck {
string port_id = 1;

string channel_id = 2;

string counterparty_port_id = 3;

string counterparty_channel_id = 4;

string connection_id = 5;
}

// EventChannelCloseInit is a typed event emitted on channel close init
message EventChannelCloseInit {
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
string port_id = 1;

string channel_id = 2;

string counterparty_port_id = 3;

string counterparty_channel_id = 4;

string connection_id = 5;
}

// EventChannelOpenConfirm is a typed event emitted on channel open confirm
message EventChannelOpenConfirm {
string port_id = 1;

string channel_id = 2;

string counterparty_port_id = 3;

string counterparty_channel_id = 4;

string connection_id = 5;
}

// EventChannelCloseConfirm is a typed event emitted on channel close confirm
message EventChannelCloseConfirm {
string port_id = 1;

string channel_id = 2;

string counterparty_port_id = 3;

string counterparty_channel_id = 4;

string connection_id = 5;
}

// EventChannelSendPacket is a typed event emitted when packet is sent
message EventChannelSendPacket {
bytes data = 1;

google.protobuf.Any timeout_height = 2 [(cosmos_proto.accepts_interface) = "Height"];

uint64 timeout_timestamp = 3;

uint64 sequence = 4;

string src_port = 5;

string src_channel = 6;

string dst_port = 7;

string dst_channel = 8;

Order channel_ordering = 9;
}

// EventChannelRecvPacket is a typed event emitted when packet is received in channel
message EventChannelRecvPacket {
bytes data = 1;

google.protobuf.Any timeout_height = 2 [(cosmos_proto.accepts_interface) = "Height"];

uint64 timeout_timestamp = 3;

uint64 sequence = 4;

string src_port = 5;

string src_channel = 6;

string dst_port = 7;

string dst_channel = 8;

Order channel_ordering = 9;
}

// EventChannelWriteAck is a typed event emitted on write acknowledgement
message EventChannelWriteAck {
bytes data = 1;

google.protobuf.Any timeout_height = 2 [(cosmos_proto.accepts_interface) = "Height"];

uint64 timeout_timestamp = 3;

uint64 sequence = 4;

string src_port = 5;

string src_channel = 6;

string dst_port = 7;

string dst_channel = 8;

bytes acknowledgement = 9;
}

// EventChannelAckPacket is a typed event emitted when packet acknowledgement is executed
message EventChannelAckPacket {
google.protobuf.Any timeout_height = 1 [(cosmos_proto.accepts_interface) = "Height"];

uint64 timeout_timestamp = 2;

uint64 sequence = 3;

string src_port = 4;

string src_channel = 5;

string dst_port = 6;

string dst_channel = 7;

Order channel_ordering = 8;
}

// EventChannelTimeoutPacket is a typed event emitted when packet is timeout
message EventChannelTimeoutPacket {
google.protobuf.Any timeout_height = 1 [(cosmos_proto.accepts_interface) = "Height"];

uint64 timeout_timestamp = 2;

uint64 sequence = 3;

string src_port = 4;

string src_channel = 5;

string dst_port = 6;

string dst_channel = 7;

Order channel_ordering = 8;
}
26 changes: 13 additions & 13 deletions proto/ibc/core/channel/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ message QueryChannelResponse {
// merkle proof of existence
bytes proof = 2;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3;
}

// QueryChannelsRequest is the request type for the Query/Channels RPC method
Expand All @@ -126,7 +126,7 @@ message QueryChannelsResponse {
// pagination response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
// query block height
ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height height = 3;
}

// QueryConnectionChannelsRequest is the request type for the
Expand All @@ -146,7 +146,7 @@ message QueryConnectionChannelsResponse {
// pagination response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
// query block height
ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height height = 3;
}

// QueryChannelClientStateRequest is the request type for the Query/ClientState
Expand All @@ -166,7 +166,7 @@ message QueryChannelClientStateResponse {
// merkle proof of existence
bytes proof = 2;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3;
}

// QueryChannelConsensusStateRequest is the request type for the
Expand All @@ -192,7 +192,7 @@ message QueryChannelConsensusStateResponse {
// merkle proof of existence
bytes proof = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 4;
}

// QueryPacketCommitmentRequest is the request type for the
Expand All @@ -215,7 +215,7 @@ message QueryPacketCommitmentResponse {
// merkle proof of existence
bytes proof = 2;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3;
}

// QueryPacketCommitmentsRequest is the request type for the
Expand All @@ -236,7 +236,7 @@ message QueryPacketCommitmentsResponse {
// pagination response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
// query block height
ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height height = 3;
}

// QueryPacketReceiptRequest is the request type for the
Expand All @@ -259,7 +259,7 @@ message QueryPacketReceiptResponse {
// merkle proof of existence
bytes proof = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 4;
}

// QueryPacketAcknowledgementRequest is the request type for the
Expand All @@ -282,7 +282,7 @@ message QueryPacketAcknowledgementResponse {
// merkle proof of existence
bytes proof = 2;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3;
}

// QueryPacketAcknowledgementsRequest is the request type for the
Expand All @@ -303,7 +303,7 @@ message QueryPacketAcknowledgementsResponse {
// pagination response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
// query block height
ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height height = 3;
}

// QueryUnreceivedPacketsRequest is the request type for the
Expand All @@ -323,7 +323,7 @@ message QueryUnreceivedPacketsResponse {
// list of unreceived packet sequences
repeated uint64 sequences = 1;
// query block height
ibc.core.client.v1.Height height = 2 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height height = 2;
}

// QueryUnreceivedAcks is the request type for the
Expand All @@ -343,7 +343,7 @@ message QueryUnreceivedAcksResponse {
// list of unreceived acknowledgement sequences
repeated uint64 sequences = 1;
// query block height
ibc.core.client.v1.Height height = 2 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height height = 2;
}

// QueryNextSequenceReceiveRequest is the request type for the
Expand All @@ -363,5 +363,5 @@ message QueryNextSequenceReceiveResponse {
// merkle proof of existence
bytes proof = 2;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3;
}
Loading