Describe the issue:
Good afternoon,
It seems the latest version of Slither Analyzer is incompatible with the most recent Hardhat versions. When trying to perform the static analysis, it throws an error complaining there is no key output in the build info file. From what I have inspected, this happens because the newest versions of Hardhat generate two build info filés inside the artifacts folder, whereas Slither code expects only one. Hence, It reads the file, while the one that contains the specified key is the second one.
Besides that, the analyzer also reads information from the solcVersion key (which now ia present in the first filé of build info folder). Given the two mentioned keys are now located in separated files (and I don't know If there are other ones considered in static analysis), I believe the current latest version of Slither does not worki. Could you guys inspect this and provide a fix, if possible?
Best regards
Luciano Augusto
Code example to reproduce the issue:
The internal code from Slither dependency that throws the error is shown in the following picture, in the line 72:
This other image shows the two build info files genereted in the lates Hardhat versions, seen from the IDE file browser:
Version:
- Slither: 0.11.5;
- Hardhat: 3.8.0 or greater.
Relevant log output:
npx hardhat clean' running (wd: /home/wsl/Documents/projects/pbc-nft-smart-contract)
'npx hardhat clean --global' running (wd: /home/wsl/Documents/projects/pbc-nft-smart-contract)
Problem deserializing hardhat configuration, using defaults: Expecting value: line 1 column 1 (char 0)
'npx hardhat compile --force' running (wd: /home/wsl/Documents/projects/pbc-nft-smart-contract)
Traceback (most recent call last):
File "/home/wsl/.cache/aic-pyenv/versions/pbc-nft-smart-contract/bin/slither", line 8, in <module>
sys.exit(main())
File "/home/wsl/.cache/aic-pyenv/versions/3.10.12/envs/pbc-nft-smart-contract/lib/python3.10/site-packages/slither/__main__.py", line 760, in main
main_impl(all_detector_classes=detectors, all_printer_classes=printers)
File "/home/wsl/.cache/aic-pyenv/versions/3.10.12/envs/pbc-nft-smart-contract/lib/python3.10/site-packages/slither/__main__.py", line 865, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/home/wsl/.cache/aic-pyenv/versions/3.10.12/envs/pbc-nft-smart-contract/lib/python3.10/site-packages/slither/__main__.py", line 95, in process_all
compilations = compile_all(target, **vars(args))
File "/home/wsl/.cache/aic-pyenv/versions/3.10.12/envs/pbc-nft-smart-contract/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 722, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/home/wsl/.cache/aic-pyenv/versions/3.10.12/envs/pbc-nft-smart-contract/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 211, in __init__
self._compile(**kwargs)
File "/home/wsl/.cache/aic-pyenv/versions/3.10.12/envs/pbc-nft-smart-contract/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 633, in _compile
self._platform.compile(self, **kwargs)
File "/home/wsl/.cache/aic-pyenv/versions/3.10.12/envs/pbc-nft-smart-contract/lib/python3.10/site-packages/crytic_compile/platform/hardhat.py", line 184, in compile
hardhat_like_parsing(crytic_compile, self._target, build_directory, hardhat_working_dir)
File "/home/wsl/.cache/aic-pyenv/versions/3.10.12/envs/pbc-nft-smart-contract/lib/python3.10/site-packages/crytic_compile/platform/hardhat.py", line 72, in hardhat_like_parsing
targets_json = loaded_json["output"]
KeyError: 'output'
saída slither: 1
Describe the issue:
Good afternoon,
It seems the latest version of Slither Analyzer is incompatible with the most recent Hardhat versions. When trying to perform the static analysis, it throws an error complaining there is no key output in the build info file. From what I have inspected, this happens because the newest versions of Hardhat generate two build info filés inside the artifacts folder, whereas Slither code expects only one. Hence, It reads the file, while the one that contains the specified key is the second one.
Besides that, the analyzer also reads information from the solcVersion key (which now ia present in the first filé of build info folder). Given the two mentioned keys are now located in separated files (and I don't know If there are other ones considered in static analysis), I believe the current latest version of Slither does not worki. Could you guys inspect this and provide a fix, if possible?
Best regards
Luciano Augusto
Code example to reproduce the issue:
The internal code from Slither dependency that throws the error is shown in the following picture, in the line 72:
This other image shows the two build info files genereted in the lates Hardhat versions, seen from the IDE file browser:
Version:
Relevant log output: