Skip to content

Commit

Permalink
Merge pull request #1735 from eth-brownie/update-deps
Browse files Browse the repository at this point in the history
Bump dependencies, linting, fix (some) tests
  • Loading branch information
iamdefinitelyahuman authored Feb 2, 2024
2 parents db055df + cfcdaba commit cdec5d6
Show file tree
Hide file tree
Showing 48 changed files with 232 additions and 278 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/core-ganache-3.10.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Core Ganache (py10)
name: Core Ganache (py3.10)
on: ["push", "pull_request"]

env:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Core Ganache (py39)
name: Core Ganache (py3.11)
on: ["push", "pull_request"]

env:
Expand All @@ -7,16 +7,11 @@ env:
WEB3_INFURA_PROJECT_ID: 1668fecbc9c242d58253476103a42ce9

jobs:
py39core:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
py311core:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Cache Solidity Installations
uses: actions/cache@v2
Expand All @@ -27,21 +22,21 @@ jobs:
key: ${{ runner.os }}-compiler-cache

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4

- name: Install Ganache
run: npm install -g ganache@7.0.2
run: npm install -g ganache@7.9.2

- name: Setup Python 3.9
uses: actions/setup-python@v2
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: "3.11"

- name: Install Tox
run: pip install tox

- name: Run Tox
run: tox -e py39
run: tox -e py311

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Core Ganache (py38)
name: Core Ganache (py3.12)
on: ["push", "pull_request"]

env:
Expand All @@ -7,11 +7,11 @@ env:
WEB3_INFURA_PROJECT_ID: 21317ddb5ded42ce8d40c7d78f90474f

jobs:
py38core:
py312core:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Cache Solidity Installations
uses: actions/cache@v2
Expand All @@ -22,21 +22,21 @@ jobs:
key: ${{ runner.os }}-compiler-cache

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4

- name: Install Ganache
run: npm install -g ganache@7.0.2
run: npm install -g ganache@7.9.2

- name: Setup Python 3.8
uses: actions/setup-python@v2
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.12"

- name: Install Tox
run: pip install tox

- name: Run Tox
run: tox -e py38
run: tox -e py312

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/evm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
job: [evm-byzantium, evm-petersburg, evm-istanbul, evm-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Cache Solidity Installations
uses: actions/cache@v2
Expand All @@ -29,15 +29,15 @@ jobs:
key: ${{ runner.os }}-compiler-cache

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4

- name: Install Ganache
run: npm install -g ganache@7.0.2
run: npm install -g ganache@7.9.2

- name: Setup Python 3.8
uses: actions/setup-python@v2
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"

- name: Install Tox
run: pip install tox
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/functionality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
job: [plugintest, pmtest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Cache Solidity Installations
uses: actions/cache@v2
Expand All @@ -29,15 +29,15 @@ jobs:
key: ${{ runner.os }}-compiler-cache

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4

- name: Install Ganache
run: npm install -g ganache@7.0.2
run: npm install -g ganache@7.9.2

- name: Setup Python 3.8
uses: actions/setup-python@v2
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"

- name: Install Tox
run: pip install tox
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
experimental: true

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Python 3.8
uses: actions/setup-python@v2
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"

- name: Install Tox
run: pip install tox
Expand Down
15 changes: 5 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,22 @@ repos:
hooks:
- id: check-yaml

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.9.3
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.1.0
rev: 24.1.1
hooks:
- id: black
name: black

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.720
hooks:
- id: mypy


default_language_version:
python: python3
4 changes: 0 additions & 4 deletions brownie/convert/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


class Wei(int):

"""Integer subclass that converts a value to wei and allows comparison against
similarly formatted values.
Expand Down Expand Up @@ -125,7 +124,6 @@ def _return_int(original: Any, value: Any) -> int:


class Fixed(Decimal):

"""
Decimal subclass that allows comparison against strings, integers and Wei.
Expand Down Expand Up @@ -199,7 +197,6 @@ def _to_fixed(value: Any) -> Decimal:


class EthAddress(str):

"""String subclass that raises TypeError when compared to a non-address."""

def __new__(cls, value: Union[bytes, str]) -> str:
Expand Down Expand Up @@ -231,7 +228,6 @@ def _address_compare(a: Any, b: Any) -> bool:


class HexString(bytes):

"""Bytes subclass for hexstring comparisons. Raises TypeError if compared to
a non-hexstring. Evaluates True for hexstrings with the same value but differing
leading zeros or capitalization."""
Expand Down
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
1 change: 0 additions & 1 deletion brownie/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class MainnetUndefined(Exception):


class VirtualMachineError(Exception):

"""
Raised when a call to a contract causes an EVM exception.
Expand Down
35 changes: 16 additions & 19 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 @@ -233,7 +233,7 @@ def load(
break
except ValueError as e:
if allow_retry:
prompt = f"Incorrect password, try again: "
prompt = "Incorrect password, try again: "
password = None
continue
raise e
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 @@ -482,8 +481,8 @@ def _check_for_revert(self, tx: Dict) -> None:
except ValueError as exc:
exc = VirtualMachineError(exc)
raise ValueError(
f"Execution reverted during call: '{exc.revert_msg}'. This transaction will likely revert. "
"If you wish to broadcast, include `allow_revert:True` as a transaction parameter.",
f"Execution reverted during call: '{exc.revert_msg}'. This transaction will likely "
"revert. If you wish to broadcast, include `allow_revert:True` as a parameter.",
) from None

def deploy(
Expand Down Expand Up @@ -606,7 +605,7 @@ def estimate_gas(
"data": HexBytes(data or ""),
}
if gas_price is not None:
tx["gasPrice"] = web3.toHex(gas_price)
tx["gasPrice"] = web3.to_hex(gas_price)
try:
return web3.eth.estimate_gas(tx)
except ValueError as exc:
Expand Down Expand Up @@ -753,7 +752,7 @@ def _make_transaction(
"from": self.address,
"value": Wei(amount),
"nonce": nonce if nonce is not None else self._pending_nonce(),
"gas": web3.toHex(gas_limit),
"gas": web3.to_hex(gas_limit),
"data": HexBytes(data),
}
if to:
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 @@ -925,6 +922,7 @@ def save(self, filename: str, overwrite: bool = False, password: Optional[str] =
password = getpass("Enter the password to encrypt this account with: ")

encrypted = web3.eth.account.encrypt(self.private_key, password)
encrypted["address"] = encrypted["address"].lower()
with json_file.open("w") as fp:
json.dump(encrypted, fp)
return str(json_file)
Expand Down Expand Up @@ -984,7 +982,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 All @@ -1000,10 +997,10 @@ def _transact(self, tx: Dict, allow_revert: bool) -> None:
self._check_for_revert(tx)

formatters = {
"nonce": web3.toHex,
"value": web3.toHex,
"chainId": web3.toHex,
"data": web3.toHex,
"nonce": web3.to_hex,
"value": web3.to_hex,
"chainId": web3.to_hex,
"data": web3.to_hex,
"from": to_address,
}
if "to" in tx:
Expand All @@ -1029,7 +1026,7 @@ def _apply_fee_to_tx(
if gas_price is not None:
if max_fee or priority_fee:
raise ValueError("gas_price and (max_fee, priority_fee) are mutually exclusive")
tx["gasPrice"] = web3.toHex(gas_price)
tx["gasPrice"] = web3.to_hex(gas_price)
return tx

if priority_fee is None:
Expand All @@ -1046,7 +1043,7 @@ def _apply_fee_to_tx(
if priority_fee > max_fee:
raise InvalidTransaction("priority_fee must not exceed max_fee")

tx["maxFeePerGas"] = web3.toHex(max_fee)
tx["maxPriorityFeePerGas"] = web3.toHex(priority_fee)
tx["type"] = web3.toHex(2)
tx["maxFeePerGas"] = web3.to_hex(max_fee)
tx["maxPriorityFeePerGas"] = web3.to_hex(priority_fee)
tx["type"] = web3.to_hex(2)
return tx
Loading

0 comments on commit cdec5d6

Please sign in to comment.