9std::vector<uint8_t> download_grumpkin_g1_data(
size_t num_points)
12 std::string url =
"https://crs.aztec.network/grumpkin_g1.dat";
15 std::string command =
"curl -s -H \"Range: bytes=0-" +
std::to_string(g1_end) +
"\" '" + url +
"'";
18 if (
data.size() < g1_end) {
19 THROW std::runtime_error(
"Failed to download grumpkin g1 data.");
33 std::filesystem::create_directories(path);
34 auto g1_path = path /
"grumpkin_g1.flat.dat";
36 if (g1_downloaded_points >= num_points) {
37 vinfo(
"using cached grumpkin crs with num points ", g1_downloaded_points,
" at: ", g1_path);
40 for (uint32_t i = 0; i < num_points; ++i) {
43 if (points[0].on_curve()) {
47 if (!allow_download && g1_downloaded_points == 0) {
48 throw_or_abort(
"grumpkin g1 data not found and download not allowed in this context");
49 }
else if (!allow_download) {
54 " were requested but download not allowed in this context"));
56 vinfo(
"downloading grumpkin crs...");
57 auto data = download_grumpkin_g1_data(num_points);
61 for (uint32_t i = 0; i < num_points; ++i) {
typename Group::affine_element AffineElement
std::string format(Args... args)
const std::vector< FF > data
Entry point for Barretenberg command-line interface.
std::vector< curve::Grumpkin::AffineElement > get_grumpkin_g1_data(const std::filesystem::path &path, size_t num_points, bool allow_download)
std::vector< uint8_t > read_file(const std::string &filename, size_t bytes=0)
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)