Skip to content

test_bal_system_contract_noop_filtering()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_cross_index.py::test_bal_system_contract_noop_filtering@2119b382.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_cross_index.py::test_bal_system_contract_noop_filtering --fork Amsterdam

Test that system contract post-execution calls filter net-zero storage writes.

When no transaction interacts with withdrawal/consolidation contracts during a block, the post-execution system calls read storage slots 0-3 but don't modify them. These should appear as storage READS, not storage CHANGES.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_cross_index.py
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
def test_bal_system_contract_noop_filtering(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    Test that system contract post-execution calls filter net-zero
    storage writes.

    When no transaction interacts with withdrawal/consolidation contracts
    during a block, the post-execution system calls read storage slots
    0-3 but don't modify them. These should appear as storage READS,
    not storage CHANGES.
    """
    sender = pre.fund_eoa()
    receiver = pre.fund_eoa(amount=0)

    # simple transfer that doesn't interact with system contracts
    tx = Transaction(
        sender=sender,
        to=receiver,
        value=100,
    )

    # withdrawal and consolidation contracts should NOT have any storage
    # changes since they weren't modified - only reads occurred during
    # post-execution system calls
    expected_block_access_list = BlockAccessListExpectation(
        account_expectations={
            WITHDRAWAL_REQUEST_ADDRESS: BalAccountExpectation(
                storage_changes=[],
                storage_reads=[0x00, 0x01, 0x02, 0x03],
            ),
            CONSOLIDATION_REQUEST_ADDRESS: BalAccountExpectation(
                storage_changes=[],
                storage_reads=[0x00, 0x01, 0x02, 0x03],
            ),
        }
    )

    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=[tx],
                expected_block_access_list=expected_block_access_list,
            )
        ],
        post={
            receiver: Account(balance=100),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.