Skip to content

fix(core/04-channel/v2): do not reuse the TAO cache context for app callbacks in RecvPacket - #9078

Open
kriss39 wants to merge 1 commit into
lfdt-ibc:mainfrom
kriss39:fix/channel-v2-recv-double-write
Open

kriss39 wants to merge 1 commit into
lfdt-ibc:mainfrom
kriss39:fix/channel-v2-recv-double-write

Conversation

@kriss39

@kriss39 kriss39 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Description

Since #8545 the application callbacks in ChannelKeeperV2.RecvPacket ran in the cached context that had already been written after TAO verification. The second writeFn() re-emitted every event recorded by recvPacket, so recv_packet (and message) events were emitted twice on every successful receive, and on application failure the TAO events were additionally converted into ibccallbackerror-* events.

This PR creates a fresh cached context for the application callbacks (matching the v1 handler) and adds TestMsgRecvPacketEventsNotDuplicated, which asserts that recv_packet / write_acknowledgement are emitted exactly once and that no ibccallbackerror-recv_packet event is emitted, for both a successful and a failing application callback. On main the test fails with recv_packet: 2 / ibccallbackerror-recv_packet: 1.

closes: #9073


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:47
@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

@kriss39
kriss39 force-pushed the fix/channel-v2-recv-double-write branch from ff4a9cf to fd91003 Compare September 13, 2026 20:51
@kriss39
kriss39 force-pushed the fix/channel-v2-recv-double-write branch from 4b454d0 to a47ed08 Compare October 21, 2026 10:10
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.83%. Comparing base (501acd1) to head (a47ed08).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9078   +/-   ##
=======================================
  Coverage   66.83%   66.83%           
=======================================
  Files         329      329           
  Lines       17497    17498    +1     
=======================================
+ Hits        11694    11695    +1     
  Misses       5069     5069           
  Partials      734      734           
Flag Coverage Δ
08-wasm 65.04% <ø> (ø)
ibc-go 66.89% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kriss39
kriss39 requested a review from a team as a code owner November 15, 2026 21:25
@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kriss39
kriss39 force-pushed the fix/channel-v2-recv-double-write branch from 6bfd08a to 133b659 Compare November 29, 2026 08:22
…acks in RecvPacket

Since lfdt-ibc#8545 the application callbacks in MsgRecvPacket run in the same cached
context that was already written after TAO verification. The second writeFn
call re-emits every event recorded by recvPacket, so relayers and indexers
see the core recv_packet (and message) events twice on every successful
receive. When an application returns a failure the same TAO events are
additionally converted and emitted as ibccallbackerror-* events.

Create a fresh cached context for the application callbacks, matching the
v1 handler, and add a regression test asserting the event counts.

Signed-off-by: Kriss <93033289+kriss39@users.noreply.github.com>
@kriss39
kriss39 force-pushed the fix/channel-v2-recv-double-write branch from 133b659 to 38f1f4b Compare November 29, 2026 08:25

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.

core/04-channel/v2: MsgRecvPacket emits core recv_packet events twice (and as error events on app failure)

1 participant