Skip to content
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
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ This release additionally includes fixes for tests in hive, as well as new test
- ✨ Added `--watch` flag that monitors test files for changes and automatically re-runs the fill command when developing tests ([#2173](https://github.com/ethereum/execution-spec-tests/pull/2173)).
- 🔀 Upgraded ckzg version to 2.1.3 or newer for correct handling of points at infinity ([#2171](https://github.com/ethereum/execution-spec-tests/pull/2171)).
- 🔀 Move pytest marker registration for `fill` and `execute-*` from their respective ini files to the shared `pytest_plugins.shared.execute_fill` pytest plugin ([#2110](https://github.com/ethereum/execution-spec-tests/pull/2110)).
- ✨ Added an `--input.config` CLI argument to the transition tool (`t8n`) invocation ([#2264](https://github.com/ethereum/execution-spec-tests/pull/2264)).

#### `consume`

Expand Down
10 changes: 10 additions & 0 deletions src/ethereum_clis/cli_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Hash,
HexNumber,
)
from ethereum_test_base_types.composite_types import ForkBlobSchedule
from ethereum_test_exceptions import (
BlockException,
ExceptionMapperValidator,
Expand Down Expand Up @@ -261,6 +262,15 @@ class TransitionToolInput(CamelModel):
env: Environment


class TransitionToolCLIInput(CamelModel):
"""Transition tool CLI input."""

alloc: Alloc
txs: List[Transaction]
env: Environment
blob_params: ForkBlobSchedule | None = None


class TransitionToolOutput(CamelModel):
"""Transition tool output."""

Expand Down
1 change: 1 addition & 0 deletions src/ethereum_clis/clis/evmone.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class EvmOneTransitionTool(TransitionTool):
cached_version: Optional[str] = None
trace: bool
supports_opcode_count: ClassVar[bool] = True
supports_blob_params: ClassVar[bool] = True

def __init__(
self,
Expand Down
31 changes: 30 additions & 1 deletion src/ethereum_clis/transition_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from requests_unixsocket import Session

from ethereum_test_base_types import BlobSchedule
from ethereum_test_base_types.composite_types import ForkBlobSchedule
from ethereum_test_exceptions import ExceptionMapper
from ethereum_test_forks import Fork
from ethereum_test_forks.helpers import get_development_forks, get_forks
Expand All @@ -29,6 +30,7 @@
Traces,
TransactionReceipt,
TransactionTraces,
TransitionToolCLIInput,
TransitionToolContext,
TransitionToolInput,
TransitionToolOutput,
Expand Down Expand Up @@ -75,6 +77,7 @@ class TransitionTool(EthereumCLI):
supports_opcode_count: ClassVar[bool] = False

supports_xdist: ClassVar[bool] = True
supports_blob_params: ClassVar[bool] = False

@abstractmethod
def __init__(
Expand Down Expand Up @@ -175,6 +178,16 @@ def fork_name(self) -> str:
timestamp=self.env.timestamp,
)

@property
def blob_params(self) -> ForkBlobSchedule | None:
"""Return the blob parameters for the current fork."""
if self.blob_schedule:
fork_name = self.fork.fork_at(
block_number=self.env.number, timestamp=self.env.timestamp
).name()
return self.blob_schedule[fork_name]
return None

def __post_init__(self) -> None:
"""Modify the reward if the environment number is 0."""
if self.env.number == 0:
Expand All @@ -188,6 +201,15 @@ def to_input(self) -> TransitionToolInput:
env=self.env,
)

def to_cli_input(self) -> TransitionToolCLIInput:
"""Convert the data to a TransitionToolCLIInput object."""
return TransitionToolCLIInput(
alloc=self.alloc,
txs=self.txs,
env=self.env,
blob_params=self.blob_params,
)

def get_request_data(self) -> TransitionToolRequest:
"""Convert the data to a TransitionToolRequest object."""
return TransitionToolRequest(
Expand All @@ -214,7 +236,7 @@ def _evaluate_filesystem(
os.mkdir(os.path.join(temp_dir.name, "input"))
os.mkdir(os.path.join(temp_dir.name, "output"))

input_contents = t8n_data.to_input().model_dump(mode="json", **model_dump_config)
input_contents = t8n_data.to_cli_input().model_dump(mode="json", **model_dump_config)

input_paths = {
k: os.path.join(temp_dir.name, "input", f"{k}.json") for k in input_contents.keys()
Expand Down Expand Up @@ -258,6 +280,13 @@ def _evaluate_filesystem(
"opcodes.json",
]
)
if self.supports_blob_params and input_paths.get("blobParams"):
args.extend(
[
"--input.blobParams",
input_paths["blobParams"],
]
)

if self.trace:
args.append("--trace")
Expand Down
11 changes: 11 additions & 0 deletions src/ethereum_test_forks/base_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,17 @@ def parent(cls) -> Type["BaseFork"] | None:
return None
return base_class

@classmethod
def non_bpo_ancestor(cls) -> Type["BaseFork"]:
"""Return the nearest non-BPO ancestor fork."""
ancestor = cls
while ancestor.bpo_fork():
parent = ancestor.parent()
if parent is None:
break
ancestor = parent
return ancestor

@classmethod
def children(cls) -> Set[Type["BaseFork"]]:
"""Return the children forks."""
Expand Down
12 changes: 12 additions & 0 deletions src/ethereum_test_forks/forks/forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,18 @@ def blob_base_cost(cls, *, block_number: int = 0, timestamp: int = 0) -> int:
class BPO1(Osaka, bpo_fork=True):
"""Mainnet BPO1 fork - Blob Parameter Only fork 1."""

@classmethod
def transition_tool_name(cls, *, block_number: int = 0, timestamp: int = 0) -> str:
"""
Return fork name as it's meant to be passed to the transition tool for
execution.
"""
return (
cls.fork_at(block_number=block_number, timestamp=timestamp)
.non_bpo_ancestor()
.transition_tool_name()
)

@classmethod
def blob_base_fee_update_fraction(cls, *, block_number: int = 0, timestamp: int = 0) -> int:
"""Return the blob base fee update fraction for BPO1."""
Expand Down
Loading