Go to the source code of this file.
|
template<typename FieldT > |
void | simulate_random_memory_contents (const tinyram_architecture_params &ap, const size_t input_size, const size_t program_size) |
|
template<typename ppT > |
void | profile_ram_zksnark_verifier (const tinyram_architecture_params &ap, const size_t input_size, const size_t program_size) |
|
template<typename ppT > |
void | print_ram_zksnark_verifier_profiling () |
|
template<typename ppT > |
void | profile_ram_zksnark (const tinyram_architecture_params &ap, const size_t program_size, const size_t input_size, const size_t time_bound) |
|
bool | process_command_line (const int argc, const char **argv, bool &profile_gp, size_t &w, size_t &k, bool &profile_v, size_t &l) |
|
int | main (int argc, const char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
const char * |
argv[] |
|
) |
| |
Definition at line 187 of file profile_ram_zksnark.cpp.
189 libff::start_profiling();
205 profile_ram_zksnark<default_ram_zksnark_pp>(
210 profile_ram_zksnark_verifier<default_ram_zksnark_pp>(ap, l / 2, l / 2);
◆ print_ram_zksnark_verifier_profiling()
template<typename ppT >
void print_ram_zksnark_verifier_profiling |
( |
| ) |
|
Definition at line 57 of file profile_ram_zksnark.cpp.
59 libff::inhibit_profiling_info =
true;
60 for (
size_t w : {16, 32}) {
63 for (
size_t input_size : {0, 10, 100}) {
64 for (
size_t program_size = 10; program_size <= 10000;
68 profile_ram_zksnark_verifier<ppT>(ap, input_size, program_size);
70 const double input_map =
71 libff::last_times[
"Call to ram_zksnark_verifier_input_map"];
72 const double preprocessing = libff::last_times
73 [
"Call to r1cs_ppzksnark_verifier_process_vk"];
74 const double accumulate = libff::last_times
75 [
"Call to r1cs_ppzksnark_IC_query::accumulate"];
76 const double pairings =
77 libff::last_times[
"Online pairing computations"];
79 libff::last_times[
"Call to ram_zksnark_verifier"];
81 total - (input_map + preprocessing + accumulate + pairings);
83 const double delegated_ra_memory_init = libff::last_times
84 [
"Construct delegated_ra_memory from memory map"];
86 libff::Fr<typename ppT::curve_A_pp>>(
87 ap, input_size, program_size);
88 const double delegated_ra_memory_init_random =
89 libff::last_times[
"Initialize random delegated memory"];
90 const double input_map_random = input_map -
91 delegated_ra_memory_init +
92 delegated_ra_memory_init_random;
93 const double total_random = total - delegated_ra_memory_init +
94 delegated_ra_memory_init_random;
97 "w = %zu, k = %zu, program_size = %zu, input_size = %zu, "
98 "input_map = %0.2fms, preprocessing = %0.2fms, accumulate "
99 "= %0.2fms, pairings = %0.2fms, rest = %0.2fms, total = "
100 "%0.2fms (input_map_random = %0.2fms, total_random = "
107 preprocessing * 1e-6,
112 input_map_random * 1e-6,
113 total_random * 1e-6);
◆ process_command_line()
bool process_command_line |
( |
const int |
argc, |
|
|
const char ** |
argv, |
|
|
bool & |
profile_gp, |
|
|
size_t & |
w, |
|
|
size_t & |
k, |
|
|
bool & |
profile_v, |
|
|
size_t & |
l |
|
) |
| |
Definition at line 138 of file profile_ram_zksnark.cpp.
148 po::options_description desc(
"Usage");
149 desc.add_options()(
"help",
"print this help message")(
150 "profile_gp",
"profile generator and prover")(
151 "w", po::value<size_t>(&w)->default_value(16),
"word size")(
152 "k", po::value<size_t>(&k)->default_value(16),
"register count")(
153 "profile_v",
"profile verifier")(
"v",
"print version info")(
154 "l", po::value<size_t>(&l)->default_value(10),
"program length");
156 po::variables_map vm;
157 po::store(po::parse_command_line(argc, argv, desc), vm);
160 libff::print_compilation_info();
164 if (vm.count(
"help")) {
165 std::cout << desc <<
"\n";
169 profile_gp = vm.count(
"profile_gp");
170 profile_v = vm.count(
"profile_v");
172 if (!(vm.count(
"profile_gp") ^ vm.count(
"profile_v"))) {
173 std::cout <<
"Must choose between profiling generator/prover and "
174 "profiling verifier (see --help)\n";
179 }
catch (std::exception &e) {
180 std::cerr <<
"Error: " << e.what() <<
"\n";
◆ profile_ram_zksnark()
template<typename ppT >
void profile_ram_zksnark |
( |
const tinyram_architecture_params & |
ap, |
|
|
const size_t |
program_size, |
|
|
const size_t |
input_size, |
|
|
const size_t |
time_bound |
|
) |
| |
Definition at line 120 of file profile_ram_zksnark.cpp.
128 const size_t boot_trace_size_bound = program_size + input_size;
130 ap, boot_trace_size_bound, time_bound,
true);
131 const bool test_serialization =
true;
132 const bool bit = run_ram_zksnark<ppT>(example, test_serialization);
◆ profile_ram_zksnark_verifier()
Definition at line 36 of file profile_ram_zksnark.cpp.
42 const size_t time_bound = 10;
44 const size_t boot_trace_size_bound = program_size + input_size;
46 ap, boot_trace_size_bound, time_bound,
true);
52 libff::enter_block(
"Verify fake proof");
53 ram_zksnark_verifier<ppT>(vk, example.
boot_trace, time_bound, pi);
54 libff::leave_block(
"Verify fake proof");
◆ simulate_random_memory_contents()
template<typename FieldT >
Definition at line 19 of file profile_ram_zksnark.cpp.
24 const size_t num_addresses = 1ul << ap.
dwaddr_len();
25 const size_t value_size = 2 * ap.
w;
27 num_addresses, value_size, program_size + (input_size + 1) / 2);
29 libff::enter_block(
"Initialize random delegated memory");
31 num_addresses, value_size, init_random);
32 libff::leave_block(
"Initialize random delegated memory");
bool process_command_line(const int argc, const char **argv, bool &profile_gp, size_t &w, size_t &k, bool &profile_v, size_t &l)