Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it is not possible to pass custom hardhat build info path to crytic-compile #4

Closed
doncesarts opened this issue Apr 4, 2022 · 2 comments
Milestone

Comments

@doncesarts
Copy link

doncesarts commented Apr 4, 2022

Locally It would be possible by passing the argument hardhat-artifacts-directory for example:

slither --hardhat-artifacts-directory=build .

But as the slither args are evaluated after the compile crytic-compile it is not possible to pass this argument even if it is set on the argument slither-args

# -- calling the compiler before evaluating the extra arguments ---
crytic-compile "$TARGET" $IGNORECOMPILEFLAG

if [[ -z "$SLITHERARGS" ]]; then
    slither "$TARGET" $SARIFFLAG $IGNORECOMPILEFLAG $CONFIGFLAG
else
    echo "[-] SLITHERARGS provided. Running slither with extra arguments"
    printf "%s\n" "$SLITHERARGS" | xargs slither "$TARGET" $SARIFFLAG $IGNORECOMPILEFLAG $CONFIGFLAG
fi

Error

Traceback (most recent call last):
  File "/opt/slither/bin/crytic-compile", line 8, in <module>
    sys.exit(main())
  File "/opt/slither/lib/python3.9/site-packages/crytic_compile/__main__.py", line 192, in main
    compilations = compile_all(**vars(args))
  File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "/opt/slither/lib/python3.9/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'

Thanks

@elopez
Copy link
Member

elopez commented Apr 4, 2022

Hi! Thanks for the report. This is a similar issue to the one in #3. As slither already runs crytic-compile by itself, we can probably just drop the extra call before running slither without any side effects. Once that call is gone, you should be able to specify the option through slither's config file or args.

@doncesarts
Copy link
Author

Amazing. Thanks !

elopez added a commit that referenced this issue Apr 28, 2022
This extra call is breaking some use-cases that require custom crytic-compile
options, as there is no way to pass them. As slither will invoke
the compilation by itself when needed, this extra call is not really
needed and should be safe to drop.

Fixes: #3, #4
@elopez elopez added this to the v0.2 milestone Sep 5, 2022
@elopez elopez closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants