-
Notifications
You must be signed in to change notification settings - Fork 211
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
feat(cli): Add --check-return
to execute
#6765
base: master
Are you sure you want to change the base?
Conversation
Compilation Sample
|
Peak Memory Sample
|
--check-return
to execute
Is this reading necessary to be honest so it's kind of surprised that we didn't error out when ABI decoding already. If we have a witness map from which we want to decode return values and we find empty witnesses at indices that should hold return values then we should just error and that should avoid the need for this flag I think. |
@TomAFrench the reason it did not complain about the gaps in the witness map is explained here:
You are right that based on the ABI we can tell if the circuit has any return values. I'm not sure if But I'd argue that the flag still has value to easily assert the actual value of what is being returned, not just that something is, at least in the context of integration testing, where we use |
Ok, sorry I didn't read fully as I was on the tube. I'll have a look at this properly tomorrow. |
I added another check to see if the return value is empty when it should be non-empty according to the ABI; all the tests are passing so I suppose that means this is a reasonable expectation. Again doing it after saving the (partial) witness map to file, but could be one earlier if the value cannot be printed. Maybe we could compare |
Description
Problem*
Followup to #6757
Related to #6516
Summary*
Adds a
--check-return
option to theexecute
command; iftrue
and there is areturn
entry inProver.toml
, its value is compared to the ABI encoded result returned from the execution, the one printed tostdout
by the command upon successful execution. If the two don't match, an error is returned, the two values are printed, and the program exits with an error code.This is done after the witness is saved, so we can inspect what went into the file if necessary; the main goal is to be able to use this integration testing, since the ABI parser already looks for the
return
key.build.rs
has been amended to use the--check-return
flag when running the tests inexecution_success
, so we can verify the expected output. Added the test case from #6516 as extra coverage in addition to the unit test in #6757The
execute
command is also doing a check now to demand that if the circuit, according to its ABI, should have a return value, then that return value isSome
value, to help us catch cases where some witnesses have not been assigned, even if we did not configure their expected values in tests.Additional Context
Example of running the test with wrong output in
Prover.toml
:Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.