Test Account Trie Structure¶
Documentation for tests/mpt/test_account_trie_structure.py@02aafd78.
Generate fixtures for these test cases for Bogota with:
fill -v tests/mpt/test_account_trie_structure.py --fork Bogota
Exercise the Merkle Patricia Trie via account addresses.
The account trie adds bookkeeping to the node operations the storage
tests cover: accounts are deleted and re-created, each leaf value carries
a storage root, and every block touches accounts the test does not
choose (sender, coinbase, system contracts). The tests use mined
addresses (*_ADDRS_* in constants.py).
Because of those accounts, shape assertions run over pre, which holds
the whole genesis of the fixture being filled (plus the coinbase after
the block), and pin only the nodes around the mined group; an
uncontrolled account sharing the group's prefix fails the fill.
A committed account leaf can only be deleted by a contract created in the same transaction (EIP-6780). The deletion tests fund a mined address at genesis and CREATE2 onto it through the deterministic factory with init code that self-destructs at once: creation at a balance-only address is legal, and the contract counts as created in the transaction. The init code sends the balance to the sender, because from EIP-8246 a self-destructed account keeps its balance and is removed only when that balance is zero (EIP-161).
Not expressible: emptying a committed storage trie in one step while its account survives, and clearing a committed empty account (the filler emits no empty genesis accounts). CREATE2 onto an address that holds storage is out of scope.
Test Functions Overview¶
| Name | Type | Cases (Bogota) | Description |
|---|---|---|---|
test_account_deleted_and_recreated_same_block |
blockchain_test | 1 | Delete a leaf and re-create it by a value transfer in the same block. |
test_code_hash_flip_with_account_shape_change |
blockchain_test | 1 | Code is deployed onto the collapse survivor, a balance-only account. |
test_delete_and_update_survivor_same_block |
blockchain_test | 1 | Delete one sibling and credit the other within one block. |
test_delete_collapses_under_controlled_parent |
state_test | 6 | Delete one child of a 2-child branch below a mined parent node. |
test_delete_from_three_child_branch |
state_test | 1 | Delete one of three accounts under one branch. |
test_delete_resurrect_delete_across_blocks |
blockchain_test | 1 | Delete a leaf, re-create it by a transfer, delete it again. |
test_genesis_extension_and_branch |
state_test | 1 | Two funded addresses sharing four nibbles sit under one branch. |
test_genesis_full_branch_arity_sixteen |
state_test | 1 | Sixteen funded addresses sharing four nibbles fill one branch. |
test_insert_full_branch_during_execution |
state_test | 1 | A contract pays sixteen mined addresses, creating their leaves. |
test_mass_delete_sixteen_to_one |
blockchain_test | 1 | Delete fifteen of sixteen accounts under one branch in one block. |
test_resurrection_via_withdrawal |
blockchain_test | 2 | Delete a leaf, then a withdrawal targets its address in the same block. |
test_storage_root_flip_with_account_shape_change |
blockchain_test | 2 | The collapse survivor is a contract whose storage root flips. |
test_touched_empty_account_never_persists |
state_test | 1 | A zero-value call to a never-seen address creates no leaf. |