fix: eth_estimateGas failing with not enough funds for L1 fee#3169
Open
fix: eth_estimateGas failing with not enough funds for L1 fee#3169
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
approved these changes
Mar 2, 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 has a low balance,
eth_estimateGaswas failing because we were inspecting the transaction with non zero L1 fee rate.This PR fixes the issue by executing with a zero L1 fee rate, and then computing the l1 fee in the handler using the l1 diff from execution.
Testing
Added
test_estimate_gas_no_balance.