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

Large Field Input Causes Error #2545

Closed
Jurarpereurs opened this issue Sep 4, 2023 · 0 comments · Fixed by #2547
Closed

Large Field Input Causes Error #2545

Jurarpereurs opened this issue Sep 4, 2023 · 0 comments · Fixed by #2547
Labels
bug Something isn't working

Comments

@Jurarpereurs
Copy link

Aim

Noir throws an exception when you try to use a large field value as input to the program. However, if you use a large field value as input in the #[test] function, the test will pass.

Expected Behavior

Noir should not error when using a large field value as input to the program.

Bug

Save the following code in src/main.nr:

fn main(x : Field, y : pub Field) {
    assert(x != y);
}

#[test]
fn test_main() {
    main(38635681773907251013895061801454257562916000962161246236232113416393728196608, 2);
}

Then run nargo check, you would see the following message:

[hello] Constraint system successfully built!

, meaning that the test case in #[test] passes.

Then, save the following in Prover.toml with exactly the same input as the test case:

x = "38635681773907251013895061801454257562916000962161246236232113416393728196608"
y = "2"

Then run nargo prove, you would see the following message:

Error: Expected witness values to be integers, provided value causes `number too large to fit in target type` error

Location:
    crates/nargo_cli/src/cli/mod.rs:79:5

To Reproduce

  1. Create a new project with nargo new hello
  2. Save the code in src/main.nr
  3. Run nargo check
  4. Save the code in Prover.toml
  5. Run nargo prove

Installation Method

Binary

Nargo Version

nargo 0.10.5 (git version hash: 9fe4cfd, is dirty: false)

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@Jurarpereurs Jurarpereurs added the bug Something isn't working label Sep 4, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 4, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Sep 4, 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
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant