Skip to content

Test Withdrawals Trie Structure

Documentation for tests/mpt/test_withdrawals_trie_structure.py@02aafd78.

Generate fixtures for these test cases for Bogota with:

fill -v tests/mpt/test_withdrawals_trie_structure.py --fork Bogota

Exercise Merkle Patricia Trie node embedding via the withdrawals trie.

The withdrawals trie is unsecured (keys are rlp(index)) and its leaves are tiny, so realistic payloads straddle the 32-byte inlining threshold naturally: no preimage mining is needed. With at most 16 withdrawals per block the trie has exactly three shapes: one entry is a root leaf, two entries a root branch with two one-nibble leaves, three to sixteen a root branch whose nibble-0 child is a branch of empty-path leaves. Growing amount by one RLP byte moves a leaf from inlined to hashed.

Test Functions Overview

Name Type Cases (Bogota) Description
test_single_small_withdrawal_root_is_hashed blockchain_test 1 One 100 Gwei withdrawal: the whole trie is a 30-byte leaf.
test_withdrawal_branch_mixes_embedded_and_hashed blockchain_test 2 Three or sixteen withdrawals; odd indices inline, even ones hashed.
test_withdrawal_leaf_embedding_boundary blockchain_test 3 Two withdrawals whose leaves are exactly 31, 32 or 33 bytes.