Skip to content

chore(deps): remove dependency on ethereum-execution #1787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/configs/eels_resolutions.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"Frontier": {
"path": "../../execution-specs/src/ethereum/frontier"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"Homestead": {
"path": "../../execution-specs/src/ethereum/homestead"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"Byzantium": {
"path": "../../execution-specs/src/ethereum/byzantium"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"ConstantinopleFix": {
"path": "../../execution-specs/src/ethereum/constantinople"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"Istanbul": {
"path": "../../execution-specs/src/ethereum/istanbul"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"Berlin": {
"path": "../../execution-specs/src/ethereum/berlin"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"London": {
"path": "../../execution-specs/src/ethereum/london"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"Merge": {
"path": "../../execution-specs/src/ethereum/paris"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"Shanghai": {
"path": "../../execution-specs/src/ethereum/shanghai"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"Cancun": {
"path": "../../execution-specs/src/ethereum/cancun"
"path": "$GITHUB_WORKSPACE/execution-specs/"
},
"Prague": {
"git_url": "https://github.com/ethereum/execution-specs.git",
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/tox_verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ jobs:
repository: ethereum/execution-specs
ref: fa847a0e48309debee8edc510ceddb2fd5db2f2e
path: execution-specs
sparse-checkout: |
src/ethereum
fetch-depth: 1
- name: Install uv ${{ vars.UV_VERSION }} and python ${{ matrix.python }}
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182
Expand All @@ -134,6 +132,9 @@ jobs:
targets: "evmone-t8n"
- name: Build GETH EVM
uses: ./.github/actions/build-evm-client/geth
- name: Update eels_resolutions.json
run: |
sed -i -e "s|\$GITHUB_WORKSPACE|${GITHUB_WORKSPACE}|g" .github/configs/eels_resolutions.json
- name: Run tox - run framework unit tests with pytest
env:
EELS_RESOLUTIONS_FILE: ${{ github.workspace }}/.github/configs/eels_resolutions.json
Expand Down Expand Up @@ -161,8 +162,6 @@ jobs:
repository: ethereum/execution-specs
ref: fa847a0e48309debee8edc510ceddb2fd5db2f2e
path: execution-specs
sparse-checkout: |
src/ethereum
fetch-depth: 1
- name: Install uv ${{ vars.UV_VERSION }} and python ${{ matrix.python }}
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182
Expand All @@ -171,6 +170,9 @@ jobs:
cache-dependency-glob: "uv.lock"
version: ${{ vars.UV_VERSION }}
python-version: ${{ matrix.python }}
- name: Update eels_resolutions.json
run: |
sed -i -e "s|\$GITHUB_WORKSPACE|${GITHUB_WORKSPACE}|g" .github/configs/eels_resolutions.json
- name: Run tox - fill tests for deployed forks
env:
EELS_RESOLUTIONS_FILE: ${{ github.workspace }}/.github/configs/eels_resolutions.json
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ classifiers = [
]
dependencies = [
"click>=8.1.0,<9",
"ethereum-execution==1.17.0rc6.dev1",
"hive.py @ git+https://github.com/marioevz/hive.py",
"ethereum-spec-evm-resolver",
"gitpython>=3.1.31,<4",
Expand Down
70 changes: 65 additions & 5 deletions src/ethereum_test_types/account_types.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""Account-related types for Ethereum tests."""

from dataclasses import dataclass
from typing import List, Literal
from dataclasses import dataclass, field
from typing import Dict, List, Literal, Optional, Tuple

from coincurve.keys import PrivateKey
from ethereum.frontier.fork_types import Account as FrontierAccount
from ethereum.frontier.fork_types import Address as FrontierAddress
from ethereum.frontier.state import State, set_account, set_storage, state_root
from ethereum_types.bytes import Bytes20
from ethereum_types.numeric import U256, Bytes32, Uint
from pydantic import PrivateAttr

Expand All @@ -26,8 +24,70 @@
)
from ethereum_test_vm import EVMCodeType

from .trie import EMPTY_TRIE_ROOT, FrontierAccount, Trie, root, trie_get, trie_set
from .utils import keccak256

FrontierAddress = Bytes20


@dataclass
class State:
"""Contains all information that is preserved between transactions."""

_main_trie: Trie[Bytes20, Optional[FrontierAccount]] = field(
default_factory=lambda: Trie(secured=True, default=None)
)
_storage_tries: Dict[Bytes20, Trie[Bytes32, U256]] = field(default_factory=dict)
_snapshots: List[
Tuple[
Trie[Bytes20, Optional[FrontierAccount]],
Dict[Bytes20, Trie[Bytes32, U256]],
]
] = field(default_factory=list)


def set_account(state: State, address: Bytes20, account: Optional[FrontierAccount]) -> None:
"""
Set the `Account` object at an address. Setting to `None` deletes
the account (but not its storage, see `destroy_account()`).
"""
trie_set(state._main_trie, address, account)


def set_storage(state: State, address: Bytes20, key: Bytes32, value: U256) -> None:
"""
Set a value at a storage key on an account. Setting to `U256(0)` deletes
the key.
"""
assert trie_get(state._main_trie, address) is not None

trie = state._storage_tries.get(address)
if trie is None:
trie = Trie(secured=True, default=U256(0))
state._storage_tries[address] = trie
trie_set(trie, key, value)
if trie._data == {}:
del state._storage_tries[address]


def storage_root(state: State, address: Bytes20) -> Bytes32:
"""Calculate the storage root of an account."""
assert not state._snapshots
if address in state._storage_tries:
return root(state._storage_tries[address])
else:
return EMPTY_TRIE_ROOT


def state_root(state: State) -> Bytes32:
"""Calculate the state root."""
assert not state._snapshots

def get_storage_root(address: Bytes20) -> Bytes32:
return storage_root(state, address)

return root(state._main_trie, get_storage_root=get_storage_root)


class EOA(Address):
"""
Expand Down
Loading
Loading