Skip to content

test_update_existing_leaf()

Documentation for tests/mpt/test_storage_trie_structure.py::test_update_existing_leaf@02aafd78.

Generate fixtures for these test cases for Bogota with:

fill -v tests/mpt/test_storage_trie_structure.py::test_update_existing_leaf --fork Bogota

Overwrite the only leaf; the value changes, the shape does not.

pre: leaf(64) = 1 post: leaf(64) = 2

Source code in tests/mpt/test_storage_trie_structure.py
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
def test_update_existing_leaf(state_test: StateTestFiller, pre: Alloc) -> None:
    """
    Overwrite the only leaf; the value changes, the shape does not.

    pre:  leaf(64) = 1
    post: leaf(64) = 2
    """
    assert storage_shape([SINGLE_SLOT], SINGLE_SLOT) == [(0, "leaf", 64)]
    contract = pre.deploy_contract(
        code=_writer_code([(SINGLE_SLOT, 2)]), storage={SINGLE_SLOT: 1}
    )

    state_test(
        pre=pre,
        tx=Transaction(sender=pre.fund_eoa(), to=contract),
        post={contract: Account(storage={SINGLE_SLOT: 2})},
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.