Skip to content

test_bal_2935_absent_contract()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip2935.py::test_bal_2935_absent_contract@c74f1a67.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip2935.py::test_bal_2935_absent_contract --fork Amsterdam

Ensure an undeployed history contract is still recorded in the BAL.

Overriding the genesis contract with an empty account drops it from the pre-state. The block-start system call reads the now-absent account (recording it) and finds no code to run, so the address is in the BAL with an empty AccountChanges. Unreachable on mainnet, consensus-relevant on custom or test chains.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip2935.py
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
@pytest.mark.pre_alloc_mutable()
def test_bal_2935_absent_contract(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    Ensure an undeployed history contract is still recorded in the BAL.

    Overriding the genesis contract with an empty account drops it from the
    pre-state. The block-start system call reads the now-absent account
    (recording it) and finds no code to run, so the address is in the BAL
    with an empty AccountChanges. Unreachable on mainnet,
    consensus-relevant on custom or test chains.
    """
    pre[HISTORY_STORAGE_ADDRESS] = Account(code=b"", nonce=0, balance=0)
    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=[],
                expected_block_access_list=BlockAccessListExpectation(
                    account_expectations={
                        HISTORY_STORAGE_ADDRESS: BalAccountExpectation.empty(),
                    }
                ),
            )
        ],
        post={HISTORY_STORAGE_ADDRESS: Account.NONEXISTENT},
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.