Skip to content

Commit

Permalink
fix: bb unnecessary env var (#3901)
Browse files Browse the repository at this point in the history
Closes AztecProtocol/barretenberg#822

Co-authored-by: ludamad <adam@aztecprotocol.com>
  • Loading branch information
ludamad and ludamad0 authored Jan 10, 2024
1 parent 6164ccd commit f127e5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
1 change: 1 addition & 0 deletions barretenberg/cpp/src/barretenberg/bb/get_bn254_crs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ std::vector<uint8_t> download_bn254_g1_data(size_t num_points)

std::string url = "https://aztec-ignition.s3.amazonaws.com/MAIN%20IGNITION/flat/g1.dat";

// IMPORTANT: this currently uses a shell, DO NOT let user-controlled strings here.
std::string command = "curl -s -H \"Range: bytes=0-" + std::to_string(g1_end) + "\" '" + url + "'";

auto data = exec_pipe(command);
Expand Down
19 changes: 2 additions & 17 deletions barretenberg/cpp/src/barretenberg/bb/get_grumpkin_crs.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
#include "get_grumpkin_crs.hpp"

// Gets the transcript URL from the BARRETENBERG_GRUMPKIN_TRANSCRIPT_URL environment variable, if set.
// Otherwise returns the default URL.
namespace {
std::string get_grumpkin_transcript_url()
{
const char* ENV_VAR_NAME = "BARRETENBERG_GRUMPKIN_TRANSCRIPT_URL";
const std::string DEFAULT_URL = "https://aztec-ignition.s3.amazonaws.com/TEST%20GRUMPKIN/monomial/transcript00.dat";

const char* env_url = std::getenv(ENV_VAR_NAME);

auto environment_variable_exists = ((env_url != nullptr) && *env_url);

return environment_variable_exists ? env_url : DEFAULT_URL;
}
} // namespace

std::vector<uint8_t> download_grumpkin_g1_data(size_t num_points)
{
size_t g1_start = 28;
size_t g1_end = g1_start + num_points * 64 - 1;

std::string url = get_grumpkin_transcript_url();
std::string url = "https://aztec-ignition.s3.amazonaws.com/TEST%20GRUMPKIN/monomial/transcript00.dat";

// IMPORTANT: this currently uses a shell, DO NOT let user-controlled strings here.
std::string command =
"curl -s -H \"Range: bytes=" + std::to_string(g1_start) + "-" + std::to_string(g1_end) + "\" '" + url + "'";

Expand Down

0 comments on commit f127e5a

Please sign in to comment.