Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
Functions
profile_r1cs_ppzksnark.cpp File Reference
#include <cassert>
#include <cstdio>
#include <libff/common/profiling.hpp>
#include <libff/common/utils.hpp>
#include <libsnark/common/default_types/r1cs_ppzksnark_pp.hpp>
#include <libsnark/relations/constraint_satisfaction_problems/r1cs/examples/r1cs_examples.hpp>
#include <libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/examples/run_r1cs_ppzksnark.hpp>
Include dependency graph for profile_r1cs_ppzksnark.cpp:

Go to the source code of this file.

Functions

int main (int argc, const char *argv[])
 

Detailed Description

Profiling program that exercises the ppzkSNARK (first generator, then prover, then verifier) on a synthetic R1CS instance.

The command

$

libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/profiling/profile_r1cs_ppzksnark 1000 10 Fr

exercises the ppzkSNARK (first generator, then prover, then verifier) on an R1CS instance with 1000 equations and an input consisting of 10 field elements.

(If you get the error zmInit ERR:can't protect, see the discussion above.)

The command

$

libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/profiling/profile_r1cs_ppzksnark 1000 10 bytes

does the same but now the input consists of 10 bytes.

Author
This file is part of libsnark, developed by SCIPR Lab and contributors (see AUTHORS).

Definition in file profile_r1cs_ppzksnark.cpp.

Function Documentation

◆ main()

int main ( int  argc,
const char *  argv[] 
)

Definition at line 41 of file profile_r1cs_ppzksnark.cpp.

42 {
43  default_r1cs_ppzksnark_pp::init_public_params();
44  libff::start_profiling();
45 
46  if (argc == 2 && strcmp(argv[1], "-v") == 0) {
47  libff::print_compilation_info();
48  return 0;
49  }
50 
51  if (argc != 3 && argc != 4) {
52  printf("usage: %s num_constraints input_size [Fr|bytes]\n", argv[0]);
53  return 1;
54  }
55  const int num_constraints = atoi(argv[1]);
56  int input_size = atoi(argv[2]);
57  if (argc == 4) {
58  assert(strcmp(argv[3], "Fr") == 0 || strcmp(argv[3], "bytes") == 0);
59  if (strcmp(argv[3], "bytes") == 0) {
60  input_size = libff::div_ceil(
61  8 * input_size, libff::Fr<libff::default_ec_pp>::capacity());
62  }
63  }
64 
65  libff::enter_block("Generate R1CS example");
68  libff::Fr<default_r1cs_ppzksnark_pp>>(num_constraints, input_size);
69  libff::leave_block("Generate R1CS example");
70 
71  libff::print_header("(enter) Profile R1CS ppzkSNARK");
72  const bool test_serialization = true;
73  run_r1cs_ppzksnark<default_r1cs_ppzksnark_pp>(example, test_serialization);
74  libff::print_header("(leave) Profile R1CS ppzkSNARK");
75 }
Here is the call graph for this function:
libsnark::r1cs_example
Definition: r1cs_examples.hpp:25
libsnark::generate_r1cs_example_with_field_input
r1cs_example< FieldT > generate_r1cs_example_with_field_input(const size_t num_constraints, const size_t num_inputs)