Fix/eth estimated gas returns 6x inflated gas#3358
Open
radhika-kapoor wants to merge 6 commits intotempoxyz:mainfrom
Open
Fix/eth estimated gas returns 6x inflated gas#3358radhika-kapoor wants to merge 6 commits intotempoxyz:mainfrom
radhika-kapoor wants to merge 6 commits intotempoxyz:mainfrom
Conversation
klkvr
reviewed
Mar 31, 2026
fcf8426 to
5764df2
Compare
klkvr
approved these changes
Mar 31, 2026
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.
Summary
Closes #3178
eth_estimateGaswas returning ~6x inflated gas (~293k instead of ~43k)for TIP-20 transfers submitted using the
callsarray format with anon-zero
nonceKey.Root cause
In
crates/revm/src/handler.rs, the condition that charges thenew_account_cost(250,000 gas) for contract creation usedtx.kind().is_create()to detect a CREATE operation.For AA transactions using the
callsformat,inner.toisNone(the destination lives inside the
callsarray), which causedtx.kind()to returnTxKind::Createeven for plain transfers —incorrectly triggering the 250k charge.
Fix
Replace
tx.kind().is_create()with an inspection of the first entryin
aa_calls, which is the correct source of truth for AA transactions:Non-AA transactions fall back to the original tx.kind().is_create() path,
so existing behaviour is unchanged.
TestCase Added
test_aa_tx_transfer_calls_format_no_extra_250k
Test plan
eth_estimateGascurl: calls format now returns 0xa9d4 (~43k) instead of 0x47b04 (~293k)~43k Gas Breakdown