-
Notifications
You must be signed in to change notification settings - Fork 57
Description
When Triton VM tries to execute instruction assert while the top of its stack is unequal to 1, it fails. Currently, the error it returns does not give any further context. It would be beneficial for developers writing Triton assembly if instruction assert could be decorated with some context, indicating which of potentially many assert statements failed, and potentially also why it failed.
One idea would be to allow specifying an error code:
push 42
assert 127 ; Triton VM returns `InstructionError::AssertionFailed(127)`Another possibility is to be more explicit about the failure reason:
push 42
assert [expect = "The moon should be blue."]User-provided context should be optional. That is, the following program should remain syntactically correct (even though it will not halt successfully):
push 42
assert
haltNote that all syntax examples are simply first drafts of suggestions and should be designed properly.