Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman authored Jan 29, 2023
2 parents e5217cf + c842d53 commit 12cff5e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Anvil support, you can now access trace, events and return_value for anvil transactions.
- Removes `eth-abi` depreciation warnings
- Bump web3.py dep to support async provider in threaded applications

## [1.19.2](https://github.com/eth-brownie/brownie/tree/v1.19.2) - 2022-10-16
### Added
Expand Down
2 changes: 1 addition & 1 deletion brownie/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, exc: ValueError) -> None:

self.revert_type = "revert"
err_msg = exc["data"][len(ERROR_SIG) :]
(err_msg,) = eth_abi.decode_abi(["string"], HexBytes(err_msg))
(err_msg,) = eth_abi.decode(["string"], HexBytes(err_msg))
self.revert_msg = err_msg

return
Expand Down
14 changes: 7 additions & 7 deletions brownie/network/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def decode_input(self, calldata: Union[str, bytes]) -> Tuple[str, Any]:
function_sig = build_function_signature(abi)

types_list = get_type_strings(abi["inputs"])
result = eth_abi.decode_abi(types_list, calldata[4:])
result = eth_abi.decode(types_list, calldata[4:])
input_args = format_input(abi, result)

return function_sig, input_args
Expand Down Expand Up @@ -578,7 +578,7 @@ def encode_input(self, *args: tuple) -> str:

data = format_input(self.abi, args)
types_list = get_type_strings(self.abi["inputs"])
return bytecode + eth_abi.encode_abi(types_list, data).hex()
return bytecode + eth_abi.encode(types_list, data).hex()

def estimate_gas(self, *args: Tuple) -> int:
"""
Expand Down Expand Up @@ -680,7 +680,7 @@ def decode_input(self, calldata: Union[str, bytes]) -> Tuple[str, Any]:
function_sig = build_function_signature(abi)

types_list = get_type_strings(abi["inputs"])
result = eth_abi.decode_abi(types_list, calldata[4:])
result = eth_abi.decode(types_list, calldata[4:])
input_args = format_input(abi, result)

return function_sig, input_args
Expand Down Expand Up @@ -1698,7 +1698,7 @@ def call(
selector = HexBytes(data)[:4].hex()

if selector == "0x08c379a0":
revert_str = eth_abi.decode_abi(["string"], HexBytes(data)[4:])[0]
revert_str = eth_abi.decode(["string"], HexBytes(data)[4:])[0]
raise ValueError(f"Call reverted: {revert_str}")
elif selector == "0x4e487b71":
error_code = int(HexBytes(data)[4:].hex(), 16)
Expand Down Expand Up @@ -1762,7 +1762,7 @@ def decode_input(self, hexstr: str) -> List:
Decoded values
"""
types_list = get_type_strings(self.abi["inputs"])
result = eth_abi.decode_abi(types_list, HexBytes(hexstr)[4:])
result = eth_abi.decode(types_list, HexBytes(hexstr)[4:])
return format_input(self.abi, result)

def encode_input(self, *args: Tuple) -> str:
Expand All @@ -1781,7 +1781,7 @@ def encode_input(self, *args: Tuple) -> str:
"""
data = format_input(self.abi, args)
types_list = get_type_strings(self.abi["inputs"])
return self.signature + eth_abi.encode_abi(types_list, data).hex()
return self.signature + eth_abi.encode(types_list, data).hex()

def decode_output(self, hexstr: str) -> Tuple:
"""
Expand All @@ -1797,7 +1797,7 @@ def decode_output(self, hexstr: str) -> Tuple:
Decoded values
"""
types_list = get_type_strings(self.abi["outputs"])
result = eth_abi.decode_abi(types_list, HexBytes(hexstr))
result = eth_abi.decode(types_list, HexBytes(hexstr))
result = format_output(self.abi, result)
if len(result) == 1:
result = result[0]
Expand Down
6 changes: 3 additions & 3 deletions brownie/network/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import black
import requests
from eth_abi import decode_abi
from eth_abi import decode
from hexbytes import HexBytes
from web3.exceptions import TransactionNotFound

Expand Down Expand Up @@ -728,7 +728,7 @@ def _reverted_trace(self, trace: Sequence) -> None:
else:
self._revert_msg = f"Panic (error code: {error_code})"
elif selector == "0x08c379a0": # keccak of Error(string)
self._revert_msg = decode_abi(["string"], data[4:])[0]
self._revert_msg = decode(["string"], data[4:])[0]
else:
# TODO: actually parse the data
self._revert_msg = f"typed error: {data.hex()}"
Expand Down Expand Up @@ -951,7 +951,7 @@ def _expand_trace(self) -> None:
data = _get_memory(trace[i], -1)
if len(data) > 4:
try:
subcall["revert_msg"] = decode_abi(["string"], data[4:])[0]
subcall["revert_msg"] = decode(["string"], data[4:])[0]
except Exception:
subcall["revert_msg"] = data.hex()
if "revert_msg" not in subcall and "dev" in pc:
Expand Down
3 changes: 2 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ semantic-version<3
tqdm<5
vvm>=0.1.0,<1
vyper>=0.2.11,<1
web3>=5.22.0,<6
# web3 versions 5.29.0 thru 5.31.2 have a bug when using the async provider in subthreads. This is relevant for some ecosystem libs downstream from brownie.
web3>=5.22.0,!=5.29.*,!=5.30.*,!=5.31.1,!=5.31.2,<6
wrapt>=1.12.1,<2
10 changes: 6 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements.in
# pip-compile
#
aiohttp==3.8.3
# via web3
Expand Down Expand Up @@ -236,6 +236,8 @@ toolz==0.12.0
# via cytoolz
tqdm==4.64.1
# via -r requirements.in
typing-extensions==4.4.0
# via black
urllib3==1.26.12
# via requests
varint==1.0.2
Expand All @@ -246,7 +248,7 @@ vyper==0.3.7
# via -r requirements.in
wcwidth==0.2.5
# via prompt-toolkit
web3==5.31.1
web3==5.31.3
# via -r requirements.in
websockets==9.1
# via web3
Expand Down

0 comments on commit 12cff5e

Please sign in to comment.