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

IBC: Allow onRecvPacket to bypass synchronous call of PacketExecuted #7200

Closed
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ invalid or incomplete requests.
* (x/genutil) [\#5938](https://github.com/cosmos/cosmos-sdk/pull/5938) Fix `InitializeNodeValidatorFiles` error handling.
* (x/staking) [\#5949](https://github.com/cosmos/cosmos-sdk/pull/5949) Skip staking `HistoricalInfoKey` in simulations as headers are not exported.
* (client) [\#5964](https://github.com/cosmos/cosmos-sdk/issues/5964) `--trust-node` is now false by default - for real. Users must ensure it is set to true if they don't want to enable the verifier.
* (x/ibc) [\#7200](https://github.com/cosmos/cosmos-sdk/pull/7200) an `OnRecvPacket` callback can declare that it will do its own `PacketExecuted` if the callback returns an acknowledgment of `[]byte(nil)`.

### State Machine Breaking

Expand Down
9 changes: 6 additions & 3 deletions x/ibc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,12 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return nil, sdkerrors.Wrap(err, "receive packet callback failed")
}

// Set packet acknowledgement
if err = k.ChannelKeeper.PacketExecuted(ctx, cap, msg.Packet, ack); err != nil {
return nil, err
// If the caller returned a nil ack, it intends to do its own PacketExecuted.
if ack != nil {
// Set packet acknowledgement
if err = k.ChannelKeeper.PacketExecuted(ctx, cap, msg.Packet, ack); err != nil {
return nil, err
}
}

return res, nil
Expand Down