12 namespace po = boost::program_options;
23 std::string linear_combination_file;
29 "dummy-phase2",
"Run a dummy MPC to generate test data")
30 , linear_combination_file()
36 void initialize_suboptions(
37 po::options_description &options,
38 po::options_description &all_options,
39 po::positional_options_description &pos)
override
41 all_options.add(options).add_options()(
42 "linear_combination_file",
43 po::value<std::string>(),
44 "Linear combination file")(
45 "final_challenge_file",
46 po::value<std::string>(),
47 "Final challenge file");
48 pos.add(
"linear_combination_file", 1);
49 pos.add(
"final_challenge_file", 1);
52 void parse_suboptions(
const po::variables_map &vm)
override
54 if (0 == vm.count(
"linear_combination_file")) {
55 throw po::error(
"linear_combination file not specified");
57 if (0 == vm.count(
"final_challenge_file")) {
58 throw po::error(
"final_challenge_file not specified");
60 linear_combination_file =
61 vm[
"linear_combination_file"].as<std::string>();
62 out_file = vm[
"final_challenge_file"].as<std::string>();
65 void subcommand_usage(
const char *argv0)
override
67 std::cout <<
"Usage:\n " << argv0 <<
" " << subcommand_name
68 <<
" [<options>] <linear_combination_file> "
69 "<final_challenge_file>\n";
75 std::cout <<
"linear_combination_file: " << linear_combination_file
77 <<
"out_file: " << out_file << std::endl;
81 libff::enter_block(
"reading linear combination data");
83 read_from_file<srs_mpc_layer_L1<pp>>(linear_combination_file);
84 libff::leave_block(
"reading linear combination data");
87 libff::enter_block(
"computing num_inputs");
88 const size_t num_inputs = [&options]() {
89 libsnark::protoboard<Field> pb;
91 return pb.num_inputs();
93 libff::print_indent();
94 std::cout << std::to_string(num_inputs) << std::endl;
95 libff::leave_block(
"computing num_inputs");
98 const Field delta = Field::random_element();
102 srs_mpc_dummy_phase2<pp>(lin_comb, delta, num_inputs);
103 libff::enter_block(
"writing phase2 data");
105 std::ofstream out(out_file);
108 libff::leave_block(
"writing phase2 data");