Skip to content

Commit b11e439

Browse files
refactor(fw): split ethereum_test_types/types.py (#1665)
Co-authored-by: danceratopz <danceratopz@gmail.com>
1 parent 08f1629 commit b11e439

File tree

22 files changed

+756
-686
lines changed

22 files changed

+756
-686
lines changed

docs/CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Users can select any of the artifacts depending on their testing needs for their
4848
- 🔀 Updated from pytest 7 to [pytest 8](https://docs.pytest.org/en/stable/changelog.html#features-and-improvements), benefits include improved type hinting and hook typing, stricter mark handling, and clearer error messages for plugin and metadata development ([#1433](https://github.com/ethereum/execution-spec-tests/pull/1433)).
4949
- 🐞 Fix bug in ported-from plugin and coverage script that made PRs fail with modified tests that contained no ported tests ([#1661](https://github.com/ethereum/execution-spec-tests/pull/1661)).
5050
- 🔀 Refactor the `click`-based CLI interface used for pytest-based commands (`fill`, `execute`, `consume`) to make them more extensible ([#1654](https://github.com/ethereum/execution-spec-tests/pull/1654)).
51+
- 🔀 Split `src/ethereum_test_types/types.py` into several files to improve code organization ([#1665](https://github.com/ethereum/execution-spec-tests/pull/1665)).
5152

5253
### 🧪 Test Cases
5354

@@ -180,7 +181,7 @@ This feature can be disabled by using `--disable-strict-exception-matching` for
180181
### 📋 Misc
181182

182183
- 🐞 Configure `markdownlint` to expect an indent of 4 with unordered lists (otherwise HTML documentation is rendered incorrectly, [#1460](https://github.com/ethereum/execution-spec-tests/pull/1460)).
183-
- 🔀 Update `eels_resolutions.json` to point to temporary commit `bb0eb750d643ced0ebf5dec732cdd23558d0b7f2`, which is based on `forks/prague` branch, commit `d9a7ee24db359aacecd636349b4f3ac95a4a6e71`, with PRs https://github.com/ethereum/execution-specs/pull/1182, https://github.com/ethereum/execution-specs/pull/1183 and https://github.com/ethereum/execution-specs/pull/1191 merged ([#1394](https://github.com/ethereum/execution-spec-tests/pull/1394)).
184+
- 🔀 Update `eels_resolutions.json` to point to temporary commit `bb0eb750d643ced0ebf5dec732cdd23558d0b7f2`, which is based on `forks/prague` branch, commit `d9a7ee24db359aacecd636349b4f3ac95a4a6e71`, with PRs <https://github.com/ethereum/execution-specs/pull/1182>, <https://github.com/ethereum/execution-specs/pull/1183> and <https://github.com/ethereum/execution-specs/pull/1191> merged ([#1394](https://github.com/ethereum/execution-spec-tests/pull/1394)).
184185

185186
## [v4.2.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v4.2.0) - 2025-04-08
186187

@@ -571,7 +572,7 @@ The following changes may be potentially breaking (all clients were tested with
571572

572573
- Cancun is now the latest deployed fork, and the development fork is now Prague ([#489](https://github.com/ethereum/execution-spec-tests/pull/489)).
573574
- Stable fixtures artifact `fixtures.tar.gz` has been renamed to `fixtures_stable.tar.gz` ([#573](https://github.com/ethereum/execution-spec-tests/pull/573))
574-
- The "Blockchain Test Hive" fixture format has been renamed to "Blockchain Test Engine" and updated to more closely resemble the `engine_newPayload` format in the `execution-apis` specification (https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md#request) and now contains a single `"params"` field instead of multiple fields for each parameter ([#687](https://github.com/ethereum/execution-spec-tests/pull/687)).
575+
- The "Blockchain Test Hive" fixture format has been renamed to "Blockchain Test Engine" and updated to more closely resemble the `engine_newPayload` format in the `execution-apis` specification (<https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md#request>) and now contains a single `"params"` field instead of multiple fields for each parameter ([#687](https://github.com/ethereum/execution-spec-tests/pull/687)).
575576
- Output folder for fixtures has been renamed from "blockchain_tests_hive" to "blockchain_tests_engine" ([#687](https://github.com/ethereum/execution-spec-tests/pull/687)).
576577

577578
## [v2.1.1](https://github.com/ethereum/execution-spec-tests/releases/tag/v2.1.1) - 2024-03-09
@@ -607,7 +608,7 @@ The following changes may be potentially breaking (all clients were tested with
607608

608609
## [v2.1.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v2.1.0) - 2024-01-29: 🐍🏖️ Cancun
609610

610-
Release [v2.1.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v2.1.0) primarily fixes a small bug introduced within the previous release where transition forks are used within the new `StateTest` format. This was highlighted by @chfast within #405 (https://github.com/ethereum/execution-spec-tests/issues/405), where the fork name `ShanghaiToCancunAtTime15k` was found within state tests.
611+
Release [v2.1.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v2.1.0) primarily fixes a small bug introduced within the previous release where transition forks are used within the new `StateTest` format. This was highlighted by @chfast within #405 (<https://github.com/ethereum/execution-spec-tests/issues/405>), where the fork name `ShanghaiToCancunAtTime15k` was found within state tests.
611612

612613
### 🧪 Test Cases
613614

src/cli/eofwrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
from ethereum_test_specs.eof import EOFParse
3333
from ethereum_test_tools import Opcodes as Op
3434
from ethereum_test_types import Transaction
35+
from ethereum_test_types.block_types import Environment
3536
from ethereum_test_types.eof.v1 import Container
36-
from ethereum_test_types.types import Environment
3737
from ethereum_test_vm.bytecode import Bytecode
3838

3939

src/ethereum_test_fixtures/blockchain.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@
3333
)
3434
from ethereum_test_exceptions import EngineAPIError, ExceptionInstanceOrList
3535
from ethereum_test_forks import Fork, Paris
36-
from ethereum_test_types.types import (
36+
from ethereum_test_types import (
3737
Transaction,
38-
TransactionFixtureConverter,
39-
TransactionGeneric,
4038
Withdrawal,
41-
WithdrawalGeneric,
4239
)
40+
from ethereum_test_types.block_types import WithdrawalGeneric
41+
from ethereum_test_types.transaction_types import TransactionFixtureConverter, TransactionGeneric
4342

4443
from .base import BaseFixture
4544
from .common import FixtureAuthorizationTuple, FixtureBlobSchedule

src/ethereum_test_fixtures/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
SignableRLPSerializable,
1212
ZeroPaddedHexNumber,
1313
)
14-
from ethereum_test_types.types import Address, AuthorizationTupleGeneric
14+
from ethereum_test_types.account_types import Address
15+
from ethereum_test_types.transaction_types import AuthorizationTupleGeneric
1516

1617

1718
class FixtureForkBlobSchedule(CamelModel):

src/ethereum_test_fixtures/state.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
Address,
1010
Alloc,
1111
Bytes,
12+
CamelModel,
1213
Hash,
1314
ZeroPaddedHexNumber,
1415
)
1516
from ethereum_test_exceptions import TransactionExceptionInstanceOrList
16-
from ethereum_test_types.types import (
17-
CamelModel,
18-
EnvironmentGeneric,
17+
from ethereum_test_types.block_types import EnvironmentGeneric
18+
from ethereum_test_types.transaction_types import (
1919
Transaction,
2020
TransactionFixtureConverter,
2121
)

src/ethereum_test_fixtures/transaction.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
from pydantic import Field
66

7-
from ethereum_test_base_types import Address, Bytes, Hash, ZeroPaddedHexNumber
7+
from ethereum_test_base_types import Address, Bytes, CamelModel, Hash, ZeroPaddedHexNumber
88
from ethereum_test_exceptions import TransactionExceptionInstanceOrList
9-
from ethereum_test_types.types import CamelModel
109

1110
from .base import BaseFixture
1211

src/ethereum_test_specs/static_state/state_static.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@
66
import pytest
77
from _pytest.mark.structures import ParameterSet
88

9-
from ethereum_test_base_types import Address, Hash, HexNumber, Storage, ZeroPaddedHexNumber
9+
from ethereum_test_base_types import (
10+
Account,
11+
Address,
12+
Hash,
13+
HexNumber,
14+
Storage,
15+
ZeroPaddedHexNumber,
16+
)
1017
from ethereum_test_exceptions import TransactionExceptionInstanceOrList
1118
from ethereum_test_forks import Fork
12-
from ethereum_test_types import Account, Alloc, Environment, Transaction
19+
from ethereum_test_types import Alloc, Environment, Transaction
1320

1421
from ..base_static import BaseStaticTest
1522
from ..state import StateTestFiller

src/ethereum_test_specs/tests/test_expect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import pytest
66

77
from ethereum_clis import TransitionTool
8-
from ethereum_test_base_types import Account, Address, TestAddress, TestPrivateKey
8+
from ethereum_test_base_types import Account, Address, Storage, TestAddress, TestPrivateKey
99
from ethereum_test_exceptions import TransactionException
1010
from ethereum_test_fixtures import BlockchainFixture, FixtureFormat, StateFixture
1111
from ethereum_test_forks import Fork, get_deployed_forks
1212
from ethereum_test_tools import Block
13-
from ethereum_test_types import Alloc, Environment, Storage, Transaction, TransactionReceipt
13+
from ethereum_test_types import Alloc, Environment, Transaction, TransactionReceipt
1414

1515
from ..blockchain import BlockchainEngineFixture, BlockchainTest
1616
from ..helpers import (

src/ethereum_test_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Address,
1010
Bytes,
1111
Hash,
12+
Storage,
1213
TestAddress,
1314
TestAddress2,
1415
TestPrivateKey,
@@ -49,7 +50,6 @@
4950
NetworkWrappedTransaction,
5051
Removable,
5152
Requests,
52-
Storage,
5353
TestParameterGroup,
5454
Transaction,
5555
TransactionReceipt,

src/ethereum_test_types/__init__.py

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
"""Common definitions and types."""
22

3+
from .account_types import EOA, Alloc
4+
from .block_types import (
5+
Environment,
6+
EnvironmentDefaults,
7+
Withdrawal,
8+
)
39
from .helpers import (
410
TestParameterGroup,
511
add_kzg_version,
@@ -8,63 +14,44 @@
814
compute_create_address,
915
compute_eofcreate_address,
1016
)
11-
from .types import (
12-
EOA,
13-
Account,
14-
Alloc,
15-
AuthorizationTuple,
16-
Blob,
17-
CamelModel,
17+
from .receipt_types import TransactionReceipt
18+
from .request_types import (
1819
ConsolidationRequest,
1920
DepositRequest,
20-
Environment,
21-
EnvironmentDefaults,
22-
NetworkWrappedTransaction,
23-
Removable,
2421
Requests,
25-
Storage,
22+
WithdrawalRequest,
23+
)
24+
from .transaction_types import (
25+
AuthorizationTuple,
26+
Blob,
27+
NetworkWrappedTransaction,
2628
Transaction,
2729
TransactionDefaults,
28-
TransactionReceipt,
29-
Withdrawal,
30-
WithdrawalRequest,
31-
keccak256,
3230
)
31+
from .utils import Removable, keccak256
3332

3433
__all__ = (
35-
"Account",
3634
"Alloc",
3735
"AuthorizationTuple",
3836
"Blob",
39-
"CamelModel",
4037
"ConsolidationRequest",
4138
"DepositRequest",
42-
"EmptyTrieRoot",
4339
"Environment",
4440
"EnvironmentDefaults",
4541
"EOA",
46-
"Hash",
47-
"HeaderNonce",
48-
"HexNumber",
4942
"NetworkWrappedTransaction",
50-
"Number",
5143
"Removable",
5244
"Requests",
53-
"Storage",
5445
"TestParameterGroup",
55-
"TestPrivateKey",
56-
"TestPrivateKey2",
5746
"Transaction",
5847
"TransactionDefaults",
5948
"TransactionReceipt",
6049
"Withdrawal",
6150
"WithdrawalRequest",
62-
"ZeroPaddedHexNumber",
6351
"add_kzg_version",
6452
"ceiling_division",
6553
"compute_create_address",
6654
"compute_create2_address",
6755
"compute_eofcreate_address",
6856
"keccak256",
69-
"to_json",
7057
)

0 commit comments

Comments
 (0)