From ae6b333c75e63a748d276e8546ee263f51ec5d0d Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Thu, 18 Aug 2016 12:15:08 -0600 Subject: [PATCH] Perform curve parameter initialization at start of gtest suite. --- src/gtest/main.cpp | 7 +++++++ src/gtest/test_circuit.cpp | 2 -- src/gtest/test_merkletree.cpp | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gtest/main.cpp b/src/gtest/main.cpp index 0fdc2b775..84e6f867c 100644 --- a/src/gtest/main.cpp +++ b/src/gtest/main.cpp @@ -1,8 +1,15 @@ #include "gtest/gtest.h" #include "crypto/common.h" +#include "libsnark/common/default_types/r1cs_ppzksnark_pp.hpp" +#include "libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp" + int main(int argc, char **argv) { assert(init_and_check_sodium() != -1); + libsnark::default_r1cs_ppzksnark_pp::init_public_params(); + libsnark::inhibit_profiling_info = true; + libsnark::inhibit_profiling_counters = true; + testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/src/gtest/test_circuit.cpp b/src/gtest/test_circuit.cpp index 2039e5b94..f8a0416a7 100644 --- a/src/gtest/test_circuit.cpp +++ b/src/gtest/test_circuit.cpp @@ -35,7 +35,6 @@ void test_value_equals(uint64_t i) { TEST(circuit, values) { - default_r1cs_ppzksnark_pp::init_public_params(); typedef Fr FieldT; test_value_equals(0); test_value_equals(1); @@ -162,7 +161,6 @@ TEST(circuit, merkle_tree_gadget_weirdness) behavior. */ - default_r1cs_ppzksnark_pp::init_public_params(); typedef Fr FieldT; // Test the normal case diff --git a/src/gtest/test_merkletree.cpp b/src/gtest/test_merkletree.cpp index d0e49a952..b0c009b2a 100644 --- a/src/gtest/test_merkletree.cpp +++ b/src/gtest/test_merkletree.cpp @@ -170,8 +170,6 @@ void test_tree(Array root_tests, Array ser_tests, Array witness_ser_tests, Array } TEST(merkletree, vectors) { - libsnark::default_r1cs_ppzksnark_pp::init_public_params(); - Array root_tests = read_json(std::string(json_tests::merkle_roots, json_tests::merkle_roots + sizeof(json_tests::merkle_roots))); Array ser_tests = read_json(std::string(json_tests::merkle_serialization, json_tests::merkle_serialization + sizeof(json_tests::merkle_serialization))); Array witness_ser_tests = read_json(std::string(json_tests::merkle_witness_serialization, json_tests::merkle_witness_serialization + sizeof(json_tests::merkle_witness_serialization)));