-
Notifications
You must be signed in to change notification settings - Fork 781
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
trie: add verifyRangeProof #1731
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
The test case failed to run because |
Agreed, this is a strange one because we're already supposed to be polyfilling |
@samlior If you delete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First thanks for this extensive work. I had a cursory look but didn't check everything with detail, specially the utility methods, e.g. unset
, ... and had some comments and clarification questions. Another nitpick is you use invalid proof
for all errors :d having more descriptive errors would be more user-friendly.
In general this function is very niche. The only use-case I'm aware of is snap sync. I'm not sure if other users of the library will benefit from this, e.g. compared to a general multiproof (e.g. see ethereumjs/merkle-patricia-tree#94 or ethereumjs/merkle-patricia-tree#101). Do you plan to use it yourself?
You are right, this feature is really niche, I need this feature because I want to add snap sync to my own Ethereum implementation, and this feature is indispensable. I can go ahead and submit some improvements or continue discussions on this issue, but before that, I'd like to know if you guys think this feature is necessary to be added to this library. @s1na |
@holgerd77 In my understanding, in fact, ethereumjs/merkle-patricia-tree#101 and my work are two completely different things. Is my understanding correct? @s1na |
@samlior @holgerd77 yes if the use-case is snap sync then the old PRs won't suffice. This PR is needed. Also if EthereumJS wants to at some point adopt snap sync this PR will be useful. |
TBH I am not able to review this - I am not deep enough into the trie library - and I wonder if someone else from the team could do a really in-depth review. Since this is such isolated functionality I would nevertheless be inclined to just merge this in, the side effects if we miss some edge cases here or whatever are extremely limited. @samlior can you fix (or give a short explaination if you can't/won't) on the remaining issues/comments Sina had? Then I guess we would already be more or less ready to go. |
(ah, and also wanted to mention: we have also some additional security by the tests) |
@samlior: also let us know if you need a quick release on this. |
@holgerd77 I can and I will continue to work on this PR. |
Ok, cool, let us know when you consider this ready! 😄 |
@holgerd77 this PR is ready, and the test fails because karma still reports that |
looks great, thanks for addressing feedback and everything, I can try to fix that karma issue tomorrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @samlior, this looks really really great! Will merge this in now, again - super-isolated functionality which cannot do harm to other areas even if we are missing some edge cases here or something.
verifyRangeProof
is not currently supported, so I implemented the js version with reference to geth