@@ -516,27 +516,33 @@ void vk_as_fields(const std::string& vk_path, const std::string& output_path)
516516 *
517517 * @param bytecode_path Path to the file containing the serialised bytecode
518518 * @param calldata_path Path to the file containing the serialised calldata (could be empty)
519- * @param crs_path Path to the file containing the CRS (ignition is suitable for now)
519+ * @param public_inputs_path Path to the file containing the serialised avm public inputs
520+ * @param hints_path Path to the file containing the serialised avm circuit hints
520521 * @param output_path Path (directory) to write the output proof and verification keys
521522 */
522523void avm_prove (const std::filesystem::path& bytecode_path,
523524 const std::filesystem::path& calldata_path,
525+ const std::filesystem::path& public_inputs_path,
526+ const std::filesystem::path& hints_path,
524527 const std::filesystem::path& output_path)
525528{
526529 // Get Bytecode
527- std::vector<uint8_t > const avm_bytecode =
530+ std::vector<uint8_t > const bytecode =
528531 bytecode_path.extension () == " .gz" ? gunzip (bytecode_path) : read_file (bytecode_path);
529- std::vector<uint8_t > call_data_bytes{};
530- if (std::filesystem::exists (calldata_path)) {
531- call_data_bytes = read_file (calldata_path);
532+ std::vector<fr> const calldata = many_from_buffer<fr>(read_file (calldata_path));
533+ std::vector<fr> const public_inputs_vec = many_from_buffer<fr>(read_file (public_inputs_path));
534+ std::vector<uint8_t > avm_hints;
535+ try {
536+ avm_hints = read_file (hints_path);
537+ } catch (std::runtime_error const & err) {
538+ vinfo (" No hints were provided for avm proving.... Might be fine!" );
532539 }
533- std::vector<fr> const call_data = many_from_buffer<fr>(call_data_bytes);
534540
535541 // Hardcoded circuit size for now, with enough to support 16-bit range checks
536542 init_bn254_crs (1 << 17 );
537543
538544 // Prove execution and return vk
539- auto const [verification_key, proof] = avm_trace::Execution::prove (avm_bytecode, call_data );
545+ auto const [verification_key, proof] = avm_trace::Execution::prove (bytecode, calldata );
540546 // TODO(ilyas): <#4887>: Currently we only need these two parts of the vk, look into pcs_verification key reqs
541547 std::vector<uint64_t > vk_vector = { verification_key.circuit_size , verification_key.num_public_inputs };
542548 std::vector<fr> vk_as_fields = { verification_key.circuit_size , verification_key.num_public_inputs };
@@ -891,11 +897,14 @@ int main(int argc, char* argv[])
891897 std::string output_path = get_option (args, " -o" , vk_path + " _fields.json" );
892898 vk_as_fields (vk_path, output_path);
893899 } else if (command == " avm_prove" ) {
894- std::filesystem::path avm_bytecode_path = get_option (args, " -b" , " ./target/avm_bytecode.bin" );
895- std::filesystem::path calldata_path = get_option (args, " -d" , " ./target/call_data.bin" );
900+ std::filesystem::path avm_bytecode_path = get_option (args, " --avm-bytecode" , " ./target/avm_bytecode.bin" );
901+ std::filesystem::path avm_calldata_path = get_option (args, " --avm-calldata" , " ./target/avm_calldata.bin" );
902+ std::filesystem::path avm_public_inputs_path =
903+ get_option (args, " --avm-public-inputs" , " ./target/avm_public_inputs.bin" );
904+ std::filesystem::path avm_hints_path = get_option (args, " --avm-hints" , " ./target/avm_hints.bin" );
896905 // This outputs both files: proof and vk, under the given directory.
897906 std::filesystem::path output_path = get_option (args, " -o" , " ./proofs" );
898- avm_prove (avm_bytecode_path, calldata_path , output_path);
907+ avm_prove (avm_bytecode_path, avm_calldata_path, avm_public_inputs_path, avm_hints_path , output_path);
899908 } else if (command == " avm_verify" ) {
900909 return avm_verify (proof_path, vk_path) ? 0 : 1 ;
901910 } else if (command == " prove_ultra_honk" ) {
0 commit comments