You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the suggestion from @huitseeker, I submit this proposal to improve RecursiveSNARK a bit further.
Motivation
Improve the interface of RecursiveSNARK to make it more friendly to use. The current interface is keep passing many values as parameters meanwhile it should be a part of internal context.
Specification
Here is how RecursiveSNARK looks for now.
// produce a recursive SNARKletmut recursive_snark = RecursiveSNARK::<G1,G2,TrivialTestCircuit<<G1asGroup>::Scalar>,CubicCircuit<<G2asGroup>::Scalar>,>::new(&pp,&circuit_primary,&circuit_secondary,vec![<G1asGroup>::Scalar::ONE],vec![<G2asGroup>::Scalar::ZERO],);for _i in0..num_steps {let res = recursive_snark.prove_step(&pp,&circuit_primary,&circuit_secondary,vec![<G1asGroup>::Scalar::ONE],vec![<G2asGroup>::Scalar::ZERO],);assert!(res.is_ok());}// verify the recursive SNARKlet res = recursive_snark.verify(&pp,
num_steps,&[<G1asGroup>::Scalar::ONE],&[<G2asGroup>::Scalar::ZERO],);
You may notice this ugly code in my pull request #163.
// Frist step was already done in the constructorifself.i == 0{self.i = 1;returnOk(());}
To solve everything completly, I propose to have two major changes.
The ParamContext and is a part of RecursiveSNARK struct. The interface will be changed, and look like this.
// produce a recursive SNARKletmut recursive_snark = RecursiveSNARK::<G1,G2,TrivialTestCircuit<<G1asGroup>::Scalar>,CubicCircuit<<G2asGroup>::Scalar>,>::new(&pp,&circuit_primary,&circuit_secondary,);for _i in0..num_steps {let res = recursive_snark.prove_step();assert!(res.is_ok());}// verify the recursive SNARKlet res = recursive_snark.verify();
These two new structs will be used to store the context of proving and parameters. The RecursiveSNARK struct will be changed to this. By making ProvingContext is an optional, we can get rid of the ugly code in the pull request #163.
Thanks @chiro-hiro! Given it introduces lifetime and borrowed values in struct with minimal benefits to the interface (the current interface is somewhat simplified e.g., prove_step no longer takes initial inputs), we will defer this change to the future. So, closing it for now.
As the suggestion from @huitseeker, I submit this proposal to improve
RecursiveSNARK
a bit further.Motivation
Improve the interface of RecursiveSNARK to make it more friendly to use. The current interface is keep passing many values as parameters meanwhile it should be a part of internal context.
Specification
Here is how RecursiveSNARK looks for now.
You may notice this ugly code in my pull request #163.
To solve everything completly, I propose to have two major changes.
1. Add a
ParamContext
structThe
ParamContext
and is a part ofRecursiveSNARK
struct. The interface will be changed, and look like this.2. Add a
ProvingContext
structThese two new structs will be used to store the context of proving and parameters. The
RecursiveSNARK
struct will be changed to this. By makingProvingContext
is an optional, we can get rid of the ugly code in the pull request #163.Consideration
Arc
andMutex
to keep a single instance ofParamContext
.proving_steps
,z0_primary
,z0_secondary
...)The text was updated successfully, but these errors were encountered: