anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
454 stars 53 forks source link

Use Anoma nock interpreter `%puts hint` feature in Nock backend debug mode #3022

Closed paulcadman closed 1 month ago

paulcadman commented 1 month ago

We would like to be able to debug errors that occur when running Nock code in Anoma Node. Currently we only receive :error in the node logs. The Anoma Node nock interpreter now supports logging of strings using %puts hint feature:

We can use this to wrap some nock cells in the nockma output with useful messages. For example, log the Juvix function that is being called. We should only output this debug information in debug builds.

juped commented 1 month ago

If a more complicated stack trace style (hints for pushing strings/line nos/whatever onto a stack and then dumping them all in the event we reach the error result) would be helpful, please open an issue back at anoma/anoma and we'll do it in the next round of VM updates; it's stateful so actually takes work unlike this, but we can. (Otherwise we'll get to it "whenever".)