Skip to content

Commit

Permalink
Merge pull request #843 from eth-brownie/fix-revert-msg
Browse files Browse the repository at this point in the history
fix: handle undecodable revert message in subcalls
  • Loading branch information
iamdefinitelyahuman authored Nov 11, 2020
2 parents 6ab8f6d + 20086b4 commit 3fad0bd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions brownie/network/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,12 @@ def _expand_trace(self) -> None:
subcall["selfdestruct"] = True
else:
if opcode == "REVERT":
data = _get_memory(trace[i], -1)[4:]
if data:
subcall["revert_msg"] = decode_abi(["string"], data)[0]
data = _get_memory(trace[i], -1)
if len(data) > 4:
try:
subcall["revert_msg"] = decode_abi(["string"], data[4:])[0]
except Exception:
subcall["revert_msg"] = data.hex()
if "revert_msg" not in subcall and "dev" in pc:
subcall["revert_msg"] = pc["dev"]

Expand Down

0 comments on commit 3fad0bd

Please sign in to comment.