Skip to content

Commit

Permalink
Reorder IBC channel callbacks (#8441)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Treglia authored Jan 26, 2021
1 parent 5179e7e commit f67c4f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

### Improvements

* (x/ibc) [\#8404](https://github.com/cosmos/cosmos-sdk/pull/8404) Reorder IBC `ChanOpenAck` and `ChanOpenConfirm` handler execution to perform core handler first, followed by application callbacks.

### Bug Fixes

* (simapp) [\#8418](https://github.com/cosmos/cosmos-sdk/pull/8418) Add balance coin to supply when adding a new genesis account
Expand Down
16 changes: 8 additions & 8 deletions x/ibc/core/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,15 @@ func (k Keeper) ChannelOpenAck(goCtx context.Context, msg *channeltypes.MsgChann
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

if err = cbs.OnChanOpenAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyVersion); err != nil {
return nil, sdkerrors.Wrap(err, "channel open ack callback failed")
}

_, err = channel.HandleMsgChannelOpenAck(ctx, k.ChannelKeeper, cap, msg)
if err != nil {
return nil, err
}

if err = cbs.OnChanOpenAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyVersion); err != nil {
return nil, sdkerrors.Wrap(err, "channel open ack callback failed")
}

return &channeltypes.MsgChannelOpenAckResponse{}, nil
}

Expand All @@ -354,15 +354,15 @@ func (k Keeper) ChannelOpenConfirm(goCtx context.Context, msg *channeltypes.MsgC
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

if err = cbs.OnChanOpenConfirm(ctx, msg.PortId, msg.ChannelId); err != nil {
return nil, sdkerrors.Wrap(err, "channel open confirm callback failed")
}

_, err = channel.HandleMsgChannelOpenConfirm(ctx, k.ChannelKeeper, cap, msg)
if err != nil {
return nil, err
}

if err = cbs.OnChanOpenConfirm(ctx, msg.PortId, msg.ChannelId); err != nil {
return nil, sdkerrors.Wrap(err, "channel open confirm callback failed")
}

return &channeltypes.MsgChannelOpenConfirmResponse{}, nil
}

Expand Down

0 comments on commit f67c4f9

Please sign in to comment.