Skip to content

Commit a7c7353

Browse files
danceratopzCarsons-Eels
authored andcommitted
refactor(fill,fixtures): rename "engine reorg" to "engine x"; improve pre-allocation group terminology (ethereum#1760)
* refactor(docs): move `engine_reorg` -> `engine_x` * refactor(all): rename 'engine reorg' to 'engine x' * refactor(all): update lang from 'shared pre-alloc' to 'pre-allocation groups' 1/2 Terminology: - 'shared pre-allocation' → 'pre-allocation groups' - 'shared pre-state' → 'pre-allocation groups' Flags: - `--generate-shared-pre` -> `--generate-grouped-pre-allocs` - `--use-shared-pre` -> `--use-grouped-pre-allocs` Method names updated: - `update_shared_pre_state` → `update_pre_alloc_groups` - `compute_shared_pre_alloc_hash` → `compute_pre_alloc_group_hash` - `shared_pre_alloc_folder_path` → `grouped_pre_allocs_folder_path` * refactor(all): update lang from 'shared pre-alloc' to 'pre-allocation groups' 2/2 * docs: update changelog * refactor(filler): rename flags for consistency with class names Rename command-line flags to align with function and class naming: - --generate-grouped-pre-allocs → --generate-pre-alloc-groups - --use-grouped-pre-allocs → --use-pre-alloc-groups This improves consistency with PreAllocGroups class and related method names throughout the codebase. Updated all flag definitions, config.getoption() calls, property names, and documentation.
1 parent 9a71c71 commit a7c7353

File tree

18 files changed

+271
-271
lines changed

18 files changed

+271
-271
lines changed

docs/CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ Users can select any of the artifacts depending on their testing needs for their
2929

3030
#### `fill`
3131

32-
- ✨ Add the `ported_from` test marker to track Python test cases that were converted from static fillers in [ethereum/tests](https://github.com/ethereum/tests) repository [#1590](https://github.com/ethereum/execution-spec-tests/pull/1590).
33-
- ✨ Add a new pytest plugin, `ported_tests`, that lists the static fillers and PRs from `ported_from` markers for use in the coverage Github Workflow [#1634](https://github.com/ethereum/execution-spec-tests/pull/1634).
34-
- ✨ Enable two-phase filling of fixtures with shared pre-allocation groups and add a `BlockchainEngineReorgFixture` format [#1606](https://github.com/ethereum/execution-spec-tests/pull/1706).
32+
- ✨ Add the `ported_from` test marker to track Python test cases that were converted from static fillers in [ethereum/tests](https://github.com/ethereum/tests) repository ([#1590](https://github.com/ethereum/execution-spec-tests/pull/1590)).
33+
- ✨ Add a new pytest plugin, `ported_tests`, that lists the static fillers and PRs from `ported_from` markers for use in the coverage Github Workflow ([#1634](https://github.com/ethereum/execution-spec-tests/pull/1634)).
34+
- ✨ Enable two-phase filling of fixtures with pre-allocation groups and add a `BlockchainEngineXFixture` format ([#1706](https://github.com/ethereum/execution-spec-tests/pull/1706), [#1760](https://github.com/ethereum/execution-spec-tests/pull/1760)).
3535
- 🔀 Refactor: Encapsulate `fill`'s fixture output options (`--output`, `--flat-output`, `--single-fixture-per-file`) into a `FixtureOutput` class ([#1471](https://github.com/ethereum/execution-spec-tests/pull/1471),[#1612](https://github.com/ethereum/execution-spec-tests/pull/1612)).
3636
- ✨ Don't warn about a "high Transaction gas_limit" for `zkevm` tests ([#1598](https://github.com/ethereum/execution-spec-tests/pull/1598)).
3737
- 🐞 `fill` no longer writes generated fixtures into an existing, non-empty output directory; it must now be empty or `--clean` must be used to delete it first ([#1608](https://github.com/ethereum/execution-spec-tests/pull/1608)).

docs/library/cli/extract_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Since Hive doesn't directly expose container IDs, the tool uses a detection mech
120120
The tool supports:
121121

122122
- Individual fixture JSON files (BlockchainFixture format)
123-
- SharedPreStateGroup JSON files
123+
- PreAllocGroup JSON files
124124
- Directories containing multiple fixture files
125125

126126
## Troubleshooting

docs/navigation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* [State Tests](running_tests/test_formats/state_test.md)
4343
* [Blockchain Tests](running_tests/test_formats/blockchain_test.md)
4444
* [Blockchain Engine Tests](running_tests/test_formats/blockchain_test_engine.md)
45-
* [Blockchain Engine Reorg Tests](running_tests/test_formats/blockchain_test_engine_reorg.md)
45+
* [Blockchain Engine X Tests](running_tests/test_formats/blockchain_test_engine_x.md)
4646
* [EOF Tests](running_tests/test_formats/eof_test.md)
4747
* [Transaction Tests](running_tests/test_formats/transaction_test.md)
4848
* [Common Types](running_tests/test_formats/common_types.md)
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
# Blockchain Engine Reorg Tests <!-- markdownlint-disable MD051 (MD051=link-fragments "Link fragments should be valid") -->
1+
# Blockchain Engine X Tests <!-- markdownlint-disable MD051 (MD051=link-fragments "Link fragments should be valid") -->
22

3-
The Blockchain Engine Reorg Test fixture format tests are included in the fixtures subdirectory `blockchain_tests_engine_reorg`, and use Engine API directives with optimized shared pre-allocation for improved execution performance.
3+
The Blockchain Engine X Test fixture format tests are included in the fixtures subdirectory `blockchain_tests_engine_x`, and use Engine API directives with optimized pre-allocation groups for improved execution performance.
44

5-
These are produced by the `StateTest` and `BlockchainTest` test specs when using the `--generate-shared-pre` and `--use-shared-pre` flags.
5+
These are produced by the `StateTest` and `BlockchainTest` test specs when using the `--generate-pre-alloc-groups` and `--use-pre-alloc-groups` flags.
66

77
## Description
88

9-
The Blockchain Engine Reorg Test fixture format is an optimized variant of the [Blockchain Engine Test](./blockchain_test_engine.md) format designed for large-scale test execution with performance optimizations.
9+
The Blockchain Engine X Test fixture format is an optimized variant of the [Blockchain Engine Test](./blockchain_test_engine.md) format designed for large-scale test execution with performance optimizations.
1010

11-
It uses the Engine API to test block validation and consensus rules while leveraging **shared pre-allocation state** to significantly reduce test execution time and resource usage. Tests are grouped by their initial state (fork + environment + pre-allocation) and share common genesis states through blockchain reorganization.
11+
It uses the Engine API to test block validation and consensus rules while leveraging **pre-allocation groups** to significantly reduce test execution time and resource usage. Tests are grouped by their initial state (fork + environment + pre-allocation). Each group is executed against the same client instance using a common genesis state.
1212

1313
The key optimization is that **clients need only be started once per group** instead of once per test (as in the original engine fixture format), dramatically improving execution performance for large test suites.
1414

15-
Instead of including large pre-allocation state in each test fixture, this format references a shared pre-allocation folder (`pre_alloc`) which includes all different pre-allocation combinations used for any test fixture group.
15+
Instead of including large pre-allocation state in each test fixture, this format references a pre-allocation groups folder (`pre_alloc`) which contains all different pre-allocation combinations organized by group.
1616

17-
A single JSON fixture file is composed of a JSON object where each key-value pair is a different [`ReorgFixture`](#reorgfixture) test object, with the key string representing the test name.
17+
A single JSON fixture file is composed of a JSON object where each key-value pair is a different [`BlockchainTestEngineXFixture`](#BlockchainTestEngineXFixture) test object, with the key string representing the test name.
1818

1919
The JSON file path plus the test name are used as the unique test identifier.
2020

21-
## Shared Pre-Allocation File
21+
## Pre-Allocation Groups Folder
2222

23-
The `blockchain_tests_engine_reorg` directory contains a special directory `pre_alloc` that stores shared pre-allocation state file used by all tests in this format, one per pre-allocation group with the name of the pre-alloc hash. This folder is essential for test execution and must be present alongside the test fixtures.
23+
The `blockchain_tests_engine_x` directory contains a special directory `pre_alloc` that stores pre-allocation group files used by all tests in this format, one per pre-allocation group with the name of the pre-alloc hash. This folder is essential for test execution and must be present alongside the test fixtures.
2424

25-
### Pre-Allocation File Structure
25+
### Pre-Allocation Group File Structure
2626

27-
Each file in the `pre_alloc` folder corresponds to a pre-allocation hash to shared state groups:
27+
Each file in the `pre_alloc` folder corresponds to a pre-allocation group identified by a hash:
2828

2929
```json
3030
{
@@ -37,28 +37,28 @@ Each file in the `pre_alloc` folder corresponds to a pre-allocation hash to shar
3737
}
3838
```
3939

40-
#### SharedPreStateGroup Fields
40+
#### Pre-Allocation Group Fields
4141

42-
- **`test_count`**: Number of tests sharing this pre-allocation group
43-
- **`pre_account_count`**: Number of accounts in the shared pre-allocation state
44-
- **`testIds`**: Array of test identifiers that use this shared state
42+
- **`test_count`**: Number of tests in this pre-allocation group
43+
- **`pre_account_count`**: Number of accounts in the pre-allocation group
44+
- **`testIds`**: Array of test identifiers that belong to this group
4545
- **`network`**: Fork name (e.g., "Prague", "Cancun")
4646
- **`environment`**: Complete [`Environment`](./common_types.md#environment) object with execution context
47-
- **`pre`**: Shared [`Alloc`](./common_types.md#alloc-mappingaddressaccount) object containing initial account states
47+
- **`pre`**: Pre-allocation group [`Alloc`](./common_types.md#alloc-mappingaddressaccount) object containing initial account states
4848

4949
## Consumption
5050

51-
For each [`ReorgFixture`](#reorgfixture) test object in the JSON fixture file, perform the following steps:
51+
For each [`BlockchainTestEngineXFixture`](#BlockchainTestEngineXFixture) test object in the JSON fixture file, perform the following steps:
5252

53-
1. **Load Shared Pre-Allocation**:
53+
1. **Load Pre-Allocation Group**:
5454
- Read the appropriate file from the `pre_alloc` folder in the same directory
55-
- Locate the shared state group using [`preHash`](#-prehash-string)
56-
- Extract the `pre` allocation and `environment` from the shared group
55+
- Locate the pre-allocation group using [`preHash`](#-prehash-string)
56+
- Extract the `pre` allocation and `environment` from the group
5757

5858
2. **Initialize Client**:
5959
- Use [`network`](#-network-fork) to configure the execution fork schedule
60-
- Use the shared `pre` allocation as the starting state
61-
- Use the shared `environment` as the execution context
60+
- Use the pre-allocation group's `pre` allocation as the starting state
61+
- Use the pre-allocation group's `environment` as the execution context
6262
- Use [`genesisBlockHeader`](#-genesisblockheader-fixtureheader) as the genesis block header
6363

6464
3. **Execute Engine API Sequence**:
@@ -70,13 +70,13 @@ For each [`ReorgFixture`](#reorgfixture) test object in the JSON fixture file, p
7070
4. **Verify Final State**:
7171
- Compare the final chain head against [`lastblockhash`](#-lastblockhash-hash)
7272
- If [`postStateDiff`](#-poststatediff-optionalalloc) is present:
73-
- Apply the state differences to the shared pre-allocation
73+
- Apply the state differences to the pre-allocation group
7474
- Verify the resulting state matches the client's final state
7575
- If `post` field were present (not typical), verify it directly
7676

7777
## Structures
7878

79-
### `ReorgFixture`
79+
### `BlockchainTestEngineXFixture`
8080

8181
#### - `network`: [`Fork`](./common_types.md#fork)
8282

@@ -88,39 +88,39 @@ This field is going to be replaced by the value contained in `config.network`.
8888

8989
#### - `preHash`: `string`
9090

91-
Hash identifier referencing a shared pre-allocation group in the `pre_alloc` folder. This hash uniquely identifies the combination of fork, environment, and pre-allocation state shared by multiple tests.
91+
Hash identifier referencing a pre-allocation group in the `pre_alloc` folder. This hash uniquely identifies the combination of fork, environment, and pre-allocation state that defines the group.
9292

9393
#### - `genesisBlockHeader`: [`FixtureHeader`](./blockchain_test.md#fixtureheader)
9494

95-
Genesis block header. The state root in this header must match the state root calculated from the shared pre-allocation referenced by [`preHash`](#-prehash-string).
95+
Genesis block header. The state root in this header must match the state root calculated from the pre-allocation group referenced by [`preHash`](#-prehash-string).
9696

9797
#### - `engineNewPayloads`: [`List`](./common_types.md#list)`[`[`FixtureEngineNewPayload`](#fixtureenginenewpayload)`]`
9898

9999
List of `engine_newPayloadVX` directives to be processed after the genesis block. These define the sequence of blocks to be executed via the Engine API.
100100

101101
#### - `syncPayload`: [`Optional`](./common_types.md#optional)`[`[`FixtureEngineNewPayload`](#fixtureenginenewpayload)`]`
102102

103-
Optional synchronization payload used for blockchain reorganization scenarios. When present, this payload is typically used to sync the chain to a specific state before or after the main payload sequence.
103+
Optional synchronization payload. When present, this payload is typically used to sync the chain to a specific state before or after the main payload sequence.
104104

105105
#### - `lastblockhash`: [`Hash`](./common_types.md#hash)
106106

107107
Hash of the last valid block after all payloads have been processed, or the genesis block hash if all payloads are invalid.
108108

109109
#### - `postStateDiff`: [`Optional`](./common_types.md#optional)`[`[`Alloc`](./common_types.md#alloc-mappingaddressaccount)`]`
110110

111-
State differences from the shared pre-allocation state after test execution. This optimization stores only the accounts that changed, were created, or were deleted during test execution, rather than the complete final state.
111+
State differences from the pre-allocation group after test execution. This optimization stores only the accounts that changed, were created, or were deleted during test execution, rather than the complete final state.
112112

113113
To reconstruct the final state:
114114

115-
1. Start with the shared pre-allocation from the `pre_alloc` folder
115+
1. Start with the pre-allocation group from the `pre_alloc` folder
116116
2. Apply the changes in `postStateDiff`:
117117
- **Modified accounts**: Replace existing accounts with new values
118118
- **New accounts**: Add accounts not present in pre-allocation
119119
- **Deleted accounts**: Remove accounts (represented as `null` values)
120120

121121
#### - `config`: [`FixtureConfig`](#fixtureconfig)
122122

123-
Chain configuration object to be applied to the client running the blockchain engine reorg test.
123+
Chain configuration object to be applied to the client running the blockchain engine x test.
124124

125125
### `FixtureConfig`
126126

@@ -138,8 +138,7 @@ Engine API payload structure identical to the one defined in [Blockchain Engine
138138

139139
## Usage Notes
140140

141-
- This format is only generated when using `--generate-shared-pre` and `--use-shared-pre` flags
141+
- This format is only generated when using `--generate-pre-alloc-groups` and `--use-pre-alloc-groups` flags
142142
- The `pre_alloc` folder is essential and must be distributed with the test fixtures
143143
- Tests are grouped by identical (fork + environment + pre-allocation) combinations
144144
- The format is optimized for Engine API testing (post-Paris forks)
145-
- Reorganization scenarios are supported through the `forkChoiceUpdate` mechanism

src/cli/extract_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from ethereum_test_fixtures import BlockchainFixtureCommon
2222
from ethereum_test_fixtures.blockchain import FixtureHeader
2323
from ethereum_test_fixtures.file import Fixtures
24-
from ethereum_test_fixtures.shared_alloc import SharedPreStateGroup
24+
from ethereum_test_fixtures.pre_alloc_groups import PreAllocGroup
2525
from ethereum_test_forks import Fork
2626
from pytest_plugins.consume.hive_simulators.ruleset import ruleset
2727

@@ -111,9 +111,9 @@ def create_genesis_from_fixture(fixture_path: Path) -> Tuple[FixtureHeader, Allo
111111
alloc = fixture.pre
112112
chain_id = int(fixture.config.chain_id)
113113
else:
114-
shared_alloc = SharedPreStateGroup.model_validate(fixture_json)
115-
genesis = shared_alloc.genesis # type: ignore
116-
alloc = shared_alloc.pre
114+
pre_alloc_group = PreAllocGroup.model_validate(fixture_json)
115+
genesis = pre_alloc_group.genesis # type: ignore
116+
alloc = pre_alloc_group.pre
117117

118118
return genesis, alloc, chain_id
119119

0 commit comments

Comments
 (0)