Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gas fee calculation in debug calls #189

Closed
wants to merge 1 commit into from

Conversation

mininny
Copy link
Member

@mininny mininny commented Jun 16, 2024

This PR fixes gas fee calculation for rpc calls. It mostly borrows changes from geth and resolves previously differently-resolved issues.

  • baseFee should not be used as a default value for gasFeeCap when gasFee/gasTip fields hasn't be set.
    • Instead, baseFee is used for validating whether the final gas fee + gas tip is higher than basFee
    • Setting gasFeeCap to baseFee will prevent calling eth_estimateGas with 0-balance accounts because the account's balance has to be bigger than the baseFee.
  • For debug RPC calls, we should set evm.Config().NoBaseFee to true
    • Also, we should set blockCtx.BaseFee = 0 when NoBaseFee is true, because we want to skip comparing gasFeeCap with the real baseFee when it's for debug calls.
    • This allows calling rpcs like eth_estimateGas debug_traceCall with accounts that have 0 balance.

Fixes #183

@mininny
Copy link
Member Author

mininny commented Jun 25, 2024

Merged in upstream erigontech#10825

@mininny mininny closed this Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect gas estimation
1 participant