zkBob / fawkes-crypto

Fawkes-Crypto - zkSNARKs framework
https://github.com/zeropoolnetwork/fawkes-crypto
Apache License 2.0
2 stars 1 forks source link

Move gates parsing from proving #12

Open AllFi opened 1 year ago

AllFi commented 1 year ago

I have profiled our proving process and discovered that a significant portion of the process involves decompressing and parsing gates. image

We can decompress and parse the gates during the parameters initialization phase, which means we can move this process from the proving phase to the initialization phase. Since parameter initialization now takes place in the background, preprocessing will mostly be finished before the first proving in most cases.

I've tried to implement it, and here are some results of the decreased proving time:

But the size of the decompressed gates is huge, it's about 260 MB. Here are some potential drawbacks of this modification:

I think that this optimization makes sense for delegated prover and cloud environments, and may also make sense for PC. However, it is definitely not viable for mobile devices due to their limited memory capacity.

Related PRs:

Note: It is necessary to update zkbob-cloud and zkbob-prover to include the changes introduced in this PR.

AllFi commented 1 year ago

I've tried to apply this optimization to the relayer. Here are the results:

maikReal commented 1 year ago

Ready, waiting for https://github.com/zkBob/zeropool-relayer/issues/176 to test on staging

AllFi commented 1 year ago

@vadimnikonov1 Could you perform regression testing on the stage to confirm that everything is functioning properly?

vadimnikonov1 commented 1 year ago

The regression testing was successful