Skip to content

Commit c5934d6

Browse files
marioevzfselmo
authored andcommitted
feat(cli,specs): EIP-7691: Pass blob schedule to t8n
1 parent d492229 commit c5934d6

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

src/ethereum_clis/clis/besu.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import requests
1313

14+
from ethereum_test_base_types import BlobSchedule
1415
from ethereum_test_exceptions import (
1516
EOFException,
1617
ExceptionMapper,
@@ -101,8 +102,9 @@ def evaluate(
101102
txs: List[Transaction],
102103
env: Environment,
103104
fork: Fork,
104-
chain_id: int = 1,
105-
reward: int = 0,
105+
chain_id: int,
106+
reward: int,
107+
blob_schedule: BlobSchedule | None = None,
106108
eips: Optional[List[int]] = None,
107109
debug_output_path: str = "",
108110
state_test: bool = False,

src/ethereum_clis/tests/test_execution_specs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def test_evm_t8n(
176176
txs=txs,
177177
env=env,
178178
fork=Berlin,
179+
chain_id=1,
180+
reward=0,
181+
blob_schedule=Berlin.blob_schedule(),
179182
)
180183
assert to_json(t8n_output.alloc) == expected.get("alloc")
181184
if isinstance(t8n, ExecutionSpecsTransitionTool):

src/ethereum_clis/transition_tool.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import textwrap
99
import time
1010
from abc import abstractmethod
11-
from dataclasses import dataclass, field
11+
from dataclasses import dataclass
1212
from pathlib import Path
1313
from typing import Any, Dict, List, Mapping, Optional, Type
1414
from urllib.parse import urlencode
@@ -17,6 +17,7 @@
1717
from requests.exceptions import ConnectionError as RequestsConnectionError
1818
from requests_unixsocket import Session # type: ignore
1919

20+
from ethereum_test_base_types import BlobSchedule
2021
from ethereum_test_exceptions import ExceptionMapper
2122
from ethereum_test_fixtures import FixtureFormat, FixtureVerifier
2223
from ethereum_test_forks import Fork
@@ -136,9 +137,10 @@ class TransitionToolData:
136137
txs: List[Transaction]
137138
env: Environment
138139
fork_name: str
139-
chain_id: int = field(default=1)
140-
reward: int = field(default=0)
141-
state_test: bool = field(default=False)
140+
chain_id: int
141+
reward: int
142+
blob_schedule: BlobSchedule | None
143+
state_test: bool
142144

143145
def to_input(self) -> TransitionToolInput:
144146
"""Convert the data to a TransactionToolInput object."""
@@ -155,6 +157,7 @@ def get_request_data(self) -> TransitionToolRequest:
155157
fork=self.fork_name,
156158
chain_id=self.chain_id,
157159
reward=self.reward,
160+
blob_schedule=self.blob_schedule,
158161
),
159162
input=self.to_input(),
160163
)
@@ -474,8 +477,9 @@ def evaluate(
474477
txs: List[Transaction],
475478
env: Environment,
476479
fork: Fork,
477-
chain_id: int = 1,
478-
reward: int = 0,
480+
chain_id: int,
481+
reward: int,
482+
blob_schedule: BlobSchedule | None,
479483
eips: Optional[List[int]] = None,
480484
debug_output_path: str = "",
481485
state_test: bool = False,
@@ -502,6 +506,7 @@ def evaluate(
502506
fork_name=fork_name,
503507
chain_id=chain_id,
504508
reward=reward,
509+
blob_schedule=blob_schedule,
505510
state_test=state_test,
506511
)
507512

src/ethereum_clis/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pydantic import Field
66

7-
from ethereum_test_base_types import Bloom, Bytes, CamelModel, Hash, HexNumber
7+
from ethereum_test_base_types import BlobSchedule, Bloom, Bytes, CamelModel, Hash, HexNumber
88
from ethereum_test_types import Alloc, Environment, Transaction, TransactionReceipt
99

1010

@@ -60,6 +60,7 @@ class TransitionToolContext(CamelModel):
6060
fork: str
6161
chain_id: int = Field(..., alias="chainid")
6262
reward: int
63+
blob_schedule: BlobSchedule | None
6364

6465

6566
class TransitionToolRequest(CamelModel):

src/ethereum_test_specs/blockchain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ def generate_block_data(
391391
fork=fork,
392392
chain_id=self.chain_id,
393393
reward=fork.get_reward(env.number, env.timestamp),
394+
blob_schedule=fork.blob_schedule(),
394395
eips=eips,
395396
debug_output_path=self.get_next_transition_tool_output_path(),
396397
slow_request=slow,

src/ethereum_test_specs/state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def make_state_test_fixture(
136136
fork=fork,
137137
chain_id=self.chain_id,
138138
reward=0, # Reward on state tests is always zero
139+
blob_schedule=fork.blob_schedule(),
139140
eips=eips,
140141
debug_output_path=self.get_next_transition_tool_output_path(),
141142
state_test=True,

0 commit comments

Comments
 (0)