privacy-scaling-explorations / sonobe

Experimental folding schemes library
https://privacy-scaling-explorations.github.io/sonobe-docs/
MIT License
160 stars 37 forks source link

Sumcheck fails with zero polynomial #122

Open NiDimi opened 4 days ago

NiDimi commented 4 days ago

We are working on a project that requires to use of a zero polynomial for the sumcheck, and it seems that the verifier cannot handle this. Demo for the bug:

let mut g: VirtualPolynomial<Fr> = VirtualPolynomial::new(2);
    let temp = [Fr::zero()];
    let mle = dense_vec_to_dense_mle(2, &temp);

    let vp_aux_info = VPAuxInfo::<Fr> {
        max_degree: 2,
        num_variables: 2,
        phantom: PhantomData::<Fr>,
    };

    g.add_mle_list([Arc::new(mle.clone()), Arc::new(mle.clone())], Fr::one()).expect("TODO: panic message");

    let sumcheck_proof = IOPSumCheck::<Projective,
        PoseidonTranscript<Projective>>::prove(&g, &mut transcript_p)
        .map_err(|err| Error::SumCheckProveError(err.to_string())).unwrap();

    let sumcheck_subclaim =
        IOPSumCheck::<Projective, PoseidonTranscript<Projective>>::verify(running_committed_instance.x[0], &sumcheck_proof, &vp_aux_info, &mut transcript_p)
            .map_err(|err| Error::SumCheckVerifyError(err.to_string()));

Error: thread 'main' panicked at .../sonobe-internal/folding-schemes/src/utils/espresso/sum_check/verifier.rs:140:59 index out of bounds: the len is 0 but the index is 0

arnaucube commented 4 days ago

Thanks for reporting this! Could you provide a small repo where we can reproduce this? From the code snipped above I'm not sure to understand how you're using Sonobe to end up in this sumcheck situation. Again, thanks for reporting the issue!