semaphore-protocol / semaphore

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

fix(proof): replace root public signal with actual root #843

Closed cedoor closed 1 month ago

cedoor commented 1 month ago

Description

For the proof to be valid, it is necessary that the group root passed as a parameter to the generateProof function matches the root returned by groth16.fullProve as a public signal.

There are two options for checking it:

  1. The Semaphore proof keeps the public signals. And before verifying it devs will need to check that the root of the Semaphore proof matches the root of the group used to generate the proof (this is how V3 and current V4 work).
  2. The Semaphore proof already returns the root that is expected to be correct (that of the group passed as a parameter). Devs will just need to verify the proof, which would fail if the roots don't match (this is how V4 will work, better DX).

Related Issue(s)

Fixes #842

Other information

Checklist