TritonVM / triton-vm

Triton is a virtual machine that comes with Algebraic Execution Tables (AET) and Arithmetic Intermediate Representations (AIR) for use in combination with a STARK proof system.
https://triton-vm.org
Apache License 2.0
223 stars 35 forks source link

Add optional error code to `assert` and `assert_vector` #269

Open Sword-Smith opened 2 months ago

Sword-Smith commented 2 months ago

I was just writing a negative test of a Triton VM assembler code snippet and it was failing as I expected. However, when I ran the program with the debugger, I realized that it was failing on another assert instruction than the one I intended to test.

To make it easier to write negative tests of TVM code snippets, it should be possible to tag each assert, for example with a usize such that you can write more fine-grained negative tests.

The tag can be optional, but I would probably let the parser enforce that each tag is only used once in a program, just like it enforces that each jump-destination label is only used once.