Skip to content

Commit ebc98a3

Browse files
committed
fix(consume): update according to renaming in #1760
1 parent 4aad19c commit ebc98a3

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

src/pytest_plugins/consume/simulators/engine_reorg/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""
22
Pytest fixtures for the `consume engine-reorg` simulator.
33
4-
Configures the hive back-end & EL clients for test execution with BlockchainEngineReorgFixtures.
4+
Configures the hive back-end & EL clients for test execution with BlockchainEngineXFixtures.
55
"""
66

77
import pytest
88
from hive.client import Client
99

1010
from ethereum_test_exceptions import ExceptionMapper
11-
# Note: BlockchainEngineReorgFixture import removed as it may not exist at this commit
11+
from ethereum_test_fixtures import BlockchainEngineXFixture
1212
from ethereum_test_rpc import EngineRPC
1313

1414
pytest_plugins = (
@@ -22,7 +22,7 @@
2222

2323
def pytest_configure(config):
2424
"""Set the supported fixture formats for the engine simulator."""
25-
config._supported_fixture_formats = [BlockchainEngineReorgFixture.format_name]
25+
config._supported_fixture_formats = [BlockchainEngineXFixture.format_name]
2626

2727

2828
@pytest.fixture(scope="module")

src/pytest_plugins/consume/simulators/helpers/client_wrapper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from ethereum_test_base_types import Number, to_json
1313
from ethereum_test_fixtures import BlockchainFixtureCommon
14-
# Note: SharedPreStateGroup import removed as shared_alloc module may not exist at this commit
14+
from ethereum_test_fixtures.pre_alloc_groups import PreAllocGroup
1515
from ethereum_test_forks import Fork
1616
from pytest_plugins.consume.simulators.helpers.ruleset import ruleset
1717

@@ -203,7 +203,7 @@ def __init__(
203203
self,
204204
pre_hash: str,
205205
client_type: ClientType,
206-
shared_pre_state: SharedPreStateGroup,
206+
shared_pre_state: PreAllocGroup,
207207
):
208208
"""
209209
Initialize a reorg client wrapper.
@@ -296,15 +296,15 @@ def set_pre_alloc_path(self, path: Path) -> None:
296296
self.pre_alloc_path = path
297297
logger.debug(f"Pre-alloc path set to: {path}")
298298

299-
def load_shared_pre_state(self, pre_hash: str) -> SharedPreStateGroup:
299+
def load_shared_pre_state(self, pre_hash: str) -> PreAllocGroup:
300300
"""
301301
Load the shared pre-state for a given preHash.
302302
303303
Args:
304304
pre_hash: The hash identifying the pre-allocation group
305305
306306
Returns:
307-
The loaded SharedPreStateGroup
307+
The loaded PreAllocGroup
308308
309309
Raises:
310310
RuntimeError: If pre-alloc path is not set
@@ -318,7 +318,7 @@ def load_shared_pre_state(self, pre_hash: str) -> SharedPreStateGroup:
318318
if not pre_alloc_file.exists():
319319
raise FileNotFoundError(f"Pre-allocation file not found: {pre_alloc_file}")
320320

321-
return SharedPreStateGroup.model_validate_json(pre_alloc_file.read_text())
321+
return PreAllocGroup.model_validate_json(pre_alloc_file.read_text())
322322

323323
def get_or_create_reorg_client(
324324
self,

src/pytest_plugins/consume/simulators/multi_test_client.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
from hive.testing import HiveTestSuite
1111

1212
from ethereum_test_base_types import to_json
13+
from ethereum_test_fixtures import BlockchainEngineXFixture
1314
from ethereum_test_fixtures.blockchain import FixtureHeader
15+
from ethereum_test_fixtures.pre_alloc_groups import PreAllocGroup
1416
from pytest_plugins.consume.consume import FixturesSource
1517
from pytest_plugins.consume.simulators.helpers.ruleset import (
1618
ruleset, # TODO: generate dynamically
@@ -24,17 +26,17 @@
2426

2527

2628
@pytest.fixture(scope="session")
27-
def shared_pre_state_cache() -> Dict[str, SharedPreStateGroup]:
29+
def shared_pre_state_cache() -> Dict[str, PreAllocGroup]:
2830
"""Cache for shared pre-state groups to avoid reloading from disk."""
2931
return {}
3032

3133

3234
@pytest.fixture(scope="function")
3335
def shared_pre_state_group(
34-
fixture: BlockchainEngineReorgFixture,
36+
fixture: BlockchainEngineXFixture,
3537
fixtures_source: FixturesSource,
36-
shared_pre_state_cache: Dict[str, SharedPreStateGroup],
37-
) -> SharedPreStateGroup:
38+
shared_pre_state_cache: Dict[str, PreAllocGroup],
39+
) -> PreAllocGroup:
3840
"""Load the shared pre-state group for the current test case."""
3941
pre_hash = fixture.pre_hash
4042

@@ -48,20 +50,20 @@ def shared_pre_state_group(
4850

4951
# Look for shared pre-allocation file using FixtureOutput path structure
5052
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"
5254
if not shared_alloc_path.exists():
5355
raise FileNotFoundError(f"Shared pre-allocation file not found: {shared_alloc_path}")
5456

5557
# Load and cache
5658
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())
5860

5961
shared_pre_state_cache[pre_hash] = shared_group
6062
return shared_group
6163

6264

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."""
6567
fork = shared_pre_state_group.fork
6668
assert fork in ruleset, f"fork '{fork}' missing in hive ruleset"
6769
return {
@@ -73,7 +75,7 @@ def create_environment(shared_pre_state_group: SharedPreStateGroup, check_live_p
7375
}
7476

7577

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]:
7779
"""Define the files that hive will start the client with."""
7880
genesis = to_json(shared_pre_state_group.genesis) # type: ignore
7981
alloc = to_json(shared_pre_state_group.pre)
@@ -103,7 +105,7 @@ def reorg_client_manager() -> Generator[ReorgClientManager, None, None]:
103105

104106

105107
@pytest.fixture(scope="function")
106-
def genesis_header(shared_pre_state_group: SharedPreStateGroup) -> FixtureHeader:
108+
def genesis_header(shared_pre_state_group: PreAllocGroup) -> FixtureHeader:
107109
"""Provide the genesis header from the shared pre-state group."""
108110
return shared_pre_state_group.genesis # type: ignore
109111

@@ -113,8 +115,8 @@ def client(
113115
test_suite: HiveTestSuite,
114116
client_type: ClientType,
115117
total_timing_data: TimingData,
116-
fixture: BlockchainEngineReorgFixture,
117-
shared_pre_state_group: SharedPreStateGroup,
118+
fixture: BlockchainEngineXFixture,
119+
shared_pre_state_group: PreAllocGroup,
118120
reorg_client_manager: ReorgClientManager,
119121
fixtures_source: FixturesSource,
120122
) -> Generator[Client, None, None]:
@@ -125,7 +127,7 @@ def client(
125127
# Set pre-alloc path in manager if not already set
126128
if reorg_client_manager.pre_alloc_path is None:
127129
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)
129131

130132
# Check for existing client
131133
existing_client = reorg_client_manager.get_client_for_test(pre_hash)

src/pytest_plugins/consume/simulators/simulator_logic/test_via_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import time
99

1010
from ethereum_test_exceptions import UndefinedException
11-
from ethereum_test_fixtures import BlockchainEngineFixture
11+
from ethereum_test_fixtures import BlockchainEngineFixture, BlockchainEngineXFixture
1212
from ethereum_test_fixtures.blockchain import FixtureHeader
1313
from ethereum_test_rpc import EngineRPC, EthRPC
1414
from ethereum_test_rpc.types import ForkchoiceState, JSONRPCError, PayloadStatusEnum
@@ -33,7 +33,7 @@ def test_blockchain_via_engine(
3333
timing_data: TimingData,
3434
eth_rpc: EthRPC,
3535
engine_rpc: EngineRPC,
36-
fixture: BlockchainEngineFixture,
36+
fixture: BlockchainEngineFixture | BlockchainEngineXFixture,
3737
genesis_header: FixtureHeader,
3838
strict_exception_matching: bool,
3939
):

0 commit comments

Comments
 (0)