Add a nargo execute
command to solve a circuit and extract its return value
#626
Labels
enhancement
New feature or request
Problem
The lifecycle of a Noir program is made up of three parts:
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.
The text was updated successfully, but these errors were encountered: