Skip to content

Commit

Permalink
feat(prover): make verifier_index Arc to enable reuse of it
Browse files Browse the repository at this point in the history
  • Loading branch information
binier authored and sebastiencs committed Sep 19, 2024
1 parent 484ebe9 commit b6ad2d0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion book/src/specs/kimchi.md
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ pub struct ProverIndex<G: KimchiCurve, OpeningProof: OpenProof<G>> {

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

/// The verifier index digest corresponding to this prover index
#[serde_as(as = "Option<o1_utils::serialization::SerdeAs>")]
Expand Down
4 changes: 2 additions & 2 deletions kimchi/src/bench.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::array;
use std::{array, sync::Arc};

use groupmap::{BWParameters, GroupMap};
use mina_curves::pasta::{Fp, Vesta, VestaParameters};
Expand Down Expand Up @@ -29,7 +29,7 @@ pub struct BenchmarkCtx {
num_gates: usize,
group_map: BWParameters<VestaParameters>,
index: ProverIndex<Vesta, OpeningProof<Vesta>>,
verifier_index: VerifierIndex<Vesta, OpeningProof<Vesta>>,
verifier_index: Arc<VerifierIndex<Vesta, OpeningProof<Vesta>>>,
}

impl BenchmarkCtx {
Expand Down
2 changes: 1 addition & 1 deletion kimchi/src/prover_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct ProverIndex<G: KimchiCurve, OpeningProof: OpenProof<G>> {

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

/// The verifier index digest corresponding to this prover index
#[serde_as(as = "Option<o1_utils::serialization::SerdeAs>")]
Expand Down
6 changes: 3 additions & 3 deletions kimchi/src/verifier_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ where
/// # Panics
///
/// Will panic if `srs` cannot be in `cell`.
pub fn verifier_index(&self) -> VerifierIndex<G, OpeningProof>
pub fn verifier_index(&self) -> Arc<VerifierIndex<G, OpeningProof>>
where
VerifierIndex<G, OpeningProof>: Clone,
{
Expand Down Expand Up @@ -205,7 +205,7 @@ where
};

// TODO: Switch to commit_evaluations for all index polys
VerifierIndex {
Arc::new(VerifierIndex {
domain,
max_poly_size: self.max_poly_size,
zk_rows: self.cs.zk_rows,
Expand Down Expand Up @@ -310,7 +310,7 @@ where
endo: self.cs.endo,
lookup_index,
linearization: self.linearization.clone(),
}
})
}
}

Expand Down

0 comments on commit b6ad2d0

Please sign in to comment.