-
Notifications
You must be signed in to change notification settings - Fork 236
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
Write a version of assert
which allows a msg to be passed to the simulator
#1434
Comments
I think that given the fact that we now have stepwise execution of ACIR we could just create a wrapper assert fn that if the condition is false calls an oracle with the message and then asserts the condition, and it would work fine for aztec (although It could be a bit inefficient), receiving the oracle call and then failing. But this could be much easier if the acir expressions could just have a message attached in case they fail. |
Why would this be inefficient?
Yeah, it was that discussion that made me open this issue. Distributing source code isn't guaranteed (although validation of source code against bytecode should be encouraged, of course). Distributing the bytecode is guaranteed. |
For every assert with message you'll end up with two opcodes, the expression itself and a brillig opcode to send the message just before. But It would be only executed in the case of failure which should be ok |
This issue is being worked on the noir side in this issue noir-lang/noir#1939 |
Done in #1997 |
At the moment,
assert(condition)
doesn't enable an error message to be given.assert(condition, error_msg)
would be lovely.Now, I'm not sure if this is an issue that should be opened in the noir-lang repo, or if this is something we'll need to implement ourselves, to enable to the error message to be passed directly to the simulator via an oracle call.
E.g. we could create a wrapper function
contract_assert(condition, error_msg)
, which under the hood does anassert(condition)
and then does an oracle call with the message?Tagging @sirasistant for inspirational ideas :)
The text was updated successfully, but these errors were encountered: