Skip to content

Commit

Permalink
gen-circuit-params option added to transpiler binary. Closes #162
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaskov committed Jul 18, 2023
1 parent fbae550 commit d66350b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions bin/transpiler/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()("help,h", "Display help message")
("version,v", "Display version")
("mode,m", boost::program_options::value<std::string>(), "Transpiler mode (gen-test-proof, gen-gate-argument).\
gen-test-proof prepares gate argument, placeholder params and sample proof for testing.\
gen-gate-argument prepares gate argument and some placeholder params")
("mode,m", boost::program_options::value<std::string>(), "Transpiler mode (gen-circuit-params, gen-gate-argument, gen-test-proof).\
gen-gate-argument prepares gate argument and some placeholder params.\
gen-circuit-params prepares circuit parameters for verification.\
gen-test-proof prepares gate argument, placeholder params and sample proof for local testing.")
("public-input,i", boost::program_options::value<std::string>(), "Public input file")
("assignment-table,t", boost::program_options::value<std::string>(), "Assignment table input file")
("circuit,c", boost::program_options::value<std::string>(), "Circuit input file")
Expand Down Expand Up @@ -256,7 +257,7 @@ int main(int argc, char *argv[]) {
return 1;
}

if (mode != "gen-test-proof" && mode != "gen-gate-argument") {
if (!(mode == "gen-test-proof" || mode == "gen-gate-argument" || mode == "gen-circuit-params")) {
std::cerr << "Invalid mode specified" << std::endl;
std::cout << options_desc << std::endl;
return 1;
Expand Down Expand Up @@ -381,6 +382,11 @@ int main(int argc, char *argv[]) {
constraint_system, columns_rotations, output_folder_path, optimize_gates);
}

if ((mode == "gen-circuit-params") || (mode == "gen-test-proof")) {
nil::crypto3::zk::snark::print_placeholder_params<FRIScheme, TableDescriptionType, ColumnsRotationsType, ArithmetizationParams>(
fri_params, table_description, columns_rotations, output_folder_path+"/circuit_params.json");
}

if (mode == "gen-test-proof") {
typename nil::crypto3::zk::snark::placeholder_public_preprocessor<
BlueprintFieldType, placeholder_params>::preprocessed_data_type public_preprocessed_data =
Expand All @@ -391,9 +397,6 @@ int main(int argc, char *argv[]) {
nil::crypto3::zk::snark::placeholder_private_preprocessor<BlueprintFieldType, placeholder_params>::process(
constraint_system, assignment_table.private_table(), table_description, fri_params
);

nil::crypto3::zk::snark::print_placeholder_params<FRIScheme, TableDescriptionType, ColumnsRotationsType, ArithmetizationParams>(
fri_params, table_description, columns_rotations, output_folder_path+"/circuit_params.json");

using ProofType = nil::crypto3::zk::snark::placeholder_proof<BlueprintFieldType, placeholder_params>;
ProofType proof = nil::crypto3::zk::snark::placeholder_prover<BlueprintFieldType, placeholder_params>::process(
Expand Down

0 comments on commit d66350b

Please sign in to comment.