Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Witness size to be a power of 2^n isn't checked in Spartan/crr1csproof.rs #287

Open
h-hafezi opened this issue Oct 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@h-hafezi
Copy link

Program Information

In Spartan/crr1csproof.rs it's not checked the witness to be a power of two, in fact, it can be checked in

by adding the following lines:

    assert!(z.len().is_power_of_two(), "z must be a power of two");
    assert!(evals_ABC.len().is_power_of_two(), "eval_ABC must be a power of two");
    assert_eq!(z.len(), evals_ABC.len(), "vector z and eval_ABC should have equal length");

similarly, it can be checked in the conversion function in

https://github.com/nexus-xyz/nexus-zkvm/blob/main/nova/src/circuits/nova/pcd/compression/conversion.rs

when converting an r1cs instance to check witness size to be a power of two in

impl<G> TryFrom<RelaxedR1CSWitness<G>> for CRR1CSWitness<G::ScalarField>

Project Information

No response

Reproduction Steps

...

What is expected?

...

What is actually happening?

if this is not done you get a reading index of zero from an empty vector in the function

impl<F: PrimeField> SumcheckInstanceProof<F> {

System Information

No response

Any additional comments?

No response

@h-hafezi h-hafezi added the bug Something isn't working label Oct 18, 2024
@nexodon
Copy link

nexodon commented Oct 20, 2024

Thanks @h-hafezi for this thorough check and proposed fix! Definitely worth taking. We'll look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants