Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Tools: Source map decoder #353

Merged
merged 38 commits into from
Jul 13, 2022
Merged

Dev Tools: Source map decoder #353

merged 38 commits into from
Jul 13, 2022

Conversation

barnjamin
Copy link
Contributor

@barnjamin barnjamin commented Jun 20, 2022

The VLQ encoding is a lot to ask folks to implement themselves, lets provide some easier way to get the numeric pc

Lifted from @algochoi https://github.com/algochoi/teal-sourcemap-decoder

@michaeldiamant I think this would need to be implemented across the SDKs assuming we can come up with a good way to expose it.

I'm imagining with the json src_map

err_pc_num = 996 # really comes from error message returned by algod
sm = SourceMap(src_map)
print(f"Teal source line number: {sm.get_line_for_pc(err_pc_num)}")

@algochoi
Copy link
Contributor

Nice, I think this will work nicely when the APIs also support the disassemble endpoint (related ticket). We could add some cucumber tests in the testing repo as well to check the translation, but I'm not sure what would be the easiest way to test it (maybe output the VLQ->Int mapping in a unified JSON format?)

algosdk/logic.py Outdated Show resolved Hide resolved
algosdk/logic.py Outdated Show resolved Hide resolved
algosdk/logic.py Outdated Show resolved Hide resolved
@barnjamin barnjamin marked this pull request as ready for review June 24, 2022 15:47
run_integration.sh Outdated Show resolved Hide resolved
@barnjamin barnjamin requested a review from ahangsu June 24, 2022 17:17
@barnjamin barnjamin requested a review from algochoi July 1, 2022 17:17
Co-authored-by: Michael Diamant <[email protected]>
@barnjamin barnjamin closed this Jul 6, 2022
@barnjamin barnjamin reopened this Jul 6, 2022
@barnjamin barnjamin changed the title Src map decoder debbugging: Source map decoder Jul 6, 2022
@barnjamin barnjamin changed the title debbugging: Source map decoder Dev Tools: Source map decoder Jul 6, 2022
algosdk/source_map.py Outdated Show resolved Hide resolved
algosdk/source_map.py Outdated Show resolved Hide resolved
algosdk/source_map.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ahangsu ahangsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, once Andrew's suggestion is resolved, we should probably ship it?

Copy link
Contributor

@michaeldiamant michaeldiamant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@barnjamin Leaving approval with a friendly reminder to revert branch change in run_integration.sh prior to merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants