From d66350b67f0ddd4f15667db73b7f85428c01945e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 18 Jul 2023 19:21:23 +0000 Subject: [PATCH] gen-circuit-params option added to transpiler binary. Closes #162 --- bin/transpiler/src/main.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/transpiler/src/main.cpp b/bin/transpiler/src/main.cpp index 037c8ab6..1f31942c 100644 --- a/bin/transpiler/src/main.cpp +++ b/bin/transpiler/src/main.cpp @@ -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(), "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(), "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(), "Public input file") ("assignment-table,t", boost::program_options::value(), "Assignment table input file") ("circuit,c", boost::program_options::value(), "Circuit input file") @@ -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; @@ -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( + 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 = @@ -391,9 +397,6 @@ int main(int argc, char *argv[]) { nil::crypto3::zk::snark::placeholder_private_preprocessor::process( constraint_system, assignment_table.private_table(), table_description, fri_params ); - - nil::crypto3::zk::snark::print_placeholder_params( - fri_params, table_description, columns_rotations, output_folder_path+"/circuit_params.json"); using ProofType = nil::crypto3::zk::snark::placeholder_proof; ProofType proof = nil::crypto3::zk::snark::placeholder_prover::process(