10
10
from hive .testing import HiveTestSuite
11
11
12
12
from ethereum_test_base_types import to_json
13
- from ethereum_test_fixtures import BlockchainEngineReorgFixture
13
+ from ethereum_test_fixtures import BlockchainEngineXFixture
14
14
from ethereum_test_fixtures .blockchain import FixtureHeader
15
- from ethereum_test_fixtures .shared_alloc import SharedPreStateGroup
15
+ from ethereum_test_fixtures .pre_alloc_groups import PreAllocGroup
16
16
from pytest_plugins .consume .consume import FixturesSource
17
17
from pytest_plugins .consume .simulators .helpers .ruleset import (
18
18
ruleset , # TODO: generate dynamically
26
26
27
27
28
28
@pytest .fixture (scope = "session" )
29
- def shared_pre_state_cache () -> Dict [str , SharedPreStateGroup ]:
29
+ def shared_pre_state_cache () -> Dict [str , PreAllocGroup ]:
30
30
"""Cache for shared pre-state groups to avoid reloading from disk."""
31
31
return {}
32
32
33
33
34
34
@pytest .fixture (scope = "function" )
35
35
def shared_pre_state_group (
36
- fixture : BlockchainEngineReorgFixture ,
36
+ fixture : BlockchainEngineXFixture ,
37
37
fixtures_source : FixturesSource ,
38
- shared_pre_state_cache : Dict [str , SharedPreStateGroup ],
39
- ) -> SharedPreStateGroup :
38
+ shared_pre_state_cache : Dict [str , PreAllocGroup ],
39
+ ) -> PreAllocGroup :
40
40
"""Load the shared pre-state group for the current test case."""
41
41
pre_hash = fixture .pre_hash
42
42
@@ -50,20 +50,20 @@ def shared_pre_state_group(
50
50
51
51
# Look for shared pre-allocation file using FixtureOutput path structure
52
52
fixture_output = FixtureOutput (output_path = fixtures_source .path )
53
- shared_alloc_path = fixture_output .shared_pre_alloc_folder_path / f"{ pre_hash } .json"
53
+ shared_alloc_path = fixture_output .pre_alloc_groups_folder_path / f"{ pre_hash } .json"
54
54
if not shared_alloc_path .exists ():
55
55
raise FileNotFoundError (f"Shared pre-allocation file not found: { shared_alloc_path } " )
56
56
57
57
# Load and cache
58
58
with open (shared_alloc_path ) as f :
59
- shared_group = SharedPreStateGroup .model_validate_json (f .read ())
59
+ shared_group = PreAllocGroup .model_validate_json (f .read ())
60
60
61
61
shared_pre_state_cache [pre_hash ] = shared_group
62
62
return shared_group
63
63
64
64
65
- def create_environment (shared_pre_state_group : SharedPreStateGroup , check_live_port : int ) -> dict :
66
- """Define environment using SharedPreStateGroup data."""
65
+ def create_environment (shared_pre_state_group : PreAllocGroup , check_live_port : int ) -> dict :
66
+ """Define environment using PreAllocGroup data."""
67
67
fork = shared_pre_state_group .fork
68
68
assert fork in ruleset , f"fork '{ fork } ' missing in hive ruleset"
69
69
return {
@@ -75,7 +75,7 @@ def create_environment(shared_pre_state_group: SharedPreStateGroup, check_live_p
75
75
}
76
76
77
77
78
- def client_files (shared_pre_state_group : SharedPreStateGroup ) -> Mapping [str , io .BufferedReader ]:
78
+ def client_files (shared_pre_state_group : PreAllocGroup ) -> Mapping [str , io .BufferedReader ]:
79
79
"""Define the files that hive will start the client with."""
80
80
genesis = to_json (shared_pre_state_group .genesis ) # type: ignore
81
81
alloc = to_json (shared_pre_state_group .pre )
@@ -105,7 +105,7 @@ def reorg_client_manager() -> Generator[ReorgClientManager, None, None]:
105
105
106
106
107
107
@pytest .fixture (scope = "function" )
108
- def genesis_header (shared_pre_state_group : SharedPreStateGroup ) -> FixtureHeader :
108
+ def genesis_header (shared_pre_state_group : PreAllocGroup ) -> FixtureHeader :
109
109
"""Provide the genesis header from the shared pre-state group."""
110
110
return shared_pre_state_group .genesis # type: ignore
111
111
@@ -115,8 +115,8 @@ def client(
115
115
test_suite : HiveTestSuite ,
116
116
client_type : ClientType ,
117
117
total_timing_data : TimingData ,
118
- fixture : BlockchainEngineReorgFixture ,
119
- shared_pre_state_group : SharedPreStateGroup ,
118
+ fixture : BlockchainEngineXFixture ,
119
+ shared_pre_state_group : PreAllocGroup ,
120
120
reorg_client_manager : ReorgClientManager ,
121
121
fixtures_source : FixturesSource ,
122
122
) -> Generator [Client , None , None ]:
@@ -127,7 +127,7 @@ def client(
127
127
# Set pre-alloc path in manager if not already set
128
128
if reorg_client_manager .pre_alloc_path is None :
129
129
fixture_output = FixtureOutput (output_path = fixtures_source .path )
130
- reorg_client_manager .set_pre_alloc_path (fixture_output .shared_pre_alloc_folder_path )
130
+ reorg_client_manager .set_pre_alloc_path (fixture_output .pre_alloc_groups_folder_path )
131
131
132
132
# Check for existing client
133
133
existing_client = reorg_client_manager .get_client_for_test (pre_hash )
0 commit comments