MCPcopy Create free account
hub / github.com/AztecProtocol/aztec-packages / avm_prove

Function avm_prove

barretenberg/cpp/src/barretenberg/vm2/api_avm.cpp:30–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28} // namespace
29
30void avm_prove(const std::filesystem::path& inputs_path, const std::filesystem::path& output_path)
31{
32 avm2::AvmAPI avm;
33 auto inputs = avm2::AvmAPI::ProvingInputs::from(read_file(inputs_path));
34 auto proof = avm.prove(inputs);
35
36 // NOTE: As opposed to other proof systems, the public inputs are NOT part of the proof.
37 write_file(output_path / "proof", to_buffer(proof));
38
39 print_avm_stats();
40
41 // NOTE: Temporarily we also verify after proving.
42 // The reasoning is that proving will always pass unless it crashes.
43 // We want to return an exit code != 0 if the proof is invalid so that the prover client saves the inputs.
44 info("verifying...");
45 bool res = avm.verify(proof, inputs.public_inputs);
46 info("verification: ", res ? "success" : "failure");
47 if (!res) {
48 throw std::runtime_error("Generated proof is invalid!!!!!");
49 }
50}
51
52void avm_check_circuit(const std::filesystem::path& inputs_path)
53{

Callers 1

Calls 7

read_fileFunction · 0.85
write_fileFunction · 0.85
to_bufferFunction · 0.85
print_avm_statsFunction · 0.85
infoFunction · 0.85
proveMethod · 0.45
verifyMethod · 0.45

Tested by

no test coverage detected