Skip to content

test_insert_full_branch_during_execution()

Documentation for tests/mpt/test_account_trie_structure.py::test_insert_full_branch_during_execution@02aafd78.

Generate fixtures for these test cases for Bogota with:

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

A contract pays sixteen mined addresses, creating their leaves.

pre: no branch at depth 4 on the group's path post: .. -> branch@4 -> {16 x leaf}

Source code in tests/mpt/test_account_trie_structure.py
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
def test_insert_full_branch_during_execution(
    state_test: StateTestFiller, pre: Alloc
) -> None:
    """
    A contract pays sixteen mined addresses, creating their leaves.

    pre:  no branch at depth 4 on the group's path
    post: .. -> branch@4 -> {16 x leaf}
    """
    addresses = [Address(x) for x in SIXTEEN_ADDRS_BRANCH4]
    payer = pre.deploy_contract(code=_pay_each(addresses), balance=16)
    sender = pre.fund_eoa()
    assert covering(account_shape(pre, addresses[0]), 4)[1] != "branch"
    after = _after_block(pre) + addresses
    assert node_at(account_shape(after, addresses[0]), 4) == ("branch", 16)

    state_test(
        pre=pre,
        tx=Transaction(sender=sender, to=payer),
        post={
            payer: Account(balance=0),
            **{a: Account(balance=1) for a in addresses},
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.