-
Notifications
You must be signed in to change notification settings - Fork 221
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
Return values in Prover.toml should not be supplied by the prover #624
Comments
Why is this unlikely? You cannot refer to a value returned from main before it is actually returned so I see no reason why we cannot generate these automatically. Can you give a problematic example? |
Because the semantics of return is that it is what is returned "after" you have executed the main function. It seems like we agree though, I am saying that they can be generated automatically by the compiler, but it is unlikely that the prover/developer will put the values in manually by themselves. ie the usecase of If the user wants to add the values manually then they can just provide the value as an input and make it public. |
I think there's value in being able to fail early in the situation where you have additional context about what the return value of a circuit should be and want to enforce this at proving time. Otherwise the prover would have to immediately verify their proof using their expected return value which adds a bunch of overhead. There will definitely exist buggy circuits which make it to production so the earlier these can be flagged up the better. |
They could provide the value as input in that case no? Though I think this argument also falls under the camp of "we need better testing infrastructure" for circuits |
This assumes that they can change the circuit they're using from a "return as return value" to a "return as public input" model. If you're proving a circuit written by someone else then you may not be able to do this. |
Note this doesn't have to happen inside the solving of the circuit. It would also be acceptable if the generated return value could be extracted from the witness and compared against the expected return value. |
This makes sense, though I still think it falls under the testing infrastructure umbrella and regular usage would probably not warrant this behaviour |
I disagree, testing infrastructure umbrella falls into this case (providing the return value), but this case does not always falls into the infrastructure umbrella. |
I also disagree with the goal of the issue:
To do that prover needs to add inputs and manually constraint the result to the inputs, which with the |
|
Because it requires some constraint: |
This was also the case before, you needed a constraint to constrain the Though as noted, I do not see a usecase for this, except for testing infrastructure. Note that without Noir, the way to check that a public value is equal to something is via the verifier passing in the same value. You don't need to apply an explicit constraint in the circuit. |
Closed by #731 |
Description
Currently we allow return values to be supplied by the prover. This can only be done if the prover runs through the program and generates those values, which is unlikely.
Aim
If the prover wants to pass in values, they should just pass them into main as an argument and not via the
return =""
field.Expected behavior
When
return =""
is prefilled in for the prover when creating proofs, we should issue an error.Bug
(Describe the bug. Supplement error codes / terminal logs if applicable.)
To reproduce
(Describe the steps to reproduce the behavior.)
Environment
(Specify your setup and versions of dependencies.)
For
nargo
usersclang --version
)For TypeScript users
node --version
)yarn.lock
)yarn.lock
)yarn.lock
)Additional context
(If applicable.)
The text was updated successfully, but these errors were encountered: