-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Hello Pequin Maintainers,
I'm writing this to report a simple code fragment that does not compile :-)
Replace mem_naive_micro.c with the following:
void compute(struct In *input, struct Out *output) {
int zeroth = input->in[0];
int first = input->in[1];
int second = input->in[2];
int third = input->in[3];
output->out[0] = zeroth;
output->out[1] = first;
output->out[2] = second;
output->out[3] = third;
}compile and prove:
./pepper_compile_and_setup_V.sh mem_naive_micro mem_naive_micro.vkey mem_naive_micro.pkey
./pepper_compile_and_setup_P.sh mem_naive_micro
bin/pepper_verifier_mem_naive_micro gen_input mem_naive_micro.inputs
bin/pepper_prover_mem_naive_micro prove mem_naive_micro.pkey mem_naive_micro.inputs mem_naive_micro.outputs mem_naive_micro.proofit will fail with the following:
pepper_prover_mem_naive_micro: ../thirdparty/libsnark/libsnark/zk_proof_systems/ppzksnark/r1cs_gg_ppzksnark/r1cs_gg_ppzksnark.tcc:406: libsnark::r1cs_gg_ppzksnark_proof<ppT> libsnark::r1cs_gg_ppzksnark_prover(const libsnark::r1cs_gg_ppzksnark_proving_key<ppT>&, libsnark::r1cs_gg_ppzksnark_primary_input<ppT>&, libsnark::r1cs_gg_ppzksnark_auxiliary_input<ppT>&) [with ppT = libff::bn128_pp; libsnark::r1cs_gg_ppzksnark_primary_input<ppT> = std::vector<libff::Fp_model<4, ((const libff::bigint<4>&)(& libff::bn128_modulus_r))>, std::allocator<libff::Fp_model<4, ((const libff::bigint<4>&)(& libff::bn128_modulus_r))> > >; libsnark::r1cs_gg_ppzksnark_auxiliary_input<ppT> = std::vector<libff::Fp_model<4, ((const libff::bigint<4>&)(& libff::bn128_modulus_r))>, std::allocator<libff::Fp_model<4, ((const libff::bigint<4>&)(& libff::bn128_modulus_r))> > >]: Assertion `!qap_wit.coefficients_for_H[qap_wit.degree()-2].is_zero()' failed.The following, however, does not error on proving:
/*
Microbenchmark to measure the cost of naive RAM
*/
void compute(struct In *input, struct Out *output) {
int i;
for (i = 0; i < NUMACC; i++) {
output->out[i] = input->in[i] * input->addr[i];
}
}And this fragment does error on proving:
```cpp
/*
Microbenchmark to measure the cost of naive RAM
*/
void compute(struct In *input, struct Out *output) {
int i;
for (i = 0; i < NUMACC; i++) {
output->out[i] = input->in[i] * input->addr[i];
}
}So, I believe that the reason the above does not compile is (probably) because there are no multiplications, and therefore no constraints.
I think this could potentially be dealt with by giving a better error message when there are no constraints that come from the code.
Thank you :-)
Metadata
Metadata
Assignees
Labels
No labels