Skip to content

Commit

Permalink
gate file generation behind test feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin-Ray committed Oct 5, 2024
1 parent c18fb01 commit 5e85414
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crates/proof-of-sql/src/proof_primitive/dory/public_parameters.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down Expand Up @@ -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
Expand All @@ -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<Self> {
// Open the file at the specified path
Expand All @@ -98,6 +101,7 @@ impl PublicParameters {
}
}

#[cfg(test)]
impl CanonicalSerialize for PublicParameters {
fn serialize_with_mode<W: std::io::Write>(
&self,
Expand Down Expand Up @@ -161,6 +165,7 @@ impl CanonicalSerialize for PublicParameters {
}
}

#[cfg(test)]
impl CanonicalDeserialize for PublicParameters {
fn deserialize_with_mode<R: std::io::Read>(
mut reader: R,
Expand Down Expand Up @@ -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> {
Expand Down

0 comments on commit 5e85414

Please sign in to comment.