ethereum / ethereum/execution-specs

feat(test-execute): Allow `execute` to use `eth_estimateGas`

Open
#3,437 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
1.2k
Forks
505
Avg merge
2d 14h
Merged PRs (30d)
116

Description

For tests with transactions that do not define a gas limit, we should make `execute` query the RPC in order to get the gas limit that the transaction will include.

This would allow us to:
- Reduce the amount of gas that is wasted during execution of tests in live networks
- Check the validity of `eth_estimateGas` across clients.

Main roadblocks:
- Currently there's a circular dependency to this: the balance of each test's sender (`sender = pre.fund_eoa()`) is deferred until the test runner can determine how much gas is used by all transactions the sender is supposed to send during the test execution. The problem is that many tests deploy contracts after making attempting to do this calculation, and since `eth_estimateGas` requires the contracts to already be in-place in order to accurately predict the gas the transaction is going to use, we probably need to re-order the deployment of contracts and the sender balance estimation in the execute flow.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the execute flow, focusing on deferred sender balance estimation and contract deployment order. Determine how transactions without a gas limit are represented and where RPC calls can be introduced after required contracts are deployed. Done means execute queries eth_estimateGas for those transactions and uses the result during live-network test execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.