Skip to content

Commit 998870e

Browse files
committed
update
1 parent 8b549b0 commit 998870e

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,21 @@ void UltraHonkAPI::prove(const Flags& flags,
7373
// Handle VK
7474
std::vector<uint8_t> vk_bytes;
7575

76-
if (flags.write_vk) {
77-
info("WARNING: computing verification key while proving due to write_vk. Precompute the VK and don't pass "
78-
"--write_vk for better performance.");
79-
auto vk_response =
80-
bbapi::CircuitComputeVk{ .circuit = { .name = "circuit", .bytecode = bytecode }, .settings = settings }
81-
.execute();
82-
83-
// Write VK outputs separately
84-
write_vk_outputs(vk_response, output_dir);
85-
vk_bytes = std::move(vk_response.bytes);
86-
} else {
76+
if (!vk_path.empty() && !flags.write_vk) {
8777
vk_bytes = read_file(vk_path);
8878
}
8979

9080
// Prove
91-
auto prove_response = bbapi::CircuitProve{ .circuit = { .name = "circuit",
92-
.bytecode = std::move(bytecode),
93-
.verification_key = std::move(vk_bytes) },
94-
.witness = std::move(witness),
95-
.settings = std::move(settings) }
96-
.execute();
97-
98-
// Write proof outputs (not VK - that's handled above)
99-
write_proof_outputs(prove_response, output_dir);
81+
auto response = bbapi::CircuitProve{ .circuit = { .name = "circuit",
82+
.bytecode = std::move(bytecode),
83+
.verification_key = std::move(vk_bytes) },
84+
.witness = std::move(witness),
85+
.settings = std::move(settings) }
86+
.execute();
87+
write_proof_outputs(response, output_dir);
88+
if (flags.write_vk) {
89+
write_vk_outputs(response.vk, output_dir);
90+
}
10091
}
10192

10293
bool UltraHonkAPI::verify(const Flags& flags,

0 commit comments

Comments
 (0)