Skip to content

Commit 7f2be17

Browse files
feat(fill,zkevm): suppress high tx gas limit warnings for zkevm tests (#1598)
* refactor(spec): rename `is_slow_test()` to `is_tx_gas_heavy_test()` This updates the terminology to better reflect that we're identifying tests with transactions that consume a lot of gas rather than focusing on execution time. * feat(spec): prevent zkevm tests from raising tx gas limit warnings * docs: update changelog --------- Co-authored-by: Mario Vega <marioevz@gmail.com>
1 parent 4e35d0f commit 7f2be17

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Test fixtures for use by clients are available for each release on the [Github r
1313
#### `fill`
1414

1515
- 🔀 Refactor: Encapsulate `fill`'s fixture output options (`--output`, `--flat-output`, `--single-fixture-per-file`) into a `FixtureOutput` class ([#1471](https://github.com/ethereum/execution-spec-tests/pull/1471)).
16+
- ✨ Don't warn about a "high Transaction gas_limit" for `zkevm` tests ([#1598](https://github.com/ethereum/execution-spec-tests/pull/1598)).
1617

1718
#### `consume`
1819

src/ethereum_test_specs/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,13 @@ def get_next_transition_tool_output_path(self) -> str:
139139
str(current_value),
140140
)
141141

142-
def is_slow_test(self) -> bool:
143-
"""Check if the test is slow."""
142+
def is_tx_gas_heavy_test(self) -> bool:
143+
"""Check if the test is gas-heavy for transaction execution."""
144144
if self._request is not None and hasattr(self._request, "node"):
145-
return self._request.node.get_closest_marker("slow") is not None
145+
node = self._request.node
146+
has_slow_marker = node.get_closest_marker("slow") is not None
147+
has_zkevm_marker = node.get_closest_marker("zkevm") is not None
148+
return has_slow_marker or has_zkevm_marker
146149
return False
147150

148151
def is_exception_test(self) -> bool | None:

src/ethereum_test_specs/blockchain.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ def generate_block_data(
402402
previous_env: Environment,
403403
previous_alloc: Alloc,
404404
eips: Optional[List[int]] = None,
405-
slow: bool = False,
406405
) -> Tuple[FixtureHeader, List[Transaction], List[Bytes] | None, Alloc, Environment]:
407406
"""Generate common block data for both make_fixture and make_hive_fixture."""
408407
if block.rlp and block.exception is not None:
@@ -417,7 +416,7 @@ def generate_block_data(
417416

418417
txs: List[Transaction] = []
419418
for tx in block.txs:
420-
if not self.is_slow_test() and tx.gas_limit >= Environment().gas_limit:
419+
if not self.is_tx_gas_heavy_test() and tx.gas_limit >= Environment().gas_limit:
421420
warnings.warn(
422421
f"{self.node_id()} uses a high Transaction gas_limit: {tx.gas_limit}",
423422
stacklevel=2,
@@ -446,7 +445,7 @@ def generate_block_data(
446445
blob_schedule=fork.blob_schedule(),
447446
eips=eips,
448447
debug_output_path=self.get_next_transition_tool_output_path(),
449-
slow_request=slow,
448+
slow_request=self.is_tx_gas_heavy_test(),
450449
)
451450

452451
try:
@@ -598,7 +597,6 @@ def make_fixture(
598597
previous_env=env,
599598
previous_alloc=alloc,
600599
eips=eips,
601-
slow=self.is_slow_test(),
602600
)
603601
fixture_block = FixtureBlockBase(
604602
header=header,
@@ -687,7 +685,6 @@ def make_hive_fixture(
687685
previous_env=env,
688686
previous_alloc=alloc,
689687
eips=eips,
690-
slow=self.is_slow_test(),
691688
)
692689
if block.rlp is None:
693690
fixture_payloads.append(

src/ethereum_test_specs/state.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def make_state_test_fixture(
170170

171171
env = self.env.set_fork_requirements(fork)
172172
tx = self.tx.with_signature_and_sender(keep_secret_key=True)
173-
if not self.is_slow_test() and tx.gas_limit >= Environment().gas_limit:
173+
if not self.is_tx_gas_heavy_test() and tx.gas_limit >= Environment().gas_limit:
174174
warnings.warn(
175175
f"{self.node_id()} uses a high Transaction gas_limit: {tx.gas_limit}",
176176
stacklevel=2,
@@ -193,7 +193,7 @@ def make_state_test_fixture(
193193
eips=eips,
194194
debug_output_path=self.get_next_transition_tool_output_path(),
195195
state_test=True,
196-
slow_request=self.is_slow_test(),
196+
slow_request=self.is_tx_gas_heavy_test(),
197197
)
198198

199199
try:

0 commit comments

Comments
 (0)