semaphore-protocol / semaphore

A zero-knowledge protocol for anonymous interactions.
https://semaphore.pse.dev
MIT License
928 stars 211 forks source link

Create CLI Foundry template #185

Open cedoor opened 1 year ago

cedoor commented 1 year ago

Description

There is a CLI Hardhat template called cli-template-contracts-hardhat with a sample contract and tests for that contract.

The idea is to recreate that same template using Foundry instead of Hardhat. The template will be called cli-template-contracts-foundry.

Previous work

https://github.com/vplasencia/semaphore-foundry

https://github.com/vplasencia/semaphore-foundry-hardhat

https://github.com/vplasencia/semaphore-hardhat-foundry

vplasencia commented 1 year ago

The challenge here is to deploy the Semaphore contract properly using Foundry in the test environment. The equivalent in Hardhat is: https://github.com/semaphore-protocol/semaphore/blob/main/packages/hardhat/src/tasks/deploy-semaphore.ts

More context: Getting the poseidon code and linking libraries:

The poseidon function in the PoseidonT3 library is empty by default, to get its code the circomlibjs javascript library is used. Then, it is necessary to link the PoseidonT3 library with the new code, to the IncrementalBinaryTree library.

We didn't change the implementation of the poseidon function because that code is already audited.

cedoor commented 10 months ago

Re-opening this issue as Semaphore V4 will use an actual contract for Poseidon and there shouldn't be any problems with Foundry.

csiejimmyliu commented 3 months ago

Hi @cedoor, @vplasencia! I'm interested in this issue. Please assign it to me. Thank you!

cedoor commented 2 months ago

Hey @csiejimmyliu, assigned :)

csiejimmyliu commented 2 months ago

Hey @cedoor ! I'm in PSE Core Taiwan, my group mate @timou0911 works with me on this issue. Can you assign him too?

cedoor commented 2 months ago

Hey @csiejimmyliu, sure! They need to comment here tho.

timou0911 commented 2 months ago

Hi @cedoor ! Just created a PR of this issue!