Skip to content
New issue

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

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

Already on GitHub? # to your account

Sourcemap templates #696

Merged
merged 6 commits into from
Mar 23, 2023
Merged

Sourcemap templates #696

merged 6 commits into from
Mar 23, 2023

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented Mar 22, 2023

Description

Sourcemapper was breaking on the compile step it uses to discover program counters when TMPL variables were used. This PR adds back the template substitution prior to compilation, using new zeroed typed definitions to substitute in for the templates for the purposes of PC collection.

Previous Behavior

❯ python examples/signature/dutch_auction.py
... first error in chain ...
urllib.error.HTTPError: HTTP Error 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
... most relevant error ...
  File "/Users/zeph/github/algorand/pt2/pyteal/compiler/sourcemap.py", line 940, in _build_pc_sourcemap
    algod_compilation = algod.compile(self.compiled_teal(), source_map=True)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/zeph/github/algorand/pt2/.venv/lib/python3.11/site-packages/algosdk/v2client/algod.py", line 470, in compile
    self.algod_request(
  File "/Users/zeph/github/algorand/pt2/.venv/lib/python3.11/site-packages/algosdk/v2client/algod.py", line 110, in algod_request
    raise error.AlgodHTTPError(e, code)
algosdk.error.AlgodHTTPError: 20: strconv.ParseUint: parsing "TMPL_START_ROUND": invalid syntax
21: strconv.ParseUint: parsing "TMPL_WRAPUP_ROUND": invalid syntax
33: failed to decode address TMPL_RECEIVER to base 32
44: failed to decode address TMPL_RECEIVER to base 32
48: strconv.ParseUint: parsing "TMPL_ASSET_A": invalid syntax
83: strconv.ParseUint: parsing "TMPL_REDEEM_ROUND": invalid syntax
91: strconv.ParseUint: parsing "TMPL_ASSET_B": invalid syntax
99: strconv.ParseUint: parsing "TMPL_ASSET_A": invalid syntax
107: strconv.ParseUint: parsing "TMPL_ASSET_C": invalid syntax
111: strconv.ParseUint: parsing "TMPL_REDEEM_ROUND": invalid syntax

@tzaffi tzaffi requested a review from barnjamin March 22, 2023 01:57
Copy link
Contributor

@bbroder-algo bbroder-algo left a comment

Choose a reason for hiding this comment

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

Sourcemapper was breaking on the compile step it uses to discover program counters when TMPL variables were used. This PR adds back the template substitution prior to compilation, using new zeroed typed definitions to substitute in for the templates for the purposes of PC collection.

@tzaffi

This comment was marked as resolved.

@tzaffi tzaffi added the Bug-Fix label Mar 22, 2023
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.

just one minor question, but mostly looks reasonable

@bbroder-algo bbroder-algo merged commit fd073e2 into master Mar 23, 2023
@tzaffi tzaffi deleted the sourcemap-templates branch March 23, 2023 17:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants