You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Developers currently have trouble mapping PC values to TEAL. A common use case is trying to see which assert in a TEAL program failed from a particular PC. We would like to create a standardized format to show this mapping using the Javascript standard.
Solution
Create a subcommand/flag for the goal clerk compile command that will generate a JSON of the source map.
The format of the JSON should match the Javascript standard noted above, but for this ticket, we should only really be concerned with the sources field and the mappings field. The mapping is done in base64 VLQ encoding, and there is an implementation in the tealdbg that converts integers to VLQ.
There is a PR by @barnjamin that does a lot of the heavy lifting for this proposed solution, and can be used to convert the output into the standard above.
It would also be nice if this was supported in the REST endpoint as well with an optional parameter, e.g. ?map=true, but this could be a subject of a later ticket. It would also be nice to tackle this issue as well, since there seems to be high community interest: #1654
Example
myprog.teal
#pragma version 5
int 3
byte 0x03
btoi
==
assert
int 10
byte 0x10
btoi
==
assert
Problem
Developers currently have trouble mapping PC values to TEAL. A common use case is trying to see which assert in a TEAL program failed from a particular PC. We would like to create a standardized format to show this mapping using the Javascript standard.
Solution
Create a subcommand/flag for the
goal clerk compile
command that will generate a JSON of the source map.The format of the JSON should match the Javascript standard noted above, but for this ticket, we should only really be concerned with the
sources
field and themappings
field. The mapping is done in base64 VLQ encoding, and there is an implementation in the tealdbg that converts integers to VLQ.There is a PR by @barnjamin that does a lot of the heavy lifting for this proposed solution, and can be used to convert the output into the standard above.
It would also be nice if this was supported in the REST endpoint as well with an optional parameter, e.g.
?map=true
, but this could be a subject of a later ticket. It would also be nice to tackle this issue as well, since there seems to be high community interest: #1654Example
myprog.teal
myprog.teal.map.json
The code used to generate this is in this PR branch: #3726
The source map is generated by passing the
-m
flag togoal clerk compile
.Example decoder here: https://github.com/algochoi/teal-sourcemap-decoder/tree/examples
Dependencies
None
Urgency
Medium
The text was updated successfully, but these errors were encountered: