-
Notifications
You must be signed in to change notification settings - Fork 1
/
gadget_from_r1cs.hpp
45 lines (31 loc) · 1.41 KB
/
gadget_from_r1cs.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
/** @file
*****************************************************************************
Declaration of interfaces for a gadget that can be created from an R1CS constraint system.
*****************************************************************************
* @author This file is part of libsnark, developed by SCIPR Lab
* and contributors (see AUTHORS).
* @copyright MIT license (see LICENSE file)
*****************************************************************************/
#ifndef GADGET_FROM_R1CS_HPP_
#define GADGET_FROM_R1CS_HPP_
#include <map>
#include <libsnark/gadgetlib1/gadget.hpp>
namespace libsnark {
template<typename FieldT>
class gadget_from_r1cs : public gadget<FieldT> {
private:
const std::vector<pb_variable_array<FieldT> > vars;
const r1cs_constraint_system<FieldT> cs;
std::map<size_t, size_t> cs_to_vars;
public:
gadget_from_r1cs(protoboard<FieldT> &pb,
const std::vector<pb_variable_array<FieldT> > &vars,
const r1cs_constraint_system<FieldT> &cs,
const std::string &annotation_prefix);
void generate_r1cs_constraints();
void generate_r1cs_witness(const r1cs_primary_input<FieldT> &primary_input,
const r1cs_auxiliary_input<FieldT> &auxiliary_input);
};
} // libsnark
#include <libsnark/gadgetlib1/gadgets/gadget_from_r1cs.tcc>
#endif // GADGET_FROM_R1CS_HPP_