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

Error reporting in programs without constraints #233

Open
bufferhe4d opened this issue Nov 12, 2024 · 1 comment
Open

Error reporting in programs without constraints #233

bufferhe4d opened this issue Nov 12, 2024 · 1 comment

Comments

@bufferhe4d
Copy link
Contributor

bufferhe4d commented Nov 12, 2024

I was writing the following example (an example where there are no constraints with a public input):

fn main(pub aa: Field) {
    let mut xx = aa + 1;
}

After running cargo run test --path examples/no_cons.no --public-inputs '{"aa": "3"}', I hit the following error:

Error:   × Looks like something went wrong in constraint-finalization
   ╭─[<BUILTIN>:1:1]
 1 │ <SEE NONAME CODE>
   · ▲
   · ╰── here
   ╰────
  help: Unexpected error: there's a bug in the circuit_writer, some cellvar does not end up being a cellvar in the circuit!.

If I try the same example with a private input, the error is more descriptive:

Error:   × Looks like something went wrong in constraint-finalization
   ╭─[examples/no_cons.no:1:1]
 1 │ fn main(aa: Field) {
   ·         ─┬
   ·          ╰── here
 2 │     let mut xx = aa + 1;
   ╰────
  help: private input not used in the circuit

I thought it could help to give the same error in those cases as help: public input not used in the circuit

@katat
Copy link
Collaborator

katat commented Nov 13, 2024

Yes, great discovery. I agreed it will be helpful to display where the error originate from as you said above. Feel free to create a PR if you want :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants