@@ -521,27 +521,33 @@ void vk_as_fields(const std::string& vk_path, const std::string& output_path)
521
521
*
522
522
* @param bytecode_path Path to the file containing the serialised bytecode
523
523
* @param calldata_path Path to the file containing the serialised calldata (could be empty)
524
- * @param crs_path Path to the file containing the CRS (ignition is suitable for now)
524
+ * @param public_inputs_path Path to the file containing the serialised avm public inputs
525
+ * @param hints_path Path to the file containing the serialised avm circuit hints
525
526
* @param output_path Path (directory) to write the output proof and verification keys
526
527
*/
527
528
void avm_prove (const std::filesystem::path& bytecode_path,
528
529
const std::filesystem::path& calldata_path,
530
+ const std::filesystem::path& public_inputs_path,
531
+ const std::filesystem::path& hints_path,
529
532
const std::filesystem::path& output_path)
530
533
{
531
534
// Get Bytecode
532
- std::vector<uint8_t > const avm_bytecode =
535
+ std::vector<uint8_t > const bytecode =
533
536
bytecode_path.extension () == " .gz" ? gunzip (bytecode_path) : read_file (bytecode_path);
534
- std::vector<uint8_t > call_data_bytes{};
535
- if (std::filesystem::exists (calldata_path)) {
536
- call_data_bytes = read_file (calldata_path);
537
+ std::vector<fr> const calldata = many_from_buffer<fr>(read_file (calldata_path));
538
+ std::vector<fr> const public_inputs_vec = many_from_buffer<fr>(read_file (public_inputs_path));
539
+ std::vector<uint8_t > avm_hints;
540
+ try {
541
+ avm_hints = read_file (hints_path);
542
+ } catch (std::runtime_error const & err) {
543
+ vinfo (" No hints were provided for avm proving.... Might be fine!" );
537
544
}
538
- std::vector<fr> const call_data = many_from_buffer<fr>(call_data_bytes);
539
545
540
546
// Hardcoded circuit size for now, with enough to support 16-bit range checks
541
547
init_bn254_crs (1 << 17 );
542
548
543
549
// Prove execution and return vk
544
- auto const [verification_key, proof] = avm_trace::Execution::prove (avm_bytecode, call_data );
550
+ auto const [verification_key, proof] = avm_trace::Execution::prove (bytecode, calldata, public_inputs_vec );
545
551
// TODO(ilyas): <#4887>: Currently we only need these two parts of the vk, look into pcs_verification key reqs
546
552
std::vector<uint64_t > vk_vector = { verification_key.circuit_size , verification_key.num_public_inputs };
547
553
std::vector<fr> vk_as_fields = { verification_key.circuit_size , verification_key.num_public_inputs };
@@ -890,11 +896,14 @@ int main(int argc, char* argv[])
890
896
std::string output_path = get_option (args, " -o" , vk_path + " _fields.json" );
891
897
vk_as_fields (vk_path, output_path);
892
898
} else if (command == " avm_prove" ) {
893
- std::filesystem::path avm_bytecode_path = get_option (args, " -b" , " ./target/avm_bytecode.bin" );
894
- std::filesystem::path calldata_path = get_option (args, " -d" , " ./target/call_data.bin" );
899
+ std::filesystem::path avm_bytecode_path = get_option (args, " --avm-bytecode" , " ./target/avm_bytecode.bin" );
900
+ std::filesystem::path avm_calldata_path = get_option (args, " --avm-calldata" , " ./target/avm_calldata.bin" );
901
+ std::filesystem::path avm_public_inputs_path =
902
+ get_option (args, " --avm-public-inputs" , " ./target/avm_public_inputs.bin" );
903
+ std::filesystem::path avm_hints_path = get_option (args, " --avm-hints" , " ./target/avm_hints.bin" );
895
904
// This outputs both files: proof and vk, under the given directory.
896
905
std::filesystem::path output_path = get_option (args, " -o" , " ./proofs" );
897
- avm_prove (avm_bytecode_path, calldata_path , output_path);
906
+ avm_prove (avm_bytecode_path, avm_calldata_path, avm_public_inputs_path, avm_hints_path , output_path);
898
907
} else if (command == " avm_verify" ) {
899
908
return avm_verify (proof_path, vk_path) ? 0 : 1 ;
900
909
} else if (command == " prove_ultra_honk" ) {
0 commit comments