scale-it/algo-builder

Minimal interactive debugger for runtime

MetaB0y opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

Having stack output in runtime debugger is a simple but incredibly useful feature. The speed of runtime allows me to debug instantly instead of waiting tens of seconds or even minutes until the desired state is reached on devnet.

However, it doesn't provide any functionality except for showing the current line and stacktrace.

Describe the solution you'd like

Ideally, I would like to have feature parity with devnet debugging which means support for interactive debugger in Chromium. However, I understand it might be a huge amount of work.

Instead, I propose to reach for low-hanging fruits. An approach I propose is minimal interactivity:

  • go to line X in file Y
  • go to the next line
  • print global state
  • print contract balances.
  • print list of opted-in accounts

Some additional features which could be added later:

  • print contract call trace (for contract-to-contract calls and ABI)
  • [in near future] print box storage contents

An alternative (even simpler!) approach would be to let user to set breakpoint[s] in advance, stop execution when it is reached, and let the user probe runtime state using already available methods such as runtime.getGlobalState.

This normally works. runtime is a JS object run in Node, so you can run debugger as with any other Node project.
But good point we will add a tutorial.