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 42 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
23 changes: 23 additions & 0 deletions proto/ibc/applications/transfer/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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";

// 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",
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit, I'd just use string here

(gogoproto.moretags) = "yaml:\"trace_hash\""
];

string denom = 2;
}
210 changes: 210 additions & 0 deletions proto/ibc/core/channel/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
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 "gogoproto/gogo.proto";
import "ibc/core/client/v1/client.proto";

// EventChannelOpenInit is a typed event emitted on channel open init
message EventChannelOpenInit {
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];

string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];

string counterparty_port_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_port_id\""];

string counterparty_channel_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""];
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

string connection_id = 5 [(gogoproto.moretags) = "yaml:\"connection_id\""];
}

// EventChannelOpenTry is a typed event emitted on channel open try
message EventChannelOpenTry {
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];

string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];

string counterparty_port_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_port_id\""];

string counterparty_channel_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""];

string connection_id = 5 [(gogoproto.moretags) = "yaml:\"connection_id\""];
}

// EventChannelOpenAck is a typed event emitted on channel open acknowledgement
message EventChannelOpenAck {
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];

string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];

string counterparty_port_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_port_id\""];

string counterparty_channel_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""];

string connection_id = 5 [(gogoproto.moretags) = "yaml:\"connection_id\""];
}

// 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 [(gogoproto.moretags) = "yaml:\"port_id\""];

string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];

string counterparty_port_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_port_id\""];

string counterparty_channel_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""];

string connection_id = 5 [(gogoproto.moretags) = "yaml:\"connection_id\""];
}

// EventChannelOpenConfirm is a typed event emitted on channel open confirm
message EventChannelOpenConfirm {
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];

string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];

string counterparty_port_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_port_id\""];

string counterparty_channel_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""];

string connection_id = 5 [(gogoproto.moretags) = "yaml:\"connection_id\""];
}

// EventChannelCloseConfirm is a typed event emitted on channel close confirm
message EventChannelCloseConfirm {
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];

string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];

string counterparty_port_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_port_id\""];

string counterparty_channel_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""];

string connection_id = 5 [(gogoproto.moretags) = "yaml:\"connection_id\""];
}

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

ibc.core.client.v1.Height timeout_height = 2
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];

uint64 timeout_timestamp = 3 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];

uint64 sequence = 4;

string src_port = 5 [(gogoproto.moretags) = "yaml:\"src_port\""];

string src_channel = 6 [(gogoproto.moretags) = "yaml:\"src_channel\""];

string dst_port = 7 [(gogoproto.moretags) = "yaml:\"dst_port\""];

string dst_channel = 8 [(gogoproto.moretags) = "yaml:\"dst_channel\""];

Order channel_ordering = 9 [(gogoproto.moretags) = "yaml:\"channel_ordering\""];
}

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

ibc.core.client.v1.Height timeout_height = 2
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];

uint64 timeout_timestamp = 3 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];

uint64 sequence = 4;

string src_port = 5 [(gogoproto.moretags) = "yaml:\"src_port\""];

string src_channel = 6 [(gogoproto.moretags) = "yaml:\"src_channel\""];

string dst_port = 7 [(gogoproto.moretags) = "yaml:\"dst_port\""];

string dst_channel = 8 [(gogoproto.moretags) = "yaml:\"dst_channel\""];

Order channel_ordering = 9 [(gogoproto.moretags) = "yaml:\"channel_ordering\""];

bool success = 10;
}

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

ibc.core.client.v1.Height timeout_height = 2
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];

uint64 timeout_timestamp = 3 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];

uint64 sequence = 4;

string src_port = 5 [(gogoproto.moretags) = "yaml:\"src_port\""];

string src_channel = 6 [(gogoproto.moretags) = "yaml:\"src_channel\""];

string dst_port = 7 [(gogoproto.moretags) = "yaml:\"dst_port\""];

string dst_channel = 8 [(gogoproto.moretags) = "yaml:\"dst_channel\""];

bytes acknowledgement = 9;
}

// EventChannelAckPacket is a typed event emitted when packet acknowledgement is executed
message EventChannelAckPacket {
bytes data = 1;

ibc.core.client.v1.Height timeout_height = 2
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];

uint64 timeout_timestamp = 3 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];

uint64 sequence = 4;

string src_port = 5 [(gogoproto.moretags) = "yaml:\"src_port\""];

string src_channel = 6 [(gogoproto.moretags) = "yaml:\"src_channel\""];

string dst_port = 7 [(gogoproto.moretags) = "yaml:\"dst_port\""];

string dst_channel = 8 [(gogoproto.moretags) = "yaml:\"dst_channel\""];

Order channel_ordering = 9 [(gogoproto.moretags) = "yaml:\"channel_ordering\""];

bytes acknowledgement = 10;
}

// EventChannelTimeoutPacket is a typed event emitted when packet is timeout
message EventChannelTimeoutPacket {
bytes data = 1;

ibc.core.client.v1.Height timeout_height = 2
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];

uint64 timeout_timestamp = 3 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];

uint64 sequence = 4;

string src_port = 5 [(gogoproto.moretags) = "yaml:\"src_port\""];

string src_channel = 6 [(gogoproto.moretags) = "yaml:\"src_channel\""];

string dst_port = 7 [(gogoproto.moretags) = "yaml:\"dst_port\""];

string dst_channel = 8 [(gogoproto.moretags) = "yaml:\"dst_channel\""];

Order channel_ordering = 9 [(gogoproto.moretags) = "yaml:\"channel_ordering\""];
}

// EventAcknowledgementSuccess is a typed event emitted on packet acknowledgement success
message EventAcknowledgementSuccess {
bytes success = 1;
}

// EventAcknowledgementError is a typed event emitted on packet acknowledgement error
message EventAcknowledgementError {
string error = 1;
}
57 changes: 57 additions & 0 deletions proto/ibc/core/client/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
syntax = "proto3";
package ibc.core.client.v1;

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

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

// EventCreateClient is a typed event emitted on creating client
message EventCreateClient {
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];

string client_type = 2 [(gogoproto.moretags) = "yaml:\"client_type\""];

ibc.core.client.v1.Height consensus_height = 3
[(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false];
}

// EventUpdateClient is a typed event emitted on updating client
message EventUpdateClient {
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];

string client_type = 2 [(gogoproto.moretags) = "yaml:\"client_type\""];

ibc.core.client.v1.Height consensus_height = 3
[(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false];
}

// EventUpgradeClient is a typed event emitted on upgrading client
message EventUpgradeClient {
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];

string client_type = 2 [(gogoproto.moretags) = "yaml:\"client_type\""];

ibc.core.client.v1.Height consensus_height = 3
[(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false];
}

// EventUpdateClientProposal is a typed event emitted on updating client proposal
message EventUpdateClientProposal {
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];

string client_type = 2 [(gogoproto.moretags) = "yaml:\"client_type\""];

ibc.core.client.v1.Height consensus_height = 3
[(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false];
}

// EventClientMisbehaviour is a typed event emitted when misbehaviour is submitted
message EventClientMisbehaviour {
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];

string client_type = 2 [(gogoproto.moretags) = "yaml:\"client_type\""];

ibc.core.client.v1.Height consensus_height = 3
[(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false];
}
50 changes: 50 additions & 0 deletions proto/ibc/core/connection/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
syntax = "proto3";
package ibc.core.connection.v1;

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

import "gogoproto/gogo.proto";

// EventConnectionOpenInit is a typed event emitted on connection open init
message EventConnectionOpenInit {
string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];

string client_id = 2 [(gogoproto.moretags) = "yaml:\"client_id\""];

string counterparty_connection_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_connection_id\""];
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

string counterparty_client_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_client_id\""];
}

// EventConnectionOpenTry is a typed event emitted on connection open try
message EventConnectionOpenTry {
string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];

string client_id = 2 [(gogoproto.moretags) = "yaml:\"client_id\""];

string counterparty_connection_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_connection_id\""];

string counterparty_client_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_client_id\""];
}

// EventConnectionOpenAck is a typed event emitted on connection open acknowledgement
message EventConnectionOpenAck {
string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];

string client_id = 2 [(gogoproto.moretags) = "yaml:\"client_id\""];

string counterparty_connection_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_connection_id\""];

string counterparty_client_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_client_id\""];
}

// EventConnectionOpenConfirm is a typed event emitted on connection open init
message EventConnectionOpenConfirm {
string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];

string client_id = 2 [(gogoproto.moretags) = "yaml:\"client_id\""];

string counterparty_connection_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_connection_id\""];

string counterparty_client_id = 4 [(gogoproto.moretags) = "yaml:\"counterparty_client_id\""];
}
Loading