-
Notifications
You must be signed in to change notification settings - Fork 8
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
Revertable function #150
Comments
Hi! I'll need a bit more information on how you expect this function to behave. It appears that it will simply raise an error if If the function raises an error, then the function never returns, and thus the conditions specified in the Does this make any sense? |
Thanks, @langfield ! But looking into the cairo documentation, when the function cannot complete, (in this case) it sends an error message that can be checked outside this function. The Certora prover uses an annotation @withRevert (associated with a function to signal that the function can revert) and a boolean variable "lastReverted", which reveals if this function worked as expected or reverted... What can we do with horus about this? I know that such a situation is not usual in the formal methods community but it is practical...in the present context... |
@acmLL The best we can currently do about this is to mark this as a feature request (smh took me a while to realize we have this as an 'enhancement tag'!) and add it to our internal pile of features to work on :). Thank you kindly for sketching the way Certora does it, one can certainly take some inspiration from their approach. I do think Horus does indeed need some way to reason about this and I suspect this will be a common request, so I'll make sure to assign appropriate priority. |
Thank you very much, @Ferinko ! Another point I would like to ask is: can we use horus with "tests" without concrete values? Something like a \forall x... instead of a x = 2... Best! |
@acmLL Of course you can; as a matter of fact, As a simple example, this test proves for the function There are many more examples in the |
I have also made a small change to the original example:
Which outputs:
Note that I made a deliberate mistake and pushed Note that this (dis)proves that |
I have a function that can revert for some inputs. I would like to know how to use horus (@pre/@post or other feature) in such a situation. For example:
func assertValid{range_check_ptr}(n) {
with_attr error_message("Number out of bound") {
assert_le(n, SomeBound);
assert_le(-SomeBound, n);
}
return ();
}
Thanks!
The text was updated successfully, but these errors were encountered: