diff --git a/Cargo.toml b/Cargo.toml index 0baec55..b583430 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ resolver = "2" members = [ # "evm-vrfier", - "pasta-tree", +# "pasta-tree", "w3f-plonk-common", "w3f-ring-proof", # "w3f-ring-vrf-snark", diff --git a/w3f-plonk-common/Cargo.toml b/w3f-plonk-common/Cargo.toml index f3393a7..8850113 100644 --- a/w3f-plonk-common/Cargo.toml +++ b/w3f-plonk-common/Cargo.toml @@ -51,3 +51,4 @@ parallel = [ print-trace = ["ark-std/print-trace"] asm = ["w3f-pcs/asm"] test-vectors = [] +twisted_edwards = [] \ No newline at end of file diff --git a/w3f-plonk-common/src/gadgets/ec/mod.rs b/w3f-plonk-common/src/gadgets/ec/mod.rs index 7c54d37..04b023e 100644 --- a/w3f-plonk-common/src/gadgets/ec/mod.rs +++ b/w3f-plonk-common/src/gadgets/ec/mod.rs @@ -8,8 +8,11 @@ use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; use ark_std::marker::PhantomData; use ark_std::vec::Vec; +#[cfg(not(feature = "twisted_edwards"))] pub mod sw_cond_add; +#[cfg(feature = "twisted_edwards")] pub mod te_cond_add; +#[cfg(feature = "twisted_edwards")] pub mod te_doubling; // A vec of affine points from the prime-order subgroup of the curve whose base field enables FFTs, diff --git a/w3f-ring-proof/Cargo.toml b/w3f-ring-proof/Cargo.toml index 893c03f..230ba94 100644 --- a/w3f-ring-proof/Cargo.toml +++ b/w3f-ring-proof/Cargo.toml @@ -29,26 +29,27 @@ name = "ring_proof" harness = false [features] -default = [ "std" ] +default = ["std", "twisted_edwards"] std = [ - "ark-std/std", - "ark-ff/std", - "ark-ec/std", - "ark-poly/std", - "ark-serialize/std", - "w3f-pcs/std", - "w3f-plonk-common/std" + "ark-std/std", + "ark-ff/std", + "ark-ec/std", + "ark-poly/std", + "ark-serialize/std", + "w3f-pcs/std", + "w3f-plonk-common/std" ] parallel = [ - "std", - "rayon", - "ark-std/parallel", - "ark-ff/parallel", - "ark-ec/parallel", - "ark-poly/parallel", - "w3f-plonk-common/parallel", - "w3f-pcs/parallel" + "std", + "rayon", + "ark-std/parallel", + "ark-ff/parallel", + "ark-ec/parallel", + "ark-poly/parallel", + "w3f-plonk-common/parallel", + "w3f-pcs/parallel" ] print-trace = ["ark-std/print-trace"] -asm = [ "w3f-pcs/asm" ] -test-vectors = [ "w3f-plonk-common/test-vectors" ] +asm = ["w3f-pcs/asm"] +test-vectors = ["w3f-plonk-common/test-vectors"] +twisted_edwards = ["w3f-plonk-common/twisted_edwards"] diff --git a/w3f-ring-proof/src/piop/prover.rs b/w3f-ring-proof/src/piop/prover.rs index 285f7fb..a0076e8 100644 --- a/w3f-ring-proof/src/piop/prover.rs +++ b/w3f-ring-proof/src/piop/prover.rs @@ -1,5 +1,3 @@ -use ark_ec::short_weierstrass::{Affine as SwAffine, SWCurveConfig}; -use ark_ec::twisted_edwards::{Affine as TeAffine, TECurveConfig}; use ark_ec::AffineRepr; use ark_ff::PrimeField; use ark_poly::univariate::DensePolynomial; @@ -140,6 +138,9 @@ impl> PiopProver { } } +#[cfg(feature = "twisted_edwards")] +use ark_ec::twisted_edwards::{Affine as TeAffine, TECurveConfig}; +#[cfg(feature = "twisted_edwards")] impl ProverPiop for PiopProver> where F: PrimeField, @@ -202,6 +203,9 @@ where } } +#[cfg(not(feature = "twisted_edwards"))] +use ark_ec::short_weierstrass::{Affine as SwAffine, SWCurveConfig}; +#[cfg(not(feature = "twisted_edwards"))] impl ProverPiop for PiopProver> where F: PrimeField, diff --git a/w3f-ring-proof/src/piop/verifier.rs b/w3f-ring-proof/src/piop/verifier.rs index eeb53b0..06de09b 100644 --- a/w3f-ring-proof/src/piop/verifier.rs +++ b/w3f-ring-proof/src/piop/verifier.rs @@ -1,5 +1,3 @@ -use ark_ec::short_weierstrass::{Affine as SwAffine, SWCurveConfig}; -use ark_ec::twisted_edwards::{Affine as TeAffine, TECurveConfig}; use ark_ec::AffineRepr; use ark_ff::PrimeField; use ark_std::marker::PhantomData; @@ -102,6 +100,9 @@ impl, P: AffineRepr> PiopVerifier } } +#[cfg(feature = "twisted_edwards")] +use ark_ec::twisted_edwards::{Affine as TeAffine, TECurveConfig}; +#[cfg(feature = "twisted_edwards")] impl, Jubjub: TECurveConfig> VerifierPiop for PiopVerifier> { @@ -150,6 +151,9 @@ impl, Jubjub: TECurveConfig> Veri } } +#[cfg(not(feature = "twisted_edwards"))] +use ark_ec::short_weierstrass::{Affine as SwAffine, SWCurveConfig}; +#[cfg(not(feature = "twisted_edwards"))] impl, Jubjub: SWCurveConfig> VerifierPiop for PiopVerifier> {