Skip to content

Commit 2b7dc12

Browse files
marioevzspencer-tb
andauthored
enhance(test-cli-execute): Many Improvements to execute remote command (#1822)
* feat(execute): Deferred EOA funding * fix(execute): remove _refresh_sender_nonce calls * fix(execute): workaround for priority fee * feat(execute): Support blob transactions * refactor(execute): Re-nonce worker key * refactor(execute): Fixture renames * refactor(execute): unused param * refactor(execute): nit * refactor(execute): Add a ton of logging * fix(plugins): Change `execute remote` from loadscope to load * fix(execute): Try on refund txs * refactor(execute): More logging * fix(execute): Collect only * fix(execute): mypy * fix(plugins): Change `execute hive` from loadscope to load * refactor: Rename flag * docs: Add new features * feat(execute): Use seed directly if not running xdist * fix: docs lint * docs: Changelog * Update docs/running_tests/execute/hive.md Co-authored-by: spencer <[email protected]> * Update docs/running_tests/execute/hive.md Co-authored-by: spencer <[email protected]> * Update docs/running_tests/execute/hive.md Co-authored-by: spencer <[email protected]> * Apply suggestions from code review Co-authored-by: spencer <[email protected]> * Apply suggestions from code review Co-authored-by: spencer <[email protected]> * fix: Logging mode --------- Co-authored-by: spencer <[email protected]>
1 parent 6cb2ed6 commit 2b7dc12

File tree

19 files changed

+1199
-309
lines changed

19 files changed

+1199
-309
lines changed

docs/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ Test fixtures for use by clients are available for each release on the [Github r
2424

2525
- 🐞 Fix a bug with `consume sync` tests where some clients don't have JSON-RPC immediately available after syncing and can't yet serve the synced block ([#1670](https://github.com/ethereum/execution-specs/pull/1670)).
2626

27+
#### `execute`
28+
29+
-`execute hive` and `execute remote` now defer funding of accounts until the minimum amount required to send the test transactions is calculated, in order to optimize the amount of Eth used to execute the tests ([#1822](https://github.com/ethereum/execution-specs/pull/1822)).
30+
- ✨ Dynamically fetch gas prices from the network and update all transactions to use 1.5x the current values ([#1822](https://github.com/ethereum/execution-specs/pull/1822)).
31+
- ✨ New `--dry-run` flag to calculate the amount of Eth that will be spent executing a test given the current network gas prices ([#1822](https://github.com/ethereum/execution-specs/pull/1822)).
32+
- 🔀 Load balancing mode of `execute` for xdist was updated from `loadscope` to `load` ([#1822](https://github.com/ethereum/execution-specs/pull/1822)).
33+
- 💥 `--eoa-fund-amount-default` has been deprecated since the command now automatically calculates the funding amount ([#1822](https://github.com/ethereum/execution-specs/pull/1822)).
34+
- 💥 `--sender-key-initial-balance` flag of `execute hive` has been renamed to `--seed-key-initial-balance` ([#1822](https://github.com/ethereum/execution-specs/pull/1822)).
35+
- 🔀 Flags --default-gas-price, --default-max-fee-per-gas and --default-max-priority-fee-per-gas now default to None and ideally should be omitted because, when unset, the command now defaults to fetch the value from the network, which is a more reliable behavior ([#1822](https://github.com/ethereum/execution-specs/pull/1822)).
36+
2737
### 📋 Misc
2838

2939
- 🐞 WELDed the EEST tox environments relevant to producing documentation into EELS, and added a tool to cleanly add codespell whitelist entries. ([#1695](https://github.com/ethereum/execution-specs/pull/1659)).

docs/running_tests/execute/hive.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ Tests can be executed on a local hive-controlled single-client network by runnin
44

55
## The `eest/execute-blobs` Simulator
66

7-
The `blob_transaction_test` execute test spec sends blob transactions to a running client in order to verify its `engine_getBlobsVX` endpoint behavior. These tests can be run using:
7+
The `blob_transaction_test` execute test spec sends blob transactions to a running client. Blob transactions are fully supported in execute mode:
8+
9+
- Blob transactions can be sent via `eth_sendRawTransaction`
10+
- Blob validation via `engine_getBlobsVX` endpoints (when Engine RPC available)
11+
- Automatic gas pricing is used for the blob gas fees
12+
13+
Tests can be run using:
814

915
```bash
10-
./hive --client besu --client-file ./configs/osaka.yaml --sim ethereum/eest/execute-blobs
16+
./hive --client besu --client-file ./configs/osaka.yaml --sim ethereum/eels/execute-blobs
1117
```
1218

19+
**Note**: If the Engine RPC is unavailable, blob transactions will be sent and `getBlobsV*` validation is skipped.
20+
1321
See [Hive](../hive/index.md) for help installing and configuring Hive.
1422

1523
## Running `execute` tests with Hive in Dev Mode

docs/running_tests/execute/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,12 @@ Reasoning behind the random generation of the sender keys is that one can execut
3939

4040
The `fill` plugin will use a fixed and minimum gas price for all the transactions it uses for testing, but this is not possible with the `execute` plugin, as the gas price is determined by the current state of the network.
4141

42-
At the moment, the `execute` plugin does not query the client for the current gas price, but instead uses a fixed increment to the gas price in order to avoid the transactions to be stuck in the mempool.
42+
The `execute` plugin queries the network for current gas prices and defaults to 1.5x the network price to ensure transaction inclusion. Gas prices can be overridden via command-line flags (`--default-gas-price`, `--default-max-fee-per-gas`, `--default-max-priority-fee-per-gas`).
43+
44+
### Deferred EOA Funding
45+
46+
EOAs are funded after gas prices are determined, enabling accurate balance calculations based on actual network conditions. This ensures sufficient funds are allocated for all test transactions.
47+
48+
### Blob Transaction Support
49+
50+
Blob transactions are fully supported in execute mode, including automatic gas pricing for blob gas fees and validation via `engine_getBlobsVX` endpoints when the Engine RPC is available.

docs/running_tests/execute/remote.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,42 @@ One last requirement is that the `--chain-id` flag is set to the chain id of the
2424
uv run execute remote --fork=Prague --rpc-endpoint=https://rpc.endpoint.io --rpc-seed-key 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f --chain-id 12345
2525
```
2626

27+
## Test Accounts and Contracts
28+
29+
Since `execute remote` does not control the blockchain where it runs the tests, and therefore cannot modify the genesis pre-allocation like `fill` does, all accounts and contracts need to be deployed via transactions sent to the network.
30+
31+
These transactions are created from the seed or worker accounts provided via the command flags.
32+
33+
When the test is executed, all `pre.fund_eoa` and `pre.deploy_contract` calls generate transactions that create the accounts on chain, instead of placing them directly in the `pre` object like `fill` does.
34+
35+
The transactions are collected and only sent after the test function finishes execution. This is done in order to perform optimizations based on the transactions that the test requires to perform its verifications.
36+
37+
One optimization is the deferred calculation of the funding amount for the EOA, which is calculated on the fly depending the test transactions that use the account as sender, and this amount is the minimum balance that the account would need in order for the transactions to be included given the current network gas prices.
38+
39+
### Dry Run Mode
40+
41+
Dry run mode calculates the minimum balance required without executing any transactions on chain:
42+
43+
```bash
44+
uv run execute remote --fork=Prague --rpc-endpoint=https://rpc.endpoint.io --dry-run ./tests/prague/eip7702_set_code_tx/
45+
```
46+
47+
This outputs the minimum balance needed and total gas consumption per test, useful for:
48+
49+
- Estimating gas costs before execution
50+
- Verifying the seed account has sufficient funds
51+
- Planning parallel execution funding requirements
52+
53+
### Limit Gas Used By Tests
54+
55+
A limit of the total gas consumption per test can be specified with the `--max-gas-per-test` flag:
56+
57+
```bash
58+
uv run execute remote --fork=Prague --rpc-endpoint=https://rpc.endpoint.io --max-gas-per-test 30000000 --rpc-seed-key 0x... --chain-id 12345
59+
```
60+
61+
Tests exceeding this limit will fail with an assertion error and will not send any transactions to the chain.
62+
2763
## Engine RPC Endpoint (Optional)
2864

2965
By default, the `execute remote` command assumes that the execution client is connected to a beacon node and the chain progresses automatically. However, you can optionally specify an Engine RPC endpoint to drive the chain manually when new transactions are submitted.

0 commit comments

Comments
 (0)