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

chore(circuits): Restructure Merkle tree templates into separate files #2362

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

knelsondev
Copy link

Description

Introduced new templates for Merkle tree operations: BinaryMerkleRoot, CheckRoot, LeafExists, MerkleTreeInclusionProof, and MerkleGeneratePathIndices.

  • Refactored incrementalMerkleTree.circom to include these new templates, improving modularity and maintainability of the codebase.

This pull request addresses issue #1419 by restructuring the Circom templates located in packages/circuits/circom/utils/trees/incrementalMerkleTree.circom.

Previously, this single file contained multiple template definitions related to Merkle tree operations (MerkleTreeInclusionProof, LeafExists, CheckRoot, MerkleGeneratePathIndices, BinaryMerkleRoot).

To improve code organization and modularity, each template has been extracted into its own dedicated file within the same directory (packages/circuits/circom/utils/trees/).

The original incrementalMerkleTree.circom file has been updated to simply include these new, individual template files. This ensures that existing circuits which depend on incrementalMerkleTree.circom continue to function without modification, as they will now implicitly import all the necessary templates via the updated include statements.

Additional Notes

No additional notes.

Related issue(s)

Confirmation

Important

We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.

Additional Notes

Related issue(s)

Confirmation

Important

We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.

Copy link

vercel bot commented Apr 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
maci-website ✅ Ready (Inspect) Visit Preview Apr 14, 2025 2:38pm

- Introduced new templates for Merkle tree operations: `BinaryMerkleRoot`, `CheckRoot`, `LeafExists`, `MerkleTreeInclusionProof`, and `MerkleGeneratePathIndices`.
- Refactored `incrementalMerkleTree.circom` to include these new templates, improving modularity and maintainability of the codebase.
@0xmad 0xmad force-pushed the chore/circuits-split-merkle-templats branch from e2eb0dc to 79593e5 Compare April 14, 2025 14:35
Copy link
Collaborator

@0xmad 0xmad left a comment

Choose a reason for hiding this comment

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

@knelsondev thanks, just one suggestion and please add new lines at the end of newly added files.

Comment on lines +3 to +9
// Include the individual Merkle tree utility templates.
// These files were created by splitting the original content of this file.
include "./MerkleTreeInclusionProof.circom";
include "./LeafExists.circom";
include "./CheckRoot.circom";
include "./MerkleGeneratePathIndices.circom";
include "./BinaryMerkleRoot.circom";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you keep only imports here? Does it make sense to remove this file and use these imports where they are needed?

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.

restructure imt folders in the circuit package
2 participants