Skip to content

Commit

Permalink
refactor(fw): refactor ethereum_test_tools submodules into libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Jul 16, 2024
1 parent 1cc59e1 commit d4d86ff
Show file tree
Hide file tree
Showing 120 changed files with 10,181 additions and 11,245 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Test fixtures for use by clients are available for each release on the [Github r
- ✨ Enable loading of [ethereum/tests/BlockchainTests](https://github.com/ethereum/tests/tree/develop/BlockchainTests) ([#596](https://github.com/ethereum/execution-spec-tests/pull/596)).
- 🔀 Refactor `gentest` to use `ethereum_test_tools.rpc.rpc` by adding to `get_transaction_by_hash`, `debug_trace_call` to `EthRPC` ([#568](https://github.com/ethereum/execution-spec-tests/pull/568)).
- ✨ Write a properties file to the output directory and enable direct generation of a fixture tarball from `fill` via `--output=fixtures.tgz`([#627](https://github.com/ethereum/execution-spec-tests/pull/627)).
- 🔀 `ethereum_test_tools` library has been split into multiple libraries ([#645](https://github.com/ethereum/execution-spec-tests/pull/645)).

### 🔧 EVM Tools

Expand Down
22 changes: 20 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ classifiers =

[options]
packages =
evm_transition_tool
ethereum_test_base_types
ethereum_test_exceptions
ethereum_test_fixtures
ethereum_test_forks
ethereum_test_specs
ethereum_test_tools
ethereum_test_types
ethereum_test_vm
evm_transition_tool
pytest_plugins

package_dir =
Expand Down Expand Up @@ -47,11 +53,23 @@ install_requires =
solc-select>=1.0.4

[options.package_data]
ethereum_test_tools =
ethereum_test_base_types =
py.typed
ethereum_test_exceptions =
py.typed
ethereum_test_fixtures =
py.typed
ethereum_test_forks =
py.typed
forks/contracts/*.bin
ethereum_test_specs =
py.typed
ethereum_test_tools =
py.typed
ethereum_test_types =
py.typed
ethereum_test_vm =
py.typed
evm_transition_tool =
py.typed
pytest_plugins =
Expand Down
6 changes: 3 additions & 3 deletions src/cli/check_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import click
from rich.progress import BarColumn, Progress, TaskProgressColumn, TextColumn, TimeElapsedColumn

from ethereum_test_tools.common.json import to_json
from ethereum_test_tools.spec.base.base_test import HashMismatchException
from ethereum_test_tools.spec.file.types import Fixtures
from ethereum_test_base_types import to_json
from ethereum_test_fixtures.file import Fixtures
from ethereum_test_specs.base import HashMismatchException


def count_json_files_exclude_index(start_path: Path) -> int:
Expand Down
4 changes: 2 additions & 2 deletions src/cli/evm_bytes_to_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import click

from ethereum_test_tools import Macro
from ethereum_test_tools import Opcodes as Op
from ethereum_test_vm import Macro
from ethereum_test_vm import Opcodes as Op


def process_evm_bytes(evm_bytes_hex_string: Any) -> str: # noqa: D103
Expand Down
8 changes: 4 additions & 4 deletions src/cli/gen_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
TimeElapsedColumn,
)

from ethereum_test_tools.common.base_types import HexNumber
from ethereum_test_tools.spec.consume.types import IndexFile, TestCaseIndexFile
from ethereum_test_tools.spec.file.types import Fixtures
from evm_transition_tool import FixtureFormats
from ethereum_test_base_types import HexNumber
from ethereum_test_fixtures import FixtureFormats
from ethereum_test_fixtures.consume import IndexFile, TestCaseIndexFile
from ethereum_test_fixtures.file import Fixtures

from .hasher import HashableItem

Expand Down
7 changes: 4 additions & 3 deletions src/cli/gentest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@

import click

from ethereum_test_tools import Account, Address, Transaction, common
from ethereum_test_base_types import Account, Address, ZeroPaddedHexNumber
from ethereum_test_tools.rpc.rpc import BlockNumberType, EthRPC
from ethereum_test_types import Transaction


@click.command()
Expand Down Expand Up @@ -165,8 +166,8 @@ def _make_pre_state(

if account_obj.storage is not None:
for record, value in account_obj.storage.root.items():
pad_record = common.ZeroPaddedHexNumber(record)
pad_value = common.ZeroPaddedHexNumber(value)
pad_record = ZeroPaddedHexNumber(record)
pad_value = ZeroPaddedHexNumber(value)
state_str += f'{pad} "{pad_record}" : "{pad_value}",\n'

state_str += pad + "}\n"
Expand Down
67 changes: 67 additions & 0 deletions src/ethereum_test_base_types/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""
Common definitions and types.
"""

from .base_types import (
Address,
Bloom,
BLSPublicKey,
BLSSignature,
Bytes,
FixedSizeBytes,
Hash,
HashInt,
HeaderNonce,
HexNumber,
Number,
NumberBoundTypeVar,
ZeroPaddedHexNumber,
)
from .composite_types import Account, Alloc, Storage, StorageRootType
from .constants import (
AddrAA,
AddrBB,
EmptyOmmersRoot,
EmptyTrieRoot,
TestAddress,
TestAddress2,
TestPrivateKey,
TestPrivateKey2,
)
from .conversions import to_bytes, to_hex
from .json import to_json
from .pydantic import CamelModel
from .reference_spec import ReferenceSpec

__all__ = (
"Account",
"AddrAA",
"AddrBB",
"Address",
"Alloc",
"Bloom",
"BLSPublicKey",
"BLSSignature",
"Bytes",
"CamelModel",
"EmptyOmmersRoot",
"EmptyTrieRoot",
"FixedSizeBytes",
"Hash",
"HashInt",
"HeaderNonce",
"HexNumber",
"Number",
"NumberBoundTypeVar",
"ReferenceSpec",
"Storage",
"StorageRootType",
"TestAddress",
"TestAddress2",
"TestPrivateKey",
"TestPrivateKey2",
"ZeroPaddedHexNumber",
"to_bytes",
"to_hex",
"to_json",
)
File renamed without changes.
Loading

0 comments on commit d4d86ff

Please sign in to comment.