From 76a86ce8a3d84e773c95473672e8acbf6ed20ff9 Mon Sep 17 00:00:00 2001 From: Ali Zahid Raja Date: Tue, 27 Sep 2022 13:58:13 +0500 Subject: [PATCH 1/6] updated error calls with module names --- modules/core/keeper/msg_server.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index ee66a268b01..ada575a80cf 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -190,7 +190,7 @@ func (k Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgChan // Perform application logic callback version, err := cbs.OnChanOpenInit(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, cap, msg.Channel.Counterparty, msg.Channel.Version) if err != nil { - return nil, sdkerrors.Wrap(err, "channel open init callback failed") + return nil, sdkerrors.Wrapf(err, "channel open init callback failed for module: %s", module) } // Write channel into state @@ -231,7 +231,7 @@ func (k Keeper) ChannelOpenTry(goCtx context.Context, msg *channeltypes.MsgChann // Perform application logic callback version, err := cbs.OnChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, cap, msg.Channel.Counterparty, msg.CounterpartyVersion) if err != nil { - return nil, sdkerrors.Wrap(err, "channel open try callback failed") + return nil, sdkerrors.Wrapf(err, "channel open try callback failed for module: %s", module) } // Write channel into state @@ -269,7 +269,7 @@ func (k Keeper) ChannelOpenAck(goCtx context.Context, msg *channeltypes.MsgChann // Perform application logic callback if err = cbs.OnChanOpenAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelId, msg.CounterpartyVersion); err != nil { - return nil, sdkerrors.Wrap(err, "channel open ack callback failed") + return nil, sdkerrors.Wrapf(err, "channel open ack callback failed for module: %s", module) } // Write channel into state @@ -303,7 +303,7 @@ func (k Keeper) ChannelOpenConfirm(goCtx context.Context, msg *channeltypes.MsgC // Perform application logic callback if err = cbs.OnChanOpenConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrap(err, "channel open confirm callback failed") + return nil, sdkerrors.Wrapf(err, "channel open confirm callback failed for module: %s", module) } // Write channel into state @@ -328,7 +328,7 @@ func (k Keeper) ChannelCloseInit(goCtx context.Context, msg *channeltypes.MsgCha } if err = cbs.OnChanCloseInit(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrap(err, "channel close init callback failed") + return nil, sdkerrors.Wrapf(err, "channel close init callback failed for module: %s", module) } err = k.ChannelKeeper.ChanCloseInit(ctx, msg.PortId, msg.ChannelId, cap) @@ -356,7 +356,7 @@ func (k Keeper) ChannelCloseConfirm(goCtx context.Context, msg *channeltypes.Msg } if err = cbs.OnChanCloseConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrap(err, "channel close confirm callback failed") + return nil, sdkerrors.Wrapf(err, "channel close confirm callback failed for module: %s", module) } err = k.ChannelKeeper.ChanCloseConfirm(ctx, msg.PortId, msg.ChannelId, cap, msg.ProofInit, msg.ProofHeight) From 8f68c542a44c42a0172d3b8a977ae648ede711fa Mon Sep 17 00:00:00 2001 From: Ali Zahid Raja Date: Tue, 27 Sep 2022 14:01:43 +0500 Subject: [PATCH 2/6] updated changelog.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54fe9f93246..331c77b6d5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,7 +99,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/27-interchain-accounts) [\#2140](https://github.com/cosmos/ibc-go/pull/2140) Adding migration handler to ICS27 `controller` submodule to assert ownership of channel capabilities and set middleware enabled flag for existing channels. The ICS27 module consensus version has been bumped from 1 to 2. * (apps/27-interchain-accounts) [\#2290](https://github.com/cosmos/ibc-go/pull/2290) Changed `DefaultParams` function in `host` submodule to allow all messages by default. Defined a constant named `AllowAllHostMsgs` for `host` module to keep wildcard "*" string which allows all messages. * (apps/27-interchain-accounts) [\#2248](https://github.com/cosmos/ibc-go/pull/2248) Adding call to underlying app in `OnChanCloseConfirm` callback of the controller submodule and adding relevant unit tests. -* (apps/27-interchain-accounts) [\#2251](https://github.com/cosmos/ibc-go/pull/2251) Adding `msgServer` struct to controller submodule that embeds the `Keeper` struct. +* (apps/27-interchain-accounts) [\#2251](https://github.com/cosmos/ibc-go/pull/2251) Adding `msgServer` struct to controller submodule that embeds the `Keeper` struct. +* (modules/core/keeper) [\#1728](https://github.com/cosmos/ibc-go/pull/2387) Updated channel callback errors to includ module names for better identification of errors. ### Features From c0266e6a30d3ba9fcf982a9c6ab08bc39c09d7b8 Mon Sep 17 00:00:00 2001 From: Ali Zahid Raja Date: Tue, 27 Sep 2022 14:07:41 +0500 Subject: [PATCH 3/6] updated changelog.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 331c77b6d5e..b112867bcc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,7 +100,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/27-interchain-accounts) [\#2290](https://github.com/cosmos/ibc-go/pull/2290) Changed `DefaultParams` function in `host` submodule to allow all messages by default. Defined a constant named `AllowAllHostMsgs` for `host` module to keep wildcard "*" string which allows all messages. * (apps/27-interchain-accounts) [\#2248](https://github.com/cosmos/ibc-go/pull/2248) Adding call to underlying app in `OnChanCloseConfirm` callback of the controller submodule and adding relevant unit tests. * (apps/27-interchain-accounts) [\#2251](https://github.com/cosmos/ibc-go/pull/2251) Adding `msgServer` struct to controller submodule that embeds the `Keeper` struct. -* (modules/core/keeper) [\#1728](https://github.com/cosmos/ibc-go/pull/2387) Updated channel callback errors to includ module names for better identification of errors. +* (modules/core/keeper) [\#1728](https://github.com/cosmos/ibc-go/pull/2399) Updated channel callback errors to includ module names for better identification of errors. ### Features From b7d9c360c5fe82e75312f12577e2846c4489d496 Mon Sep 17 00:00:00 2001 From: Ali Zahid Raja Date: Tue, 27 Sep 2022 14:15:27 +0500 Subject: [PATCH 4/6] added portID,channelID in channel error callback --- CHANGELOG.md | 2 +- modules/core/keeper/msg_server.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b112867bcc0..134d2b2f69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,7 +100,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/27-interchain-accounts) [\#2290](https://github.com/cosmos/ibc-go/pull/2290) Changed `DefaultParams` function in `host` submodule to allow all messages by default. Defined a constant named `AllowAllHostMsgs` for `host` module to keep wildcard "*" string which allows all messages. * (apps/27-interchain-accounts) [\#2248](https://github.com/cosmos/ibc-go/pull/2248) Adding call to underlying app in `OnChanCloseConfirm` callback of the controller submodule and adding relevant unit tests. * (apps/27-interchain-accounts) [\#2251](https://github.com/cosmos/ibc-go/pull/2251) Adding `msgServer` struct to controller submodule that embeds the `Keeper` struct. -* (modules/core/keeper) [\#1728](https://github.com/cosmos/ibc-go/pull/2399) Updated channel callback errors to includ module names for better identification of errors. +* (modules/core/keeper) [\#1728](https://github.com/cosmos/ibc-go/pull/2399) Updated channel callback errors to includ portID & channelID for better identification of errors. ### Features diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index ada575a80cf..31794502d48 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -190,7 +190,7 @@ func (k Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgChan // Perform application logic callback version, err := cbs.OnChanOpenInit(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, cap, msg.Channel.Counterparty, msg.Channel.Version) if err != nil { - return nil, sdkerrors.Wrapf(err, "channel open init callback failed for module: %s", module) + return nil, sdkerrors.Wrapf(err, "channel open init callback failed for Port ID: %s, Channel ID: %s", msg.PortId, channelID) } // Write channel into state @@ -231,7 +231,7 @@ func (k Keeper) ChannelOpenTry(goCtx context.Context, msg *channeltypes.MsgChann // Perform application logic callback version, err := cbs.OnChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, cap, msg.Channel.Counterparty, msg.CounterpartyVersion) if err != nil { - return nil, sdkerrors.Wrapf(err, "channel open try callback failed for module: %s", module) + return nil, sdkerrors.Wrapf(err, "channel open try callback failed for Port ID: %s, Channel ID: %s", msg.PortId, channelID) } // Write channel into state @@ -269,7 +269,7 @@ func (k Keeper) ChannelOpenAck(goCtx context.Context, msg *channeltypes.MsgChann // Perform application logic callback if err = cbs.OnChanOpenAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelId, msg.CounterpartyVersion); err != nil { - return nil, sdkerrors.Wrapf(err, "channel open ack callback failed for module: %s", module) + return nil, sdkerrors.Wrapf(err, "channel open ack callback failed for Port ID: %s, Channel ID: %s", msg.PortId, msg.ChannelId) } // Write channel into state @@ -303,7 +303,7 @@ func (k Keeper) ChannelOpenConfirm(goCtx context.Context, msg *channeltypes.MsgC // Perform application logic callback if err = cbs.OnChanOpenConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrapf(err, "channel open confirm callback failed for module: %s", module) + return nil, sdkerrors.Wrapf(err, "channel open confirm callback failed for Port ID: %s, Channel ID: %s", msg.PortId, msg.ChannelId) } // Write channel into state @@ -328,7 +328,7 @@ func (k Keeper) ChannelCloseInit(goCtx context.Context, msg *channeltypes.MsgCha } if err = cbs.OnChanCloseInit(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrapf(err, "channel close init callback failed for module: %s", module) + return nil, sdkerrors.Wrapf(err, "channel close init callback failed for Port ID: %s, Channel ID: %s", msg.PortId, msg.ChannelId) } err = k.ChannelKeeper.ChanCloseInit(ctx, msg.PortId, msg.ChannelId, cap) @@ -356,7 +356,7 @@ func (k Keeper) ChannelCloseConfirm(goCtx context.Context, msg *channeltypes.Msg } if err = cbs.OnChanCloseConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrapf(err, "channel close confirm callback failed for module: %s", module) + return nil, sdkerrors.Wrapf(err, "channel close confirm callback failed for Port ID: %s, Channel ID: %s", msg.PortId, msg.ChannelId) } err = k.ChannelKeeper.ChanCloseConfirm(ctx, msg.PortId, msg.ChannelId, cap, msg.ProofInit, msg.ProofHeight) From 61202c6940a9861ed6c1f05632548988d7306f9b Mon Sep 17 00:00:00 2001 From: Ali Zahid Raja Date: Wed, 28 Sep 2022 16:56:54 +0500 Subject: [PATCH 5/6] updated callback error msg --- modules/core/keeper/msg_server.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 31794502d48..844621e8ec7 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -190,7 +190,7 @@ func (k Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgChan // Perform application logic callback version, err := cbs.OnChanOpenInit(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, cap, msg.Channel.Counterparty, msg.Channel.Version) if err != nil { - return nil, sdkerrors.Wrapf(err, "channel open init callback failed for Port ID: %s, Channel ID: %s", msg.PortId, channelID) + return nil, sdkerrors.Wrapf(err, "channel open init callback failed for port ID: %s, channel ID: %s", msg.PortId, channelID) } // Write channel into state @@ -231,7 +231,7 @@ func (k Keeper) ChannelOpenTry(goCtx context.Context, msg *channeltypes.MsgChann // Perform application logic callback version, err := cbs.OnChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, cap, msg.Channel.Counterparty, msg.CounterpartyVersion) if err != nil { - return nil, sdkerrors.Wrapf(err, "channel open try callback failed for Port ID: %s, Channel ID: %s", msg.PortId, channelID) + return nil, sdkerrors.Wrapf(err, "channel open try callback failed for port ID: %s, channel ID: %s", msg.PortId, channelID) } // Write channel into state @@ -269,7 +269,7 @@ func (k Keeper) ChannelOpenAck(goCtx context.Context, msg *channeltypes.MsgChann // Perform application logic callback if err = cbs.OnChanOpenAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelId, msg.CounterpartyVersion); err != nil { - return nil, sdkerrors.Wrapf(err, "channel open ack callback failed for Port ID: %s, Channel ID: %s", msg.PortId, msg.ChannelId) + return nil, sdkerrors.Wrapf(err, "channel open ack callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } // Write channel into state @@ -303,7 +303,7 @@ func (k Keeper) ChannelOpenConfirm(goCtx context.Context, msg *channeltypes.MsgC // Perform application logic callback if err = cbs.OnChanOpenConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrapf(err, "channel open confirm callback failed for Port ID: %s, Channel ID: %s", msg.PortId, msg.ChannelId) + return nil, sdkerrors.Wrapf(err, "channel open confirm callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } // Write channel into state @@ -328,7 +328,7 @@ func (k Keeper) ChannelCloseInit(goCtx context.Context, msg *channeltypes.MsgCha } if err = cbs.OnChanCloseInit(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrapf(err, "channel close init callback failed for Port ID: %s, Channel ID: %s", msg.PortId, msg.ChannelId) + return nil, sdkerrors.Wrapf(err, "channel close init callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } err = k.ChannelKeeper.ChanCloseInit(ctx, msg.PortId, msg.ChannelId, cap) @@ -356,7 +356,7 @@ func (k Keeper) ChannelCloseConfirm(goCtx context.Context, msg *channeltypes.Msg } if err = cbs.OnChanCloseConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { - return nil, sdkerrors.Wrapf(err, "channel close confirm callback failed for Port ID: %s, Channel ID: %s", msg.PortId, msg.ChannelId) + return nil, sdkerrors.Wrapf(err, "channel close confirm callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } err = k.ChannelKeeper.ChanCloseConfirm(ctx, msg.PortId, msg.ChannelId, cap, msg.ProofInit, msg.ProofHeight) From 2d9c870a61405abc4da157d094b8e31336d3d936 Mon Sep 17 00:00:00 2001 From: Ali Zahid Raja Date: Thu, 29 Sep 2022 12:42:31 +0500 Subject: [PATCH 6/6] Update CHANGELOG.md Co-authored-by: Damian Nolan --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d68b3eaef39..8a1e72ecb14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -102,7 +102,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/27-interchain-accounts) [\#2248](https://github.com/cosmos/ibc-go/pull/2248) Adding call to underlying app in `OnChanCloseConfirm` callback of the controller submodule and adding relevant unit tests. * (apps/27-interchain-accounts) [\#2251](https://github.com/cosmos/ibc-go/pull/2251) Adding `msgServer` struct to controller submodule that embeds the `Keeper` struct. * (apps/27-interchain-accounts) [\#2297](https://github.com/cosmos/ibc-go/pull/2297) Adding cli command to generate ICS27 packet data. -* (modules/core/keeper) [\#1728](https://github.com/cosmos/ibc-go/pull/2399) Updated channel callback errors to includ portID & channelID for better identification of errors. +* (modules/core/keeper) [\#1728](https://github.com/cosmos/ibc-go/pull/2399) Updated channel callback errors to include portID & channelID for better identification of errors. ### Features