1
1
use ff_ext:: ExtensionField ;
2
- use itertools:: { Itertools , chain, izip} ;
2
+ use itertools:: { chain, izip, Itertools } ;
3
3
use layer:: { Layer , LayerWitness } ;
4
4
use subprotocols:: { expression:: Point , sumcheck:: SumcheckProof } ;
5
5
use transcript:: Transcript ;
@@ -13,13 +13,13 @@ pub mod layer;
13
13
pub mod mock;
14
14
15
15
#[ derive( Clone , Debug ) ]
16
- pub struct GKRCircuit < ' a > {
17
- pub layers : & ' a [ Layer ] ,
16
+ pub struct GKRCircuit {
17
+ pub layers : Vec < Layer > ,
18
18
19
19
pub n_challenges : usize ,
20
20
pub n_evaluations : usize ,
21
- pub base_openings : & ' a [ ( usize , EvalExpression ) ] ,
22
- pub ext_openings : & ' a [ ( usize , EvalExpression ) ] ,
21
+ pub base_openings : Vec < ( usize , EvalExpression ) > ,
22
+ pub ext_openings : Vec < ( usize , EvalExpression ) > ,
23
23
}
24
24
25
25
#[ derive( Clone , Debug ) ]
@@ -42,7 +42,7 @@ pub struct Evaluation<E: ExtensionField> {
42
42
43
43
pub struct GKRClaims < Evaluation > ( pub Vec < Evaluation > ) ;
44
44
45
- impl GKRCircuit < ' _ > {
45
+ impl GKRCircuit {
46
46
pub fn prove < E > (
47
47
& self ,
48
48
circuit_wit : GKRCircuitWitness < E > ,
@@ -56,7 +56,7 @@ impl GKRCircuit<'_> {
56
56
let mut evaluations = out_evals. to_vec ( ) ;
57
57
evaluations. resize ( self . n_evaluations , PointAndEval :: default ( ) ) ;
58
58
let mut challenges = challenges. to_vec ( ) ;
59
- let sumcheck_proofs = izip ! ( self . layers, circuit_wit. layers)
59
+ let sumcheck_proofs = izip ! ( & self . layers, circuit_wit. layers)
60
60
. map ( |( layer, layer_wit) | {
61
61
layer. prove ( layer_wit, & mut evaluations, & mut challenges, transcript)
62
62
} )
@@ -85,7 +85,7 @@ impl GKRCircuit<'_> {
85
85
let mut challenges = challenges. to_vec ( ) ;
86
86
let mut evaluations = out_evals. to_vec ( ) ;
87
87
evaluations. resize ( self . n_evaluations , PointAndEval :: default ( ) ) ;
88
- for ( layer, layer_proof) in izip ! ( self . layers, sumcheck_proofs) {
88
+ for ( layer, layer_proof) in izip ! ( self . layers. clone ( ) , sumcheck_proofs) {
89
89
layer. verify ( layer_proof, & mut evaluations, & mut challenges, transcript) ?;
90
90
}
91
91
@@ -99,7 +99,7 @@ impl GKRCircuit<'_> {
99
99
evaluations : & [ PointAndEval < E > ] ,
100
100
challenges : & [ E ] ,
101
101
) -> Vec < Evaluation < E > > {
102
- chain ! ( self . base_openings, self . ext_openings)
102
+ chain ! ( & self . base_openings, & self . ext_openings)
103
103
. map ( |( poly, eval) | {
104
104
let poly = * poly;
105
105
let PointAndEval { point, eval : value } = eval. evaluate ( evaluations, challenges) ;
0 commit comments