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

fix: incorrect proof hash count causing panic #28

Merged
merged 2 commits into from
May 22, 2023

Conversation

witter-deland
Copy link
Contributor

@witter-deland witter-deland commented May 16, 2023

fix #20

@themighty1
Copy link
Contributor

Hi, would it be possible to also include tests into this PR showcasing what was fixed?

@witter-deland
Copy link
Contributor Author

The problem fixed is a bug, you can refer to #20, I also encountered a similar problem.

I don't know what kind of test is appropriate to build, it seems to just fix the original bug: use the old code, the merkle proof bug will appear, use the new code, the merkle proof will work normally

Hi, would it be possible to also include tests into this PR showcasing what was fixed?

@antouhou
Copy link
Owner

@witter-deland Thanks for the work! Yeah, please just include one simple test that passes an incorrect number of hashes, and check that this error is returned. Thank you very much!

@witter-deland
Copy link
Contributor Author

It's done : )

@witter-deland Thanks for the work! Yeah, please just include one simple test that passes an incorrect number of hashes, and check that this error is returned. Thank you very much!

@antouhou antouhou changed the title [fix] incorrect proof hash count panic #20 fix: incorrect proof hash count panic May 22, 2023
@antouhou antouhou changed the title fix: incorrect proof hash count panic fix: incorrect proof hash count causing panic May 22, 2023
@antouhou antouhou merged commit 0a9acbc into antouhou:master May 22, 2023
@antouhou
Copy link
Owner

@witter-deland Thank you! Merged. Going to publish a new patch version soon

@antouhou
Copy link
Owner

Version 1.4.1 published, thank you!

let extracted_root = proof.root(
&indices_to_prove,
&leaves_to_prove,
test_data.leaf_values.len() + 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

@witter-deland, could you pls look into this test again.
the +1 shouldn't be here iiuc. When I remove it, this test fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 means incorrect proof hash count, why did you remove it?

Copy link
Contributor

Choose a reason for hiding this comment

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

i see, sry i was confused for a second. I hope you don't mind if a change the test to actually remove the hash #31

@themighty1
Copy link
Contributor

On second thought, maybe hold off fixing it @witter-deland for now. This PR doesn't seem to address the root cause of the panic. Im working on a PR which addresses it properly. It will subsume this fix.

This was referenced Jun 5, 2023
@themighty1
Copy link
Contributor

nvm, i think this PR's fix covers all cases. thanks.

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.

panic if verifying with incorrect leaf count
3 participants