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
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
240759e
Merge branch 'release/v1.10.0b1'
algobarb Feb 15, 2022
9d5ec1b
Merge branch 'release/v1.10.0'
onetechnical Mar 2, 2022
23354e9
Merge branch 'release/v1.11.0b1'
onetechnical Mar 18, 2022
51e0364
Merge branch 'release/v1.11.0'
algobarb Mar 23, 2022
e6f5aa9
Merge branch 'release/v1.12.0'
algojack Apr 21, 2022
896d2aa
Merge branch 'release/v1.13.0'
onetechnical May 2, 2022
de80435
Merge branch 'release/v1.13.1'
onetechnical May 4, 2022
760d892
Merge branch 'release/v1.14.0'
onetechnical Jun 2, 2022
671aeb6
Merge branch 'release/v1.15.0'
algojack Jun 16, 2022
c03a53d
adding src map decoder
barnjamin Jun 20, 2022
cb7a735
fmt
barnjamin Jun 20, 2022
5a1bf5d
reorg, fmt, add comments
barnjamin Jun 20, 2022
5ca54c6
Merge branch 'src-map-decoder' into develop
barnjamin Jun 20, 2022
5bc92ab
remove comments from src map
barnjamin Jun 23, 2022
f547df8
move SourceMap to its own file, add source_map arg in client for requ…
barnjamin Jun 24, 2022
a617d2c
adding tests for parsing source map from file
barnjamin Jun 24, 2022
abbf604
Merge branch 'develop' of github.com:algorand/py-algorand-sdk into de…
barnjamin Jun 24, 2022
58e60f0
Merge branch 'develop' into src-map-decoder
barnjamin Jun 24, 2022
a968807
fmt
barnjamin Jun 24, 2022
92d197c
implement new test
barnjamin Jun 24, 2022
d4618d6
fmt
barnjamin Jun 24, 2022
d0ec5c1
cr
barnjamin Jun 24, 2022
90333ca
cr
barnjamin Jun 24, 2022
c217a96
Merge branch 'src-map-decoder' of github.com:algorand/py-algorand-sdk…
barnjamin Jun 24, 2022
fe2aef6
cr changes, mostly naming fixes
barnjamin Jun 27, 2022
1d4c007
removing delimited, adding exception if version != 3, checking for ma…
barnjamin Jun 28, 2022
8ed7979
updating to new format
barnjamin Jul 1, 2022
94b59c0
remove initialized 0s
barnjamin Jul 1, 2022
be41089
fmt
barnjamin Jul 1, 2022
14b6658
Update algosdk/source_map.py
barnjamin Jul 1, 2022
7c4309c
use on dict lookup, returning None if not set
barnjamin Jul 11, 2022
ab087ff
Merge branch 'src-map-decoder' of github.com:algorand/py-algorand-sdk…
barnjamin Jul 11, 2022
ece278c
adding commments about None line and tweaking logic to append to the …
barnjamin Jul 11, 2022
689ad74
Update algosdk/source_map.py
barnjamin Jul 11, 2022
5a72f99
adding new tests
barnjamin Jul 12, 2022
e5a3ee8
Merge branch 'src-map-decoder' of github.com:algorand/py-algorand-sdk…
barnjamin Jul 12, 2022
0339df9
fmt
barnjamin Jul 12, 2022
c7cd30a
revert to master
barnjamin Jul 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
barnjamin committed Jun 24, 2022
commit a968807d51c7df495c18b431d17252c1d2797d01
4 changes: 2 additions & 2 deletions algosdk/source_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def __init__(self, map: Dict[str, Any], delimiter: str = ";"):
]

# Initialize with 0,0 for pc/line
barnjamin marked this conversation as resolved.
Show resolved Hide resolved
self.pc_to_line: Dict[int, int] = {0:0}
self.line_to_pc: Dict[int, List[int]] = {0:[0]}
self.pc_to_line: Dict[int, int] = {0: 0}
self.line_to_pc: Dict[int, List[int]] = {0: [0]}
barnjamin marked this conversation as resolved.
Show resolved Hide resolved

last_line = 0
for index, line_num in enumerate(pc_list):
Expand Down
26 changes: 13 additions & 13 deletions tests/steps/other_v2_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@
from glom import glom
import parse

from algosdk import (
dryrun_results,
encoding,
error,
mnemonic,
source_map
)
from algosdk import dryrun_results, encoding, error, mnemonic, source_map
from algosdk.error import AlgodHTTPError
from algosdk.future import transaction
from algosdk.v2client import *
Expand Down Expand Up @@ -1710,23 +1704,29 @@ def glom_app_eval_delta(context, i, path, field):
), f"path [{path}] expected value [{field}] but got [{actual_field}] instead"




@given('a source map json file "{sourcemap_file}"')
def step_impl(context, sourcemap_file):
barnjamin marked this conversation as resolved.
Show resolved Hide resolved
jsmap = json.loads(load_resource(sourcemap_file, is_binary=False))
context.source_map = source_map.SourceMap(jsmap)

@then('getting the line that corresponds to the PC "{pc_value:d}" produces "{line_number:d}"')

@then(
'getting the line that corresponds to the PC "{pc_value:d}" produces "{line_number:d}"'
)
def step_impl(context, pc_value, line_number):
pc_value = int(pc_value)
line_number = int(line_number)
actual_line = context.source_map.get_line_for_pc(pc_value)
assert actual_line == line_number, f"Expected {line_number} got {actual_line}"
assert (
actual_line == line_number
), f"Expected {line_number} got {actual_line}"


@then('getting the first PC that corresponds to the line "{line_number:d}" produces "{pc_value:d}"')
@then(
'getting the first PC that corresponds to the line "{line_number:d}" produces "{pc_value:d}"'
)
def step_impl(context, line_number, pc_value):
pc_value = int(pc_value)
line_number = int(line_number)
pcs = context.source_map.get_pcs_for_line(line_number)
pcs = context.source_map.get_pcs_for_line(line_number)
assert pcs[0] == pc_value, f"Expected {pc_value} got {pcs[0]}"