Commit 2ab9fc4
feat(fill): enable shared pre-allocation groups and add
* feat(fill): enable interface for two-phase shared alloc filling
* feat(fixtures,types): add shared pre-allocation data models
- Add `SharedPreStateGroup` and `SharedPreState` models.
- Support grouping tests by (fork, environment) hash.
- Enable serialization for phase 1/2 coordination.
* feat(fixtures): add `BlockchainEngineReorgFixture` and common base class
- Add `BlockchainEngineFixtureCommon` base class for shared functionality.
- Add `BlockchainEngineReorgFixture` with `post_state_diff` field.
- Remove unnecessary backwards compatibility validator from common class.
- Update `test_collect_only` framework test for new fixture.
* feat(fixtures): export new fixture classes and shared models
- Export `BlockchainEngineReorgFixture` and `BlockchainEngineFixtureCommon`.
- Export `SharedPreState` and `SharedPreStateGroup` models.
- Enable imports for shared pre-allocation functionality.
* feat(specs): add shared pre-allocation support to `BaseTest`
- Add `update_shared_pre_state()` and `compute_shared_pre_alloc_hash()`.
- Add `get_genesis_environment()` for polymorphic environment access.
- Support both `StateTest` and `BlockchainTest` formats.
* feat(fill): implement shared pre-allocation (`fill` pytest hooks)
- Add `pytest_sessionstart` and `pytest_sessionfinish` for phase coordination.
- Add `calculate_post_state_diff()` for memory-efficient storage.
- Add custom terminal summary with group statistics.
- Load/save shared pre-allocation state.
* feat(fixtures): enable global address allocation and shared pre-alloc path
- Add `shared_prealloc_path` property to `FixtureOutput`.
- Extend global address iterators to all test formats.
- Make the fixture scope of address iterators dynamic: session-scoped for shared pre-alloc generation, function-scoped for regular pre-alloc.
- Update and improve `pre_alloc` tests.
* feat(specs): add `BlockchainEngineReorgFixture` generation support
- Support generating reorg fixtures from blockchain tests.
- Enable shared pre-allocation integration with blockchain specs.
* feat(fixtures): add `pre_hash` field to test case index
- Support pre-allocation hash tracking in index files.
- Enable fixture consumption with shared pre-allocation metadata.
* chore(fill): only generate engine_reorg fixtures w/shared-alloc flags
* feat(fill): add a new pytest mark for custom prealloc group control
* chore(tests): apply `prealloc_group` to system contract & requests tests
* fix(tests): prevent iterator state persistence in beacon root tests during two-phase execution
The beacon root tests were failing when run with two-phase shared pre-allocation because they used `itertools.count()` objects directly in pytest parametrization. These iterator objects maintain internal state that persists across test phases when run in the same Python process.
Changes:
- Replace direct `count()` objects with factory functions that return fresh iterators.
- Update `beacon_roots` fixture to create new iterator instances on each invocation.
- Modify test parametrization to use `timestamps_factory` instead of `timestamps`.
This bug only manifested in two-phase execution because:
1. In regular single-phase filling, each test gets its own fresh Python process.
2. In two-phase execution within one process, the same parametrized iterator.
objects are reused, causing timestamps to continue from where phase 1 left off.
3. The second phase would see timestamps like 21000 instead of starting at 1000.
The fix ensures each test invocation gets fresh iterators with reset state, preventing cross-phase contamination while maintaining the same test behavior.
* chore(cli): add `groupstats` script to analyze shared pre-allocation groups
Add a new CLI tool that provides comprehensive analysis of shared pre-allocation groups generated by the test framework. The tool helps identify optimization opportunities for client teams by analyzing group distributions, test coverage, and identifying problematic test functions that create multiple size-1 groups.
Key features:
- Display overall statistics (groups, tests, accounts)
- Show distribution by fork with average tests per group
- Analyze group size frequency distribution
- Calculate test coverage impact by group size
- List test modules by execution complexity (group count)
- Identify split test functions with Groups/Fork ratio analysis
- Progressive disclosure with -v and -vv verbosity levels
The Groups/Fork ratio metric distinguishes between necessary multi-fork coverage and problematic parameter-heavy tests, enabling targeted optimization strategies for CI workflows.
* docs(consume): add `BlockchainEngineReorgFixture` docs
* refactor(all): standardize shared pre-allocation naming conventions
- CLI flags: `--generate-shared-alloc` → `--generate-shared-pre`
- CLI flags: `--use-shared-alloc` → `--use-shared-pre`
- Property: `shared_prealloc_path` → `shared_pre_alloc_path`
- Pytest marker: `prealloc_group` → `pre_alloc_group`
- Entry point: `show_pre_alloc_groups` → `groupstats`
* docs: update changelog
* fix(fixtures/filler): Pydantic fixes
* feat(filler): pre_alloc.json is now a folder
* fix(cli): groupstats
* fix: tox
* feat: Use deterministic addresses in pre-alloc
* fix: xdist
* feat: genesis header in pre_alloc files
* fix: tox
* fix: move pre
---------
Co-authored-by: Mario Vega <[email protected]>BlockchainEngineReorgFixture (ethereum#1706)1 parent f77cb56 commit 2ab9fc4
File tree
3 files changed
+147
-0
lines changed- running_tests/test_formats
3 files changed
+147
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
Lines changed: 145 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
0 commit comments