File tree Expand file tree Collapse file tree
packages/testing/src/execution_testing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636)
3737from execution_testing .fixtures .blockchain import FixtureHeader
3838from execution_testing .fixtures .file import Fixtures
39- from execution_testing .fixtures .pre_alloc_groups import PreAllocGroup
39+ from execution_testing .fixtures .pre_alloc_groups import PreAllocGroupBuilder
4040from execution_testing .forks import Fork
4141
4242
@@ -176,8 +176,9 @@ def from_fixture(cls, fixture_path: Path) -> Self:
176176 pass
177177
178178 try :
179- # Try to load pre-allocation group
180- pre_alloc_group = PreAllocGroup .model_validate_json (fixture_bytes )
179+ # Load as builder format and compute genesis on-demand
180+ builder = PreAllocGroupBuilder .model_validate_json (fixture_bytes )
181+ pre_alloc_group = builder .build ()
181182 return cls (
182183 header = pre_alloc_group .genesis ,
183184 alloc = pre_alloc_group .pre ,
Original file line number Diff line number Diff line change 1717 Tuple ,
1818)
1919
20- from pydantic import Field , PrivateAttr , ValidationError
20+ from pydantic import Field , PrivateAttr
2121
2222from execution_testing .base_types import (
2323 CamelModel ,
@@ -340,21 +340,13 @@ def from_file(cls, file: Path) -> Self:
340340 """
341341 Load a pre-allocation group from a JSON file.
342342
343- Handles both builder format (without genesis) and full format (with
344- genesis). If genesis is missing, computes it from the pre-allocation
345- state. This ensures state root computation happens exactly once when
346- loading in Phase 2, not during Phase 1 merging.
343+ Files are stored in builder format (without genesis). Genesis is
344+ computed on-demand when loading, ensuring state root computation
345+ happens exactly once in Phase 2, not during Phase 1 merging.
347346 """
348347 with open (file ) as f :
349348 data = f .read ()
350349
351- # Try loading as full PreAllocGroup first (backwards compatibility)
352- try :
353- return cls .model_validate_json (data )
354- except ValidationError :
355- pass
356-
357- # Load as builder format and compute genesis
358350 builder = PreAllocGroupBuilder .model_validate_json (data )
359351 built = builder .build ()
360352 # Use cls.model_validate to ensure proper Self return type
You can’t perform that action at this time.
0 commit comments