Anoma NockVM error reporting
The Anoma NockVM is used to interpret Nock code that’s submitted to Anoma. For
example:
- Nock computations via the
/prove
endpoint (used to compute transaction
candidates) - Transaction candidates submitted to the mempool
- Logic functions in Resources
An Anoma NockVM errors can occur when:
- The submitted Nock code is invalid (e.g it cannot be decoded)
- The interpreter reaches an error condition in Nock code
- A crash happens in a jet (i.e Elixir code)
The user only recieves feedback if a NockVM error occurs when calling /prove
.
There’s currently no way to see errors that happen during logic function or
transaction candidate execution.
These errors are reported using the single error value :error
with no
additional context.
This makes it hard for application authors to debug because it’s hard to
determine the cause of an error.
Ideas for error reporting
-
Each
:error
value could have a string payload describing why the error
occured. For example this could contain the name of the jet that failed if
the error occured in a jet. -
Provide a mechanism for logging VM errors that occur in transaction
candidates or logic functions that can be queried by the application author.
Also making trace logs emitted by transaction candidates / logic functions
would be useful here.
More long term ideas that we’ve discussed before:
- Provide an interface for injecting Juvix call-stack and source file/line
number information into Nock terms so we can report a stack trace of the
error to the user.