|
| 1 | +# Execute eth-config Command |
| 2 | + |
| 3 | +The `execute eth-config` command is a specialized testing tool that validates an Ethereum client's configuration against expected network parameters using the `eth_config` RPC endpoint as specified by [EIP-7910](https://eips.ethereum.org/EIPS/eip-7910). |
| 4 | + |
| 5 | +The goal is to test baked-in configurations primarily but it can be used to test that genesis and config files were successfully parsed, in devnets for example. |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +This command verifies that a client is correctly configured for a specific network by checking: |
| 10 | + |
| 11 | +- Current fork configuration. |
| 12 | +- Fork activation times. |
| 13 | +- Chain ID. |
| 14 | +- Precompile addresses. |
| 15 | +- System contract addresses. |
| 16 | +- Fork hashes and IDs. |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +### Standalone, Direct Usage |
| 21 | + |
| 22 | +The `eth-config` sub-command can be ran directly, without cloning @ethereum/execution-spec-tests, by [installing uv](https://docs.astral.sh/uv/getting-started/installation/) and running: |
| 23 | + |
| 24 | +```bash |
| 25 | +uv run --with git+https://github.com/ethereum/execution-spec-tests.git execute eth-config --network Mainnet --rpc-endpoint http://<ETH_RPC_ENDPOINT> |
| 26 | +``` |
| 27 | + |
| 28 | +### From within the EEST Repository |
| 29 | + |
| 30 | +```bash |
| 31 | +uv run execute eth-config --network <NETWORK_NAME> --rpc-endpoint <RPC_URL> [OPTIONS] |
| 32 | +``` |
| 33 | + |
| 34 | +### Required Arguments |
| 35 | + |
| 36 | +- `--network`: Name of the network to verify (e.g., `Mainnet`, `Sepolia`, `Holesky`, `Hoodi`) |
| 37 | +- `--rpc-endpoint`: RPC endpoint URL of the execution client to test |
| 38 | + |
| 39 | +### Optional Arguments |
| 40 | + |
| 41 | +- `--network-config-file`: Path to a custom YAML file containing network configurations (defaults to `src/pytest_plugins/execute/eth_config/networks.yml`) |
| 42 | + |
| 43 | +## Examples |
| 44 | + |
| 45 | +### Testing a Mainnet Client |
| 46 | + |
| 47 | +```bash |
| 48 | +uv run execute eth-config --network Mainnet --rpc-endpoint http://localhost:8545 |
| 49 | +``` |
| 50 | + |
| 51 | +### Testing a Sepolia Client |
| 52 | + |
| 53 | +```bash |
| 54 | +uv run execute eth-config --network Sepolia --rpc-endpoint http://localhost:8545 |
| 55 | +``` |
| 56 | + |
| 57 | +### Using a Custom Network Configuration |
| 58 | + |
| 59 | +```bash |
| 60 | +uv run execute eth-config --network MyCustomNet --rpc-endpoint http://localhost:8545 --network-config-file ./my-networks.yml |
| 61 | +``` |
| 62 | + |
| 63 | +## Network Configuration File Format |
| 64 | + |
| 65 | +The network configuration file is a YAML file that defines the parameters for each network. Here's the structure: |
| 66 | + |
| 67 | +```yaml |
| 68 | +MyCustomNet: |
| 69 | + chainId: 0xabcd # Chain ID in hex |
| 70 | + genesisHash: 0xd4e5674... # Genesis block hash |
| 71 | + forkActivationTimes: # Fork activation block numbers/times |
| 72 | + 0: Cancun # Genesis fork, it must be the latest fork activated in the genesis |
| 73 | + 1742999832: Prague |
| 74 | + 1742999833: Osaka |
| 75 | + bpoForkActivationTimes: # Optional: Blob parameter only fork definitions |
| 76 | + 1742999834: |
| 77 | + target: 9 |
| 78 | + max: 12 |
| 79 | + base_fee_update_fraction: 5007716 |
| 80 | + 1742999835: |
| 81 | + target: 12 |
| 82 | + max: 15 |
| 83 | + base_fee_update_fraction: 5007716 |
| 84 | + addressOverrides: # Optional: Override addresses for precompiles/contracts |
| 85 | + 0x00000000219ab540...: 0x7f02c3e3c98b133... |
| 86 | +``` |
| 87 | +
|
| 88 | +### Supported Networks |
| 89 | +
|
| 90 | +The default configuration file includes: |
| 91 | +
|
| 92 | +- **Mainnet**: Ethereum mainnet. |
| 93 | +- **Sepolia**: Public testnet. |
| 94 | +- **Hoodi**: Public testnet. |
| 95 | +- **Holesky**: Public testnet. |
| 96 | +
|
| 97 | +## How It Works |
| 98 | +
|
| 99 | +1. **Configuration Loading**: The command loads the network configuration from the YAML file. |
| 100 | +2. **RPC Connection**: Connects to the specified client RPC endpoint. |
| 101 | +3. **eth_config Call**: Calls the `eth_config` RPC method to get the client's current configuration. |
| 102 | +4. **Validation**: Compares the client's response against the expected configuration based on: |
| 103 | + - Current system timestamp. |
| 104 | + - Fork activation schedule. |
| 105 | + - Address overrides (if any). |
| 106 | + |
| 107 | +## `eth_config` Expected Response Details |
| 108 | + |
| 109 | +See [EIP-7910](https://eips.ethereum.org/EIPS/eip-7910) for the expected response description. |
0 commit comments