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

Handle incomplete solc source map #676

Merged
merged 1 commit into from
Jul 9, 2020
Merged
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions brownie/project/compiler/solidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,14 @@ def _generate_coverage_data(
key = (pc_list[-1]["path"], pc_list[-1]["offset"])
revert_map.setdefault(key, []).append(len(pc_list))

while opcodes and opcodes[0] not in ("INVALID", "STOP"):
# necessary because sometimes solidity returns an incomplete source map
pc_list.append({"op": opcodes.popleft(), "pc": pc})
pc += 1
if opcodes and opcodes[0][:2] == "0x":
pc_list[-1]["value"] = opcodes.popleft()
pc += int(pc_list[-1]["op"][4:])

# compare revert and require statements against the map of revert jumps
for (contract_id, fn_offset), values in revert_map.items():
fn_node = source_nodes[contract_id].children(
Expand Down