Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use_small_heuristics = "Default"
struct_lit_width = 18
use_field_init_shorthand = false
2 changes: 1 addition & 1 deletion src/backends/arkworks/ark_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<R: RngCore>(rng: &mut R, max_log_n: usize) -> Self {
let (prover_setup, _) = crate::setup::<BN254, _>(rng, max_log_n);
Self(prover_setup)
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ where
ProverSetup<E>: DorySerialize + DoryDeserialize,
VerifierSetup<E>: DorySerialize + DoryDeserialize,
{
#[cfg(feature = "disk-persistence")]
#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))]
{
// Try to load from disk
match setup::load_setup::<E>(max_log_n) {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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<E: PairingCurve, R: rand_core::RngCore>(
rng: &mut R,
max_log_n: usize,
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/transcript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
12 changes: 6 additions & 6 deletions src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -204,7 +204,7 @@ impl<E: PairingCurve> ProverSetup<E> {
/// - 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<PathBuf> {
let cache_directory = {
// Check for Windows first (LOCALAPPDATA is Windows-specific)
Expand Down Expand Up @@ -252,7 +252,7 @@ fn get_storage_path(max_log_n: usize) -> Option<PathBuf> {
/// - 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<E: PairingCurve>(
prover: &ProverSetup<E>,
verifier: &VerifierSetup<E>,
Expand Down Expand Up @@ -294,7 +294,7 @@ pub fn save_setup<E: PairingCurve>(
/// - 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<E: PairingCurve>(
max_log_n: usize,
) -> Result<(ProverSetup<E>, VerifierSetup<E>), crate::DoryError>
Expand Down