diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..3237dad --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,3 @@ +use_small_heuristics = "Default" +struct_lit_width = 18 +use_field_init_shorthand = false diff --git a/src/backends/arkworks/ark_setup.rs b/src/backends/arkworks/ark_setup.rs index cff54a8..ece2669 100644 --- a/src/backends/arkworks/ark_setup.rs +++ b/src/backends/arkworks/ark_setup.rs @@ -40,7 +40,7 @@ impl ArkworksProverSetup { } /// Load prover setup from disk cache, or generate and cache if not available - #[cfg(feature = "disk-persistence")] + #[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] pub fn new_from_urs(rng: &mut R, max_log_n: usize) -> Self { let (prover_setup, _) = crate::setup::(rng, max_log_n); Self(prover_setup) diff --git a/src/lib.rs b/src/lib.rs index 6adb0d0..ae90490 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -145,7 +145,7 @@ where ProverSetup: DorySerialize + DoryDeserialize, VerifierSetup: DorySerialize + DoryDeserialize, { - #[cfg(feature = "disk-persistence")] + #[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] { // Try to load from disk match setup::load_setup::(max_log_n) { @@ -174,7 +174,7 @@ where (prover_setup, verifier_setup) } - #[cfg(not(feature = "disk-persistence"))] + #[cfg(any(not(feature = "disk-persistence"), target_arch = "wasm32"))] { tracing::info!("Generating new setup for max_log_n={}", max_log_n); @@ -203,7 +203,7 @@ where /// /// # Availability /// This function is only available when the `disk-persistence` feature is enabled. -#[cfg(feature = "disk-persistence")] +#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] pub fn generate_urs( rng: &mut R, max_log_n: usize, diff --git a/src/primitives/transcript.rs b/src/primitives/transcript.rs index 8e020be..d745d5f 100644 --- a/src/primitives/transcript.rs +++ b/src/primitives/transcript.rs @@ -5,7 +5,7 @@ use crate::primitives::arithmetic::{Group, PairingCurve}; use crate::primitives::DorySerialize; -/// Transcript to standardize fiat shamir across different transcript impleemntations +/// Transcript to standardize fiat shamir across different transcript implementations pub trait Transcript { type Curve: PairingCurve; fn append_bytes(&mut self, label: &[u8], bytes: &[u8]); diff --git a/src/setup.rs b/src/setup.rs index 841bd45..6a60806 100644 --- a/src/setup.rs +++ b/src/setup.rs @@ -8,11 +8,11 @@ use crate::primitives::arithmetic::{Group, PairingCurve}; use crate::primitives::serialization::{DoryDeserialize, DorySerialize}; use rand_core::RngCore; -#[cfg(feature = "disk-persistence")] +#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] use std::fs::{self, File}; -#[cfg(feature = "disk-persistence")] +#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] use std::io::{BufReader, BufWriter}; -#[cfg(feature = "disk-persistence")] +#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] use std::path::PathBuf; /// Prover setup parameters @@ -204,7 +204,7 @@ impl ProverSetup { /// - Windows: `{FOLDERID_LocalAppData}\dory\` /// /// Note: Detects OS at runtime by checking environment variables then chooses XDG cache directory for persistent storage. -#[cfg(feature = "disk-persistence")] +#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] fn get_storage_path(max_log_n: usize) -> Option { let cache_directory = { // Check for Windows first (LOCALAPPDATA is Windows-specific) @@ -252,7 +252,7 @@ fn get_storage_path(max_log_n: usize) -> Option { /// - Directory creation fails /// - File creation fails /// - Serialization of prover or verifier setup fails -#[cfg(feature = "disk-persistence")] +#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] pub fn save_setup( prover: &ProverSetup, verifier: &VerifierSetup, @@ -294,7 +294,7 @@ pub fn save_setup( /// - Setup file doesn't exist /// - File cannot be opened /// - Deserialization fails -#[cfg(feature = "disk-persistence")] +#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))] pub fn load_setup( max_log_n: usize, ) -> Result<(ProverSetup, VerifierSetup), crate::DoryError>