Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bb.js): Truncate buffer_size in bb to the amount of points that we have downloaded #1862

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ inline std::vector<barretenberg::g1::affine_element> get_g1_data(const std::file
vinfo("using cached crs at: ", path);
auto data = read_file(path / "g1.dat");
auto points = std::vector<barretenberg::g1::affine_element>(num_points);

auto size_of_points_in_bytes = num_points * 64;
if (data.size() < size_of_points_in_bytes) {
vinfo("data is smaller than expected!", data.size(), size_of_points_in_bytes);
}
size_t actual_buffer_size = std::min(data.size(), size_of_points_in_bytes);
kevaundray marked this conversation as resolved.
Show resolved Hide resolved

barretenberg::srs::IO<curve::BN254>::read_affine_elements_from_buffer(
points.data(), (char*)data.data(), num_points * 64);
points.data(), (char*)data.data(), actual_buffer_size);
return points;
}

Expand Down