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