diff --git a/libsnark/zk_proof_systems/plonk/srs.hpp b/libsnark/zk_proof_systems/plonk/srs.hpp index 2d28c6fe5..d87646a77 100644 --- a/libsnark/zk_proof_systems/plonk/srs.hpp +++ b/libsnark/zk_proof_systems/plonk/srs.hpp @@ -254,7 +254,7 @@ template class transcript_hasher public: // constructor - transcript_hasher(std::vector &buffer); + transcript_hasher(); void add_element(const libff::Fr &element); void add_element(const libff::G1 &element); diff --git a/libsnark/zk_proof_systems/plonk/srs.tcc b/libsnark/zk_proof_systems/plonk/srs.tcc index d52488575..5f5d33945 100644 --- a/libsnark/zk_proof_systems/plonk/srs.tcc +++ b/libsnark/zk_proof_systems/plonk/srs.tcc @@ -73,10 +73,10 @@ plonk_keypair::plonk_keypair( } // transcript_hasher constructor -template -transcript_hasher::transcript_hasher(std::vector &buffer) - : buffer(std::move(buffer)) +template transcript_hasher::transcript_hasher() { + // initialize to empty vector + this->buffer.clear(); // test array containing the expected hash values of the communication // transcript i.e. the communication challenges (in this order): beta, // gamma, alpha, zeta, nu, u WARNING! specific to curve BLS12-381 diff --git a/libsnark/zk_proof_systems/plonk/tests/test_plonk.cpp b/libsnark/zk_proof_systems/plonk/tests/test_plonk.cpp index 18cb18d36..2c82339dd 100644 --- a/libsnark/zk_proof_systems/plonk/tests/test_plonk.cpp +++ b/libsnark/zk_proof_systems/plonk/tests/test_plonk.cpp @@ -490,8 +490,7 @@ template void test_plonk_prover_rounds() srs srs = plonk_srs_derive_from_usrs(usrs, circuit); // initialize hasher - std::vector buffer; - transcript_hasher hasher(buffer); + transcript_hasher hasher; // Prover Round 0 (initialization) round_zero_out_t round_zero_out = plonk_prover::round_zero(srs); @@ -692,8 +691,7 @@ template void test_plonk_prover() srs srs = plonk_srs_derive_from_usrs(usrs, circuit); // initialize hasher - std::vector buffer; - transcript_hasher hasher(buffer); + transcript_hasher hasher; // initialize prover plonk_prover prover; @@ -970,8 +968,7 @@ template void test_plonk_verifier_steps() srs srs = plonk_srs_derive_from_usrs(usrs, circuit); // initialize hasher - std::vector buffer; - transcript_hasher hasher(buffer); + transcript_hasher hasher; // initialize prover plonk_prover prover; @@ -1075,8 +1072,7 @@ template void test_plonk_verifier() srs srs = plonk_srs_derive_from_usrs(usrs, circuit); // initialize hasher - std::vector buffer; - transcript_hasher hasher(buffer); + transcript_hasher hasher; // initialize prover plonk_prover prover;