diff --git a/packages/testing/src/execution_testing/cli/extract_config.py b/packages/testing/src/execution_testing/cli/extract_config.py index 10cf25c965..af98b15a9d 100755 --- a/packages/testing/src/execution_testing/cli/extract_config.py +++ b/packages/testing/src/execution_testing/cli/extract_config.py @@ -36,7 +36,7 @@ ) from execution_testing.fixtures.blockchain import FixtureHeader from execution_testing.fixtures.file import Fixtures -from execution_testing.fixtures.pre_alloc_groups import PreAllocGroup +from execution_testing.fixtures.pre_alloc_groups import PreAllocGroupBuilder from execution_testing.forks import Fork @@ -176,8 +176,9 @@ def from_fixture(cls, fixture_path: Path) -> Self: pass try: - # Try to load pre-allocation group - pre_alloc_group = PreAllocGroup.model_validate_json(fixture_bytes) + # Load as builder format and compute genesis on-demand + builder = PreAllocGroupBuilder.model_validate_json(fixture_bytes) + pre_alloc_group = builder.build() return cls( header=pre_alloc_group.genesis, alloc=pre_alloc_group.pre, diff --git a/packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py b/packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py index 6ade0d7666..69e69fcf21 100644 --- a/packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py +++ b/packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py @@ -17,7 +17,7 @@ Tuple, ) -from pydantic import Field, PrivateAttr, ValidationError +from pydantic import Field, PrivateAttr from execution_testing.base_types import ( CamelModel, @@ -340,21 +340,13 @@ def from_file(cls, file: Path) -> Self: """ Load a pre-allocation group from a JSON file. - Handles both builder format (without genesis) and full format (with - genesis). If genesis is missing, computes it from the pre-allocation - state. This ensures state root computation happens exactly once when - loading in Phase 2, not during Phase 1 merging. + Files are stored in builder format (without genesis). Genesis is + computed on-demand when loading, ensuring state root computation + happens exactly once in Phase 2, not during Phase 1 merging. """ with open(file) as f: data = f.read() - # Try loading as full PreAllocGroup first (backwards compatibility) - try: - return cls.model_validate_json(data) - except ValidationError: - pass - - # Load as builder format and compute genesis builder = PreAllocGroupBuilder.model_validate_json(data) built = builder.build() # Use cls.model_validate to ensure proper Self return type