Skip to content

Commit

Permalink
Return string
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerg1996 committed May 2, 2022
1 parent 6574c74 commit 438aaf9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions bin/state-proof-gen/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,14 @@ std::string marshalling_to_blob(const PlaceholderProof &proof) {
}
}

#ifndef __EMSCRIPTEN__
std::string proof_gen() {
#else

extern "C" {

const char *proof_gen() {
#endif
auto start = std::chrono::high_resolution_clock::now();
std::ofstream out("time.log", std::ios::app);

Expand Down Expand Up @@ -318,22 +323,19 @@ const char *proof_gen() {
}
using Endianness = nil::marshalling::option::big_endian;

#ifndef __EMSCRIPTEN__
// if (vm.count("output")) {
// }
#else

#endif
std::string st = marshalling_to_blob<Endianness>(proof);
auto prover_duration =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);

out << "state-proof-gen-preprocessed-data: " << preprocessed_data_duration.count() << "ms" << std::endl;
out << "state-proof-gen-prover: " << prover_duration.count() << "ms" << std::endl;
out.close();

#ifndef __EMSCRIPTEN__
return st;
#else
return st.c_str();
}
#endif
}

int main(int argc, char *argv[]) {
Expand Down

0 comments on commit 438aaf9

Please sign in to comment.