zk-kit icon indicating copy to clipboard operation
zk-kit copied to clipboard

feat(imt): add rust implementation of imt

Open Arch0125 opened this issue 1 year ago • 4 comments

Description

This PR adds Rust implmentation of IMT, aligned with the current TS version, with the following methods included insert/update/delete/create-proof/verify-proof

Related Issue

Resolves #133

Does this introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

Test coverage

  • [x] Test New IMT Instance

    • Description: Ensure that a new IMT instance is created successfully.
  • [x] Test Leaf Insertion

    • Description: Check if new leaves can be inserted into the tree.
  • [x] Test Leaf Deletion

    • Description: Test the deletion functionality of a leaf in the tree.
  • [x] Test Leaf Update

    • Description: Ensure that a leaf in the tree can be updated correctly.
  • [x] Test Create and Verify Proof

    • Description: Create a Merkle proof for a leaf and verify its correctness.
  • [x] Should Not Initialize with Too Many Leaves

    • Description: The tree should not initialize if the number of leaves exceeds arity ^ depth.
  • [x] Should Not Insert in Full Tree

    • Description: Test that leaves cannot be inserted into a full tree.
  • [x] Should Not Delete Nonexistent Leaf

    • Description: Ensure that attempting to delete a nonexistent leaf results in an error.

Arch0125 avatar Jan 29 '24 08:01 Arch0125

Hey @Arch0125, do you think you'll have time to work on the remaining minor changes?

We're planning to create a ZK-Kit repo for Rust and it would be nice to have this implementation there :)

cedoor avatar Jun 24 '24 18:06 cedoor

Hey @cedoor, yeah ill get done with the minor changes mostly by EOD, or by earlier tomorrow. It kinda slipped out of my mind, got busy with some stuff at work, apologies for that

Arch0125 avatar Jun 26 '24 07:06 Arch0125

@Arch0125 no worries :) Thanks for your quick response!

cedoor avatar Jun 26 '24 09:06 cedoor

Updating the code structure in the next commit as mentioned by @0xjei

Arch0125 avatar Jun 29 '24 21:06 Arch0125

@Arch0125 This PR should be ready right? Could you solve the conflicts?

cedoor avatar Jul 10 '24 13:07 cedoor

Yep solving the conflicts asap

Arch0125 avatar Jul 10 '24 15:07 Arch0125

@cedoor ive fixed the remaining issues that came up after the merge

Arch0125 avatar Jul 11 '24 11:07 Arch0125

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.

gitpoap-bot[bot] avatar Jul 11 '24 11:07 gitpoap-bot[bot]

@Arch0125 Thank you so much for this PR! As a second step, we need to move this crate to the zk-kit.rust repo. Would you like to do it yourself?

cedoor avatar Jul 11 '24 11:07 cedoor

@cedoor Yeah sure, ill take it up, can you assign it there ?

Arch0125 avatar Jul 11 '24 12:07 Arch0125

@cedoor Yeah sure, ill take it up, can you assign it there ?

Sure, here: https://github.com/privacy-scaling-explorations/zk-kit.rust/issues/3. Can you add a comment there?

cedoor avatar Jul 11 '24 13:07 cedoor