Skip to content

Latest commit

 

History

History
51 lines (30 loc) · 3.54 KB

README.md

File metadata and controls

51 lines (30 loc) · 3.54 KB

teal-debugger-extension

This is TEAL debugger extension for VS Code with support up to and including TEAL 5. Support for TEAL 6 is coming in the future.

It allows you to run TEAL code directly on a simulated AVM (Algorand virtual machine) without having to do any setup or configuration

To run TEAL code on a real AVM you need to setup an Algorand block chain node (which is complicated and takes time). Then you have to jump through hoops to run, test and debug your code. This TEAL debugger extension allows you to test and debug your code without any of that complexity.

Install the debugger

Install this extension from the VS Code marketplace.

Or install the latest version manually, downloaded from the releases page.

Using the debugger

With the debugger installed, open a TEAL file.

Debug it like you would any other type of code:

  • F5 to start debugging.
  • F10 to single step lines of code.
  • View the debug pane to see the compute stack and variables.

See the VS Code Debugging guide for help on using the debugger UI.

Configuring the debugger

Running TEAL code often requires a lot of environmental context (hereafter referred to as the context), things like:

  • The current transaction or transaction group
  • Global and local state
  • Details about the block chain account

This TEAL debugger requires no initial configuration, you can simply start debugging and it asks you to choose from the following options:

  • Choose a new existing configuration file (if you have one)
  • Create a new configuration from a default (if you have some defaults)
  • Proceed with no configuration.

The first time you use the TEAL debugger the easiest way is to proceed with no configuration. The debugger runs in automatic configuration mode: when it needs to load a value from the context, and the value doesn't yet exist, it prompts you for input. The inputs you provide are stored in the context. When the context is updated you then are prompted to save a configuration file. This is the easiest way to generate a new configuration file.

The saved configuration is output into the .teal-debugger directory under the same directory as the TEAL file you are debugging. The name of the configuration file is automatically generated by adding .json to the name of the TEAL file. So if you are debugging blah.teal the first generated configuration will be named .teal-debugger/blah.teal.json. Please rename this file to give it a more meaningful name. Subsequent generated configuration files for the same TEAL file add numbers to the name, i.e. .teal-debugger/blah.teal-1.json, .teal-debugger/blah.teal-2.json and so on.

You can copy existing configurations in the .teal-debugger directory, give them new names and tweak the values therein to create new configurations for the TEAL debugger.

To create default (or template) configurations copy existing configuration file to the .teal-debugger directory under your home directory (you must create this directory yourself). Be sure to give these files good names so that you'll remember their purpose later.

To learn more about what goes in a configuration file, please see the configuration guide for the TEAL interpreter (that this debugger is built on).

Development

See the development guide for instructions on development of this extension.