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@ffe48572.

Generate fixtures for these test cases for Bogota with:

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

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
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 2 forks.