privacy-scaling-explorations / sonobe

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

More generalized API #111

Closed mimoo closed 2 months ago

mimoo commented 3 months ago

Hello hello!

We over at noname (https://github.com/zksecurity/noname) are looking on how we could integrate with sonobe. We have our own R1CS serialization and witness generator in Rust, and are compatible with snarkjs in the sense that we can produce a .r1cs and .witness files that look like what circom produces.

We wanted to know if we could call sonobe like a library (we're in Rust too!), passing it either our R1CS format or the R1CS format that you use, and for the witness generator perhaps passing a closure with our own witness generator that produces a vec of bigint or something that you understand :o

arnaucube commented 3 months ago

That would be very cool! The way that different circuit arithmetizations can be plugged in is through the FCircuit interface. I guess that one way to move it forward would be implementing it with noname logic for it, and then a FCircuit defined with noname can be plugged into sonobe and be folded and so on. Does that sound like an approach that would make sense from noname's perspective?

mimoo commented 3 months ago

mm I see, the problem is that we're not using arkworks, but maybe we could implement arkworks as a backend. It seems like it would be easier to just pass the Circom R1CS and be able to pass a closure for witness generation, which I believe we could do if you had a higher-level API than this. wdyt?

dmpierre commented 3 months ago

Hey David! I just wrote a prototype library to port noname R1CS circuits to arkworks. It now shouldn't be too hard to implement the FCircuit trait, which is what I'm going to do in the next few days.

mimoo commented 3 months ago

oh this is great :) I think we could use this to prove/verify R1CS directly in noname using arkworks (https://github.com/zksecurity/noname/issues/135)!

actually @dmpierre if you want to upstream this code we would accept a PR as well :o (up to you!)

dmpierre commented 3 months ago

Looking at how to upstream this, it looks like noname is using arkworks libraries at version 0.3. In our case, sonobe is using arkworks libraries at version 0.4. If I upstream this in the noname repo, there will be compatibility issues down the line. I will continue this work with a separate lib and continue the discussion on integrating this to noname in the PR you opened.

mimoo commented 3 months ago

thanks so much! Created an issue for that here: https://github.com/zksecurity/noname/issues/138 I believe it should be pretty straightforward for us to move to 0.4.0!