forked from iden3/rapidsnark-old
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfullprover.hpp
53 lines (38 loc) · 1.22 KB
/
fullprover.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef FULLPROVER_H
#define FULLPROVER_H
#include <nlohmann/json.hpp>
using json = nlohmann::json;
#include <mutex>
#include "alt_bn128.hpp"
#include "groth16.hpp"
#include "binfile_utils.hpp"
#include "zkey_utils.hpp"
class FullProver {
enum Status {aborted = -2, busy = -1, failed = 0, success = 1, unverified =2, uninitialized=3, initializing=5, ready=6 };
Status status;
std::mutex mtx;
std::string pendingInput;
std::string executingInput;
std::string pendingCircuit;
std::string executingCircuit;
std::map<std::string, std::unique_ptr<Groth16::Prover<AltBn128::Engine>>> provers;
std::map<std::string, std::unique_ptr<ZKeyUtils::Header>> zkHeaders;
std::map<std::string, std::unique_ptr<BinFileUtils::BinFile>> zKeys;
mpz_t altBbn128r;
json proof;
json pubData;
std::string errString;
bool canceled;
bool isCanceled();
void calcFinished();
void thread_calculateProve();
void checkPending();
public:
FullProver(std::string zkeyFileNames[], int size);
~FullProver();
void startProve(std::string input, std::string circuit);
void abort();
json getStatus();
std::string &getErrString() { return errString; };
};
#endif // FULLPROVER_H