-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow using custom R1CS to QAP reductions #34
feat: allow using custom R1CS to QAP reductions #34
Conversation
fix: make r1cs_to_qap public
fix: make more structures public to allow r1cs to QAP customization
src/r1cs_to_qap.rs
Outdated
pub(crate) struct R1CStoQAP; | ||
pub struct R1CStoQAP; | ||
|
||
impl R1CStoQAP { | ||
pub trait QAPCalculator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I would rename the trait to R1CSToQAP
, and change the struct name to something more specific; maybe LibsnarkReduction
, and the new circom one would be CircomReduction
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo the naming change!
Actually another suggestion: maybe we can parameterize the Groth16 struct itself by a new generic type parameter bounded by the |
Addressed your comments!
I think we should be considering a larger refactor (which I've started here) so as to allow the prover to cache intermediate steps, which should also help with having a cleaner abstraction around the QAP type |
Also, for the documentation, should we add the details of the reduction as described in libsnark: https://github.com/scipr-lab/libsnark/blob/2af440246fa2c3d0b1b0a425fb6abd8cc8b9c54d/libsnark/reductions/r1cs_to_qap/r1cs_to_qap.tcc |
I updated the API names slightly @gakonst, but this is good to merge otherwise. Any comments? |
Description
As discussed, it is potentially useful to allow customizing the R1CS to QAP conversion, for cases such as Circom's where they skip some of the FFTs.
Implementation
This PR abstracts the R1CS to QAP to a trait and exposes methods for providing implementors of the trait. It maintains backwards compat.