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 StopIteration within tx receipts #1059

Merged
merged 1 commit into from
Apr 16, 2021
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
9 changes: 6 additions & 3 deletions brownie/network/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,8 @@ def _reverted_trace(self, trace: Sequence,) -> None:
self._dev_revert_msg = ""
return

step = next(i for i in trace[::-1] if i["op"] in ("REVERT", "INVALID"))
self._revert_msg = "invalid opcode" if step["op"] == "INVALID" else ""
op = next((i["op"] for i in trace[::-1] if i["op"] in ("REVERT", "INVALID")), None)
self._revert_msg = "invalid opcode" if op == "INVALID" else ""

def _expand_trace(self) -> None:
"""Adds the following attributes to each step of the stack trace:
Expand Down Expand Up @@ -1101,7 +1101,10 @@ def _traceback_string(self) -> str:
except StopIteration:
return ""

result = [next(i for i in trace_range if trace[i]["source"])]
try:
result = [next(i for i in trace_range if trace[i]["source"])]
except StopIteration:
return ""
depth, jump_depth = trace[idx]["depth"], trace[idx]["jumpDepth"]

while True:
Expand Down