From b6ad2d0f30575120ff742e9fa5852a8fe71d000e Mon Sep 17 00:00:00 2001 From: Zura Benashvili Date: Thu, 19 Sep 2024 21:38:07 +0400 Subject: [PATCH] feat(prover): make verifier_index `Arc` to enable reuse of it --- book/src/specs/kimchi.md | 2 +- kimchi/src/bench.rs | 4 ++-- kimchi/src/prover_index.rs | 2 +- kimchi/src/verifier_index.rs | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/book/src/specs/kimchi.md b/book/src/specs/kimchi.md index 91852cdbb0..d8e2319561 100644 --- a/book/src/specs/kimchi.md +++ b/book/src/specs/kimchi.md @@ -1729,7 +1729,7 @@ pub struct ProverIndex> { /// The verifier index corresponding to this prover index #[serde(skip)] - pub verifier_index: Option>, + pub verifier_index: Option>>, /// The verifier index digest corresponding to this prover index #[serde_as(as = "Option")] diff --git a/kimchi/src/bench.rs b/kimchi/src/bench.rs index ccf4808c84..385690a09a 100644 --- a/kimchi/src/bench.rs +++ b/kimchi/src/bench.rs @@ -1,4 +1,4 @@ -use std::array; +use std::{array, sync::Arc}; use groupmap::{BWParameters, GroupMap}; use mina_curves::pasta::{Fp, Vesta, VestaParameters}; @@ -29,7 +29,7 @@ pub struct BenchmarkCtx { num_gates: usize, group_map: BWParameters, index: ProverIndex>, - verifier_index: VerifierIndex>, + verifier_index: Arc>>, } impl BenchmarkCtx { diff --git a/kimchi/src/prover_index.rs b/kimchi/src/prover_index.rs index 523d583e18..c62144cc21 100644 --- a/kimchi/src/prover_index.rs +++ b/kimchi/src/prover_index.rs @@ -47,7 +47,7 @@ pub struct ProverIndex> { /// The verifier index corresponding to this prover index #[serde(skip)] - pub verifier_index: Option>, + pub verifier_index: Option>>, /// The verifier index digest corresponding to this prover index #[serde_as(as = "Option")] diff --git a/kimchi/src/verifier_index.rs b/kimchi/src/verifier_index.rs index 67ecaeace0..b7e5209f6f 100644 --- a/kimchi/src/verifier_index.rs +++ b/kimchi/src/verifier_index.rs @@ -160,7 +160,7 @@ where /// # Panics /// /// Will panic if `srs` cannot be in `cell`. - pub fn verifier_index(&self) -> VerifierIndex + pub fn verifier_index(&self) -> Arc> where VerifierIndex: Clone, { @@ -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, @@ -310,7 +310,7 @@ where endo: self.cs.endo, lookup_index, linearization: self.linearization.clone(), - } + }) } }