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
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Users can select any of the artifacts depending on their testing needs for their
- ✨ Add a `pytest.mark.with_all_typed_transactions` marker that creates default typed transactions for each `tx_type` supported by the current `fork` ([#1890](https://github.com/ethereum/execution-spec-tests/pull/1890)).
- ✨ Add basic support for ``Amsterdam`` fork in order to begin testing Glamsterdam ([#2069](https://github.com/ethereum/execution-spec-tests/pull/2069)).
- ✨ [EIP-7928](https://eips.ethereum.org/EIPS/eip-7928): Add initial framework support for `Block Level Access Lists (BAL)` testing for Amsterdam ([#2067](https://github.com/ethereum/execution-spec-tests/pull/2067)).
- πŸ”€ Restrict extra args from being passed to ``BaseTest`` implementations (e.g. ``BlockchainTest``) ([#2102](https://github.com/ethereum/execution-spec-tests/pull/2102)).

### πŸ§ͺ Test Cases

Expand All @@ -162,6 +163,7 @@ Users can select any of the artifacts depending on their testing needs for their
- πŸ”€ Adds the max blob transaction limit to the tests including updates to [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) for Osaka ([#1884](https://github.com/ethereum/execution-spec-tests/pull/1884)).
- 🐞 Fix issues when filling block rlp size limit tests with ``--generate-pre-alloc-groups`` ([#1989](https://github.com/ethereum/execution-spec-tests/pull/1989)).
- ✨ [EIP-7928](https://eips.ethereum.org/EIPS/eip-7928): Add test cases for `Block Level Access Lists (BAL)` to Amsterdam ([#2067](https://github.com/ethereum/execution-spec-tests/pull/2067)).
- 🐞 Fix valid BAL cases to pass the expected block access list via each block, not the blockchain test itself ([2102](https://github.com/ethereum/execution-spec-tests/pull/2102)).

## [v4.5.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v4.5.0) - 2025-05-14

Expand Down
4 changes: 3 additions & 1 deletion src/ethereum_test_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Callable, ClassVar, Dict, Generator, List, Sequence, Type

import pytest
from pydantic import BaseModel, Field, PrivateAttr
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
from typing_extensions import Self

from ethereum_clis import Result, TransitionTool
Expand Down Expand Up @@ -61,6 +61,8 @@ class OpMode(StrEnum):
class BaseTest(BaseModel):
"""Represents a base Ethereum test which must return a single test fixture."""

model_config = ConfigDict(extra="forbid")

tag: str = ""

_request: pytest.FixtureRequest | None = PrivateAttr(None)
Expand Down
4 changes: 0 additions & 4 deletions src/ethereum_test_specs/tests/test_expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,6 @@ def test_block_intermediate_state(
with pytest.raises(expected_exception) as _:
BlockchainTest(
genesis_environment=env,
fork=fork,
t8n=default_t8n,
pre=pre,
post=block_3.expected_post_state,
blocks=[block_1, block_2, block_3],
Expand All @@ -428,8 +426,6 @@ def test_block_intermediate_state(
else:
BlockchainTest(
genesis_environment=env,
fork=fork,
t8n=default_t8n,
pre=pre,
post=block_3.expected_post_state,
blocks=[block_1, block_2, block_3],
Expand Down
5 changes: 4 additions & 1 deletion src/pytest_plugins/filler/tests/test_prealloc_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class MockTest(BaseTest):

def __init__(self, pre: Alloc, genesis_environment: Environment, request=None):
"""Initialize mock test."""
super().__init__(pre=pre, genesis_environment=genesis_environment)
super().__init__( # type: ignore
pre=pre,
genesis_environment=genesis_environment,
)
self._request = request

def generate(self, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ def test_bal_nonce_changes(
value=100,
)

block = Block(txs=[tx])
block = Block(
txs=[tx],
expected_block_access_list=BlockAccessListExpectation(
account_expectations={
alice: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
}
),
)

blockchain_test(
pre=pre,
Expand All @@ -52,13 +61,6 @@ def test_bal_nonce_changes(
alice: Account(nonce=1),
bob: Account(balance=100),
},
expected_block_access_list=BlockAccessListExpectation(
account_expectations={
alice: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
}
),
)


Expand Down Expand Up @@ -88,21 +90,15 @@ def test_bal_balance_changes(
gas_price=1_000_000_000,
)

block = Block(txs=[tx])
alice_account = pre[alice]
assert alice_account is not None, "Alice account should exist"
alice_initial_balance = alice_account.balance

# Account for both the value sent and gas cost (gas_price * gas_used)
alice_final_balance = alice_initial_balance - 100 - (intrinsic_gas_cost * 1_000_000_000)

blockchain_test(
pre=pre,
blocks=[block],
post={
alice: Account(nonce=1, balance=alice_final_balance),
bob: Account(balance=100),
},
block = Block(
txs=[tx],
expected_block_access_list=BlockAccessListExpectation(
account_expectations={
alice: BalAccountExpectation(
Expand All @@ -118,6 +114,15 @@ def test_bal_balance_changes(
),
)

blockchain_test(
pre=pre,
blocks=[block],
post={
alice: Account(nonce=1, balance=alice_final_balance),
bob: Account(balance=100),
},
)


@pytest.mark.valid_from("Amsterdam")
def test_bal_storage_writes(
Expand All @@ -139,15 +144,8 @@ def test_bal_storage_writes(
gas_limit=100000,
)

block = Block(txs=[tx])

blockchain_test(
pre=pre,
blocks=[block],
post={
alice: Account(nonce=1),
storage_contract: Account(storage={0x01: 0x42}),
},
block = Block(
txs=[tx],
expected_block_access_list=BlockAccessListExpectation(
account_expectations={
storage_contract: BalAccountExpectation(
Expand All @@ -162,6 +160,15 @@ def test_bal_storage_writes(
),
)

blockchain_test(
pre=pre,
blocks=[block],
post={
alice: Account(nonce=1),
storage_contract: Account(storage={0x01: 0x42}),
},
)


@pytest.mark.valid_from("Amsterdam")
def test_bal_storage_reads(
Expand All @@ -181,7 +188,16 @@ def test_bal_storage_reads(
gas_limit=100000,
)

block = Block(txs=[tx])
block = Block(
txs=[tx],
expected_block_access_list=BlockAccessListExpectation(
account_expectations={
storage_contract: BalAccountExpectation(
storage_reads=[0x01],
),
}
),
)

blockchain_test(
pre=pre,
Expand All @@ -190,13 +206,6 @@ def test_bal_storage_reads(
alice: Account(nonce=1),
storage_contract: Account(storage={0x01: 0x42}),
},
expected_block_access_list=BlockAccessListExpectation(
account_expectations={
storage_contract: BalAccountExpectation(
storage_reads=[0x01],
),
}
),
)


Expand Down Expand Up @@ -244,21 +253,10 @@ def test_bal_code_changes(
gas_limit=500000,
)

block = Block(txs=[tx])

created_contract = compute_create_address(address=factory_contract, nonce=1)

blockchain_test(
pre=pre,
blocks=[block],
post={
alice: Account(nonce=1),
factory_contract: Account(nonce=2), # incremented by CREATE to 2
created_contract: Account(
code=runtime_code_bytes,
storage={},
),
},
block = Block(
txs=[tx],
expected_block_access_list=BlockAccessListExpectation(
account_expectations={
alice: BalAccountExpectation(
Expand All @@ -273,3 +271,16 @@ def test_bal_code_changes(
}
),
)

blockchain_test(
pre=pre,
blocks=[block],
post={
alice: Account(nonce=1),
factory_contract: Account(nonce=2), # incremented by CREATE to 2
created_contract: Account(
code=runtime_code_bytes,
storage={},
),
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_tx_gas_larger_than_block_gas_limit(
exception=TransactionException.GAS_ALLOWANCE_EXCEEDED if exceed_block_gas_limit else None,
)

blockchain_test(env=env, pre=pre, post={}, blocks=[block])
blockchain_test(pre=pre, post={}, blocks=[block])


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ def test_invalid_history_contract_calls(
pre=pre,
blocks=blocks,
post=post,
reverts=reverts,
)


Expand Down Expand Up @@ -490,5 +489,4 @@ def test_invalid_history_contract_calls_input_size(
pre=pre,
blocks=blocks,
post=post,
reverts=reverts,
)
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ def test_jumpf_with_inputs_stack_overflow(
def test_jumpf_infinite_loop(eof_state_test: EOFStateTestFiller, container: Container):
"""Tests JUMPF causing an infinite loop."""
eof_state_test(
tx_gas=100_000,
container=container,
container_post=Account(storage={slot_code_worked: 0}),
)
Expand Down
Loading