Skip to content

Commit

Permalink
fix: bbmalloc linker error (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad authored May 19, 2023
1 parent b5838a6 commit d4761c1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cpp/src/barretenberg/env/crs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

const int NUM_POINTS_IN_TRANSCRIPT = 5040001;


extern "C" {
/**
* @brief In WASM, loads the verifier reference string.
* Used in native code to quickly create an in-memory reference string.
*/
uint8_t* env_load_verifier_crs() {
uint8_t* env_load_verifier_crs()
{
std::ifstream transcript;
transcript.open("../srs_db/ignition/monomial/transcript00.dat", std::ifstream::binary);
// We need two g2 points, each 64 bytes.
Expand All @@ -22,7 +22,7 @@ uint8_t* env_load_verifier_crs() {
transcript.seekg(28 + NUM_POINTS_IN_TRANSCRIPT * 64);
transcript.read((char*)g2_points.data(), (std::streamsize)g2_points_size);
transcript.close();
auto* g2_points_copy = (uint8_t*)bbmalloc(g2_points_size);
auto* g2_points_copy = (uint8_t*)aligned_alloc(64, g2_points_size);
memcpy(g2_points_copy, g2_points.data(), g2_points_size);
return g2_points_copy;
}
Expand All @@ -33,20 +33,20 @@ uint8_t* env_load_verifier_crs() {
* In native code, not intended to be used.
* @param num_points The number of points to load.
*/
uint8_t* env_load_prover_crs(size_t num_points) {
uint8_t* env_load_prover_crs(size_t num_points)
{
// Note: This implementation is only meant to be instructive.
// This should only be used in c-binds to implement the C++ abstractions.
std::ifstream transcript;
transcript.open("../srs_db/ignition/monomial/transcript00.dat", std::ifstream::binary);
// Each g1 point is 64 bytes.
size_t g1_points_size = (num_points) * 64;
size_t g1_points_size = (num_points)*64;
std::vector<uint8_t> g1_points(g1_points_size);
transcript.seekg(28);
transcript.read((char*)g1_points.data(), (std::streamsize)g1_points_size);
transcript.close();
auto* g1_points_copy = (uint8_t*)bbmalloc(g1_points_size);
auto* g1_points_copy = (uint8_t*)aligned_alloc(64, g1_points_size);
memcpy(g1_points_copy, g1_points.data(), g1_points_size);
return g1_points_copy;
}

}

0 comments on commit d4761c1

Please sign in to comment.