Skip to content

test_bal_invalid_missing_pre_block_system_call_read()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_invalid.py::test_bal_invalid_missing_pre_block_system_call_read@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_pre_block_system_call_read --fork Amsterdam

Reject a BAL that drops the storage read made by the pre-execution beacon-root system call.

With a zero parent beacon root the root slot is rewritten with its current value, which EIP-7928 records as a read next to the timestamp slot write. The timestamp and the zero root are the framework defaults, spelled out here because the scenario turns on both.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_invalid.py
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
@pytest.mark.valid_from("Amsterdam")
@pytest.mark.exception_test
def test_bal_invalid_missing_pre_block_system_call_read(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    Reject a BAL that drops the storage read made by the pre-execution
    beacon-root system call.

    With a zero parent beacon root the root slot is rewritten with its
    current value, which EIP-7928 records as a read next to the timestamp
    slot write. The timestamp and the zero root are the framework defaults,
    spelled out here because the scenario turns on both.
    """
    block_timestamp = 12
    timestamp_slot, root_slot = get_beacon_root_slots(block_timestamp)
    blockchain_test(
        pre=pre,
        post={},
        blocks=[
            Block(
                txs=[],
                timestamp=block_timestamp,
                parent_beacon_block_root=Hash(0),
                exception=BlockException.INVALID_BLOCK_ACCESS_LIST,
                expected_block_access_list=BlockAccessListExpectation(
                    account_expectations={
                        BEACON_ROOTS_ADDRESS: BalAccountExpectation(
                            storage_changes=[
                                BalStorageSlot(
                                    slot=timestamp_slot,
                                    slot_changes=[
                                        BalStorageChange(
                                            block_access_index=0,
                                            post_value=block_timestamp,
                                        )
                                    ],
                                ),
                            ],
                            storage_reads=[root_slot],
                        ),
                        SYSTEM_ADDRESS: None,
                    }
                ).modify(remove_storage_reads(BEACON_ROOTS_ADDRESS)),
            )
        ],
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.