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

fix(ics04): packet receive event type identifier #1179

Merged
merged 7 commits into from
Apr 22, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [ibc-core-channel-types] Make receive packet event type identifier consistent
with `ibc-go`. ([\#1180](https://github.com/cosmos/ibc-rs/issues/1180))
8 changes: 5 additions & 3 deletions ibc-core/ics04-channel/types/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ use super::Version;
use crate::error::ChannelError;
use crate::packet::Packet;

/// Channel event types
/// Channel event types corresponding to ibc-go's channel events:
/// https://github.com/cosmos/ibc-go/blob/c4413c5877f9ef883494da1721cb18caaba7f7f5/modules/core/04-channel/types/events.go#L52-L72
const CHANNEL_OPEN_INIT_EVENT: &str = "channel_open_init";
const CHANNEL_OPEN_TRY_EVENT: &str = "channel_open_try";
const CHANNEL_OPEN_ACK_EVENT: &str = "channel_open_ack";
const CHANNEL_OPEN_CONFIRM_EVENT: &str = "channel_open_confirm";
const CHANNEL_CLOSE_INIT_EVENT: &str = "channel_close_init";
const CHANNEL_CLOSE_CONFIRM_EVENT: &str = "channel_close_confirm";
const CHANNEL_CLOSED_EVENT: &str = "channel_close";
Copy link
Contributor

Choose a reason for hiding this comment

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

Moving the CHANNEL_CLOSED_EVENT constant under the channel event types section introduces some ambiguity regarding the semantics and the purpose of the constant. The string itself being just "channel_close" when all the other "channel_*" constants carry some additional meaning also contributes to the ambiguity.

Can we at least add a docstring comment on the CHANNEL_CLOSED_EVENT constant?

Copy link
Member

@rnbguy rnbguy Apr 22, 2024

Choose a reason for hiding this comment

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

you mean "channel_close_*", right?

It should definitely be

- "channel_close"
+ "channel_closed"

Copy link
Member

Choose a reason for hiding this comment

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

I would suggest just adding a reference link to ibc-go. Because we copy these values from there.

Copy link
Contributor

Choose a reason for hiding this comment

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

ibc-go actually uses channel_close, not channel_closed, which is a bit confusing. But if parity is what we're aiming for, then I guess we go with channel_close.

Copy link
Member

Choose a reason for hiding this comment

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

Yea, that's what I meant that we don't have a choice here 😅


/// Packet event types
const SEND_PACKET_EVENT: &str = "send_packet";
const RECEIVE_PACKET_EVENT: &str = "receive_packet";
const RECEIVE_PACKET_EVENT: &str = "recv_packet";
const WRITE_ACK_EVENT: &str = "write_acknowledgement";
const ACK_PACKET_EVENT: &str = "acknowledge_packet";
const TIMEOUT_EVENT: &str = "timeout_packet";
const CHANNEL_CLOSED_EVENT: &str = "channel_close";

#[cfg_attr(
feature = "parity-scale-codec",
Expand Down
Loading