Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0b20f5b
feat(specs, tests): implement EIP-8037 state creation gas cost increa…
spencer-tb Feb 28, 2026
20aba9a
chore(specs, tests): restore spilled state gas to reservoir on revert…
spencer-tb Mar 6, 2026
53f3291
feat(tests): add EIP-8037 multi-block and exact coinbase fee tests
spencer-tb Mar 6, 2026
eb9a766
feat(tests): add EIP-8037 gas validation edge cases from #2426
spencer-tb Mar 6, 2026
8aee743
chore(tests): fix tests and make bulletproof
spencer-tb Mar 6, 2026
eebec60
refactor(tests,forks): add state gas calculators and use fork methods
spencer-tb Mar 6, 2026
abb98d3
feat(tests): add new_account variant to insufficient balance CALL test
spencer-tb Mar 6, 2026
f777b26
chore(tests): add valid_until marker to initcode over-limit exception…
spencer-tb Mar 6, 2026
942657e
feat(tests): add max initcode 2D gas metering test
spencer-tb Mar 12, 2026
d5bba7e
fix(tests): resolve gas constant renames and gas limits after rebase
spencer-tb Mar 17, 2026
c783390
fix(tests): prevent `tx_gas_limit` double-accumulation across fixture…
felix314159 Mar 20, 2026
9863f8e
feat(specs,tests): EIP-8037 state gas ordering and clarifications (#2…
spencer-tb Mar 28, 2026
be8a362
fix(specs, tests): remove per-tx state gas pre-check and add 2D block…
spencer-tb Mar 28, 2026
bfc6409
fix(ported-tests): bump gas limits for Amsterdam (EIP-8037 state gas)
spencer-tb Mar 31, 2026
53c5bb8
fix(spec,tests): code deposit ordering and regression tests
spencer-tb Mar 10, 2026
f2f2b91
fix(spec): track collision-burned gas in regular_gas_used
spencer-tb Mar 10, 2026
497a21e
feat(tests): update state gas creation tests with max_code_size case …
spencer-tb Mar 11, 2026
b757b62
chore(tests): remove obsolete static test skip list
spencer-tb Mar 31, 2026
8d16a3c
fix(execute): use configurable gas limit for funding txs (EIP-8037) (…
qu0b Apr 1, 2026
b21f226
chore(lint): fix import sorting and stale type annotation for static …
spencer-tb Apr 1, 2026
93cebd7
feat(tests): EIP-8037 - code deposit halt must discard initcode state…
qu0b Apr 1, 2026
8f3c9b5
feat(tests): EIP-8037 blockchain header gas_used tests (#2611)
spencer-tb Apr 1, 2026
d240849
feat(tests): block-level 2D gas accounting tests for EIP-8037 (#2610)
qu0b Apr 1, 2026
9865070
feat(spec-specs): EIP-8037 - move CREATE state gas charge after initc…
spencer-tb Apr 2, 2026
76bdac4
refactor(tests-eip8037): Condition tests to EIP inclusion
marioevz Apr 9, 2026
ddfeecf
feat(test-forks): Add EIP-8037 to Amsterdam
marioevz Apr 9, 2026
9f01b3c
fix(tests): Use `pytest.mark.valid_before` for EIP-8037
marioevz Apr 9, 2026
9755dba
fix(specs-amsterdam): Lint fails
marioevz Apr 10, 2026
123ba4a
feat(specs): EIP-8037 diff-at-call-return state gas charging
spencer-tb Apr 15, 2026
422e17e
fix(tests): update tests for diff-at-call-return model
spencer-tb Apr 15, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def deploy_deterministic_factory_contract(
fund_tx = Transaction(
to=deploy_tx_sender,
value=fund_amount,
gas_limit=200_000,
gas_price=gas_price,
sender=seed_key,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_recover_funds(
del index

remaining_balance = eth_rpc.get_balance(eoa)
refund_gas_limit = 21_000
refund_gas_limit = 200_000
tx_cost = refund_gas_limit * gas_price
if remaining_balance < tx_cost:
pytest.skip(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def __init__(
address_stubs: AddressStubs | None = None,
block_number: int = 0,
timestamp: int = 0,
funding_gas_limit: int = 200_000,
**kwargs: Any,
) -> None:
"""Initialize the pre-alloc with the given parameters."""
Expand All @@ -260,6 +261,7 @@ def __init__(
self._address_stubs = address_stubs or AddressStubs(root={})
self._block_number = block_number
self._timestamp = timestamp
self._funding_gas_limit = funding_gas_limit

def code_pre_processor(self, code: Bytecode) -> Bytecode:
"""Pre-processes the code before setting it."""
Expand Down Expand Up @@ -638,6 +640,7 @@ def _fund_eoa(
target=label,
to=eoa,
value=amount,
gas_limit=self._funding_gas_limit,
)

if fund_tx is not None:
Expand Down Expand Up @@ -855,6 +858,7 @@ def _resolve_fund_addresses(self) -> None:
target=d.address.label,
to=d.address,
value=d.amount - current_balance,
gas_limit=self._funding_gas_limit,
)
new_balance = d.amount
else:
Expand All @@ -869,6 +873,7 @@ def _resolve_fund_addresses(self) -> None:
target=d.address.label,
to=d.address,
value=d.amount,
gas_limit=self._funding_gas_limit,
)
new_balance = current_balance + d.amount

Expand Down Expand Up @@ -977,6 +982,7 @@ def pre(
max_fee_per_gas: int,
max_priority_fee_per_gas: int,
dry_run: bool,
sender_fund_refund_gas_limit: int,
request: pytest.FixtureRequest,
) -> Generator[Alloc, None, None]:
"""Return default pre allocation for all tests (Empty alloc)."""
Expand All @@ -1000,6 +1006,7 @@ def pre(
chain_id=chain_config.chain_id,
node_id=request.node.nodeid,
address_stubs=address_stubs,
funding_gas_limit=sender_fund_refund_gas_limit,
)

# Yield the pre-alloc for usage during the test
Expand All @@ -1025,7 +1032,7 @@ def pre(
# Build refund transactions
refund_txs: List[Transaction] = []
skipped_refunds = 0
refund_gas_limit = 21_000
refund_gas_limit = sender_fund_refund_gas_limit
tx_cost = refund_gas_limit * max_fee_per_gas
for idx, eoa in enumerate(funded_eoas):
account = eth_rpc.get_account(eoa, skip_code=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store",
dest="sender_fund_refund_gas_limit",
type=Wei,
default=21_000,
default=200_000,
help=(
"Gas limit set for the funding transactions of each worker's sender key." # noqa: E501
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,44 @@ def pytest_html_results_table_row(report: Any, cells: Any) -> None:
del cells[-1] # Remove the "Links" column


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_setup(item: Any) -> Generator[None, None, None]:
"""
Snapshot parametrize values before fixture setup to detect unintended
mutations of shared pytest parameter objects across fixture format runs.
"""
if hasattr(item, "callspec"):
item._param_repr_snapshot = {
key: repr(value) for key, value in item.callspec.params.items()
}
yield


def pytest_runtest_teardown(item: Any) -> None:
"""
Compare parametrize values after test teardown to the pre-setup snapshot.

Warn if any fixture mutated shared parameter objects — these mutations
persist across fixture format runs and can cause subtle bugs (e.g.
block hash mismatches between blockchain_test and blockchain_engine_test).
"""
snapshot = getattr(item, "_param_repr_snapshot", None)
if snapshot is None:
return
for key, original_repr in snapshot.items():
current_repr = repr(item.callspec.params[key])
if current_repr != original_repr:
warnings.warn(
f"Shared pytest parameter '{key}' was mutated during "
f"test '{item.nodeid}'. Mutations on parametrize values "
f"persist across fixture format runs and can cause "
f"divergent test results. Avoid mutating these objects "
f"in fixtures; compute derived values locally instead.",
stacklevel=1,
)
del item._param_repr_snapshot


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(
item: Any, call: Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def type_4_default_transaction(sender: EOA, pre: Alloc) -> Transaction:
sender=sender,
max_fee_per_gas=10**10,
max_priority_fee_per_gas=10**9,
gas_limit=150_000,
gas_limit=500_000,
data=b"\x00" * 200,
access_list=[
AccessList(address=0x4567, storage_keys=[1000, 2000, 3000]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class TransactionTraces(CamelModel):
traces: List[TraceLine]
output: str | None = None
gas_used: HexNumber | None = None
error: str | None = None

@classmethod
def from_file(cls, trace_file_path: Path) -> Self:
Expand Down
36 changes: 36 additions & 0 deletions packages/testing/src/execution_testing/forks/base_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,14 @@ def base_fee_change_calculator(cls) -> BaseFeeChangeCalculator:
"""
pass

@classmethod
@abstractmethod
def cost_per_state_byte(cls, gas_limit: int = 0) -> int:
"""
Calculate the state gas cost per byte based on the block gas limit.
"""
pass

# Fee helpers
@classmethod
@abstractmethod
Expand Down Expand Up @@ -620,6 +628,16 @@ def transaction_intrinsic_cost_calculator(
"""
pass

@classmethod
def transaction_intrinsic_state_gas(
cls,
*,
contract_creation: bool = False, # noqa: ARG003
authorization_count: int = 0, # noqa: ARG003
) -> int:
"""Return intrinsic state gas (zero pre-Amsterdam)."""
return 0

@classmethod
@abstractmethod
def blob_gas_price_calculator(cls) -> BlobGasPriceCalculator:
Expand Down Expand Up @@ -755,6 +773,24 @@ def transaction_gas_limit_cap(cls) -> int | None:
"""
pass

@classmethod
@abstractmethod
def sstore_state_gas(cls) -> int:
"""Return state gas for a zero-to-nonzero SSTORE."""
pass

@classmethod
@abstractmethod
def code_deposit_state_gas(cls, *, code_size: int) -> int:
"""Return state gas for code deposit of the given size."""
pass

@classmethod
@abstractmethod
def create_state_gas(cls, *, code_size: int = 0) -> int:
"""Return total state gas for CREATE."""
pass

@classmethod
@abstractmethod
def block_rlp_size_limit(cls) -> int | None:
Expand Down
Loading
Loading