0xPolygonMiden / miden-vm

STARK-based virtual machine
MIT License
611 stars 148 forks source link

Allow user to define error codes #1378

Open hackaugusto opened 4 days ago

hackaugusto commented 4 days ago

When testing, it can be useful to inspect the stack state, something like:

proc.assert_stack_is_empty
    assertz assertz assertz assertz
    assertz assertz assertz assertz
    assertz assertz assertz assertz
    assertz assertz assertz assertz
end

And the above can be used in tests, something like:

begin
   call::account.create_note exec.assert_stack_is_empty
   call::account.create_note exec.assert_stack_is_empty
   call::account.create_note exec.assert_stack_is_empty
end

The issue if any of the above fails, there is no information regarding which one failed. Having the error code exec.assert_stack_is_empty.err=1 would be helpful to fix that. This code be done with constants https://github.com/0xPolygonMiden/miden-vm/issues/1312