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

merkle proofs: Fix get_helper_indices #1423

Merged
merged 2 commits into from
Oct 23, 2019
Merged

merkle proofs: Fix get_helper_indices #1423

merged 2 commits into from
Oct 23, 2019

Conversation

wemeetagain
Copy link
Contributor

The current implementation of get_helper_indices will include unneeded indices if both direct children are not included in the proof (either as leaves or helpers/sisters).

eg: get_helper_indices([8,9,10,11,12]) should return [13, 7], but returns [13, 7, 3]
3 is unnecessary b/c it can be computed from 12, 13, 7.

Instead of only looking at direct children, all helper indices in a leaf -> root path should be filtered out, since any indices in a path can always be computed with a valid proof.

Copy link
Contributor

@protolambda protolambda left a comment

Choose a reason for hiding this comment

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

Thanks @wemeetagain, this is more readable than the previous version, and corrects the path nodes set difference 👍
And apologies for the late review, I was too busy with devcon 😅

@protolambda protolambda merged commit d8bf5c2 into ethereum:dev Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants