Skip to content

Commit 113ff32

Browse files
committed
fix(fill): pass resolved blobParams and non-bpo fork to t8n
1 parent 9819f88 commit 113ff32

File tree

5 files changed

+45
-18
lines changed

5 files changed

+45
-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,
@@ -249,21 +249,13 @@ class TransitionToolInput(CamelModel):
249249
env: Environment
250250

251251

252-
class TransitionToolConfig(CamelModel):
253-
"""Transition tool config."""
254-
255-
fork: Fork = Field(..., alias="network")
256-
chain_id: int = Field(..., alias="chainid")
257-
blob_schedule: BlobSchedule
258-
259-
260252
class TransitionToolCLIInput(CamelModel):
261253
"""Transition tool CLI input."""
262254

263255
alloc: Alloc
264256
txs: List[Transaction]
265257
env: Environment
266-
config: TransitionToolConfig
258+
blob_params: ForkBlobSchedule | None = None
267259

268260

269261
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: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
TransactionReceipt,
3131
TransactionTraces,
3232
TransitionToolCLIInput,
33-
TransitionToolConfig,
3433
TransitionToolContext,
3534
TransitionToolInput,
3635
TransitionToolOutput,
@@ -77,6 +76,7 @@ class TransitionTool(EthereumCLI):
7776
supports_opcode_count: ClassVar[bool] = False
7877

7978
supports_xdist: ClassVar[bool] = True
79+
supports_blob_params: ClassVar[bool] = False
8080

8181
@abstractmethod
8282
def __init__(
@@ -176,6 +176,16 @@ def fork_name(self) -> str:
176176
timestamp=self.env.timestamp,
177177
)
178178

179+
@property
180+
def blob_params(self) -> Any:
181+
"""Return the blob parameters for the current fork."""
182+
if self.blob_schedule:
183+
fork_name = self.fork.fork_at(
184+
block_number=self.env.number, timestamp=self.env.timestamp
185+
).name()
186+
return self.blob_schedule[fork_name]
187+
return None
188+
179189
def __post_init__(self):
180190
"""Modify the reward if the environment number is 0."""
181191
if self.env.number == 0:
@@ -195,11 +205,7 @@ def to_cli_input(self) -> TransitionToolCLIInput:
195205
alloc=self.alloc,
196206
txs=self.txs,
197207
env=self.env,
198-
config=TransitionToolConfig(
199-
blob_schedule=self.blob_schedule or BlobSchedule(),
200-
chain_id=self.chain_id,
201-
network=self.fork,
202-
),
208+
blob_params=self.blob_params,
203209
)
204210

205211
def get_request_data(self) -> TransitionToolRequest:
@@ -252,8 +258,6 @@ def _evaluate_filesystem(
252258
input_paths["env"],
253259
"--input.txs",
254260
input_paths["txs"],
255-
"--input.config",
256-
input_paths["config"],
257261
"--output.basedir",
258262
temp_dir.name,
259263
"--output.result",
@@ -274,6 +278,13 @@ def _evaluate_filesystem(
274278
"opcodes.json",
275279
]
276280
)
281+
if self.supports_blob_params and input_paths.get("blobParams"):
282+
args.extend(
283+
[
284+
"--input.blobParams",
285+
input_paths["blobParams"],
286+
]
287+
)
277288

278289
if self.trace:
279290
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
@@ -1868,6 +1868,18 @@ def blob_base_cost(cls, *, block_number: int = 0, timestamp: int = 0) -> int:
18681868
class BPO1(Osaka, bpo_fork=True):
18691869
"""Mainnet BPO1 fork - Blob Parameter Only fork 1."""
18701870

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

0 commit comments

Comments
 (0)