Skip to content

Commit 8570378

Browse files
committed
feat(bal): Extend BAL support within framework
- Add BAL to engine execution payload as defined in: https://github.com/ethereum/consensus-specs/pull/4526/files#diff-4b950f0c895b4d521c9e8103d638e73a4c7746c6aea51250994425a1efd6f4c8R55 - Add BAL support for state tests to be able to create blockchain tests
1 parent d0eb106 commit 8570378

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/ethereum_test_fixtures/blockchain.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,17 @@ def from_fixture_header(
279279
header: FixtureHeader,
280280
transactions: List[Transaction],
281281
withdrawals: List[Withdrawal] | None,
282+
block_access_list: Bytes | None = None,
282283
) -> "FixtureExecutionPayload":
283284
"""
284285
Return FixtureExecutionPayload from a FixtureHeader, a list
285-
of transactions and a list of withdrawals.
286+
of transactions, a list of withdrawals, and an optional block access list.
286287
"""
287288
return cls(
288289
**header.model_dump(exclude={"rlp"}, exclude_none=True),
289290
transactions=[tx.rlp() for tx in transactions],
290291
withdrawals=withdrawals,
292+
block_access_list=block_access_list,
291293
)
292294

293295

@@ -342,6 +344,7 @@ def from_fixture_header(
342344
transactions: List[Transaction],
343345
withdrawals: List[Withdrawal] | None,
344346
requests: List[Bytes] | None,
347+
block_access_list: Bytes | None = None,
345348
**kwargs,
346349
) -> "FixtureEngineNewPayload":
347350
"""Create `FixtureEngineNewPayload` from a `FixtureHeader`."""
@@ -355,6 +358,7 @@ def from_fixture_header(
355358
header=header,
356359
transactions=transactions,
357360
withdrawals=withdrawals,
361+
block_access_list=block_access_list,
358362
)
359363

360364
params: List[Any] = [execution_payload]

src/ethereum_test_specs/blockchain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ def get_fixture_engine_new_payload(self) -> FixtureEngineNewPayload:
369369
requests=self.requests,
370370
validation_error=self.expected_exception,
371371
error_code=self.engine_api_error_code,
372+
block_access_list=self.block_access_list.rlp if self.block_access_list else None,
372373
)
373374

374375
def verify_transactions(self, transition_tool_exceptions_reliable: bool) -> List[int]:

src/ethereum_test_specs/state.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@
2929
FixtureTransaction,
3030
)
3131
from ethereum_test_forks import Fork
32-
from ethereum_test_types import Alloc, Environment, Transaction
32+
from ethereum_test_types import (
33+
Alloc,
34+
BlockAccessListExpectation,
35+
Environment,
36+
Transaction,
37+
)
3338

3439
from .base import BaseTest, OpMode
3540
from .blockchain import Block, BlockchainTest, Header
@@ -50,6 +55,7 @@ class StateTest(BaseTest):
5055
engine_api_error_code: Optional[EngineAPIError] = None
5156
blockchain_test_header_verify: Optional[Header] = None
5257
blockchain_test_rlp_modifier: Optional[Header] = None
58+
expected_block_access_list: Optional[BlockAccessListExpectation] = None
5359
chain_id: int = 1
5460

5561
supported_fixture_formats: ClassVar[Sequence[FixtureFormat | LabeledFixtureFormat]] = [
@@ -164,6 +170,7 @@ def generate_blockchain_test(self, *, fork: Fork) -> BlockchainTest:
164170
pre=self.pre,
165171
post=self.post,
166172
blocks=self._generate_blockchain_blocks(fork=fork),
173+
expected_block_access_list=self.expected_block_access_list,
167174
)
168175

169176
def make_state_test_fixture(

0 commit comments

Comments
 (0)