Skip to content

Commit

Permalink
fix: Wrap each use of filesystem library in ifndef __wasm__ (AztecPro…
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored Mar 2, 2023
1 parent 255bff3 commit fc79a38
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
#include <sys/stat.h>
#include <common/timer.hpp>
#include <proof_system/proving_key/serialize.hpp>

#ifndef __wasm__
#include <filesystem>
#endif

namespace join_split_example {
namespace proofs {
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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());
Expand All @@ -156,6 +162,7 @@ circuit_data get_circuit_data(std::string const& name,
}
info(name, ": Saved in ", write_timer.toString(), "s");
}
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#include "proving_key.hpp"
#include "serialize.hpp"
#include "plonk/composer/standard_composer.hpp"

#ifndef __wasm__
#include <filesystem>
#endif

using namespace barretenberg;
using namespace bonk;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
}
#endif

0 comments on commit fc79a38

Please sign in to comment.