Minor fixes

pull/823/head
Josselin 4 years ago
parent 73764edc4f
commit 71e33c608e
  1. 6
      setup.py
  2. 9
      slither/tools/flattening/flattening.py
  3. 6
      slither/tools/kspec_coverage/kspec_coverage.py
  4. 6
      tests/test_function.py

@ -11,10 +11,12 @@ setup(
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={

@ -71,10 +71,11 @@ class Flattening:
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

@ -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)

@ -13,7 +13,8 @@ from slither.core.solidity_types.elementary_type import ElementaryType
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"
@ -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

Loading…
Cancel
Save