semaphore-protocol / semaphore

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

Make the contract tests more atomic and use `loadFixture` #706

Closed vplasencia closed 4 months ago

vplasencia commented 6 months ago

Description

It would be nice to make the tests as atomic as possible and use loadFixture.

This can help: https://github.com/semaphore-protocol/semaphore/blob/main/packages/cli-template-contracts-hardhat/test/Feedback.ts

waddaboo commented 4 months ago

Hi, I would like to take on this issue! :)

vplasencia commented 4 months ago

Hey @waddaboo yes, sure. Do you want me to assign you this issue?

waddaboo commented 4 months ago

Yes, please. Thanks!

vplasencia commented 4 months ago

@waddaboo done. Please, let us know if you have any questions.

waddaboo commented 4 months ago

Hi @vplasencia, I'm currently facing an issue at the Should not verify a proof if the Merkle tree root is expired test.

I have created a new group with 0-1s expiry with createGroup(address,uint256), and when I test it with verifyProof, it returns true instead of the Semaphore_MerkleTreeRootIsExpired error.

I have tried using setTimeOut to wait out the expiration and @nomicfoundation/hardhat-toolbox/network-helpers's time helpers to advance the block timestamp but still not getting the expected return.

Any ideas on how to work around this?

Edit: Nvm, found the error 😅