Skip to content

Commit 5decc1d

Browse files
committed
fix(fill): pass resolved blobParams and non-bpo fork to t8n
1 parent 5ebf6aa commit 5decc1d

File tree

5 files changed

+46
-18
lines changed

5 files changed

+46
-18
lines changed

src/ethereum_clis/cli_types.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
Hash,
1616
HexNumber,
1717
)
18+
from ethereum_test_base_types.composite_types import ForkBlobSchedule
1819
from ethereum_test_exceptions import (
1920
BlockException,
2021
ExceptionMapperValidator,
2122
ExceptionWithMessage,
2223
TransactionException,
2324
UndefinedException,
2425
)
25-
from ethereum_test_forks.helpers import Fork
2626
from ethereum_test_types import (
2727
Alloc,
2828
BlockAccessList,
@@ -262,21 +262,13 @@ class TransitionToolInput(CamelModel):
262262
env: Environment
263263

264264

265-
class TransitionToolConfig(CamelModel):
266-
"""Transition tool config."""
267-
268-
fork: Fork = Field(..., alias="network")
269-
chain_id: int = Field(..., alias="chainid")
270-
blob_schedule: BlobSchedule
271-
272-
273265
class TransitionToolCLIInput(CamelModel):
274266
"""Transition tool CLI input."""
275267

276268
alloc: Alloc
277269
txs: List[Transaction]
278270
env: Environment
279-
config: TransitionToolConfig
271+
blob_params: ForkBlobSchedule | None = None
280272

281273

282274
class TransitionToolOutput(CamelModel):

src/ethereum_clis/clis/evmone.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class EvmOneTransitionTool(TransitionTool):
4040
cached_version: Optional[str] = None
4141
trace: bool
4242
supports_opcode_count: ClassVar[bool] = True
43+
supports_blob_params: ClassVar[bool] = True
4344

4445
def __init__(
4546
self,

src/ethereum_clis/transition_tool.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from requests_unixsocket import Session
2020

2121
from ethereum_test_base_types import BlobSchedule
22+
from ethereum_test_base_types.composite_types import ForkBlobSchedule
2223
from ethereum_test_exceptions import ExceptionMapper
2324
from ethereum_test_forks import Fork
2425
from ethereum_test_forks.helpers import get_development_forks, get_forks
@@ -30,7 +31,6 @@
3031
TransactionReceipt,
3132
TransactionTraces,
3233
TransitionToolCLIInput,
33-
TransitionToolConfig,
3434
TransitionToolContext,
3535
TransitionToolInput,
3636
TransitionToolOutput,
@@ -77,6 +77,7 @@ class TransitionTool(EthereumCLI):
7777
supports_opcode_count: ClassVar[bool] = False
7878

7979
supports_xdist: ClassVar[bool] = True
80+
supports_blob_params: ClassVar[bool] = False
8081

8182
@abstractmethod
8283
def __init__(
@@ -177,6 +178,16 @@ def fork_name(self) -> str:
177178
timestamp=self.env.timestamp,
178179
)
179180

181+
@property
182+
def blob_params(self) -> ForkBlobSchedule | None:
183+
"""Return the blob parameters for the current fork."""
184+
if self.blob_schedule:
185+
fork_name = self.fork.fork_at(
186+
block_number=self.env.number, timestamp=self.env.timestamp
187+
).name()
188+
return self.blob_schedule[fork_name]
189+
return None
190+
180191
def __post_init__(self) -> None:
181192
"""Modify the reward if the environment number is 0."""
182193
if self.env.number == 0:
@@ -196,11 +207,7 @@ def to_cli_input(self) -> TransitionToolCLIInput:
196207
alloc=self.alloc,
197208
txs=self.txs,
198209
env=self.env,
199-
config=TransitionToolConfig(
200-
blob_schedule=self.blob_schedule or BlobSchedule(),
201-
chain_id=self.chain_id,
202-
network=self.fork,
203-
),
210+
blob_params=self.blob_params,
204211
)
205212

206213
def get_request_data(self) -> TransitionToolRequest:
@@ -253,8 +260,6 @@ def _evaluate_filesystem(
253260
input_paths["env"],
254261
"--input.txs",
255262
input_paths["txs"],
256-
"--input.config",
257-
input_paths["config"],
258263
"--output.basedir",
259264
temp_dir.name,
260265
"--output.result",
@@ -275,6 +280,13 @@ def _evaluate_filesystem(
275280
"opcodes.json",
276281
]
277282
)
283+
if self.supports_blob_params and input_paths.get("blobParams"):
284+
args.extend(
285+
[
286+
"--input.blobParams",
287+
input_paths["blobParams"],
288+
]
289+
)
278290

279291
if self.trace:
280292
args.append("--trace")

src/ethereum_test_forks/base_fork.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,17 @@ def parent(cls) -> Type["BaseFork"] | None:
827827
return None
828828
return base_class
829829

830+
@classmethod
831+
def non_bpo_ancestor(cls) -> Type["BaseFork"]:
832+
"""Return the nearest non-BPO ancestor fork."""
833+
ancestor = cls
834+
while ancestor.bpo_fork():
835+
parent = ancestor.parent()
836+
if parent is None:
837+
break
838+
ancestor = parent
839+
return ancestor
840+
830841
@classmethod
831842
def children(cls) -> Set[Type["BaseFork"]]:
832843
"""Return the children forks."""

src/ethereum_test_forks/forks/forks.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,18 @@ def blob_base_cost(cls, *, block_number: int = 0, timestamp: int = 0) -> int:
18701870
class BPO1(Osaka, bpo_fork=True):
18711871
"""Mainnet BPO1 fork - Blob Parameter Only fork 1."""
18721872

1873+
@classmethod
1874+
def transition_tool_name(cls, *, block_number: int = 0, timestamp: int = 0) -> str:
1875+
"""
1876+
Return fork name as it's meant to be passed to the transition tool for
1877+
execution.
1878+
"""
1879+
return (
1880+
cls.fork_at(block_number=block_number, timestamp=timestamp)
1881+
.non_bpo_ancestor()
1882+
.transition_tool_name()
1883+
)
1884+
18731885
@classmethod
18741886
def blob_base_fee_update_fraction(cls, *, block_number: int = 0, timestamp: int = 0) -> int:
18751887
"""Return the blob base fee update fraction for BPO1."""

0 commit comments

Comments
 (0)