Skip to content

Conversation

@demosdemon
Copy link
Contributor

@demosdemon demosdemon commented Oct 15, 2025

This is used to walk along a path to yield all of the edges. In proof verification, this is used to verify the paths of the proof are valid.

@demosdemon demosdemon force-pushed the brandon.leblanc/trie-path-iter branch 2 times, most recently from 6d39ab2 to d710821 Compare October 15, 2025 14:32
@demosdemon demosdemon force-pushed the brandon.leblanc/hashable-assoc-types branch from 3e79cd6 to 99974a1 Compare October 15, 2025 15:22
@demosdemon demosdemon force-pushed the brandon.leblanc/trie-path-iter branch from d710821 to 2446fa7 Compare October 15, 2025 15:23
@demosdemon demosdemon changed the title feat: add TriePathIter for iterating over the nodes along a path in a… feat: add TriePathIter for iterating over the nodes along a path Oct 15, 2025
@demosdemon demosdemon marked this pull request as ready for review October 15, 2025 15:33
@demosdemon demosdemon requested a review from rkuris as a code owner October 15, 2025 15:33
@demosdemon demosdemon force-pushed the brandon.leblanc/hashable-assoc-types branch from 99974a1 to dbb899d Compare October 17, 2025 16:50
@demosdemon demosdemon force-pushed the brandon.leblanc/trie-path-iter branch from 2446fa7 to 787fe3c Compare October 17, 2025 16:50
Copy link
Member

@rkuris rkuris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's chat about this and how it differs from the existing MerkleNodeIter. The existing code is tested heavily as it forms the basis of MerkleKeyValueIter.

If this code is better/faster/more generic, lets describe which and the motivation for a new iterator more clearly in the PR description.

@demosdemon demosdemon force-pushed the brandon.leblanc/hashable-assoc-types branch from dbb899d to 366441a Compare October 29, 2025 16:27
@demosdemon demosdemon force-pushed the brandon.leblanc/trie-path-iter branch from 787fe3c to 30e63e5 Compare October 29, 2025 16:28
`TrieNode` is a generic trait that abstracts over the behavior of nodes
in a fixed-arity radix trie. This trait allows for different structures
to represent tries while enabling similar operations on them.

`TrieNode` is merkle-aware, meaning it can represent nodes that are a
mix of locally described children or children referenced by only their
hash. This is accomplished through `TrieEdgeState` and is used later in
proof verification.

The `HashedTrieNode` trait is for post-hashed nodes and is distinctly
different from the hash described on `TrieNode`. This trait is intended
to represent the computed hash of the node itself; whereas, the hash
accessed via `TrieNode` is the hash of a child node as seen from its
parent. While they are usually the same, they can differ during
intermediate states of a trie or during proof verification when some
information is incomplete.

`KeyValueTrieRoot` is an implementation of `TrieNode` that only
represents a key-value store and is not merkleized. This is really a
separate change and is a component of proof verification but is also
needed here as it is used to test and verify the iterator.
This expands on the previously added key-value trie by adding
a hashed variant and mechanism to convert from unhashed to hashed.
@demosdemon demosdemon force-pushed the brandon.leblanc/trie-path-iter branch from 30e63e5 to 8b019d4 Compare October 29, 2025 18:10
@demosdemon demosdemon force-pushed the brandon.leblanc/hashable-assoc-types branch 2 times, most recently from 7cf3d26 to 9087e50 Compare October 29, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants