diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d55fb3b9..5a4a5c671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ This changelog format is based on [Keep a Changelog](https://keepachangelog.com/ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased](https://github.com/eth-brownie/brownie) -### Changed +### Fixed +- 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 diff --git a/brownie/exceptions.py b/brownie/exceptions.py index b04b664d1..7b28d428f 100644 --- a/brownie/exceptions.py +++ b/brownie/exceptions.py @@ -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 diff --git a/brownie/network/contract.py b/brownie/network/contract.py index 0d28b1996..cd4e4eccf 100644 --- a/brownie/network/contract.py +++ b/brownie/network/contract.py @@ -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 @@ -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: """ @@ -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 @@ -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) @@ -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: @@ -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: """ @@ -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] diff --git a/brownie/network/transaction.py b/brownie/network/transaction.py index 71215b223..a2530b0c5 100644 --- a/brownie/network/transaction.py +++ b/brownie/network/transaction.py @@ -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 @@ -722,7 +722,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()}" @@ -945,7 +945,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: