Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
set_commitment_gadget.hpp
Go to the documentation of this file.
1 
7 #ifndef SET_COMMITMENT_GADGET_HPP_
8 #define SET_COMMITMENT_GADGET_HPP_
9 
15 
16 namespace libsnark
17 {
18 
19 template<typename FieldT, typename HashT>
21 
22 template<typename FieldT, typename HashT>
23 class set_commitment_gadget : public gadget<FieldT>
24 {
25 private:
26  std::shared_ptr<block_variable<FieldT>> element_block;
27  std::shared_ptr<digest_variable<FieldT>> element_digest;
28  std::shared_ptr<HashT> hash_element;
29  std::shared_ptr<merkle_tree_check_read_gadget<FieldT, HashT>>
30  check_membership;
31 
32 public:
33  size_t tree_depth;
38 
41  const size_t max_entries,
46  const std::string &annotation_prefix);
47 
49  void generate_r1cs_witness();
50 
51  static size_t root_size_in_bits();
52 };
53 
54 template<typename FieldT, typename HashT> void test_set_commitment_gadget();
55 
56 } // namespace libsnark
57 
59 
60 #endif // SET_COMMITMENT_GADGET_HPP_
libsnark::set_commitment_gadget::root_digest
set_commitment_variable< FieldT, HashT > root_digest
Definition: set_commitment_gadget.hpp:35
libsnark::test_set_commitment_gadget
void test_set_commitment_gadget()
libsnark::gadget::annotation_prefix
const std::string annotation_prefix
Definition: gadget.hpp:20
set_membership_proof_variable.hpp
libsnark
Definition: accumulation_vector.hpp:18
set_commitment_gadget.tcc
libsnark::gadget::pb
protoboard< FieldT > & pb
Definition: gadget.hpp:19
libsnark::set_commitment_gadget::root_size_in_bits
static size_t root_size_in_bits()
gadget.hpp
libsnark::set_commitment_gadget::generate_r1cs_witness
void generate_r1cs_witness()
libsnark::gadget
Definition: gadget.hpp:16
libsnark::set_commitment_gadget::tree_depth
size_t tree_depth
Definition: set_commitment_gadget.hpp:33
hash_io.hpp
libsnark::set_commitment_gadget::set_commitment_gadget
set_commitment_gadget(protoboard< FieldT > &pb, const size_t max_entries, const pb_variable_array< FieldT > &element_bits, const set_commitment_variable< FieldT, HashT > &root_digest, const set_membership_proof_variable< FieldT, HashT > &proof, const pb_linear_combination< FieldT > &check_successful, const std::string &annotation_prefix)
libsnark::digest_variable
Definition: hash_io.hpp:16
libsnark::pb_linear_combination
Definition: pb_variable.hpp:101
libsnark::set_commitment_gadget::check_successful
pb_linear_combination< FieldT > check_successful
Definition: set_commitment_gadget.hpp:37
basic_gadgets.hpp
libsnark::pb_variable_array
Definition: pb_variable.hpp:44
libsnark::set_commitment_gadget::proof
set_membership_proof_variable< FieldT, HashT > proof
Definition: set_commitment_gadget.hpp:36
libsnark::set_membership_proof_variable
Definition: set_membership_proof_variable.hpp:20
libsnark::set_commitment_gadget::element_bits
pb_variable_array< FieldT > element_bits
Definition: set_commitment_gadget.hpp:34
libsnark::set_commitment_gadget
Definition: set_commitment_gadget.hpp:23
merkle_tree_check_read_gadget.hpp
libsnark::set_commitment_gadget::generate_r1cs_constraints
void generate_r1cs_constraints()
libsnark::protoboard
Definition: pb_variable.hpp:22