diff --git a/ring/src/lib.rs b/ring/src/lib.rs index 9619043..e4c2350 100644 --- a/ring/src/lib.rs +++ b/ring/src/lib.rs @@ -96,7 +96,7 @@ mod tests { let ring = Ring::<_, Bls12_381, _>::with_keys(&piop_params, &pks, &ring_builder_key); - let fixed_columns_committed = FixedColumnsCommitted::from_ring(ring); + let fixed_columns_committed = FixedColumnsCommitted::from_ring(&ring); assert_eq!(fixed_columns_committed, verifier_key.fixed_columns_committed); } diff --git a/ring/src/piop/mod.rs b/ring/src/piop/mod.rs index 30eeceb..7b003bc 100644 --- a/ring/src/piop/mod.rs +++ b/ring/src/piop/mod.rs @@ -7,6 +7,8 @@ use ark_std::{vec, vec::Vec}; use ark_std::marker::PhantomData; use fflonk::pcs::{Commitment, PCS, PcsParams}; use fflonk::pcs::kzg::commitment::KzgCommitment; +use fflonk::pcs::kzg::KZG; +use fflonk::pcs::kzg::params::RawKzgVerifierKey; use common::{Column, ColumnsCommited, ColumnsEvaluated, FieldColumn}; use common::gadgets::sw_cond_add::AffineColumn; @@ -96,7 +98,7 @@ impl> FixedColumnsCommitted { impl FixedColumnsCommitted> { pub fn from_ring>( - ring: Ring, + ring: &Ring, ) -> Self { let cx = KzgCommitment(ring.cx.into_affine()); let cy = KzgCommitment(ring.cy.into_affine()); @@ -126,7 +128,6 @@ pub struct ProverKey, G: AffineRepr> { pub(crate) verifier_key: VerifierKey, // used in the Fiat-Shamir transform } - #[derive(Clone, CanonicalSerialize, CanonicalDeserialize)] pub struct VerifierKey> { pub(crate) pcs_raw_vk: ::RVK, @@ -134,6 +135,19 @@ pub struct VerifierKey> { //TODO: domain } +impl VerifierKey> { + pub fn from_ring_and_kzg_vk>( + ring: &Ring, + kzg_vk: RawKzgVerifierKey, + ) -> Self { + Self { + pcs_raw_vk: kzg_vk, + fixed_columns_committed: FixedColumnsCommitted::from_ring(ring), + } + } +} + + pub fn index, Curve: SWCurveConfig>( pcs_params: CS::Params, piop_params: &PiopParams,