privacy-scaling-explorations / sonobe

Experimental folding schemes library
https://privacy-scaling-explorations.github.io/sonobe-docs/
MIT License
204 stars 53 forks source link

Feat/better browser support #169

Open CPerezz opened 1 month ago

CPerezz commented 1 month ago

This PR resolves #155

The current approach, allows to:

  1. Re-use the same traits to fit-in the Circom browser folding.
  2. Allows to receive the Circom-generated witness from the browser and load them into the circuit in order to fold via prove_step.
  3. Implements a mechanism that allows to keep having the same exact APIs (Exept for the addition of load_witness trait fn for FCircuit.

Current benchmarks situate the folding cost within the browser in arround 3.9s. Which is definitely not good. But better than the current status.

An example on how to use this can actually be seen at https://github.com/CPerezz/wasm-sonobe-integration

CPerezz commented 1 month ago

I just noticed an important thing. Unsure if it's related specifically to that. But I've tried a ton of configs and can't really tell any other cause.

Originally, with this PR I was getting ~4s prove_step calls. When my battery dropped to <25%, i got a performance regression of +5x. I was at ~27s per fold.

I'm not sure if this is expected. But it's definitely a pain point. I know having low battery doesn't help with performance. But wasn't expecting to get such a pitfall..

Does anyone know if that's a thing?

CPerezz commented 1 month ago

Could it be updated to fold >3 iterations? so that we can check that everything works fine when folding the output of the previous fold.

I wanted to wait for the 0xPARC folks to code the full thing to actually merge this. As I don't want to use my example as a test of correctness.

But I can update it if desired.