File tree Expand file tree Collapse file tree 7 files changed +16
-3
lines changed
Expand file tree Collapse file tree 7 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 11use super :: group:: { GroupElement , VartimeMultiscalarMul , GROUP_BASEPOINT_COMPRESSED } ;
22use super :: scalar:: Scalar ;
33use digest:: { ExtendableOutput , Input , XofReader } ;
4+ use serde:: { Deserialize , Serialize } ;
45use sha3:: Shake256 ;
56
6- #[ derive( Debug ) ]
7+ #[ derive( Debug , Serialize , Deserialize ) ]
78pub struct MultiCommitGens {
89 pub n : usize ,
910 pub G : Vec < GroupElement > ,
Original file line number Diff line number Diff line change @@ -14,13 +14,14 @@ use serde::{Deserialize, Serialize};
1414#[ cfg( feature = "multicore" ) ]
1515use rayon:: prelude:: * ;
1616
17- #[ derive( Debug ) ]
17+ #[ derive( Debug , Serialize , Deserialize ) ]
1818pub struct DensePolynomial {
1919 num_vars : usize , // the number of variables in the multilinear polynomial
2020 len : usize ,
2121 Z : Vec < Scalar > , // evaluations of the polynomial in all the 2^num_vars Boolean inputs
2222}
2323
24+ #[ derive( Serialize , Deserialize ) ]
2425pub struct PolyCommitmentGens {
2526 pub gens : DotProductProofGens ,
2627}
Original file line number Diff line number Diff line change @@ -45,17 +45,19 @@ use timer::Timer;
4545use transcript:: { AppendToTranscript , ProofTranscript } ;
4646
4747/// `ComputationCommitment` holds a public preprocessed NP statement (e.g., R1CS)
48+ #[ derive( Serialize , Deserialize ) ]
4849pub struct ComputationCommitment {
4950 comm : R1CSCommitment ,
5051}
5152
5253/// `ComputationDecommitment` holds information to decommit `ComputationCommitment`
54+ #[ derive( Serialize , Deserialize ) ]
5355pub struct ComputationDecommitment {
5456 decomm : R1CSDecommitment ,
5557}
5658
5759/// `Assignment` holds an assignment of values to either the inputs or variables in an `Instance`
58- #[ derive( Clone ) ]
60+ #[ derive( Clone , Serialize , Deserialize ) ]
5961pub struct Assignment {
6062 assignment : Vec < Scalar > ,
6163}
@@ -276,6 +278,7 @@ impl Instance {
276278}
277279
278280/// `SNARKGens` holds public parameters for producing and verifying proofs with the Spartan SNARK
281+ #[ derive( Serialize , Deserialize ) ]
279282pub struct SNARKGens {
280283 gens_r1cs_sat : R1CSGens ,
281284 gens_r1cs_eval : R1CSCommitmentGens ,
Original file line number Diff line number Diff line change @@ -404,6 +404,7 @@ impl DotProductProof {
404404 }
405405}
406406
407+ #[ derive( Serialize , Deserialize ) ]
407408pub struct DotProductProofGens {
408409 n : usize ,
409410 pub gens_n : MultiCommitGens ,
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ pub struct R1CSInstance {
2525 C : SparseMatPolynomial ,
2626}
2727
28+ #[ derive( Serialize , Deserialize ) ]
2829pub struct R1CSCommitmentGens {
2930 gens : SparseMatPolyCommitmentGens ,
3031}
@@ -63,6 +64,7 @@ impl AppendToTranscript for R1CSCommitment {
6364 }
6465}
6566
67+ #[ derive( Serialize , Deserialize ) ]
6668pub struct R1CSDecommitment {
6769 dense : MultiSparseMatPolynomialAsDense ,
6870}
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ pub struct R1CSProof {
3636 proof_eq_sc_phase2 : EqualityProof ,
3737}
3838
39+ #[ derive( Serialize , Deserialize ) ]
3940pub struct R1CSSumcheckGens {
4041 gens_1 : MultiCommitGens ,
4142 gens_3 : MultiCommitGens ,
@@ -57,6 +58,7 @@ impl R1CSSumcheckGens {
5758 }
5859}
5960
61+ #[ derive( Serialize , Deserialize ) ]
6062pub struct R1CSGens {
6163 gens_sc : R1CSSumcheckGens ,
6264 gens_pc : PolyCommitmentGens ,
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ impl AppendToTranscript for DerefsCommitment {
209209 }
210210}
211211
212+ #[ derive( Serialize , Deserialize ) ]
212213struct AddrTimestamps {
213214 ops_addr_usize : Vec < Vec < usize > > ,
214215 ops_addr : Vec < DensePolynomial > ,
@@ -270,6 +271,7 @@ impl AddrTimestamps {
270271 }
271272}
272273
274+ #[ derive( Serialize , Deserialize ) ]
273275pub struct MultiSparseMatPolynomialAsDense {
274276 batch_size : usize ,
275277 val : Vec < DensePolynomial > ,
@@ -279,6 +281,7 @@ pub struct MultiSparseMatPolynomialAsDense {
279281 comb_mem : DensePolynomial ,
280282}
281283
284+ #[ derive( Serialize , Deserialize ) ]
282285pub struct SparseMatPolyCommitmentGens {
283286 gens_ops : PolyCommitmentGens ,
284287 gens_mem : PolyCommitmentGens ,
You can’t perform that action at this time.
0 commit comments