Skip to content

Commit

Permalink
feat(bb): avoid initializing CRS for bb info command (#2425)
Browse files Browse the repository at this point in the history
This PR executes the `bb info` command before we initialize the CRS as
it doesn't require it. This avoids having to read a large amount of data
from file / download from AWS when it is unnecessary.
  • Loading branch information
TomAFrench authored Sep 21, 2023
1 parent f56aa02 commit d22c7b1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,14 @@ int main(int argc, char* argv[])
std::string vk_path = getOption(args, "-k", "./target/vk");
CRS_PATH = getOption(args, "-c", "./crs");
bool recursive = flagPresent(args, "-r") || flagPresent(args, "--recursive");

// Skip CRS initialization for any command which doesn't require the CRS.
if (command == "info") {
std::string output_path = getOption(args, "-o", "info.json");
acvmInfo(output_path);
return 0;
}

init();

if (command == "prove_and_verify") {
Expand All @@ -355,9 +363,6 @@ int main(int argc, char* argv[])
} else if (command == "vk_as_fields") {
std::string output_path = getOption(args, "-o", vk_path + "_fields.json");
vkAsFields(vk_path, output_path);
} else if (command == "info") {
std::string output_path = getOption(args, "-o", "info.json");
acvmInfo(output_path);
} else {
std::cerr << "Unknown command: " << command << "\n";
return 1;
Expand Down

0 comments on commit d22c7b1

Please sign in to comment.