Skip to content

fix(apps/callbacks): use raw app ack bytes in the v2 async receive callback - #9079

Open
kriss39 wants to merge 1 commit into
cosmos:mainfrom
kriss39:fix/callbacks-v2-async-ack-type
Open

kriss39 wants to merge 1 commit into
cosmos:mainfrom
kriss39:fix/callbacks-v2-async-ack-type

Conversation

@kriss39

@kriss39 kriss39 commented Sep 13, 2026

Copy link
Copy Markdown

Description

In the IBC v2 callbacks middleware the destination callback invoked from OnRecvPacket receives a RecvAcknowledgement, so ack.Acknowledgement() returns the raw application acknowledgement bytes. The asynchronous WriteAcknowledgement path wrapped the same bytes in a channeltypesv2.Acknowledgement, whose Acknowledgement() returns the protobuf encoding of the wrapper. A contract therefore observed different acknowledgement bytes for the same packet depending on whether the application acknowledged synchronously or asynchronously.

This PR uses RecvAcknowledgement in the async path too and adds TestWriteAcknowledgementCallbackAckMatchesSyncPath, which records the bytes delivered to the contract keeper on both paths and requires them to be equal (on main it fails with {"result":"AQ=="} vs 0a 11 {"result":"AQ=="}).

closes: #9074


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Include changelog entry when appropriate (e.g. chores should be omitted from changelog).
  • Wrote unit and integration tests if relevant.
  • Updated documentation (docs/) if anything is changed. (n/a — no documented behaviour changes)
  • Added godoc comments if relevant.
  • Self-reviewed Files changed in the GitHub PR explorer.
  • Provide a conventional commit message to follow the repository standards.

@kriss39
kriss39 requested a review from a team as a code owner September 13, 2026 20:48
@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

In the IBC v2 callbacks middleware the destination callback invoked from
OnRecvPacket wraps the application acknowledgement in RecvAcknowledgement,
so Acknowledgement() returns the raw application bytes. The asynchronous
WriteAcknowledgement path instead wrapped the same bytes in a
channeltypesv2.Acknowledgement, whose Acknowledgement() returns the
protobuf encoding of the wrapper. A contract therefore observed different
acknowledgement bytes for the same packet depending on whether the
application acknowledged synchronously or asynchronously.

Use RecvAcknowledgement in both paths and add a regression test that
compares the bytes delivered to the contract keeper.

Signed-off-by: Kanan <93033289+kriss39@users.noreply.github.com>
@kriss39
kriss39 force-pushed the fix/callbacks-v2-async-ack-type branch from 801ecd0 to 12e11d4 Compare September 13, 2026 20:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

callbacks/v2: async WriteAcknowledgement hands the contract a proto-wrapped acknowledgement, unlike OnRecvPacket

1 participant