pyteal icon indicating copy to clipboard operation
pyteal copied to clipboard

PyTeal-to-TEAL mapping

Open algoanne opened this issue 3 years ago • 1 comments

Problem

It is difficult to debug PyTeal, because a user can typically only get errors reported at the TEAL line level (at best). Figuring out which PyTeal line corresponds to each TEAL line is currently a manual process.

Solution

Provide a PyTeal-to-TEAL mapping file that is generated when the PyTeal is compiled. This mapping should indicate which line(s) of PyTeal each line of TEAL came from (these are of course not 1-to-1).

FYI, this will be used to add to the trace created in https://github.com/algorand/go-algorand/issues/3953.

algoanne avatar Jul 18 '22 20:07 algoanne

Hey. I am the author of tealer, a static analysis framework for Teal code.

If pyteal can provide a source code mapping to third party tools, we would love to add Pyteal <> Teal mapping within tealer. For example we could output the control flow graph of the teal code, and add the related pyteal source code, to ease the reading, and help developers to understand how the generated code works.

montyly avatar Jul 29 '22 16:07 montyly

Would love this as well

pmprete avatar Mar 28 '23 13:03 pmprete

he @pmprete this was completed and released!

See https://github.com/algorand/pyteal/blob/master/examples/application/sourcemap.py for an example

barnjamin avatar Mar 28 '23 13:03 barnjamin