diff --git a/Cargo.toml b/Cargo.toml index d456b1a..8208299 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "common", "ring", diff --git a/common/Cargo.toml b/common/Cargo.toml index b63025b..5658a32 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -24,7 +24,24 @@ ark-ed-on-bls12-381-bandersnatch = { version = "0.4", default-features = false } [features] default = ["std"] -std = ["ark-std/std", "ark-ff/std", "ark-ec/std", "ark-poly/std", "ark-serialize/std", "fflonk/std", "merlin/std", "getrandom_or_panic/std"] -parallel = ["std", "rayon", "ark-std/parallel", "ark-ff/parallel", "ark-ec/parallel", "ark-poly/parallel"] +std = [ + "ark-std/std", + "ark-ff/std", + "ark-ec/std", + "ark-poly/std", + "ark-serialize/std", + "fflonk/std", + "merlin/std", + "getrandom_or_panic/std" +] +parallel = [ + "std", + "rayon", + "fflonk/parallel", + "ark-std/parallel", + "ark-ff/parallel", + "ark-ec/parallel", + "ark-poly/parallel" +] print-trace = ["ark-std/print-trace"] - +asm = ["fflonk/asm"] diff --git a/ring/Cargo.toml b/ring/Cargo.toml index 7869a0c..10639ed 100644 --- a/ring/Cargo.toml +++ b/ring/Cargo.toml @@ -26,6 +26,30 @@ ark-ed-on-bls12-381-bandersnatch = { version = "0.4", default-features = false } [features] default = [] -std = ["ark-std/std", "ark-ff/std", "ark-ec/std", "ark-poly/std", "ark-serialize/std", "merlin/std", "fflonk/std", "common/std"] -parallel = ["std", "rayon", "ark-std/parallel", "ark-ff/parallel", "ark-ec/parallel", "ark-poly/parallel", "common/parallel"] -print-trace = ["ark-std/print-trace", "common/print-trace"] +std = [ + "ark-std/std", + "ark-ff/std", + "ark-ec/std", + "ark-poly/std", + "ark-serialize/std", + "merlin/std", + "fflonk/std", + "common/std" +] +parallel = [ + "std", + "rayon", + "ark-std/parallel", + "ark-ff/parallel", + "ark-ec/parallel", + "ark-poly/parallel", + "common/parallel", + "fflonk/parallel" +] +print-trace = [ + "ark-std/print-trace", + "common/print-trace" +] +asm = [ + "fflonk/asm" +] diff --git a/ring/src/lib.rs b/ring/src/lib.rs index 9b7ea69..ba4a385 100644 --- a/ring/src/lib.rs +++ b/ring/src/lib.rs @@ -20,6 +20,12 @@ pub mod ring_verifier; pub type RingProof = Proof>::C>, RingEvaluations>; +/// Polynomial Commitment Schemes. +pub use fflonk::pcs; + +/// Transcript for `RingProver` and `RingVerifier` construction. +pub use merlin::Transcript; + // Calling the method for a prime-order curve results in an infinite loop. pub fn find_complement_point() -> Affine { let mut x = Curve::BaseField::zero(); @@ -74,7 +80,7 @@ mod tests { let k = rng.gen_range(0..keyset_size); // prover's secret index let pk = pks[k].clone(); - let (prover_key, verifier_key) = index::<_, CS, _>(pcs_params, &piop_params, pks); + let (prover_key, verifier_key) = index::<_, CS, _>(&pcs_params, &piop_params, &pks); // PROOF generation let secret = Fr::rand(rng); // prover's secret scalar @@ -104,7 +110,7 @@ mod tests { let keyset_size: usize = rng.gen_range(0..max_keyset_size); let pks = random_vec::(keyset_size, rng); - let (_, verifier_key) = index::<_, KZG::, _>(pcs_params, &piop_params, pks.clone()); + let (_, verifier_key) = index::<_, KZG::, _>(&pcs_params, &piop_params, &pks); let ring = Ring::<_, Bls12_381, _>::with_keys(&piop_params, &pks, &ring_builder_key); diff --git a/ring/src/piop/mod.rs b/ring/src/piop/mod.rs index 2916579..d9471a8 100644 --- a/ring/src/piop/mod.rs +++ b/ring/src/piop/mod.rs @@ -220,9 +220,9 @@ impl VerifierKey> { pub fn index, Curve: SWCurveConfig>( - pcs_params: CS::Params, + pcs_params: &CS::Params, piop_params: &PiopParams, - keys: Vec>, + keys: &[Affine], ) -> (ProverKey>, VerifierKey) { let pcs_ck = pcs_params.ck(); let pcs_raw_vk = pcs_params.raw_vk(); diff --git a/ring/src/ring.rs b/ring/src/ring.rs index e40ac7e..2e4dbd8 100644 --- a/ring/src/ring.rs +++ b/ring/src/ring.rs @@ -231,7 +231,7 @@ impl> RingBuilderKey(ring.max_keys, rng); ring.append(&keys, srs); - let (monimial_cx, monimial_cy) = get_monomial_commitment(pcs_params, &piop_params, keys.clone()); + let (monimial_cx, monimial_cy) = get_monomial_commitment(&pcs_params, &piop_params, &keys); assert_eq!(ring.cx, monimial_cx); assert_eq!(ring.cy, monimial_cy); @@ -298,9 +298,9 @@ mod tests { assert_eq!(ring, same_ring); } - fn get_monomial_commitment(pcs_params: URS, piop_params: &PiopParams, keys: Vec) -> (G1Affine, G1Affine) { - let (_, verifier_key) = crate::piop::index::<_, KZG::, _>(pcs_params, &piop_params, keys); + fn get_monomial_commitment(pcs_params: &URS, piop_params: &PiopParams, keys: &[SWAffine]) -> (G1Affine, G1Affine) { + let (_, verifier_key) = crate::piop::index::<_, KZG::, _>(pcs_params, piop_params, keys); let [monimial_cx, monimial_cy] = verifier_key.fixed_columns_committed.points; (monimial_cx.0, monimial_cy.0) } -} \ No newline at end of file +} diff --git a/ring/src/ring_prover.rs b/ring/src/ring_prover.rs index fa0a4c5..07159e7 100644 --- a/ring/src/ring_prover.rs +++ b/ring/src/ring_prover.rs @@ -12,7 +12,6 @@ pub struct RingProver, Curve: SWCurveConfig, fixed_columns: FixedColumns>, k: usize, - plonk_prover: PlonkProver, }