Skip to content

Test Index Trie Structure

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

Generate fixtures for these test cases for Bogota with:

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

Exercise Merkle Patricia Trie shapes of the transaction and receipt tries.

Both tries key on rlp(position), so their shape is a function of the transaction count alone: rlp(0) = 0x80 sits under nibble 8, 1..127 under nibbles 0..7, 128..255 have two-byte keys 0x81xx, and 256 onward three-byte keys 0x82xxxx. Keys sharing a byte's high nibble are the only way an index trie contains an extension: a 1-nibble one from 130 to 144 entries and a 3-nibble one from 258, split at its last nibble from 273. Dense sequential indices never break an extension anywhere but its last nibble. Transaction and receipt values exceed 32 bytes, so these tries never inline a node.

Test Functions Overview

Name Type Cases (Bogota) Description
test_index_trie_shapes blockchain_test 7 One block of count transfers.