From 5e854143baf0c9a634868ef16bfbdc285e37f7d4 Mon Sep 17 00:00:00 2001 From: "dustin.ray" Date: Fri, 4 Oct 2024 17:31:45 -0700 Subject: [PATCH] gate file generation behind test feature --- .../src/proof_primitive/dory/public_parameters.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/proof-of-sql/src/proof_primitive/dory/public_parameters.rs b/crates/proof-of-sql/src/proof_primitive/dory/public_parameters.rs index 272eac339..4c4c400a0 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/public_parameters.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/public_parameters.rs @@ -1,11 +1,13 @@ use super::{G1Affine, G2Affine}; use alloc::vec::Vec; use ark_ff::UniformRand; -use ark_serialize::{ - CanonicalDeserialize, CanonicalSerialize, Compress, SerializationError, Valid, Validate, -}; +#[cfg(test)] +use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError, Valid}; +#[cfg(test)] +use ark_serialize::{Compress, Validate}; use ark_std::rand::{CryptoRng, Rng}; use core::iter; +#[cfg(test)] use std::{ fs::File, io::{BufReader, BufWriter, Read, Write}, @@ -58,7 +60,7 @@ impl PublicParameters { Gamma_2_fin, } } - + #[cfg(test)] /// Function to save PublicParameters to a file in binary form pub fn save_to_file(&self, path: &Path) -> std::io::Result<()> { // Create or open the file at the specified path @@ -76,6 +78,7 @@ impl PublicParameters { Ok(()) } + #[cfg(test)] /// Function to load PublicParameters from a file in binary form pub fn load_from_file(path: &Path) -> std::io::Result { // Open the file at the specified path @@ -98,6 +101,7 @@ impl PublicParameters { } } +#[cfg(test)] impl CanonicalSerialize for PublicParameters { fn serialize_with_mode( &self, @@ -161,6 +165,7 @@ impl CanonicalSerialize for PublicParameters { } } +#[cfg(test)] impl CanonicalDeserialize for PublicParameters { fn deserialize_with_mode( mut reader: R, @@ -213,6 +218,7 @@ impl CanonicalDeserialize for PublicParameters { // Remove unnecessary methods if they're not overridden } +#[cfg(test)] // Implement the Valid trait to perform validation on deserialized data impl Valid for PublicParameters { fn check(&self) -> Result<(), SerializationError> {