Skip to content

test_bal_empty_block_no_coinbase()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py::test_bal_empty_block_no_coinbase@20373115.

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

Ensure BAL correctly handles empty blocks without including coinbase.

When a block has no transactions and no withdrawals, the coinbase/fee recipient receives no fees and should not be included in the BAL.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
def test_bal_empty_block_no_coinbase(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    Ensure BAL correctly handles empty blocks without including coinbase.

    When a block has no transactions and no withdrawals, the coinbase/fee
    recipient receives no fees and should not be included in the BAL.
    """
    coinbase = pre.fund_eoa(amount=0)

    block = Block(
        txs=[],
        withdrawals=None,
        fee_recipient=coinbase,
        expected_block_access_list=BlockAccessListExpectation(
            account_expectations={
                # Coinbase must NOT be included - receives no fees
                coinbase: None,
            }
        ),
    )

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

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.