Pass our constraint system to libsnark, so that it doesn't need to (de)serialize it in the proving key.
This commit is contained in:
parent
1fad6b87e5
commit
bf76024eb7
|
@ -231,10 +231,6 @@ public:
|
|||
out_macs[i] = PRF_pk(inputs[i].key, i, h_sig);
|
||||
}
|
||||
|
||||
std::vector<FieldT> primary_input;
|
||||
std::vector<FieldT> aux_input;
|
||||
|
||||
{
|
||||
protoboard<FieldT> pb;
|
||||
{
|
||||
joinsplit_gadget<FieldT, NumInputs, NumOutputs> g(pb);
|
||||
|
@ -254,14 +250,21 @@ public:
|
|||
throw std::invalid_argument("Constraint system not satisfied by inputs");
|
||||
}
|
||||
|
||||
primary_input = pb.primary_input();
|
||||
aux_input = pb.auxiliary_input();
|
||||
}
|
||||
// TODO: These are copies, which is not strictly necessary.
|
||||
std::vector<FieldT> primary_input = pb.primary_input();
|
||||
std::vector<FieldT> aux_input = pb.auxiliary_input();
|
||||
|
||||
// Swap A and B if it's beneficial (less arithmetic in G2)
|
||||
// In our circuit, we already know that it's beneficial
|
||||
// to swap, but it takes so little time to perform this
|
||||
// estimate that it doesn't matter if we check every time.
|
||||
pb.constraint_system.swap_AB_if_beneficial();
|
||||
|
||||
auto proof = r1cs_ppzksnark_prover<ppzksnark_ppT>(
|
||||
*pk,
|
||||
primary_input,
|
||||
aux_input
|
||||
aux_input,
|
||||
pb.constraint_system
|
||||
);
|
||||
|
||||
std::stringstream ss;
|
||||
|
|
Loading…
Reference in New Issue