From 6d44f7d5880a51d230e5dab3f6ae6118789813c0 Mon Sep 17 00:00:00 2001 From: Hanting Zhang Date: Tue, 20 Feb 2024 17:52:48 +0000 Subject: [PATCH] use home, non-wasm builds --- Cargo.toml | 1 + src/data.rs | 3 ++- src/lib.rs | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ae86589c4..9ff1f16bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,7 @@ camino = "1.1.6" # grumpkin-msm has been patched to support MSMs for the pasta curve cycle # see: https://github.com/lurk-lab/grumpkin-msm/pull/3 grumpkin-msm = { git = "https://github.com/lurk-lab/grumpkin-msm", branch = "dev" } +home = "0.5.9" [target.'cfg(target_arch = "wasm32")'.dependencies] getrandom = { version = "0.2.0", default-features = false, features = ["js"] } diff --git a/src/data.rs b/src/data.rs index 022074ed1..71b4d8bfc 100644 --- a/src/data.rs +++ b/src/data.rs @@ -30,7 +30,8 @@ pub struct DataConfig { /// Initializes the global configuration for Arecibo data storage, setting up the root directory /// and initializing counters. We create the root directory if it does not already exist. pub fn init_config() -> DataConfig { - let root_dir = Utf8PathBuf::from(ARECIBO_DATA); + let root_dir = home::home_dir().unwrap().join(ARECIBO_DATA); + let root_dir = Utf8PathBuf::from_path_buf(root_dir).unwrap(); if !root_dir.exists() { fs::create_dir_all(&root_dir).expect("Failed to create arecibo data directory"); } diff --git a/src/lib.rs b/src/lib.rs index a50996e8e..1471f6b1c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,12 +25,15 @@ pub mod r1cs; pub mod spartan; pub mod traits; +#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] pub mod data; pub mod supernova; use once_cell::sync::OnceCell; use traits::{CurveCycleEquipped, Dual}; +#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] +use crate::data::{write_arecibo_data, write_data}; use crate::digest::{DigestComputer, SimpleDigestible}; use crate::{ bellpepper::{ @@ -38,7 +41,6 @@ use crate::{ shape_cs::ShapeCS, solver::SatisfyingAssignment, }, - data::{write_arecibo_data, write_data}, r1cs::R1CSResult, }; use abomonation::Abomonation; @@ -501,7 +503,10 @@ where }; let config = RecursiveSNARKConfig { + #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] write_data: write_data(), + #[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))] + write_data: false, }; Ok(Self { @@ -611,6 +616,7 @@ where &mut self.buffer_primary.ABC_Z_2, )?; + #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] if self.config.write_data { let W = l_w_primary.W; write_arecibo_data(