Skip to content

test_bal_invalid_missing_system_contract_entry()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_invalid.py::test_bal_invalid_missing_system_contract_entry@622620d8.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_invalid.py::test_bal_invalid_missing_system_contract_entry --fork Amsterdam

Reject a BAL that omits a system contract written by a pre-execution system call, in a block with no transactions.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_invalid.py
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
@pytest.mark.valid_from("Amsterdam")
@pytest.mark.exception_test
@pytest.mark.parametrize(
    "system_contract",
    [
        pytest.param(HISTORY_STORAGE_ADDRESS, id="history_storage"),
        pytest.param(BEACON_ROOTS_ADDRESS, id="beacon_roots"),
    ],
)
def test_bal_invalid_missing_system_contract_entry(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    system_contract: Address,
) -> None:
    """
    Reject a BAL that omits a system contract written by a pre-execution
    system call, in a block with no transactions.
    """
    block_timestamp = 12
    beacon_root = Hash(0xABCDEF)
    blockchain_test(
        pre=pre,
        post={},
        blocks=[
            Block(
                txs=[],
                timestamp=block_timestamp,
                parent_beacon_block_root=beacon_root,
                exception=BlockException.INVALID_BLOCK_ACCESS_LIST,
                expected_block_access_list=BlockAccessListExpectation(
                    account_expectations={
                        # Block 1 stores its parent's (genesis) hash.
                        **block_hash_system_call_expectations(0),
                        **beacon_root_system_call_expectations(
                            block_timestamp,
                            beacon_root,
                        ),
                    }
                ).modify(remove_accounts(system_contract)),
            )
        ],
    )

Parametrized Test Cases

This test generates 2 parametrized test cases across 1 fork.