7std::vector<uint8_t> download_bn254_g1_data(
size_t num_points)
11 std::string url =
"https://crs.aztec.network/g1.dat";
14 std::string command =
"curl -H \"Range: bytes=0-" +
std::to_string(g1_end) +
"\" '" + url +
"'";
18 if (
data.size() < g1_end) {
25std::vector<uint8_t> download_bn254_g2_data()
27 std::string url =
"https://crs.aztec.network/g2.dat";
29 std::string command =
"curl '" + url +
"'";
41 std::filesystem::create_directories(path);
43 auto g1_path = path /
"bn254_g1.dat";
46 if (g1_downloaded_points >= num_points) {
47 vinfo(
"using cached bn254 crs with num points ",
std::to_string(g1_downloaded_points),
" at ", g1_path);
50 for (
size_t i = 0; i < num_points; ++i) {
56 if (!allow_download && g1_downloaded_points == 0) {
57 throw_or_abort(
"bn254 g1 data not found and download not allowed in this context");
58 }
else if (!allow_download) {
63 " were requested but download not allowed in this context"));
65 vinfo(
"downloading bn254 crs...");
66 auto data = download_bn254_g1_data(num_points);
70 for (
size_t i = 0; i < num_points; ++i) {
78 std::filesystem::create_directories(path);
80 auto g2_path = path /
"bn254_g2.dat";
85 return from_buffer<g2::affine_element>(
data.data());
87 if (!allow_download) {
88 throw_or_abort(
"bn254 g2 data not found and download not allowed in this context");
90 auto data = download_bn254_g2_data();
92 return from_buffer<g2::affine_element>(
data.data());
group_elements::affine_element< Fq, Fr, Params > affine_element
std::string format(Args... args)
const std::vector< FF > data
Entry point for Barretenberg command-line interface.
g2::affine_element get_bn254_g2_data(const std::filesystem::path &path, bool allow_download)
std::vector< uint8_t > read_file(const std::string &filename, size_t bytes=0)
std::vector< g1::affine_element > get_bn254_g1_data(const std::filesystem::path &path, size_t num_points, bool allow_download)
std::vector< uint8_t > exec_pipe(const std::string &command)
void write_file(const std::string &filename, std::vector< uint8_t > const &data)
size_t get_file_size(std::string const &filename)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
void throw_or_abort(std::string const &err)