Skip to content

Commit

Permalink
replace new uses of switch_global_version with solc_binary_path
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush committed Apr 4, 2023
1 parent 90d3b74 commit 92d3e4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions tests/unit/core/test_fallback_receive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
TEST_DATA_DIR = Path(__file__).resolve().parent / "test_data"


def test_fallback_receive():
solc_select.switch_global_version("0.6.12", always_install=True)
def test_fallback_receive(solc_binary_path):
solc_path = solc_binary_path("0.6.12")
file = Path(TEST_DATA_DIR, "fallback.sol").as_posix()
slither = Slither(file)
slither = Slither(file, solc=solc_path)
fake_fallback = slither.get_contract_from_name("FakeFallback")[0]
real_fallback = slither.get_contract_from_name("Fallback")[0]

Expand Down
16 changes: 8 additions & 8 deletions tests/unit/utils/test_upgradeability_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@


# pylint: disable=too-many-locals
def test_upgrades_compare() -> None:
solc_select.switch_global_version("0.8.2", always_install=True)
def test_upgrades_compare(solc_binary_path) -> None:
solc_path = solc_binary_path("0.8.2")

sl = Slither(os.path.join(TEST_DATA_DIR, "TestUpgrades-0.8.2.sol"))
sl = Slither(os.path.join(TEST_DATA_DIR, "TestUpgrades-0.8.2.sol"), solc=solc_path)
v1 = sl.get_contract_from_name("ContractV1")[0]
v2 = sl.get_contract_from_name("ContractV2")[0]
missing_vars, new_vars, tainted_vars, new_funcs, modified_funcs, tainted_funcs = compare(v1, v2)
Expand All @@ -37,9 +37,9 @@ def test_upgrades_compare() -> None:
]


def test_upgrades_implementation_var() -> None:
solc_select.switch_global_version("0.8.2", always_install=True)
sl = Slither(os.path.join(TEST_DATA_DIR, "TestUpgrades-0.8.2.sol"))
def test_upgrades_implementation_var(solc_binary_path) -> None:
solc_path = solc_binary_path("0.8.2")
sl = Slither(os.path.join(TEST_DATA_DIR, "TestUpgrades-0.8.2.sol"), solc=solc_path)

erc_1967_proxy = sl.get_contract_from_name("ERC1967Proxy")[0]
storage_proxy = sl.get_contract_from_name("InheritedStorageProxy")[0]
Expand All @@ -53,8 +53,8 @@ def test_upgrades_implementation_var() -> None:
assert target == storage_proxy.get_state_variable_from_name("implementation")
assert slot.slot == 1

solc_select.switch_global_version("0.5.0", always_install=True)
sl = Slither(os.path.join(TEST_DATA_DIR, "TestUpgrades-0.5.0.sol"))
solc_path = solc_binary_path("0.5.0")
sl = Slither(os.path.join(TEST_DATA_DIR, "TestUpgrades-0.5.0.sol"), solc=solc_path)

eip_1822_proxy = sl.get_contract_from_name("EIP1822Proxy")[0]
# zos_proxy = sl.get_contract_from_name("ZosProxy")[0]
Expand Down

0 comments on commit 92d3e4f

Please sign in to comment.