-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: implement incremental merkle tree #9
feat: implement incremental merkle tree #9
Conversation
ECDH Encryption completed with BabyJubJub
Merkle Tree Stuff
@cedoor I have created a DynamicCalculator trait which will works the same way but with the depth as a parameter now. This basically controls the loop. In -> packages/merkle-trees/src/incremental_merkle/tree.nr Questions:
For the tests, how would you like me to test the dynamic depth function? So I should create a tree (let's say of depth 4), and then calculate the results for depth 1, 2, 3? |
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.
@YashBit there's code which is not related to this PR (e.g. ecdh). I think you need to open a PR for the binary merkle tree by forking the main branch of zk-kit.noir.
The trait seems to be fine, I added other comments for some files that are actually just a copy of the current Merkle tree. You should be able to re-use that code.
Yes, those functions still need to be implemented I guess.
Exactly, sounds like a good way to test them. Please, take a look at these tests here: https://github.com/privacy-scaling-explorations/zk-kit.circom/blob/326cef9fdb9a2f845b890cffea0594975768be1f/packages/binary-merkle-root/tests/binary-merkle-root.test.ts#L98. You should have the same tests in Noir here. Also, be aware that this is not an incremental Merkle tree. It works as a general binary Merkle tree with an addition feature: dynamic depth, i.e. the ability to generate a proof with an arbitrary depth even if there's a maximum depth in the circuit (which must be static by design). |
s re s
Converting to draft while not ready to merge |
refactor: test1 works for incremental
refactor: incremental merkle tree
@signorecello Please can you change this back from the draft? The core logic is complete, adding a few tests now. |
Could you please comment on the algorithm? Most of it should remain the same, it is just the calculate_root_dynamic Thank you again. |
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.
@sripwoud I will make those changes. I am mainly concerned with the logic of the incremental tree. That is the most important, since after that I will be done with unit the tests as well. |
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.
Hey @YashBit I don't understand the goal here. When you use this library in a circuit, you won't be able to pass anything other than an array into its main circuit.
I don't believe we should merge this PR without a bin circuit that would show its usage
@cedoor Yes, please close this one! |
Important:
Description