Skip to content

test_bal_fully_unmutated_account()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py::test_bal_fully_unmutated_account@5c024cbb.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py::test_bal_fully_unmutated_account --fork Amsterdam

Test that BAL captures account that has zero net mutations.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
def test_bal_fully_unmutated_account(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    Test that BAL captures account that has zero net mutations.

    oracle account:
        1. Storage read and write the same value (no net change).
        2. Receives `0` value transfer (no net change).
    """
    alice = pre.fund_eoa()
    # Deploy Oracle contract with pre-existing storage value
    oracle = pre.deploy_contract(
        code=Op.SSTORE(0x01, 0x42) + Op.STOP,
        storage={0x01: 0x42},  # Pre-existing value
    )

    tx = Transaction(sender=alice, to=oracle, value=0, gas_price=0xA)

    block = Block(
        txs=[tx],
        expected_block_access_list=BlockAccessListExpectation(
            account_expectations={
                alice: BalAccountExpectation(
                    nonce_changes=[
                        BalNonceChange(block_access_index=1, post_nonce=1)
                    ],
                ),
                oracle: BalAccountExpectation(
                    storage_changes=[],  # No net storage changes
                    storage_reads=[0x01],  # But storage was accessed
                    balance_changes=[],  # No net balance changes
                ),
            }
        ),
    )

    blockchain_test(pre=pre, blocks=[block], post={})

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.