Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree: getproofitems replace children with resolved node #404

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

jsign
Copy link
Collaborator

@jsign jsign commented Oct 17, 2023

This PR makes the resolved nodes from GetProofItems replace the HashedNodes.

If we don't do this, this method can fail for unresolved nodes despite technically receiving a resolver via params. I'll point out the exact situation in the PR comment.

This allows Geth to avoid "warmup" pre-trie: gballet/go-ethereum#293

@@ -873,6 +873,7 @@ func (n *InternalNode) GetProofItems(keys keylist, resolver NodeResolverFn) (*Pr
if err != nil {
return nil, nil, nil, err
}
n.children[i] = c
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we don't do this, the line below pec, es, other, err := n.children[childIdx].GetProofItems(group, resolver) (L930) would fail since n.children[childrenIdx] can be a HashedNode and GetProofItems isn't allowed.

@jsign jsign marked this pull request as ready for review October 18, 2023 12:30
@jsign jsign requested a review from gballet October 18, 2023 12:30
Copy link
Member

@gballet gballet left a comment

Choose a reason for hiding this comment

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

Makes sense. Thanks for catching that. LGTM.

@gballet gballet merged commit 3d7dc63 into master Oct 18, 2023
6 checks passed
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.

2 participants