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: remove error from ics27 channel ack #751

Merged
merged 6 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 10 additions & 1 deletion modules/apps/27-interchain-accounts/host/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ func (im IBCModule) OnRecvPacket(
ack := channeltypes.NewResultAcknowledgement([]byte{byte(1)})

if err := im.keeper.OnRecvPacket(ctx, packet); err != nil {
ack = channeltypes.NewErrorAcknowledgement(err.Error())
ack = channeltypes.NewErrorAcknowledgement("error occurred handling packet on destination chain")
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

ctx.EventManager().EmitEvent(
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
sdk.NewEvent(
icatypes.EventTypePacket,
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
sdk.NewAttribute(icatypes.AttributeKeyControllerPort, packet.GetSourcePort()),
Copy link
Member Author

Choose a reason for hiding this comment

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

Not entirely sure if this is needed but could be useful for some kind of correlation. cc. @colin-axner

Copy link
Contributor

Choose a reason for hiding this comment

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

I think more useful to emit the destination channel ID. Then the controller port can be obtained from there. Technically a chain could be connected to two controllers (each on different chains) with the same port. If chains are running the same ICA auth modules, we will see this occur

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. Updated the attribute to AttributeKeyHostChannelID

sdk.NewAttribute(icatypes.AttributeKeyAckError, err.Error()),
),
)
}

// NOTE: acknowledgement will be written synchronously during IBC handler execution.
Expand Down
9 changes: 9 additions & 0 deletions modules/apps/27-interchain-accounts/types/events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package types

// ICS27 Interchain Accounts events
const (
EventTypePacket = "ics27_packet"

AttributeKeyAckError = "error"
AttributeKeyControllerPort = "controller_port"
)