Skip to content

test_delete_from_three_child_branch()

Documentation for tests/mpt/test_account_trie_structure.py::test_delete_from_three_child_branch@ffe48572.

Generate fixtures for these test cases for Bogota with:

fill -v tests/mpt/test_account_trie_structure.py::test_delete_from_three_child_branch --fork Bogota

Delete one of three accounts under one branch.

pre: .. -> branch@4 -> {p, q, doomed} post: .. -> branch@4 -> {p, q}

Source code in tests/mpt/test_account_trie_structure.py
def test_delete_from_three_child_branch(
    state_test: StateTestFiller, pre: Alloc
) -> None:
    """
    Delete one of three accounts under one branch.

    pre:  .. -> branch@4 -> {p, q, doomed}
    post: .. -> branch@4 -> {p, q}
    """
    p, q = (Address(x) for x in TWO_ADDRS_EXT4)
    doomed = _create2_address(COLLAPSE_SALT)
    pre.fund_address(p, amount=1)
    pre.fund_address(q, amount=2)
    pre.fund_address(doomed, amount=FUNDING)
    _ensure_factory(pre)
    sender = pre.fund_eoa()
    assert node_at(account_shape(pre, p), 4) == ("branch", 3)
    after = account_shape(_after_block(pre, doomed), p)
    assert node_at(after, 4) == ("branch", 2)

    state_test(
        pre=pre,
        tx=_delete_tx(sender, COLLAPSE_SALT),
        post={
            p: Account(balance=1),
            q: Account(balance=2),
            doomed: Account.NONEXISTENT,
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.