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: 1 addition & 1 deletion .github/configs/eels_resolutions.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
"Amsterdam": {
"git_url": "https://github.com/fselmo/execution-specs.git",
"branch": "feat/amsterdam-fork-and-block-access-lists",
"commit": "a5c7b29a658320c2432de78883d350e9f4444d14"
"commit": "39e0b59613be4100d2efc86702ff594c54e5bd81"
}
}
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ Users can select any of the artifacts depending on their benchmarking or testing
- 🔀 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 issues with `Block Level Access Lists (BAL)` tests for Amsterdam ([#2121](https://github.com/ethereum/execution-spec-tests/pull/2121)).

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

Expand Down
2 changes: 1 addition & 1 deletion src/ethereum_test_specs/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def generate_block_data(
and not block.skip_exception_verification
and not (
block.expected_block_access_list is not None
and block.expected_block_access_list.modifier is not None
and block.expected_block_access_list._modifier is not None
)
):
# Only verify block level exception if:
Expand Down
16 changes: 7 additions & 9 deletions src/ethereum_test_types/block_access_list/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any, Callable, ClassVar, Dict, List

import ethereum_rlp as eth_rlp
from pydantic import Field
from pydantic import Field, PrivateAttr

from ethereum_test_base_types import (
Address,
Expand Down Expand Up @@ -197,15 +197,13 @@ class BlockAccessListExpectation(CamelModel):

"""

model_config = CamelModel.model_config | {"extra": "forbid"}

account_expectations: Dict[Address, BalAccountExpectation | None] = Field(
default_factory=dict, description="Expected account changes or exclusions to verify"
)

modifier: Callable[["BlockAccessList"], "BlockAccessList"] | None = Field(
None,
exclude=True,
description="Optional modifier to modify the BAL for invalid tests",
)
_modifier: Callable[["BlockAccessList"], "BlockAccessList"] | None = PrivateAttr(default=None)

def modify(
self, *modifiers: Callable[["BlockAccessList"], "BlockAccessList"]
Expand All @@ -228,7 +226,7 @@ def modify(

"""
new_instance = self.model_copy(deep=True)
new_instance.modifier = compose(*modifiers)
new_instance._modifier = compose(*modifiers)
return new_instance

def to_fixture_bal(self, t8n_bal: "BlockAccessList") -> "BlockAccessList":
Expand All @@ -249,8 +247,8 @@ def to_fixture_bal(self, t8n_bal: "BlockAccessList") -> "BlockAccessList":
self.verify_against(t8n_bal)

# Apply modifier if present (for invalid tests)
if self.modifier:
return self.modifier(t8n_bal)
if self._modifier:
return self._modifier(t8n_bal)

return t8n_bal

Expand Down
2 changes: 1 addition & 1 deletion src/pytest_plugins/eels_resolutions.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
"Amsterdam": {
"git_url": "https://github.com/fselmo/execution-specs.git",
"branch": "feat/amsterdam-fork-and-block-access-lists",
"commit": "a5c7b29a658320c2432de78883d350e9f4444d14"
"commit": "39e0b59613be4100d2efc86702ff594c54e5bd81"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
)
from ethereum_test_types.block_access_list import (
BalAccountChange,
BalAccountExpectation,
BalBalanceChange,
BalNonceChange,
BalStorageChange,
Expand Down Expand Up @@ -73,12 +74,11 @@ def test_bal_invalid_missing_nonce(
txs=[tx],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=sender,
account_expectations={
sender: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
]
}
).modify(remove_nonces(sender)),
)
],
Expand Down Expand Up @@ -113,12 +113,11 @@ def test_bal_invalid_nonce_value(
txs=[tx],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=sender,
account_expectations={
sender: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
]
}
).modify(modify_nonce(sender, tx_index=1, nonce=42)),
)
],
Expand Down Expand Up @@ -158,9 +157,8 @@ def test_bal_invalid_storage_value(
txs=[tx],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=contract,
account_expectations={
contract: BalAccountExpectation(
storage_changes=[
BalStorageSlot(
slot=0x01,
Expand All @@ -176,7 +174,7 @@ def test_bal_invalid_storage_value(
),
],
),
]
}
).modify(
# Corrupt storage value for slot 0x02
modify_storage(contract, tx_index=1, slot=0x02, value=0xFF)
Expand Down Expand Up @@ -223,23 +221,20 @@ def test_bal_invalid_tx_order(
txs=[tx1, tx2],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=sender1,
account_expectations={
sender1: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
BalAccountChange(
address=sender2,
sender2: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=2, post_nonce=1)],
),
BalAccountChange(
address=receiver,
receiver: BalAccountExpectation(
balance_changes=[
BalBalanceChange(tx_index=1, post_balance=10**15),
BalBalanceChange(tx_index=2, post_balance=3 * 10**15),
],
),
]
}
).modify(swap_tx_indices(1, 2)),
)
],
Expand Down Expand Up @@ -276,12 +271,11 @@ def test_bal_invalid_account(
txs=[tx],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=sender,
account_expectations={
sender: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
]
}
).modify(
append_account(
BalAccountChange(
Expand Down Expand Up @@ -323,16 +317,14 @@ def test_bal_invalid_duplicate_account(
txs=[tx],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=sender,
account_expectations={
sender: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
BalAccountChange(
address=receiver,
receiver: BalAccountExpectation(
balance_changes=[BalBalanceChange(tx_index=1, post_balance=10**15)],
),
]
}
).modify(duplicate_account(sender)),
)
],
Expand Down Expand Up @@ -367,16 +359,14 @@ def test_bal_invalid_account_order(
txs=[tx],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=sender,
account_expectations={
sender: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
BalAccountChange(
address=receiver,
receiver: BalAccountExpectation(
balance_changes=[BalBalanceChange(tx_index=1, post_balance=10**15)],
),
]
}
).modify(reverse_accounts()),
)
],
Expand Down Expand Up @@ -424,16 +414,14 @@ def test_bal_invalid_complex_corruption(
txs=[tx1, tx2],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=sender,
account_expectations={
sender: BalAccountExpectation(
nonce_changes=[
BalNonceChange(tx_index=1, post_nonce=1),
BalNonceChange(tx_index=2, post_nonce=2),
],
),
BalAccountChange(
address=contract,
contract: BalAccountExpectation(
storage_changes=[
BalStorageSlot(
slot=0x01,
Expand All @@ -445,11 +433,10 @@ def test_bal_invalid_complex_corruption(
),
],
),
BalAccountChange(
address=receiver,
receiver: BalAccountExpectation(
balance_changes=[BalBalanceChange(tx_index=2, post_balance=10**15)],
),
]
}
).modify(
remove_nonces(sender),
modify_storage(contract, tx_index=1, slot=0x01, value=0xFF),
Expand Down Expand Up @@ -489,16 +476,14 @@ def test_bal_invalid_missing_account(
txs=[tx],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=sender,
account_expectations={
sender: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
BalAccountChange(
address=receiver,
receiver: BalAccountExpectation(
balance_changes=[BalBalanceChange(tx_index=1, post_balance=10**15)],
),
]
}
).modify(remove_accounts(receiver)),
)
],
Expand Down Expand Up @@ -533,12 +518,11 @@ def test_bal_invalid_balance_value(
txs=[tx],
exception=BlockException.INCORRECT_BLOCK_FORMAT,
expected_block_access_list=BlockAccessListExpectation(
account_changes=[
BalAccountChange(
address=receiver,
account_expectations={
receiver: BalAccountExpectation(
balance_changes=[BalBalanceChange(tx_index=1, post_balance=10**15)],
),
]
}
).modify(modify_balance(receiver, tx_index=1, balance=999999)),
)
],
Expand Down
Loading