slither
slither copied to clipboard
[Bug-Candidate]: Slither unable to generate IR
Describe the issue:
I have been trying to scan some files and projects with slither but getting same error:
46 | contract NFTMarketplace is AccessControlEnumerable, ReentrancyGuard, IERC721Receiver
| ^ (Relevant source part starts here and spans across multiple lines).
Impossible to generate IR for AccessControl.supportsInterface
Impossible to generate IR for AccessControl.supportsInterface
Impossible to generate IR for AccessControlEnumerable.supportsInterface
Impossible to generate IR for AccessControlEnumerable.supportsInterface
Impossible to generate IR for AccessControlEnumerable.supportsInterface
Impossible to generate IR for ERC721.supportsInterface
Impossible to generate IR for ERC721.supportsInterface
Impossible to generate IR for ERC721._checkOnERC721Received
Impossible to generate IR for ERC165.supportsInterface
Impossible to generate IR for NFTMarketplace.supportsInterface
Impossible to generate IR for NFTMarketplace.supportsInterface
Impossible to generate IR for NFTMarketplace.supportsInterface
Impossible to generate IR for NFTMarketplace.supportsInterface
Impossible to generate IR for NFTMarketplace.onERC721Received
Traceback (most recent call last):
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/__main__.py", line 744, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/__main__.py", line 87, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/__main__.py", line 72, in process_single
return _process(slither, detector_classes, printer_classes)
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/__main__.py", line 113, in _process
detector_results = slither.run_detectors()
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/slither.py", line 201, in run_detectors
results = [d.detect() for d in self._detectors]
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/slither.py", line 201, in <listcomp>
results = [d.detect() for d in self._detectors]
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/detectors/abstract_detector.py", line 152,
in detect
for r in [output.data for output in self._detect()]:
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/detectors/functions/arbitrary_send.py", line 140, in _detect
res = self.generate_result(info)
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/detectors/abstract_detector.py", line 224,
in generate_result
output = Output(
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/utils/output.py", line 370, in __init__
self._data["id"] = hashlib.sha3_256(id_txt.encode("utf-8")).hexdigest()
File "/home/saurabh/.local/lib/python3.9/site-packages/sha3/__init__.py", line 97, in sha3_256
return SHA3256(s)
File "/home/saurabh/.local/lib/python3.9/site-packages/sha3/__init__.py", line 30, in __init__
self._s = _sha3.sha3()
AttributeError: module '_sha3' has no attribute 'sha3'
None
Error in .
Traceback (most recent call last):
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/__main__.py", line 744, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/__main__.py", line 87, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/__main__.py", line 72, in process_single
return _process(slither, detector_classes, printer_classes)
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/__main__.py", line 113, in _process
detector_results = slither.run_detectors()
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/slither.py", line 201, in run_detectors
results = [d.detect() for d in self._detectors]
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/slither.py", line 201, in <listcomp>
results = [d.detect() for d in self._detectors]
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/detectors/abstract_detector.py", line 152,
in detect
for r in [output.data for output in self._detect()]:
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/detectors/functions/arbitrary_send.py", line 140, in _detect
res = self.generate_result(info)
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/detectors/abstract_detector.py", line 224,
in generate_result
output = Output(
File "/home/saurabh/.local/lib/python3.9/site-packages/slither/utils/output.py", line 370, in __init__
self._data["id"] = hashlib.sha3_256(id_txt.encode("utf-8")).hexdigest()
File "/home/saurabh/.local/lib/python3.9/site-packages/sha3/__init__.py", line 97, in sha3_256
return SHA3256(s)
File "/home/saurabh/.local/lib/python3.9/site-packages/sha3/__init__.py", line 30, in __init__
self._s = _sha3.sha3()
AttributeError: module '_sha3' has no attribute 'sha3'
It is giving some issue with sha3 but I am not sure if it is related to slither. I tried updating sha3 and slither as well.
Code example to reproduce the issue:
contract with all solidity versions
Version:
0.8.3
Relevant log output:
No response
This seems to be an issue with your installation. There may be a conflict between the packages pysha3 and sha3. Try running pip freeze | grep "sha3". If you see anything other than pysha3==1.0.2 e.g. sha3, you should uninstall it with pip uninstall sha3. I'd recommend setting up a fresh virtualenv and installing slither pip install slither-analyzer to see if the error persists there, too.
Got the same error and I indeed had both pysha3 and sha3 installed. Uninstalling sha3 solved the problem. Giving you a heads up since this issue is still marked as open. We can probably close it now.