Skip to content

Commit

Permalink
plonk: in transcript_hasher removed the private buffer variable as an…
Browse files Browse the repository at this point in the history
… input parameter to the constructor. only the object has access to the buffer now. addresses PR #61 comment #61 (comment)
  • Loading branch information
Vesselin Velichkov authored and dtebbs committed Oct 26, 2022
1 parent c6396cf commit d001bd3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion libsnark/zk_proof_systems/plonk/srs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ template<typename ppT> class transcript_hasher

public:
// constructor
transcript_hasher(std::vector<uint8_t> &buffer);
transcript_hasher();

void add_element(const libff::Fr<ppT> &element);
void add_element(const libff::G1<ppT> &element);
Expand Down
6 changes: 3 additions & 3 deletions libsnark/zk_proof_systems/plonk/srs.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ plonk_keypair<ppT>::plonk_keypair(
}

// transcript_hasher constructor
template<typename ppT>
transcript_hasher<ppT>::transcript_hasher(std::vector<uint8_t> &buffer)
: buffer(std::move(buffer))
template<typename ppT> transcript_hasher<ppT>::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
Expand Down
12 changes: 4 additions & 8 deletions libsnark/zk_proof_systems/plonk/tests/test_plonk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ template<typename ppT> void test_plonk_prover_rounds()
srs<ppT> srs = plonk_srs_derive_from_usrs<ppT>(usrs, circuit);

// initialize hasher
std::vector<uint8_t> buffer;
transcript_hasher<ppT> hasher(buffer);
transcript_hasher<ppT> hasher;

// Prover Round 0 (initialization)
round_zero_out_t<ppT> round_zero_out = plonk_prover<ppT>::round_zero(srs);
Expand Down Expand Up @@ -692,8 +691,7 @@ template<typename ppT> void test_plonk_prover()
srs<ppT> srs = plonk_srs_derive_from_usrs<ppT>(usrs, circuit);

// initialize hasher
std::vector<uint8_t> buffer;
transcript_hasher<ppT> hasher(buffer);
transcript_hasher<ppT> hasher;

// initialize prover
plonk_prover<ppT> prover;
Expand Down Expand Up @@ -970,8 +968,7 @@ template<typename ppT> void test_plonk_verifier_steps()
srs<ppT> srs = plonk_srs_derive_from_usrs<ppT>(usrs, circuit);

// initialize hasher
std::vector<uint8_t> buffer;
transcript_hasher<ppT> hasher(buffer);
transcript_hasher<ppT> hasher;

// initialize prover
plonk_prover<ppT> prover;
Expand Down Expand Up @@ -1075,8 +1072,7 @@ template<typename ppT> void test_plonk_verifier()
srs<ppT> srs = plonk_srs_derive_from_usrs<ppT>(usrs, circuit);

// initialize hasher
std::vector<uint8_t> buffer;
transcript_hasher<ppT> hasher(buffer);
transcript_hasher<ppT> hasher;

// initialize prover
plonk_prover<ppT> prover;
Expand Down

0 comments on commit d001bd3

Please sign in to comment.