Skip to content

Commit b6ad2d0

Browse files
biniersebastiencs
authored andcommitted
feat(prover): make verifier_index Arc to enable reuse of it
1 parent 484ebe9 commit b6ad2d0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

book/src/specs/kimchi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ pub struct ProverIndex<G: KimchiCurve, OpeningProof: OpenProof<G>> {
17291729

17301730
/// The verifier index corresponding to this prover index
17311731
#[serde(skip)]
1732-
pub verifier_index: Option<VerifierIndex<G, OpeningProof>>,
1732+
pub verifier_index: Option<Arc<VerifierIndex<G, OpeningProof>>>,
17331733

17341734
/// The verifier index digest corresponding to this prover index
17351735
#[serde_as(as = "Option<o1_utils::serialization::SerdeAs>")]

kimchi/src/bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::array;
1+
use std::{array, sync::Arc};
22

33
use groupmap::{BWParameters, GroupMap};
44
use mina_curves::pasta::{Fp, Vesta, VestaParameters};
@@ -29,7 +29,7 @@ pub struct BenchmarkCtx {
2929
num_gates: usize,
3030
group_map: BWParameters<VestaParameters>,
3131
index: ProverIndex<Vesta, OpeningProof<Vesta>>,
32-
verifier_index: VerifierIndex<Vesta, OpeningProof<Vesta>>,
32+
verifier_index: Arc<VerifierIndex<Vesta, OpeningProof<Vesta>>>,
3333
}
3434

3535
impl BenchmarkCtx {

kimchi/src/prover_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub struct ProverIndex<G: KimchiCurve, OpeningProof: OpenProof<G>> {
4747

4848
/// The verifier index corresponding to this prover index
4949
#[serde(skip)]
50-
pub verifier_index: Option<VerifierIndex<G, OpeningProof>>,
50+
pub verifier_index: Option<Arc<VerifierIndex<G, OpeningProof>>>,
5151

5252
/// The verifier index digest corresponding to this prover index
5353
#[serde_as(as = "Option<o1_utils::serialization::SerdeAs>")]

kimchi/src/verifier_index.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ where
160160
/// # Panics
161161
///
162162
/// Will panic if `srs` cannot be in `cell`.
163-
pub fn verifier_index(&self) -> VerifierIndex<G, OpeningProof>
163+
pub fn verifier_index(&self) -> Arc<VerifierIndex<G, OpeningProof>>
164164
where
165165
VerifierIndex<G, OpeningProof>: Clone,
166166
{
@@ -205,7 +205,7 @@ where
205205
};
206206

207207
// TODO: Switch to commit_evaluations for all index polys
208-
VerifierIndex {
208+
Arc::new(VerifierIndex {
209209
domain,
210210
max_poly_size: self.max_poly_size,
211211
zk_rows: self.cs.zk_rows,
@@ -310,7 +310,7 @@ where
310310
endo: self.cs.endo,
311311
lookup_index,
312312
linearization: self.linearization.clone(),
313-
}
313+
})
314314
}
315315
}
316316

0 commit comments

Comments
 (0)