zkmopro / mopro

Making client-side proving on mobile simple.
https://zkmopro.org
Apache License 2.0
131 stars 35 forks source link

Figure out how to deal with setup/zkey and CI #20

Closed oskarth closed 1 year ago

oskarth commented 1 year ago

Problem

Once we added trusted setup (to get zkey) https://github.com/oskarth/mopro/blob/main/mopro-core/examples/circom/scripts/trusted_setup.sh CI breaks.

However, it probably doesn't make sense to add snarkjs and run trusted setup in CI, because ptau file is ~1gb and this would take a long time.

Additionally, the final zkey for keccak is ~80mb so we don't want this in the git checkout either.

Notes

One idea is to disable tests for keccak256k, but seems like a good non-trivial example circuit to test.

Another is to upload the final zkey and then download it from somewhere. That might make more sense? Could upload to S3/DigitalOcean Spaces

Acceptance criteria

CI works again while still using zkey and not bloating up CI build process too much (ideally opposite).

oskarth commented 1 year ago

Here's how semaphore-rs does it:

1) Build whole thing in Rust (this is also something we can do https://github.com/oskarth/mopro/blob/main/mopro-core/build.rs#L70) but unrelated to above issue

2) Download artifacts from e.g. https://www.trusted-setup-pse.org/semaphore/16/semaphore.zkey

One major difference is that Semaphore is a standard circuit with a real trusted setup. In our case the zkey is mostly used for testing purposes and doesn't correspond to an official "keccak256 trusted setup".