fix: set L1 fee rate to zero in eth_estimateGas if sender has no balance#3169
Merged
eyusufatik merged 16 commits intonightlyfrom Mar 16, 2026
Merged
fix: set L1 fee rate to zero in eth_estimateGas if sender has no balance#3169eyusufatik merged 16 commits intonightlyfrom
eyusufatik merged 16 commits intonightlyfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes eth_estimateGas failing for low-/zero-balance from addresses by preventing L1 fee charging during the EVM simulation, while still returning an l1_fee estimate computed from the execution’s recorded L1 diff size.
Changes:
- Run
eth_estimateGassimulations withl1_fee_rate = 0to avoid"Not enough funds for L1 fee"failures during inspection. - Recompute
l1_feein the RPC handler usingtx_info.l1_diff_size * real_l1_fee_rate(instead of relying ontx_info.l1_feeproduced by a zero-fee simulation). - Add
test_estimate_gas_no_balanceto cover estimateGas behavior whenfromhas zero balance.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/evm/src/query.rs |
Adjusts estimate gas execution to simulate with zero L1 fee rate and recompute L1 fee from l1_diff_size. |
crates/evm/src/tests/queries/estimate_gas_tests.rs |
Adds a regression test ensuring eth_estimateGas succeeds for zero-balance from (except value transfers). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jfldde
previously approved these changes
Mar 2, 2026
ercecan
previously approved these changes
Mar 2, 2026
jfldde
previously approved these changes
Mar 11, 2026
exeokan
commented
Mar 12, 2026
eyusufatik
requested changes
Mar 12, 2026
eyusufatik
previously approved these changes
Mar 13, 2026
eyusufatik
approved these changes
Mar 16, 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.
Description
When the from address is not specified or has zero balance (a simulation scenario),
eth_estimateGasfailed because the transaction was inspected using a non-zero L1 fee rate.This PR resolves the issue by executing with a zero L1 fee rate in those cases, and computing the L1 fee afterward in the handler using the L1 diff from execution.
Testing
Added
test_estimate_gas_no_balance.