Skip to content

Commit 6607079

Browse files
committed
fix: repair pull request ci
1 parent 3a714c2 commit 6607079

15 files changed

Lines changed: 90 additions & 47 deletions

File tree

.github/workflows/core-ganache.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
fail-fast: false
5151
matrix:
5252
os: [ubuntu-latest, macos-latest, windows-latest]
53-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
53+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
5454
include:
5555
- python-version: "3.10"
5656
infura-key: ddddf0c53f254d36aa76ce4e3a6a390e
@@ -62,8 +62,6 @@ jobs:
6262
infura-key: ddddf0c53f254d36aa76ce4e3a6a390e
6363
- python-version: "3.14"
6464
infura-key: 1668fecbc9c242d58253476103a42ce9
65-
- python-version: "3.14t"
66-
infura-key: 21317ddb5ded42ce8d40c7d78f90474f
6765
- os: ubuntu-latest
6866
ccache-dir: ~/.cache/ccache
6967
- os: macos-latest

.github/workflows/pip-compile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
fi
6060
6161
- name: Commit changes
62-
if: env.changes_detected == 'true'
62+
if: env.changes_detected == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
6363
run: |
6464
git config --local user.name "github-actions[bot]"
6565
git config --local user.email "github-actions[bot]@users.noreply.github.com"

brownie/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class BadProjectName(Exception):
225225

226226
@final
227227
class CompilerError(Exception):
228-
def __init__(self, e: type[psutil.Popen], compiler: str = "Compiler") -> None:
228+
def __init__(self, e: Any, compiler: str = "Compiler") -> None:
229229
self.compiler: Final = compiler
230230

231231
err_json: dict[str, list[dict[str, str]]] = yaml.safe_load(e.stdout_data)

brownie/project/compiler/solidity.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/python3
22

33
import logging
4-
from typing import Any, Deque, Final
4+
from typing import Any, Deque, Final, cast
55

66
import semantic_version
77
import solcast
@@ -60,8 +60,14 @@
6060
_BINOPS_PARAMS: Final = {"nodeType": "BinaryOperation", "typeDescriptions.typeString": "bool"}
6161

6262

63+
def _to_brownie_version(version: Any) -> semantic_version.Version:
64+
if isinstance(version, Version):
65+
return version
66+
return Version(str(version))
67+
68+
6369
def get_version() -> semantic_version.Version:
64-
return solcx.get_solc_version(with_commit_hash=True)
70+
return _to_brownie_version(solcx.get_solc_version(with_commit_hash=True))
6571

6672

6773
def compile_from_input_json(
@@ -96,7 +102,7 @@ def compile_from_input_json(
96102
print(f" EVM Version: {settings['evmVersion'].capitalize()}")
97103

98104
try:
99-
return solcx.compile_standard(input_json, allow_paths=allow_paths)
105+
return solcx.compile_standard(cast(dict[Any, Any], input_json), allow_paths=allow_paths)
100106
except solcx.exceptions.SolcError as e:
101107
raise CompilerError(e, "solc")
102108

@@ -108,22 +114,22 @@ def set_solc_version(version: VersionSpec) -> str:
108114
if version < Version("0.4.22"):
109115
raise IncompatibleSolcVersion("Brownie only supports Solidity versions >=0.4.22")
110116
try:
111-
solcx.set_solc_version(version, silent=True)
117+
solcx.set_solc_version(str(version), silent=True)
112118
except solcx.exceptions.SolcNotInstalled:
113119
if version not in _get_solc_version_list()[0]:
114120
raise IncompatibleSolcVersion(
115121
f"Cannot install Solidity v{version} on this OS. You may be able to "
116122
f"manually compile from source with `solcx.compile_solc('{version}')`"
117123
)
118124
install_solc(version)
119-
solcx.set_solc_version(version, silent=True)
125+
solcx.set_solc_version(str(version), silent=True)
120126
return str(solcx.get_solc_version())
121127

122128

123129
def install_solc(*versions: VersionSpec) -> None:
124130
"""Installs solc versions."""
125131
for version in versions:
126-
solcx.install_solc(version, show_progress=False)
132+
solcx.install_solc(str(version), show_progress=False)
127133

128134

129135
def get_abi(contract_source: str, allow_paths: str | None = None) -> dict[str, list[ABIElement]]:
@@ -192,7 +198,7 @@ def find_solc_versions(
192198
# install new versions if needed
193199
if to_install:
194200
install_solc(*to_install)
195-
installed_versions = solcx.get_installed_solc_versions()
201+
installed_versions = [_to_brownie_version(i) for i in solcx.get_installed_solc_versions()]
196202
elif new_versions and not silent:
197203
print(
198204
f"New compatible solc version{'s' if len(new_versions) > 1 else ''}"
@@ -255,10 +261,14 @@ def find_best_solc_version(
255261

256262
def _get_solc_version_list() -> tuple[VersionList, VersionList]:
257263
global AVAILABLE_SOLC_VERSIONS
258-
installed_versions: VersionList = solcx.get_installed_solc_versions()
264+
installed_versions: VersionList = [
265+
_to_brownie_version(i) for i in solcx.get_installed_solc_versions()
266+
]
259267
if AVAILABLE_SOLC_VERSIONS is None:
260268
try:
261-
AVAILABLE_SOLC_VERSIONS = solcx.get_installable_solc_versions()
269+
AVAILABLE_SOLC_VERSIONS = [
270+
_to_brownie_version(i) for i in solcx.get_installable_solc_versions()
271+
]
262272
except ConnectionError:
263273
if not installed_versions:
264274
raise ConnectionError("Solc not installed and cannot connect to GitHub")

tests/network/account/test_account_deploy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,15 @@ def test_nonce_manual_on_revert_in_console(BrownieTester, accounts, console_mode
123123

124124

125125
def test_selfdestruct_during_deploy(accounts):
126-
foo = compile_source("""
126+
foo = compile_source(
127+
"""
127128
pragma solidity 0.5.0;
128129
129130
contract Foo {
130131
constructor () public { selfdestruct(address(0)); }
131132
}
132-
""").Foo
133+
"""
134+
).Foo
133135

134136
result = foo.deploy({"from": accounts[0]})
135137
assert isinstance(result, TransactionReceipt)

tests/network/contract/test_contractcall.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ def test_transact(accounts, tester):
2424

2525

2626
def test_block_identifier(accounts, history):
27-
contract = compile_source("""
27+
contract = compile_source(
28+
"""
2829
# @version 0.2.4
2930
foo: public(int128)
3031
3132
@external
3233
def set_foo(_foo: int128):
3334
self.foo = _foo
34-
""").Vyper.deploy({"from": accounts[0]})
35+
"""
36+
).Vyper.deploy({"from": accounts[0]})
3537

3638
contract.set_foo(13)
3739
contract.set_foo(42)

tests/network/test_event.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66
import pytest
77
from web3.datastructures import AttributeDict
8-
from web3.exceptions import ABIEventFunctionNotFound
8+
9+
try:
10+
from web3.exceptions import ABIEventNotFound as ABIEventFunctionNotFound
11+
except ImportError:
12+
from web3.exceptions import ABIEventFunctionNotFound
913

1014
from brownie import Contract, compile_source
1115
from brownie.exceptions import EventLookupError
@@ -110,7 +114,8 @@ def test_eventitem_raises(event):
110114

111115

112116
def test_same_topic_different_abi(accounts):
113-
proj = compile_source("""
117+
proj = compile_source(
118+
"""
114119
pragma solidity 0.5.0;
115120
116121
contract Foo {
@@ -126,7 +131,8 @@ def test_same_topic_different_abi(accounts):
126131
_addr.foo();
127132
emit Baz(4, 5, 6);
128133
}
129-
}""")
134+
}"""
135+
)
130136

131137
foo = proj.Foo.deploy({"from": accounts[0]})
132138
bar = proj.Bar.deploy({"from": accounts[0]})

tests/network/transaction/test_internal_transfer.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66

77
def test_to_eoa(accounts):
8-
container = compile_source("""
8+
container = compile_source(
9+
"""
910
# @version 0.2.4
1011
1112
@external
@@ -15,7 +16,8 @@ def send_ether(receivers: address[3]) -> bool:
1516
for i in range(3):
1617
send(receivers[i], value)
1718
value += 100
18-
return True""").Vyper
19+
return True"""
20+
).Vyper
1921
contract = container.deploy({"from": accounts[0]})
2022
tx = contract.send_ether(accounts[:3], {"value": 800})
2123
assert tx.internal_transfers == [
@@ -26,7 +28,8 @@ def send_ether(receivers: address[3]) -> bool:
2628

2729

2830
def test_to_contract(accounts):
29-
container = compile_source("""
31+
container = compile_source(
32+
"""
3033
# @version 0.2.4
3134
3235
@external
@@ -39,7 +42,8 @@ def send_ether(receiver: address) -> bool:
3942
@payable
4043
def __default__():
4144
return
42-
""").Vyper
45+
"""
46+
).Vyper
4347
contract = container.deploy({"from": accounts[0]})
4448
contract2 = container.deploy({"from": accounts[0]})
4549
tx = contract.send_ether(contract2, {"value": 31337})
@@ -48,14 +52,16 @@ def __default__():
4852

4953

5054
def test_types(accounts):
51-
container = compile_source("""
55+
container = compile_source(
56+
"""
5257
# @version 0.2.4
5358
5459
@external
5560
@payable
5661
def send_ether(receiver: address) -> bool:
5762
send(receiver, msg.value)
58-
return True""").Vyper
63+
return True"""
64+
).Vyper
5965
contract = container.deploy({"from": accounts[0]})
6066
tx = contract.send_ether(accounts[1], {"value": 800})
6167
xfer = tx.internal_transfers[0]
@@ -65,27 +71,31 @@ def send_ether(receiver: address) -> bool:
6571

6672

6773
def test_via_create_vyper(accounts):
68-
container = compile_source("""
74+
container = compile_source(
75+
"""
6976
# @version 0.2.4
7077
7178
@external
7279
@payable
7380
def send_ether() -> bool:
7481
x: address = create_forwarder_to(self, value=msg.value)
75-
return True""").Vyper
82+
return True"""
83+
).Vyper
7684
contract = container.deploy({"from": accounts[0]})
7785
tx = contract.send_ether({"value": 42})
7886
assert tx.internal_transfers == [{"from": contract, "to": tx.new_contracts[0], "value": 42}]
7987

8088

8189
def test_via_create_solidity(accounts):
82-
project = compile_source("""pragma solidity 0.6.2;
90+
project = compile_source(
91+
"""pragma solidity 0.6.2;
8392
8493
contract Foo { constructor () public payable {} }
8594
8695
contract Deployer {
8796
function create () public payable returns (Foo) { return new Foo{value: msg.value}(); }
88-
}""")
97+
}"""
98+
)
8999
contract = project.Deployer.deploy({"from": accounts[0]})
90100
tx = contract.create({"value": 69})
91101
assert tx.internal_transfers == [{"from": contract, "to": tx.new_contracts[0], "value": 69}]

tests/project/compiler/test_solidity.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,15 @@ def msolc(monkeypatch):
7373

7474
def test_set_solc_version():
7575
compiler.set_solc_version("0.5.7")
76-
assert solcx.get_solc_version(with_commit_hash=True) == compiler.solidity.get_version()
77-
assert solcx.get_solc_version(with_commit_hash=True).truncate() == Version("0.5.7")
76+
assert str(solcx.get_solc_version(with_commit_hash=True)) == str(
77+
compiler.solidity.get_version()
78+
)
79+
assert compiler.solidity.get_version().truncate() == Version("0.5.7")
7880
compiler.set_solc_version("0.4.25")
79-
assert solcx.get_solc_version(with_commit_hash=True) == compiler.solidity.get_version()
80-
assert solcx.get_solc_version(with_commit_hash=True).truncate() == Version("0.4.25")
81+
assert str(solcx.get_solc_version(with_commit_hash=True)) == str(
82+
compiler.solidity.get_version()
83+
)
84+
assert compiler.solidity.get_version().truncate() == Version("0.4.25")
8185

8286

8387
def test_generate_input_json(solc5source):

tests/project/main/test_contract_syntaxes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def test_only_events(newproject, minor):
1818
contract OnlyEvents {{
1919
event Transfer(address from, address to, uint256 value);
2020
event Approval(address owner, address spender, uint256 value);
21-
}}""".format(minor)
21+
}}""".format(
22+
minor
23+
)
2224
with newproject._path.joinpath("contracts/OnlyEvents.sol").open("w") as fp:
2325
fp.write(source)
2426
newproject.load()

0 commit comments

Comments
 (0)