semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Create CLI Foundry template

Open cedoor opened this issue 3 years ago • 7 comments

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

cedoor avatar Dec 12 '22 14:12 cedoor

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.

vplasencia avatar Mar 27 '23 12:03 vplasencia

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

cedoor avatar Jan 08 '24 11:01 cedoor