Skip to content

Commit

Permalink
fix: handle breaking changes from updated deps
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Feb 2, 2024
1 parent d3873b4 commit e9b5cb6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
2 changes: 2 additions & 0 deletions brownie/convert/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def _check_array(values: Union[List, Tuple], length: Optional[int]) -> None:


def _get_abi_types(abi_params: List) -> Sequence[ABIType]:
if not abi_params:
return []
type_str = f"({','.join(get_type_strings(abi_params))})"
tuple_type = parse(type_str)
return tuple_type.components
8 changes: 2 additions & 6 deletions brownie/network/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
import eth_account
import eth_keys
import rlp
from eip712.messages import EIP712Message, _hash_eip191_message
from eip712.messages import EIP712Message
from eth_account._utils.signing import sign_message_hash
from eth_account.datastructures import SignedMessage
from eth_account.messages import defunct_hash_message
from eth_account.messages import _hash_eip191_message, defunct_hash_message
from eth_utils import keccak
from eth_utils.applicators import apply_formatters_to_dict
from hexbytes import HexBytes
Expand Down Expand Up @@ -404,7 +404,6 @@ def get_deployment_address(self, nonce: Optional[int] = None) -> EthAddress:


class _PrivateKeyAccount(PublicKeyAccount):

"""Base class for Account and LocalAccount"""

def __init__(self, addr: str) -> None:
Expand Down Expand Up @@ -865,7 +864,6 @@ def _await_confirmation(


class Account(_PrivateKeyAccount):

"""Class for interacting with an Ethereum account.
Attributes:
Expand All @@ -881,7 +879,6 @@ def _transact(self, tx: Dict, allow_revert: bool) -> Any:


class LocalAccount(_PrivateKeyAccount):

"""Class for interacting with an Ethereum account.
Attributes:
Expand Down Expand Up @@ -984,7 +981,6 @@ def _transact(self, tx: Dict, allow_revert: bool) -> None:


class ClefAccount(_PrivateKeyAccount):

"""
Class for interacting with an Ethereum account where signing is handled in Clef.
"""
Expand Down
2 changes: 1 addition & 1 deletion brownie/network/middlewares/ganache7.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Ganache7MiddleWare(BrownieMiddlewareABC):
@classmethod
def get_layer(cls, w3: Web3, network_type: str) -> Optional[int]:
if w3.clientVersion.lower().startswith("ganache/v7"):
if w3.client_version.lower().startswith("ganache/v7"):
return -100
else:
return None
Expand Down
2 changes: 1 addition & 1 deletion brownie/network/middlewares/hardhat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class HardhatMiddleWare(BrownieMiddlewareABC):
@classmethod
def get_layer(cls, w3: Web3, network_type: str) -> Optional[int]:
if w3.clientVersion.lower().startswith("hardhat"):
if w3.client_version.lower().startswith("hardhat"):
return -100
else:
return None
Expand Down
2 changes: 1 addition & 1 deletion brownie/network/rpc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def attach(self, laddr: Union[str, Tuple]) -> None:
self.process = psutil.Process(pid)

for key, module in ATTACH_BACKENDS.items():
if web3.clientVersion.lower().startswith(key):
if web3.client_version.lower().startswith(key):
self.backend = module
break

Expand Down
4 changes: 2 additions & 2 deletions brownie/network/rpc/ganache.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def sleep(seconds: int) -> int:
def mine(timestamp: Optional[int] = None) -> None:
params = [timestamp] if timestamp else []
_request("evm_mine", params)
if timestamp and web3.clientVersion.lower().startswith("ganache/v7"):
if timestamp and web3.client_version.lower().startswith("ganache/v7"):
# ganache v7 does not modify the internal time when mining new blocks
# so we also set the time to maintain consistency with v6 behavior
_request("evm_setTime", [(timestamp + 1) * 1000])
Expand All @@ -152,7 +152,7 @@ def revert(snapshot_id: int) -> None:


def unlock_account(address: str) -> None:
if web3.clientVersion.lower().startswith("ganache/v7"):
if web3.client_version.lower().startswith("ganache/v7"):
web3.provider.make_request("evm_addAccount", [address, ""]) # type: ignore
web3.provider.make_request( # type: ignore
"personal_unlockAccount",
Expand Down
6 changes: 3 additions & 3 deletions brownie/network/web3.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from web3 import HTTPProvider, IPCProvider
from web3 import Web3 as _Web3
from web3 import WebsocketProvider
from web3.contract import ContractEvent # noqa
from web3.contract import ContractEvents as _ContractEvents # noqa
from web3.contract.contract import ContractEvent # noqa
from web3.contract.contract import ContractEvents as _ContractEvents # noqa
from web3.gas_strategies.rpc import rpc_gas_price_strategy

from brownie._config import CONFIG, _get_data_folder
Expand Down Expand Up @@ -112,7 +112,7 @@ def disconnect(self) -> None:
def isConnected(self) -> bool:
if not self.provider:
return False
return super().isConnected()
return super().is_connected()

@property
def supports_traces(self) -> bool:
Expand Down

0 comments on commit e9b5cb6

Please sign in to comment.