0

Currently I have a project that needs slither run against it so I pulled down the docker image for slither as specified in the docs here https://hub.docker.com/r/trailofbits/slither/, then I shared the folder from my computer that I needed to run slither against by running the docker images. I found the whole project inside the docker image, did a solc-select to the version of solidity I am using, ran slither against the contracts folder and received the following error:

ERROR:root:None
ERROR:root:Error in contracts/
ERROR:root:Traceback (most recent call last):
  File "/home/ethsec/.local/lib/python3.6/site-packages/crytic_compile/platform/solc.py", line 367, in _run_solc
    ret = json.loads(stdout)
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 693, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 68, in process_all
    compilations = compile_all(target, **vars(args))
  File "/home/ethsec/.local/lib/python3.6/site-packages/crytic_compile/crytic_compile.py", line 1041, in compile_all
    compilations.append(CryticCompile(filename, **kwargs))
  File "/home/ethsec/.local/lib/python3.6/site-packages/crytic_compile/crytic_compile.py", line 124, in __init__
    self._compile(**kwargs)
  File "/home/ethsec/.local/lib/python3.6/site-packages/crytic_compile/crytic_compile.py", line 931, in _compile
    self._platform.compile(self, **kwargs)
  File "/home/ethsec/.local/lib/python3.6/site-packages/crytic_compile/platform/solc.py", line 156, in compile
    force_legacy_json=force_legacy_json,
  File "/home/ethsec/.local/lib/python3.6/site-packages/crytic_compile/platform/solc.py", line 371, in _run_solc
    raise InvalidCompilation(f"Invalid solc compilation {stderr}")
crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation Error: Source "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol" not found: File not found.

Error: Source "@openzeppelin/contracts-ethereum-package/contracts/utils/ReentrancyGuard.sol" not found: File not found.

This seems to be an issue with running slither against files imported by truffle.

I ran slither using truffle as a framework like this:

slither contracts/ --compile-force-framework truffle@5.1.45

And I will still receive the same import issue as before.

I have also ran slither like this and it gives the exact same error:

slither contracts/ --truffle-version truffle@5.1.45

Any help would be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.