From fc79a38a92fcf2a759c4928f73cdbc0a0906becb Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Thu, 2 Mar 2023 08:59:21 -0700 Subject: [PATCH] fix: Wrap each use of filesystem library in ifndef __wasm__ (https://github.com/AztecProtocol/barretenberg/pull/181) --- .../join_split_example/proofs/compute_circuit_data.hpp | 7 +++++++ .../aztec/proof_system/proving_key/proving_key.test.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/circuits/cpp/barretenberg/cpp/src/aztec/join_split_example/proofs/compute_circuit_data.hpp b/circuits/cpp/barretenberg/cpp/src/aztec/join_split_example/proofs/compute_circuit_data.hpp index d76acf99a05..e9fed596b3a 100644 --- a/circuits/cpp/barretenberg/cpp/src/aztec/join_split_example/proofs/compute_circuit_data.hpp +++ b/circuits/cpp/barretenberg/cpp/src/aztec/join_split_example/proofs/compute_circuit_data.hpp @@ -6,7 +6,10 @@ #include #include #include + +#ifndef __wasm__ #include +#endif namespace join_split_example { namespace proofs { @@ -91,11 +94,13 @@ circuit_data get_circuit_data(std::string const& name, } } +#ifndef __wasm__ // If we're saving data, create the circuit data directory. if (save) { std::filesystem::create_directories(key_path.c_str()); std::filesystem::create_directories(circuit_key_path.c_str()); } +#endif if (pk) { auto pk_dir = circuit_key_path + "/proving_key"; @@ -145,6 +150,7 @@ circuit_data get_circuit_data(std::string const& name, name + name_suffix_for_benchmarks, "Proving key computed in", timer.toString()); +#ifndef __wasm__ if (save) { info(name, ": Saving proving key..."); std::filesystem::create_directories(pk_dir.c_str()); @@ -156,6 +162,7 @@ circuit_data get_circuit_data(std::string const& name, } info(name, ": Saved in ", write_timer.toString(), "s"); } +#endif } } diff --git a/circuits/cpp/barretenberg/cpp/src/aztec/proof_system/proving_key/proving_key.test.cpp b/circuits/cpp/barretenberg/cpp/src/aztec/proof_system/proving_key/proving_key.test.cpp index fe07b31026e..871d5a85976 100644 --- a/circuits/cpp/barretenberg/cpp/src/aztec/proof_system/proving_key/proving_key.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/aztec/proof_system/proving_key/proving_key.test.cpp @@ -3,7 +3,10 @@ #include "proving_key.hpp" #include "serialize.hpp" #include "plonk/composer/standard_composer.hpp" + +#ifndef __wasm__ #include +#endif using namespace barretenberg; using namespace bonk; @@ -45,6 +48,7 @@ TEST(proving_key, proving_key_from_serialized_key) } // Test that a proving key can be serialized/deserialized using mmap +#ifndef __wasm__ TEST(proving_key, proving_key_from_mmaped_key) { plonk::StandardComposer composer = plonk::StandardComposer(); @@ -108,4 +112,5 @@ TEST(proving_key, proving_key_from_mmaped_key) EXPECT_EQ(p_key.circuit_size, pk_data.circuit_size); EXPECT_EQ(p_key.num_public_inputs, pk_data.num_public_inputs); EXPECT_EQ(p_key.contains_recursive_proof, pk_data.contains_recursive_proof); -} \ No newline at end of file +} +#endif \ No newline at end of file