Skip to content

Commit 59d2ea2

Browse files
mergify[bot]mefai-devsrdtrk
authored
fix(callbacks/v2): OnTimeoutPacket blocked by UnmarshalPacketData error (backport #8856) (#8870)
* fix(callbacks/v2): OnTimeoutPacket blocked by UnmarshalPacketData error (#8856) * fix(callbacks/v2): return nil on UnmarshalPacketData error in OnTimeoutPacket OnTimeoutPacket propagates UnmarshalPacketData errors, blocking the packet timeout lifecycle. This is inconsistent with OnSendPacket (line 124) and OnAcknowledgementPacket (line 254), both of which return nil on the same error, allowing the packet lifecycle to continue unblocked. The inconsistency is also visible in the comments: - OnSendPacket: "is not blocked if the packet does not opt-in to callbacks" (line 123) - OnAcknowledgementPacket: same comment (line 252) - OnTimeoutPacket: comment was missing (now added) The V1 callbacks middleware does not have this inconsistency because it uses a different pattern (GetSourceCallbackData combining unmarshal and callback data extraction). Impact: If a packet's payload cannot be unmarshalled by the callbacks middleware (e.g., codec version mismatch), the timeout transaction reverts entirely. The underlying app's OnTimeoutPacket has already executed the refund (line 317-320), but the revert rolls back all state changes. Since the packet has already timed out on the destination chain and cannot be received, the sender's funds become permanently locked with no recovery path. This aligns with the principle stated at line 359: "callback execution errors are not allowed to block the packet lifecycle." * docs: added deleted comment * docs: added CHANGELOG entry --------- Co-authored-by: srdtrk <srdtrk@hotmail.com> (cherry picked from commit 0e8a117) # Conflicts: # CHANGELOG.md * docs: fix conflict --------- Co-authored-by: Mefai <95135443+mefai-dev@users.noreply.github.com> Co-authored-by: srdtrk <srdtrk@hotmail.com>
1 parent db1d5bd commit 59d2ea2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
6262

6363
### State Machine Breaking
6464

65-
### Improvements
66-
6765
### Bug Fixes
6866

67+
(apps/callbacks) [\#8856](https://github.com/cosmos/ibc-go/pull/8856) OnTimeoutPacket blocked by UnmarshalPacketData error
68+
6969
### Testing API
7070

7171
* [\#8366](https://github.com/cosmos/ibc-go/pull/8366) - Replaced the deprecated `codec.ProtoMarshaler` interface with `proto.Message`.

modules/apps/callbacks/v2/ibc_middleware.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,9 @@ func (im *IBCMiddleware) OnTimeoutPacket(
320320
}
321321

322322
packetData, err := im.app.UnmarshalPacketData(payload)
323+
// OnTimeoutPacket is not blocked if the packet does not opt-in to callbacks
323324
if err != nil {
324-
return err
325+
return nil
325326
}
326327

327328
cbData, isCbPacket, err := types.GetCallbackData(

0 commit comments

Comments
 (0)