Skip to content

Commit

Permalink
bugfix - properly format bytes return_value
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Feb 18, 2019
1 parent c973ae4 commit a476c8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/components/eth.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ def wei(value):
* a string specifying the unit: "10 ether", "300 gwei", "0.25 shannon"
* a large float in scientific notation, where direct conversion to int
would cause inaccuracy: 8.3e32
* a byte string: "0x330124"'''
* bytes: b'\xff\xff'
* hex strings: "0x330124"'''
if value is None:
return 0
if type(value) is bytes:
value = "0x"+value.hex()
if type(value) is float and "e+" in str(value):
num, dec = str(value).split("e+")
num = num.split(".") if "." in num else [num, ""]
Expand Down
2 changes: 2 additions & 0 deletions lib/components/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ def _evaluate_trace(self):
'0x'+i.hex() if type(i) is bytes else i
for i in self.return_value
]
elif type(self.return_value) is bytes:
self.return_value = "0x"+self.return_value.hex()
else:
self.events = []
# get revert message
Expand Down

0 comments on commit a476c8c

Please sign in to comment.