Skip to content
Merged
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
8 changes: 7 additions & 1 deletion packages/testing/src/execution_testing/specs/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,11 @@ def get_fixture_engine_new_payload(self) -> FixtureEngineNewPayload:
if self.block_access_list
else None,
inclusion_list_transactions=self.inclusion_list_txs,
inclusion_list_satisfied=self.inclusion_list_satisfied,
inclusion_list_satisfied=(
self.inclusion_list_satisfied
if self.expected_exception is None
else None
),
execution_payload_modifier=self.engine_payload_modifier(),
validation_error=self.expected_exception,
error_code=self.engine_api_error_code,
Expand Down Expand Up @@ -1396,6 +1400,8 @@ def make_hive_fixture(
block.expected_inclusion_list_satisfied = False
if block.header_verify:
block.header_verify = None
if block.rlp_modifier:
block.rlp_modifier = None
if block.expected_gas_used:
block.expected_gas_used = None
if block.expected_block_access_list:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""Regression tests for Engine API inclusion-list payload metadata."""

from typing import Any

import pytest

from execution_testing.fixtures.blockchain import FixtureEngineNewPayload

from ..blockchain import BuiltBlock


@pytest.mark.parametrize(
"validation_error,inclusion_list_satisfied,expected",
[
pytest.param(None, True, True, id="valid-satisfied"),
pytest.param(None, False, False, id="valid-unsatisfied"),
pytest.param(object(), True, None, id="invalid-satisfied"),
pytest.param(object(), False, None, id="invalid-unsatisfied"),
],
)
def test_inclusion_list_result_only_emitted_for_valid_payloads(
monkeypatch: pytest.MonkeyPatch,
validation_error: object | None,
inclusion_list_satisfied: bool,
expected: bool | None,
) -> None:
"""Invalid payload fixtures must carry a null inclusion-list result."""
captured: dict[str, Any] = {}
sentinel = object()

def capture(**kwargs: Any) -> object:
captured.update(kwargs)
return sentinel

monkeypatch.setattr(
FixtureEngineNewPayload,
"from_fixture_header",
staticmethod(capture),
)

# `model_construct` skips validation and
# `get_fixture_engine_new_payload` only forwards these fields, so the
# sentinels never need to satisfy the model's field types. Splat them
# from an untyped dict so the type checker does not require them to.
fields: dict[str, Any] = dict(
fork=object(),
header=object(),
txs=[],
withdrawals=None,
requests=None,
block_access_list=None,
inclusion_list_txs=None,
inclusion_list_satisfied=inclusion_list_satisfied,
expected_exception=validation_error,
engine_api_error_code=None,
rlp_modifier=None,
engine_new_payload_block_access_list=None,
engine_new_payload_slot_number=None,
)
block = BuiltBlock.model_construct(**fields)

assert block.get_fixture_engine_new_payload() is sentinel
assert captured["inclusion_list_satisfied"] is expected
13 changes: 10 additions & 3 deletions tests/frontier/validation/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,28 @@ def test_tx_gas_limit(
"""
Tests that if a tx gas limit is higher than the block gas limit,
an exception is raised.

The block gas limit is kept well above what an empty block's access
list needs under the EIP-7928 item cap (`gas_limit // 2000` items,
against the system-contract reads every Amsterdam block carries), so
the transaction's gas allowance is the only thing wrong with the
block and clients do not disagree on which check to report.
"""
sender = pre.fund_eoa()
to = pre.fund_eoa()

block_gas_limit = 100_000
tx = Transaction(
gas_limit=21001,
gas_limit=block_gas_limit + 1,
to=to,
gas_price=0x10, # Must be >= base fee to isolate gas limit validation
sender=sender,
protected=False,
error=TransactionException.GAS_ALLOWANCE_EXCEEDED,
)

modified_fields = {"gas_limit": ZeroPaddedHexNumber(21000)}
env.gas_limit = ZeroPaddedHexNumber(21000)
modified_fields = {"gas_limit": ZeroPaddedHexNumber(block_gas_limit)}
env.gas_limit = ZeroPaddedHexNumber(block_gas_limit)

block = Block(
txs=[tx],
Expand Down
Loading