ItsNickBarry/hardhat-dependency-compiler

Doesn't work with `slither`

Closed this issue · 9 comments

When trying to run slither it seems that the plugin breaks something with the compilation.

I opened an issue on slither as well as not sure whether the issue with the plugin or slither.

crytic/slither#743

I'm not familiar with Slither. Does it run the compiler itself, or can it use the Hardhat-generated artifacts?

By the looks of the output it uses hardhat to compile and probably it uses the artifacts after that

Here is the output.

slither .  
'npx hardhat compile' running
Nothing to compile

(node:2977304) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2977304) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/slither_analyzer-0.7.0-py3.8.egg/slither/__main__.py", line 712, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/usr/local/lib/python3.8/dist-packages/slither_analyzer-0.7.0-py3.8.egg/slither/__main__.py", line 71, in process_all
    compilations = compile_all(target, **vars(args))
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 1076, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 137, in __init__
    self._compile(**kwargs)
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 987, in _compile
    self._platform.compile(self, **kwargs)
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/platform/hardhat.py", line 145, in compile
    path = convert_filename(
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/utils/naming.py", line 102, in convert_filename
    raise InvalidCompilation(f"Unknown file: {filename}")
crytic_compile.platform.exceptions.InvalidCompilation: Unknown file: contracts/_hardhat-dependency-compiler/tellorplayground/contracts/TellorPlayground.sol
ERROR:root:None
ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/slither_analyzer-0.7.0-py3.8.egg/slither/__main__.py", line 712, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/usr/local/lib/python3.8/dist-packages/slither_analyzer-0.7.0-py3.8.egg/slither/__main__.py", line 71, in process_all
    compilations = compile_all(target, **vars(args))
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 1076, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 137, in __init__
    self._compile(**kwargs)
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 987, in _compile
    self._platform.compile(self, **kwargs)
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/platform/hardhat.py", line 145, in compile
    path = convert_filename(
  File "/home/krasi/.local/lib/python3.8/site-packages/crytic_compile/utils/naming.py", line 102, in convert_filename
    raise InvalidCompilation(f"Unknown file: {filename}")
crytic_compile.platform.exceptions.InvalidCompilation: Unknown file: contracts/_hardhat-dependency-compiler/tellorplayground/contracts/TellorPlayground.sol

@krasi-georgiev See the options added in 1.1.0.

Thanks for adding this.
Not sure why the slither team doesn't reply.

I added it but still getting the same error.
https://github.com/tellor-io/chorus/blob/main/hardhat.config.js#L84

Here is the CI run
https://github.com/tellor-io/chorus/runs/2027921857

You need to set keep to true.

Might also need to hardhat clean.

Yep I see the logic now, thanks, it worked!

I have an idea of how to fix that. Please open a new issue and I'll get to it as soon as I can.