go-ethereum/trie/bintrie
weiihann 012bec0eb1 trie/bintrie: postpend bit-length to disambiguate path encoding
The compact LSB-aligned encoding via ActiveBytes packed paths into
ceil(len/8) bytes without recording the bit-length. Two distinct paths
whose bit-lengths fell in the same byte-bucket and whose integer values
matched produced identical bytes — e.g. the 1-bit path "1" and the 8-bit
path "00000001" both encoded to [0x01], so two stems sitting at depths 1
and 8 on different branches could clobber each other in nodeset.AddNode.

Replace ActiveBytes/PutActiveBytes with KeyBytes/PutKeyBytes, which
append a uint8 bit-length byte after the active bytes. Postpend (rather
than prepend) so nodes along a single root-to-leaf descent share leading
path bytes, improving LSM block locality during traversal.

The empty path is encoded as no bytes (not [0x00]): byteCount=0 is
unique to len=0 so no disambiguation byte is needed. This keeps the
root's DB key empty, matching the resolver's existing nil-path convention.
2026-05-11 11:37:28 +08:00
..
binary_node.go trie: group 2^N binary trie nodes in serialization (#34794) 2026-05-01 15:28:19 +02:00
binary_node_test.go trie/bintrie: postpend bit-length to disambiguate path encoding 2026-05-11 11:37:28 +08:00
bitarray.go trie/bintrie: postpend bit-length to disambiguate path encoding 2026-05-11 11:37:28 +08:00
bitarray_test.go trie/bintrie: use bitarray for path encoding 2026-05-08 12:58:48 +08:00
hashed_node.go trie/bintrie: replace BinaryNode interface with GC-free NodeRef arena (#34055) 2026-04-20 14:08:30 +02:00
hashed_node_test.go trie: group 2^N binary trie nodes in serialization (#34794) 2026-05-01 15:28:19 +02:00
hasher.go trie/bintrie: use a sync.Pool when hashing binary tree nodes (#33989) 2026-03-12 10:20:12 +01:00
internal_node.go trie/bintrie: postpend bit-length to disambiguate path encoding 2026-05-11 11:37:28 +08:00
internal_node_test.go trie/bintrie: use bitarray for path encoding 2026-05-08 12:58:48 +08:00
iterator.go trie/bintrie: postpend bit-length to disambiguate path encoding 2026-05-11 11:37:28 +08:00
iterator_test.go trie/bintrie: replace BinaryNode interface with GC-free NodeRef arena (#34055) 2026-04-20 14:08:30 +02:00
key_encoding.go trie/bintrie: spec change, big endian hashing of slot key (#34670) 2026-04-13 09:42:37 +02:00
node_ref.go trie/bintrie: replace BinaryNode interface with GC-free NodeRef arena (#34055) 2026-04-20 14:08:30 +02:00
node_store.go trie/bintrie: replace BinaryNode interface with GC-free NodeRef arena (#34055) 2026-04-20 14:08:30 +02:00
stem_node.go trie/bintrie: replace BinaryNode interface with GC-free NodeRef arena (#34055) 2026-04-20 14:08:30 +02:00
stem_node_test.go trie/bintrie: use bitarray for path encoding 2026-05-08 12:58:48 +08:00
store_commit.go trie/bintrie: use bitarray for path encoding 2026-05-08 12:58:48 +08:00
store_ops.go trie/bintrie: replace BinaryNode interface with GC-free NodeRef arena (#34055) 2026-04-20 14:08:30 +02:00
trie.go trie/bintrie: postpend bit-length to disambiguate path encoding 2026-05-11 11:37:28 +08:00
trie_test.go trie: group 2^N binary trie nodes in serialization (#34794) 2026-05-01 15:28:19 +02:00