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

Add a nargo execute command to solve a circuit and extract its return value #626

Closed
TomAFrench opened this issue Jan 10, 2023 · 0 comments · Fixed by #725
Closed

Add a nargo execute command to solve a circuit and extract its return value #626

TomAFrench opened this issue Jan 10, 2023 · 0 comments · Fixed by #725
Labels
enhancement New feature or request

Comments

@TomAFrench
Copy link
Member

TomAFrench commented Jan 10, 2023

Problem

The lifecycle of a Noir program is made up of three parts:

  1. Solving the circuit (execution)
  2. Generating a proof of the execution
  3. Validating this proof

A Noir dev is only really concerned with the first of these three steps as they can assume that when given a valid program, Nargo will always handle the rest correctly.

However, currently when testing their programs they have to generate a proof whereas they really just want to check that all the constraints are applied correctly, etc. This is compounded by #624 as in order to check the constraint on the return value they would have to verify the proof to ensure the generated return value matches the expected one.

Solution

One way to handle this is through a nargo execute command which would solve the circuit's witness and then extract and decode the return value. This would also arguably provide better DX for writing tests for noir programs as it becomes simple testing of inputs and outputs which is going to be more familiar vs generating proofs.

We'd probably want to leave in the option to generate and verify proofs as part of running tests but this could be part of a "full" test run. This mode would be more comprehensive as it covers any potential issues in steps 2 and 3 but I don't think it's necessary in the majority of cases.

Alternatives considered

We can leave testing in its current form of generating/verifying proofs. Devs can also read the return value from the Verifier.toml file to check that the calculated return value is correct but this wouldn't work in a testing framework.

Additional context

Connected to #610 as the non-cli version of this would be relevant to testing.

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

Successfully merging a pull request may close this issue.

1 participant