Skip to content

Commit cdec5d6

Browse files
Merge pull request #1735 from eth-brownie/update-deps
Bump dependencies, linting, fix (some) tests
2 parents db055df + cfcdaba commit cdec5d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+232
-278
lines changed

.github/workflows/core-ganache-3.10.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Core Ganache (py10)
1+
name: Core Ganache (py3.10)
22
on: ["push", "pull_request"]
33

44
env:

.github/workflows/core-ganache-3.9.yaml .github/workflows/core-ganache-3.11.yaml

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Core Ganache (py39)
1+
name: Core Ganache (py3.11)
22
on: ["push", "pull_request"]
33

44
env:
@@ -7,16 +7,11 @@ env:
77
WEB3_INFURA_PROJECT_ID: 1668fecbc9c242d58253476103a42ce9
88

99
jobs:
10-
py39core:
11-
runs-on: ${{ matrix.os }}
12-
13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
os: [windows-latest, ubuntu-latest]
10+
py311core:
11+
runs-on: ubuntu-latest
1712

1813
steps:
19-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
2015

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

2924
- name: Setup Node.js
30-
uses: actions/setup-node@v1
25+
uses: actions/setup-node@v4
3126

3227
- name: Install Ganache
33-
run: npm install -g ganache@7.0.2
28+
run: npm install -g ganache@7.9.2
3429

35-
- name: Setup Python 3.9
36-
uses: actions/setup-python@v2
30+
- name: Setup Python 3.11
31+
uses: actions/setup-python@v5
3732
with:
38-
python-version: 3.9
33+
python-version: "3.11"
3934

4035
- name: Install Tox
4136
run: pip install tox
4237

4338
- name: Run Tox
44-
run: tox -e py39
39+
run: tox -e py311
4540

4641
- name: Upload coverage to Codecov
4742
uses: codecov/codecov-action@v1

.github/workflows/core-ganache-3.8.yaml .github/workflows/core-ganache-3.12.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Core Ganache (py38)
1+
name: Core Ganache (py3.12)
22
on: ["push", "pull_request"]
33

44
env:
@@ -7,11 +7,11 @@ env:
77
WEB3_INFURA_PROJECT_ID: 21317ddb5ded42ce8d40c7d78f90474f
88

99
jobs:
10-
py38core:
10+
py312core:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515

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

2424
- name: Setup Node.js
25-
uses: actions/setup-node@v1
25+
uses: actions/setup-node@v4
2626

2727
- name: Install Ganache
28-
run: npm install -g ganache@7.0.2
28+
run: npm install -g ganache@7.9.2
2929

30-
- name: Setup Python 3.8
31-
uses: actions/setup-python@v2
30+
- name: Setup Python 3.12
31+
uses: actions/setup-python@v5
3232
with:
33-
python-version: 3.8
33+
python-version: "3.12"
3434

3535
- name: Install Tox
3636
run: pip install tox
3737

3838
- name: Run Tox
39-
run: tox -e py38
39+
run: tox -e py312
4040

4141
- name: Upload coverage to Codecov
4242
uses: codecov/codecov-action@v1

.github/workflows/evm.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
job: [evm-byzantium, evm-petersburg, evm-istanbul, evm-latest]
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2222

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

3131
- name: Setup Node.js
32-
uses: actions/setup-node@v1
32+
uses: actions/setup-node@v4
3333

3434
- name: Install Ganache
35-
run: npm install -g ganache@7.0.2
35+
run: npm install -g ganache@7.9.2
3636

37-
- name: Setup Python 3.8
38-
uses: actions/setup-python@v2
37+
- name: Setup Python 3.10
38+
uses: actions/setup-python@v4
3939
with:
40-
python-version: 3.8
40+
python-version: "3.10"
4141

4242
- name: Install Tox
4343
run: pip install tox

.github/workflows/functionality.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
job: [plugintest, pmtest]
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2222

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

3131
- name: Setup Node.js
32-
uses: actions/setup-node@v1
32+
uses: actions/setup-node@v4
3333

3434
- name: Install Ganache
35-
run: npm install -g ganache@7.0.2
35+
run: npm install -g ganache@7.9.2
3636

37-
- name: Setup Python 3.8
38-
uses: actions/setup-python@v2
37+
- name: Setup Python 3.10
38+
uses: actions/setup-python@v4
3939
with:
40-
python-version: 3.8
40+
python-version: "3.10"
4141

4242
- name: Install Tox
4343
run: pip install tox

.github/workflows/lint.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ jobs:
2222
experimental: true
2323

2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2626

27-
- name: Setup Python 3.8
28-
uses: actions/setup-python@v2
27+
- name: Setup Python 3.10
28+
uses: actions/setup-python@v5
2929
with:
30-
python-version: 3.8
30+
python-version: "3.10"
3131

3232
- name: Install Tox
3333
run: pip install tox

.pre-commit-config.yaml

+5-10
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,22 @@ repos:
44
hooks:
55
- id: check-yaml
66

7-
- repo: https://github.com/pre-commit/mirrors-isort
8-
rev: v5.9.3
7+
- repo: https://github.com/PyCQA/isort
8+
rev: 5.13.2
99
hooks:
1010
- id: isort
1111

1212
- repo: https://github.com/psf/black
13-
rev: 22.1.0
13+
rev: 24.1.1
1414
hooks:
1515
- id: black
1616
name: black
1717

18-
- repo: https://gitlab.com/pycqa/flake8
19-
rev: 3.9.2
18+
- repo: https://github.com/pycqa/flake8
19+
rev: 7.0.0
2020
hooks:
2121
- id: flake8
2222

23-
- repo: https://github.com/pre-commit/mirrors-mypy
24-
rev: v0.720
25-
hooks:
26-
- id: mypy
27-
2823

2924
default_language_version:
3025
python: python3

brownie/convert/datatypes.py

-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232

3333
class Wei(int):
34-
3534
"""Integer subclass that converts a value to wei and allows comparison against
3635
similarly formatted values.
3736
@@ -125,7 +124,6 @@ def _return_int(original: Any, value: Any) -> int:
125124

126125

127126
class Fixed(Decimal):
128-
129127
"""
130128
Decimal subclass that allows comparison against strings, integers and Wei.
131129
@@ -199,7 +197,6 @@ def _to_fixed(value: Any) -> Decimal:
199197

200198

201199
class EthAddress(str):
202-
203200
"""String subclass that raises TypeError when compared to a non-address."""
204201

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

232229

233230
class HexString(bytes):
234-
235231
"""Bytes subclass for hexstring comparisons. Raises TypeError if compared to
236232
a non-hexstring. Evaluates True for hexstrings with the same value but differing
237233
leading zeros or capitalization."""

brownie/convert/normalize.py

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def _check_array(values: Union[List, Tuple], length: Optional[int]) -> None:
108108

109109

110110
def _get_abi_types(abi_params: List) -> Sequence[ABIType]:
111+
if not abi_params:
112+
return []
111113
type_str = f"({','.join(get_type_strings(abi_params))})"
112114
tuple_type = parse(type_str)
113115
return tuple_type.components

brownie/exceptions.py

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class MainnetUndefined(Exception):
7777

7878

7979
class VirtualMachineError(Exception):
80-
8180
"""
8281
Raised when a call to a contract causes an EVM exception.
8382

brownie/network/account.py

+16-19
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
import eth_account
1414
import eth_keys
1515
import rlp
16-
from eip712.messages import EIP712Message, _hash_eip191_message
16+
from eip712.messages import EIP712Message
1717
from eth_account._utils.signing import sign_message_hash
1818
from eth_account.datastructures import SignedMessage
19-
from eth_account.messages import defunct_hash_message
19+
from eth_account.messages import _hash_eip191_message, defunct_hash_message
2020
from eth_utils import keccak
2121
from eth_utils.applicators import apply_formatters_to_dict
2222
from hexbytes import HexBytes
@@ -233,7 +233,7 @@ def load(
233233
break
234234
except ValueError as e:
235235
if allow_retry:
236-
prompt = f"Incorrect password, try again: "
236+
prompt = "Incorrect password, try again: "
237237
password = None
238238
continue
239239
raise e
@@ -404,7 +404,6 @@ def get_deployment_address(self, nonce: Optional[int] = None) -> EthAddress:
404404

405405

406406
class _PrivateKeyAccount(PublicKeyAccount):
407-
408407
"""Base class for Account and LocalAccount"""
409408

410409
def __init__(self, addr: str) -> None:
@@ -482,8 +481,8 @@ def _check_for_revert(self, tx: Dict) -> None:
482481
except ValueError as exc:
483482
exc = VirtualMachineError(exc)
484483
raise ValueError(
485-
f"Execution reverted during call: '{exc.revert_msg}'. This transaction will likely revert. "
486-
"If you wish to broadcast, include `allow_revert:True` as a transaction parameter.",
484+
f"Execution reverted during call: '{exc.revert_msg}'. This transaction will likely "
485+
"revert. If you wish to broadcast, include `allow_revert:True` as a parameter.",
487486
) from None
488487

489488
def deploy(
@@ -606,7 +605,7 @@ def estimate_gas(
606605
"data": HexBytes(data or ""),
607606
}
608607
if gas_price is not None:
609-
tx["gasPrice"] = web3.toHex(gas_price)
608+
tx["gasPrice"] = web3.to_hex(gas_price)
610609
try:
611610
return web3.eth.estimate_gas(tx)
612611
except ValueError as exc:
@@ -753,7 +752,7 @@ def _make_transaction(
753752
"from": self.address,
754753
"value": Wei(amount),
755754
"nonce": nonce if nonce is not None else self._pending_nonce(),
756-
"gas": web3.toHex(gas_limit),
755+
"gas": web3.to_hex(gas_limit),
757756
"data": HexBytes(data),
758757
}
759758
if to:
@@ -865,7 +864,6 @@ def _await_confirmation(
865864

866865

867866
class Account(_PrivateKeyAccount):
868-
869867
"""Class for interacting with an Ethereum account.
870868
871869
Attributes:
@@ -881,7 +879,6 @@ def _transact(self, tx: Dict, allow_revert: bool) -> Any:
881879

882880

883881
class LocalAccount(_PrivateKeyAccount):
884-
885882
"""Class for interacting with an Ethereum account.
886883
887884
Attributes:
@@ -925,6 +922,7 @@ def save(self, filename: str, overwrite: bool = False, password: Optional[str] =
925922
password = getpass("Enter the password to encrypt this account with: ")
926923

927924
encrypted = web3.eth.account.encrypt(self.private_key, password)
925+
encrypted["address"] = encrypted["address"].lower()
928926
with json_file.open("w") as fp:
929927
json.dump(encrypted, fp)
930928
return str(json_file)
@@ -984,7 +982,6 @@ def _transact(self, tx: Dict, allow_revert: bool) -> None:
984982

985983

986984
class ClefAccount(_PrivateKeyAccount):
987-
988985
"""
989986
Class for interacting with an Ethereum account where signing is handled in Clef.
990987
"""
@@ -1000,10 +997,10 @@ def _transact(self, tx: Dict, allow_revert: bool) -> None:
1000997
self._check_for_revert(tx)
1001998

1002999
formatters = {
1003-
"nonce": web3.toHex,
1004-
"value": web3.toHex,
1005-
"chainId": web3.toHex,
1006-
"data": web3.toHex,
1000+
"nonce": web3.to_hex,
1001+
"value": web3.to_hex,
1002+
"chainId": web3.to_hex,
1003+
"data": web3.to_hex,
10071004
"from": to_address,
10081005
}
10091006
if "to" in tx:
@@ -1029,7 +1026,7 @@ def _apply_fee_to_tx(
10291026
if gas_price is not None:
10301027
if max_fee or priority_fee:
10311028
raise ValueError("gas_price and (max_fee, priority_fee) are mutually exclusive")
1032-
tx["gasPrice"] = web3.toHex(gas_price)
1029+
tx["gasPrice"] = web3.to_hex(gas_price)
10331030
return tx
10341031

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

1049-
tx["maxFeePerGas"] = web3.toHex(max_fee)
1050-
tx["maxPriorityFeePerGas"] = web3.toHex(priority_fee)
1051-
tx["type"] = web3.toHex(2)
1046+
tx["maxFeePerGas"] = web3.to_hex(max_fee)
1047+
tx["maxPriorityFeePerGas"] = web3.to_hex(priority_fee)
1048+
tx["type"] = web3.to_hex(2)
10521049
return tx

0 commit comments

Comments
 (0)