Commit graph

3 commits

Author SHA1 Message Date
weiihann
92e9074c5b trie/bintrie: replace left/right fields with children array
Replace InternalNode's separate left and right fields with a
children [2]BinaryNode array, where children[0] = left and
children[1] = right. The bit extracted from the key (always 0 or 1)
maps directly to the array index, eliminating duplicated if/else
blocks in GetValuesAtStem, InsertValuesAtStem, and the iterator.

Net reduction of ~100 lines across 8 files.
2026-04-09 13:25:11 +08:00
Guillaume Ballet
3f1871524f
trie/bintrie: cache hashes of clean nodes so as not to rehash the whole tree (#33961)
This is an optimization that existed for verkle and the MPT, but that
got dropped during the rebase.

Mark the nodes that were modified as needing recomputation, and skip the
hash computation if this is not needed. Otherwise, the whole tree is
hashed, which kills performance.
2026-03-06 18:06:24 +01:00
Guillaume Ballet
bd4b17907f
trie/bintrie: add eip7864 binary trees and run its tests (#32365)
Implement the binary tree as specified in [eip-7864](https://eips.ethereum.org/EIPS/eip-7864). 

This will gradually replace verkle trees in the codebase. This is only 
running the tests and will not be executed in production, but will help 
me rebase some of my work, so that it doesn't bitrot as much.

---------

Signed-off-by: Guillaume Ballet
Co-authored-by: Parithosh Jayanthi <parithosh.jayanthi@ethereum.org>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-01 21:06:51 +08:00