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

feat: add get merkle proof to lazy imt tree #162

Merged

Conversation

alrevuelta
Copy link
Contributor

@alrevuelta alrevuelta commented Feb 12, 2024

Description

This PR adds a function to the LazyIMT contract, _merkleProofElements, which returns the Merkle proof of any leaf index in the tree. The depth is configurable, which allows to get the proofs of any subtree.

Closes #123

@alrevuelta alrevuelta marked this pull request as ready for review February 21, 2024 15:31
@alrevuelta
Copy link
Contributor Author

@vimwitch @cedoor This PR is ready for review. I managed to use _root function to calculate the subhashes that either i) not calculated (odd leaf) or ii) require padding. Unit tests show this works for multiple depths and amount of leafs, and verifies that proofs are indeed valid with the already existing root functon.

@alrevuelta
Copy link
Contributor Author

Ready on my side. Added on top of the merged PR a fix for eslint.

@alrevuelta alrevuelta requested a review from chancehudson March 5, 2024 18:29
@alrevuelta
Copy link
Contributor Author

alrevuelta commented Mar 19, 2024

@vimwitch Is there anything left here? Only this is open, but resolved in here

@chancehudson chancehudson merged commit 0699fd1 into privacy-scaling-explorations:main Apr 12, 2024
2 checks passed
Copy link

gitpoap-bot bot commented Apr 12, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2024 ZK-KIT Contributor:

GitPOAP: 2024 ZK-KIT Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

@cedoor
Copy link
Member

cedoor commented Apr 17, 2024

@alrevuelta @vimwitch should we release a new version for the @zk-kit/imt.sol package?

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.

Access Merkle Proof in LazyIMT
3 participants