Skip to content

feat(fw): Add is_state_test flag to Environment #652

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Test fixtures for use by clients are available for each release on the [Github r

### 🔧 EVM Tools

- 🔀 `Environment` class passed to the transition tool (t8n) now contains field `isStateTest` which shall inhibit block-level processes, such as system-level operations, mining rewards, and withdrawals ([#652](https://github.com/ethereum/execution-spec-tests/pull/652)).

### 📋 Misc

- 🐞 Fix CI by using Golang 1.21 in Github Actions to build geth ([#484](https://github.com/ethereum/execution-spec-tests/pull/484)).
Expand Down
1 change: 1 addition & 0 deletions src/ethereum_test_specs/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def make_state_test_fixture(
fork = fork.fork_at(self.env.number, self.env.timestamp)

env = self.env.set_fork_requirements(fork)
env.is_state_test = True
tx = self.tx.with_signature_and_sender(keep_secret_key=True)
pre_alloc = Alloc.merge(
Alloc.model_validate(fork.pre_allocation()),
Expand Down
2 changes: 2 additions & 0 deletions src/ethereum_test_types/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ def test_account_merge(
"parentUncleHash": (
"0x0000000000000000000000000000000000000000000000000000000000000000"
),
"isStateTest": False,
},
id="environment_1",
),
Expand Down Expand Up @@ -577,6 +578,7 @@ def test_account_merge(
},
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000004",
"ommers": [],
"isStateTest": False,
},
id="environment_2",
),
Expand Down
2 changes: 2 additions & 0 deletions src/ethereum_test_types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ class Environment(EnvironmentGeneric[Number]):
withdrawals: List[Withdrawal] | None = Field(None)
extra_data: Bytes = Field(Bytes(b"\x00"), exclude=True)

is_state_test: bool = Field(False)

@computed_field # type: ignore[misc]
@cached_property
def parent_hash(self) -> Hash | None:
Expand Down