Skip to content

test_bal_system_address_coinbase_zero_tip()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py::test_bal_system_address_coinbase_zero_tip@26332146.

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_system_address_coinbase_zero_tip --fork Amsterdam

Ensure BAL includes SYSTEM_ADDRESS when it is the zero-tip fee recipient.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
def test_bal_system_address_coinbase_zero_tip(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
    fork: Fork,
) -> None:
    """
    Ensure BAL includes SYSTEM_ADDRESS when it is the zero-tip fee recipient.
    """
    bob = pre.fund_eoa(amount=0)

    genesis_env = Environment(base_fee_per_gas=0x7)
    base_fee_per_gas = fork.base_fee_per_gas_calculator()(
        parent_base_fee_per_gas=int(genesis_env.base_fee_per_gas or 0),
        parent_gas_used=0,
        parent_gas_limit=genesis_env.gas_limit,
    )

    tx_value = 5
    alice = pre.fund_eoa()
    tx = Transaction(
        sender=alice,
        to=bob,
        value=tx_value,
        gas_price=base_fee_per_gas,
    )

    block = Block(
        txs=[tx],
        fee_recipient=SYSTEM_ADDRESS,
        header_verify=Header(base_fee_per_gas=base_fee_per_gas),
        expected_block_access_list=BlockAccessListExpectation(
            account_expectations={
                alice: BalAccountExpectation(
                    nonce_changes=[
                        BalNonceChange(block_access_index=1, post_nonce=1)
                    ],
                ),
                bob: BalAccountExpectation(
                    balance_changes=[
                        BalBalanceChange(block_access_index=1, post_balance=5)
                    ]
                ),
                SYSTEM_ADDRESS: BalAccountExpectation.empty(),
            }
        ),
    )

    blockchain_test(
        pre=pre,
        blocks=[block],
        post={
            alice: Account(nonce=1),
            bob: Account(balance=5),
            SYSTEM_ADDRESS: Account.NONEXISTENT,
        },
        genesis_environment=genesis_env,
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.