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

Could not satisfy all constraints for regression test #1800

Closed
jfecher opened this issue Jun 22, 2023 · 5 comments · Fixed by #1965
Closed

Could not satisfy all constraints for regression test #1800

jfecher opened this issue Jun 22, 2023 · 5 comments · Fixed by #1965
Labels
bug Something isn't working refactor ssa

Comments

@jfecher
Copy link
Contributor

jfecher commented Jun 22, 2023

Aim

Tried to prove and verify the regression test

Expected Behavior

The test should produce a valid proof

Bug

The test fails to prove and verify, outputtting the message: Could not satisfy all constraints

To Reproduce

Installation Method

None

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@jfecher jfecher added the bug Something isn't working label Jun 22, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jun 22, 2023
@kevaundray kevaundray changed the title (SSA Refactor): Could not satisfy all constraints for regression test Could not satisfy all constraints for regression test Jun 23, 2023
@jfecher
Copy link
Contributor Author

jfecher commented Jun 23, 2023

After #1815, this also affects sha2_byte and sha2_blocks

Edit: All the sha tests are fixed now.

@jfecher
Copy link
Contributor Author

jfecher commented Jul 12, 2023

Observation: changing main's parameters from witnesses to constants by adding:

    let x = [0x3f, 0x1c, 0xb8, 0x99, 0xab];
    let z = 3;

to the beginning of main makes the test pass.

@kevaundray
Copy link
Contributor

Minimal example:

fn main(input: u8, length: Field) -> pub Field
{
    if input != 1 {}
    else
    {
     let cond = (0 as u64) < (length as u64) - 1;
     if cond{}
    }

    input as Field
}
// Prover.toml
input = 0x3f
length = 3

Note, input does not equal 1, so the then branch should be getting triggered, however we are getting constrained failed on the else branch. Changing input != 1 to input == 1 will produce a passing program

@kevaundray
Copy link
Contributor

Screenshot 2023-07-18 at 23 44 41

Error for reference ^

@kevaundray
Copy link
Contributor

This error seems to stem from the fact that we are not multiplying the predicate by the expression which constrains the quotient directive, we therefore account for all cases except for when q ==0 and r ==0

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor ssa
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants