Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
montyly committed Apr 9, 2021
1 parent 73764ed commit 71e33c6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
install_requires=[
"prettytable>=0.7.2",
"pysha3>=1.0.2",
#"crytic-compile>=0.1.13",
# "crytic-compile>=0.1.13",
"crytic-compile",
],
dependency_links=["git+https://github.com/crytic/crytic-compile.git@dev-compilation-units#egg=crytic-compile"],
dependency_links=[
"git+https://github.com/crytic/crytic-compile.git@dev-compilation-units#egg=crytic-compile"
],
license="AGPL-3.0",
long_description=open("README.md").read(),
entry_points={
Expand Down
9 changes: 5 additions & 4 deletions slither/tools/flattening/flattening.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ def _check_abi_encoder_v2(self):
Set _use_abi_encorder_v2
:return:
"""
for p in self._slither.pragma_directives:
if "ABIEncoderV2" in str(p.directive):
self._use_abi_encoder_v2 = True
return
for compilation_unit in self._slither.compilation_units:
for p in compilation_unit.pragma_directives:
if "ABIEncoderV2" in str(p.directive):
self._use_abi_encoder_v2 = True
return

def _get_source_code(
self, contract: Contract
Expand Down
6 changes: 5 additions & 1 deletion slither/tools/kspec_coverage/kspec_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ def kspec_coverage(args):

slither = Slither(contract, **vars(args))

compilation_units = slither.compilation_units
if len(compilation_units) != 1:
print("Only single compilation unit supported")
return
# Run the analysis on the Klab specs
run_analysis(args, slither, kspec)
run_analysis(args, compilation_units[0], kspec)
6 changes: 4 additions & 2 deletions tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
def test_functions():
# pylint: disable=too-many-statements
slither = Slither("tests/test_function.sol")
functions = slither.contracts_as_dict["TestFunction"].available_functions_as_dict()
compilation_unit = slither.compilation_units[0]
functions = compilation_unit.contracts_as_dict["TestFunction"].available_functions_as_dict()

f = functions["external_payable(uint256)"]
assert f.name == "external_payable"
Expand Down Expand Up @@ -243,7 +244,8 @@ def test_functions():

def test_function_can_send_eth():
slither = Slither("tests/test_function.sol")
functions = slither.contracts_as_dict["TestFunctionCanSendEth"].available_functions_as_dict()
compilation_unit = slither.compilation_units[0]
functions = compilation_unit.contracts_as_dict["TestFunctionCanSendEth"].available_functions_as_dict()

assert functions["send_direct()"].can_send_eth() is True
assert functions["transfer_direct()"].can_send_eth() is True
Expand Down

0 comments on commit 71e33c6

Please sign in to comment.