crytic / crytic/contract-explorer

Add configuration option to specify slither target

Open
#23 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
36
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Hi everyone!

Maybe I don't know where to look, but it seems to me that there is currently no option to specify the target directory for slither. I can run slither from my CLI with `slither src` where `src` is the `target`-folder containing the Solidity files. But the VSCode extension is always trying to run `slither .` which will ultimately throw the following error:

~~~
⸻ Starting analysis ⸻
Error: Error in workspace "/home/raoul/project":
Traceback (most recent call last):
File "/home/raoul/.local/lib/python3.8/site-packages/slither/__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/home/raoul/.local/lib/python3.8/site-packages/slither/__main__.py", line 73, in process_all
compilations = compile_all(target, **vars(args))
File "/home/raoul/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/home/raoul/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "/home/raoul/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "/home/raoul/.local/lib/python3.8/site-packages/crytic_compile/platform/hardhat.py", line 87, in compile
os.listdir(build_directory), key=lambda x: os.path.getmtime(Path(build_directory, x))
FileNotFoundError: [Errno 2] No such file or directory: 'artifacts/build-info'

⸻ Analysis: 0 succeeded, 1 failed, 0 skipped ⸻
Refreshing explorer...
Loaded 0 issues, displaying 0
~~~

The problem seems to be the following line, which passes `.` as the hardcoded target to slither:

https://github.com/crytic/slither-vscode/blob/9cbf906ebac9ef9b61964609beda17a646b0bac7/src/slither.ts#L101

It would be nice to have a workspace-folder configuration option to specify the target manually.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.