-
Notifications
You must be signed in to change notification settings - Fork 86
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(lean-imt): After a sequence of updates a proof is invalid. #355
Conversation
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.
what is the expected behavior of poseidon, when one of the inputs is undefined?
I am wondering if this should be fixed there instead
Hi 0xDatapunk. The poseidon method accepts bigint|number|string, if you pass an undefined parameter the process crashes with the error TypeError: Cannot convert undefined to a BigInt. |
When a member is removed from the tree (update a leaf with 0n) and then another member is updated, the root that is saved is not correct, so the proof that is generated is not valid.This was caused by a type validation failure. This fix the behavior described above. I detected this when I was testing in Semphore groups.
due to a bug in type checking, the root is not generated correctly.
due to a bug in type checking, the root is not generated correctly.
@cedoor I had to rebase my commit because they weren't verified. I've fixed it now. |
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2024 ZK-KIT Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
Just a cleanliness update while I check for changes in our various dependencies. Here's the story behind the updated comment, for posterity: I originally planned to use 0 as the hash value for PODNull, but decided against it because LeanIMT behaved badly. Turns out that behavior was a bug, fixed here: privacy-scaling-explorations/zk-kit#355 However, the test for that bug points out that people might assume that 0 has special meaning in many situations (including using it to mean removal from a Merkle tree), so it's still a good idea to use a unique non-zero value for PODNull's hash. In this PR I've updated the comment on the related utest to describe the general reasoning, rather than point to LeanIMT in particular.
Description
When a member is removed from the tree (update a leaf with 0n) and then another member is updated, the root that is saved is not correct, so the proof that is generated is not valid.This was caused by a type validation failure.
This fix the behavior described above.
I detected this when I was testing in Semphore groups.
Checklist
yarn style
without getting any errors