You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes a regression in IBCOnTimeoutPacketCallback where the original ctx (with a basic gas meter) was mistakenly passed to CallEVM instead of the cachedCtx (with an infinite gas meter). The same pattern is correctly applied in both IBCReceivePacketCallback and IBCOnAcknowledgementPacketCallback: EVM calls run against a cached context with an infinite gas meter to prevent the EVM gas estimation from depleting all Cosmos gas, and only the actual res.GasUsed is charged back to the original context afterward. Passing ctx instead of cachedCtx caused double gas accounting — gas was consumed once directly through the original context's basic gas meter during the EVM call, and then again when ctx.GasMeter().ConsumeGas(res.GasUsed, ...) was called.
Root cause: CallEVM in IBCOnTimeoutPacketCallback was called with ctx instead of cachedCtx, causing gas to be consumed twice.
Fix: Replaced ctx with cachedCtx in the CallEVM call, aligning IBCOnTimeoutPacketCallback with the pattern in the other callback handlers.
Impact: No logic changes beyond correcting the gas meter context; the fix is minimal and targeted.
Confidence Score: 5/5
This PR is safe to merge — it is a one-line, clearly correct bug fix with no side effects.
The change is minimal (one token changed: ctx → cachedCtx), the fix exactly mirrors the established pattern in the other two callback handlers in the same file, and the root cause (double gas accounting when using the basic gas meter directly in CallEVM) is well-understood. No new logic is introduced and no unrelated code is touched.
No files require special attention.
Important Files Changed
Filename
Overview
x/ibc/callbacks/keeper/keeper.go
Fixes double gas accounting in IBCOnTimeoutPacketCallback by passing cachedCtx (with an infinite gas meter) instead of the original ctx to CallEVM, consistent with the pattern used in IBCReceivePacketCallback and IBCOnAcknowledgementPacketCallback.
❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 63.39%. Comparing base (50b4817) to head (35ff4f6). ⚠️ Report is 2 commits behind head on main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
somehow this change got reverted, needs to be added back.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
mainbranch