Skip to content

Commit e37a2fe

Browse files
Refactor to #1138 (#1141)
* refactor(tests): EIP-7685: Add invalid cases * refactor(tests): EIP-7685: Remove redundant `test_request_types.py`, remove unused fixtures * small comment * Update tests/prague/eip7685_general_purpose_el_requests/test_deposits_withdrawals_consolidations.py Co-authored-by: danceratopz <[email protected]> --------- Co-authored-by: danceratopz <[email protected]>
1 parent e734410 commit e37a2fe

File tree

3 files changed

+31
-128
lines changed

3 files changed

+31
-128
lines changed

tests/prague/eip7685_general_purpose_el_requests/conftest.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import pytest
66

7-
from ethereum_test_forks import Fork
87
from ethereum_test_tools import (
98
Alloc,
109
Block,
@@ -36,12 +35,6 @@ def block_body_override_requests(
3635
return None
3736

3837

39-
@pytest.fixture
40-
def block_body_extra_requests() -> List[SupportsBytes]:
41-
"""List of requests that overwrite the requests in the header. None by default."""
42-
return []
43-
44-
4538
@pytest.fixture
4639
def correct_requests_hash_in_header() -> bool:
4740
"""
@@ -80,15 +73,13 @@ def is_monotonically_increasing(requests: List[bytes]) -> bool:
8073

8174
@pytest.fixture
8275
def blocks(
83-
fork: Fork,
8476
pre: Alloc,
8577
requests: List[
8678
DepositInteractionBase
8779
| WithdrawalRequestInteractionBase
8880
| ConsolidationRequestInteractionBase
8981
],
9082
block_body_override_requests: List[Bytes | SupportsBytes] | None,
91-
block_body_extra_requests: List[SupportsBytes],
9283
correct_requests_hash_in_header: bool,
9384
exception: BlockException | None,
9485
engine_api_error_code: EngineAPIError | None,
@@ -109,9 +100,6 @@ def blocks(
109100

110101
valid_requests = Requests(*valid_requests_list)
111102

112-
if block_body_override_requests is None and block_body_extra_requests is not None:
113-
block_body_override_requests = valid_requests.requests_list + block_body_extra_requests
114-
115103
rlp_modifier: Header | None = None
116104
if correct_requests_hash_in_header:
117105
rlp_modifier = Header(

tests/prague/eip7685_general_purpose_el_requests/test_deposits_withdrawals_consolidations.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,31 @@ def invalid_requests_block_combinations(fork: Fork) -> List[Any]:
465465
correct_order_transactions,
466466
correct_order + [bytes([fork.max_request_type() + 1])],
467467
BlockException.INVALID_REQUESTS,
468-
id="extra_invalid_type_request",
468+
id="extra_invalid_type_request_with_no_data",
469+
),
470+
)
471+
combinations.append(
472+
pytest.param(
473+
correct_order_transactions,
474+
correct_order + [bytes([fork.max_request_type() + 1, 0x00])],
475+
BlockException.INVALID_REQUESTS,
476+
id="extra_invalid_type_request_with_data_0x00",
477+
),
478+
)
479+
combinations.append(
480+
pytest.param(
481+
correct_order_transactions,
482+
correct_order + [bytes([fork.max_request_type() + 1, 0x01])],
483+
BlockException.INVALID_REQUESTS,
484+
id="extra_invalid_type_request_with_data_0x01",
485+
),
486+
)
487+
combinations.append(
488+
pytest.param(
489+
correct_order_transactions,
490+
correct_order + [bytes([fork.max_request_type() + 1, 0xFF])],
491+
BlockException.INVALID_REQUESTS,
492+
id="extra_invalid_type_request_with_data_0xff",
469493
),
470494
)
471495

@@ -516,6 +540,12 @@ def test_invalid_deposit_withdrawal_consolidation_requests_engine(
516540
so the block might execute properly if the client ignores the requests in the new payload
517541
parameters.
518542
543+
Note that the only difference between the engine version produced by this test and
544+
the ones produced by `test_invalid_deposit_withdrawal_consolidation_requests` is the
545+
`blockHash` value in the new payloads, which is calculated using different request hashes
546+
for each test, but since the request hash is not a value that is included in the payload,
547+
it might not be immediately apparent.
548+
519549
Also these tests would not fail if the block is imported via RLP (syncing from a peer),
520550
so we only generate the BlockchainTestEngine for them.
521551
"""

tests/prague/eip7685_general_purpose_el_requests/test_request_types.py

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)