[F-2026-17736] : Derived call can commit state even when commit=false#15
Merged
Merged
Conversation
…nintended state persistence
…7736) Asserts a derived call with commit=false does not persist state changes and commit=true does. Deploys an ERC20 and performs a transfer via DerivedEVMCall, reading the recipient balance back through the independent CallEVM path so the assertion reflects committed store state. Verified: fails against the pre-fix code (state leaked to the store on commit=false) and passes with the fix.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
[F-2026-17736] DerivedEVMCallWithData Ignores
commitFlagIssue
DerivedEVMCallWithDataaccepts acommit boolparameter but silently ignores it in two places, causing state to always be persisted regardless of what the caller passes.File:
x/vm/keeper/call_evm.goBug 1 — Hardcoded
trueinApplyMessageWithConfigThe StateDB (which holds EVM balance changes, storage writes, and newly created contracts) is always told to flush its dirty state to the underlying store, regardless of the
commitparameter.Bug 2 — Unconditional
commitState()The cache context sandbox is always propagated back to the parent context on success, regardless of the
commitparameter.Impact
Any caller passing
commit=falseexpects non-mutating, dry-run behavior — simulations, gas estimations, speculative IBC callback checks. Instead, both the StateDB and the cache context are committed, silently mutating chain state. The bug is invisible at the call site because the caller's context object is not directly modified; the mutation happens at the underlying store level.There is also an internal contradiction:
isFakeon the EVM message is correctly set to!commit, so the EVM itself treats the execution as a simulation — but its output is still persisted.Solution
Two targeted changes in
x/vm/keeper/call_evm.go:1. Pass
commitintoApplyMessageWithConfiginstead of hardcodedtrue:2. Gate
commitState()on thecommitflag:Behavior after fix
committruetruefalsefalseWhen
commit=false, execution still runs and the result is returned to the caller, but zero state changes escape to the underlying store. True dry-run semantics are restored.Closes: #XXXX
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