go-ethereum/trie
Samuel Arogbonlo fda09c7b1b
trie: add sub-trie iterator support (#32520)
- Adds `NodeIteratorWithPrefix()` method to support iterating only nodes
within a specific key prefix
- Adds `NodeIteratorWithRange()` method to support iterating only nodes
within a specific key range

Current `NodeIterator` always traverses the entire remaining trie from a
start position. For non-ethereum applications using the trie implementation, 
there's no way to limit iteration to just a subtree with a specific prefix.

  **Usage:**

  ```go
  // Only iterate nodes with prefix "key1"
  iter, err := trie.NodeIteratorWithPrefix([]byte("key1"))
  ```

Testing: Comprehensive test suite covering edge cases and boundary conditions.

Closes #32484

---------

Co-authored-by: gballet <guillaume.ballet@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-09-17 22:07:02 +08:00
..
bintrie trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
trienode cmd, core, eth, triedb/pathdb: track node origins in the path database (#32418) 2025-09-05 10:37:05 +08:00
utils all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00
bytepool.go trie: reduce allocations in stacktrie (#30743) 2025-01-23 10:17:12 +01:00
committer.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
database_test.go trie: no need to store preimage if not enabled (#32012) 2025-06-13 15:04:24 +08:00
encoding.go trie: reduce allocations in stacktrie (#30743) 2025-01-23 10:17:12 +01:00
encoding_test.go trie: reduce allocs in recHash (#27770) 2023-08-18 22:41:19 +02:00
errors.go all: fix various typos (#29600) 2024-04-23 13:09:42 +03:00
hasher.go trie: reduce the memory allocation in trie hashing (#31902) 2025-08-01 10:23:23 +08:00
iterator.go trie: add sub-trie iterator support (#32520) 2025-09-17 22:07:02 +08:00
iterator_test.go trie: add sub-trie iterator support (#32520) 2025-09-17 22:07:02 +08:00
node.go trie: reduce the memory allocation in trie hashing (#31902) 2025-08-01 10:23:23 +08:00
node_enc.go trie: reduce the memory allocation in trie hashing (#31902) 2025-08-01 10:23:23 +08:00
node_test.go trie: improve node rlp decoding performance (#25357) 2022-08-19 00:39:47 +02:00
proof.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
proof_test.go trie: add edgecase for rangeproof correctness (#31667) 2025-04-28 14:37:02 +08:00
secure_trie.go core, miner, trie: add metrics tracking state trie depth (#32388) 2025-08-22 22:09:14 +08:00
secure_trie_test.go core/state, eth/protocols, trie, triedb/pathdb: remove unused error from trie Commit (#29869) 2024-06-12 12:23:16 +03:00
stacktrie.go trie: reduce allocations in stacktrie (#30743) 2025-01-23 10:17:12 +01:00
stacktrie_fuzzer_test.go trie: do not expect ordering in stacktrie during fuzzing (#31170) 2025-02-18 10:48:42 +08:00
stacktrie_test.go trie: reduce allocations in stacktrie (#30743) 2025-01-23 10:17:12 +01:00
sync.go all: create global hasher pool (#31769) 2025-05-09 13:52:40 +08:00
sync_test.go core, trie, triedb: minor changes from snapshot integration (#30599) 2024-10-18 17:06:31 +02:00
tracer.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
tracer_test.go trie, core/state: introduce trie Prefetch for optimizing preload (#32134) 2025-08-20 21:45:27 +08:00
transition.go core,trie: fix typo in TransitionTrie (#32491) 2025-08-25 09:29:58 +02:00
trie.go trie: add sub-trie iterator support (#32520) 2025-09-17 22:07:02 +08:00
trie_id.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00
trie_reader.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
trie_test.go trie, core/state: introduce trie Prefetch for optimizing preload (#32134) 2025-08-20 21:45:27 +08:00
verkle.go trie/bintrie: add eip7864 binary trees and run its tests (#32365) 2025-09-01 21:06:51 +08:00
verkle_test.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00