Skip to content

Commit

Permalink
fix: handle malformed calldata in subcalls
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Dec 28, 2020
1 parent b99975d commit b35eba1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions brownie/network/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,13 @@ def _expand_trace(self) -> None:
self._subcalls[-1]["value"] = int(step["stack"][-3], 16)
if calldata and last_map[trace[i]["depth"]].get("function"):
fn = last_map[trace[i]["depth"]]["function"]
zip_ = zip(fn.abi["inputs"], fn.decode_input(calldata))
self._subcalls[-1].update(
inputs={i[0]["name"]: i[1] for i in zip_}, # type:ignore
function=fn._input_sig,
)
self._subcalls[-1]["function"] = fn._input_sig
try:
zip_ = zip(fn.abi["inputs"], fn.decode_input(calldata))
inputs = {i[0]["name"]: i[1] for i in zip_} # type: ignore
self._subcalls[-1]["inputs"] = inputs
except Exception:
self._subcalls[-1]["calldata"] = calldata.hex()
elif calldata:
self._subcalls[-1]["calldata"] = calldata.hex()

Expand Down

0 comments on commit b35eba1

Please sign in to comment.