Closed 0xmichalis closed 5 months ago
HI! Thanks for bringing this to our attention. This might be related to our recent releases of slither & crytic-compile, which include a new feature to auto-detect hardhat paths, which might not be working correctly when ignore-compile is set.
As you are not using the latest Slither (I see you have slither-version: v0.8.3
set), can you upgrade your slither-action to the latest release (uses: crytic/slither-action@v0.2.0
) and let us know if the issue persists then?
There is a different issue when I upgrade to the latest action version:
Collecting slither-analyzer@ https://github.com/crytic/slither/archive/v0.8.3.tar.gz
ERROR: HTTP error 404 while getting https://github.com/crytic/slither/archive/v0.8.3.tar.gz
ERROR: Could not install requirement slither-analyzer@ https://github.com/crytic/slither/archive/v0.8.3.tar.gz from https://github.com/crytic/slither/archive/v0.8.3.tar.gz because of HTTP error 404 Client Error: Not Found for url: https://codeload.github.com/crytic/slither/tar.gz/v0.8.3 for URL https://github.com/crytic/slither/archive/v0.8.3.tar.gz
You should specify the version without the v
(as in slither-version: 0.8.3
) so that it is pulled from PyPI. Any other kind of string there is treated as a Git ref (which v0.8.3 is not a valid one)
@elopez thanks for the quick responses! After updating to 0.2.0
and setting the Slither version without v
I am still getting the original error back.
Error seems to indeed stem from crytic-compile 0.3.0
. Is there a way to configure slither-action
to run crytic-compile 0.2.4
as a temporary workaround? I get the same error running this:
- name: Run Slither
uses: crytic/slither-action@v0.2.0
continue-on-error: true
id: slither
with:
ignore-compile: true
sarif: results.sarif
Unfortunately the previous slither release only has a minimum version specified for crytic-compile, so it'll pull the latest version of it π
As a temporary workaround, I've made a branch that should return Slither 0.9.2 + ignore-compile to a working state, can you try adding slither-version: dev-workaround-action-48
to the actions' with:
block and let me know if that helps?
- name: Run Slither
uses: crytic/slither-action@v0.2.0
continue-on-error: true
id: slither
with:
ignore-compile: true
sarif: results.sarif
slither-version: dev-workaround-action-48
This worked! Thanks!
@elopez fyi, if target
is set then paths are handled differently now, is that expected?
[-] Slither config provided: packages/hardhat/slither.config.json
Problem executing hardhat to fetch configuration, using defaults: [Errno 2] No such file or directory: 'npx'
Traceback (most recent call last):
File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 834, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 87, in process_all
compilations = compile_all(target, **vars(args))
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 620, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 110, in __init__
self._compile(**kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 530, in _compile
self._platform.compile(self, **kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/hardhat.py", line 195, in compile
hardhat_like_parsing(crytic_compile, self._target, build_directory, hardhat_working_dir)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/hardhat.py", line 49, in hardhat_like_parsing
os.listdir(build_directory), key=lambda x: os.path.getmtime(Path(build_directory, x))
FileNotFoundError: [Errno 2] No such file or directory: 'packages/hardhat/packages/hardhat/artifacts/build-info'
Error in packages/hardhat/
Traceback (most recent call last):
File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 834, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 87, in process_all
compilations = compile_all(target, **vars(args))
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 620, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 110, in __init__
self._compile(**kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 530, in _compile
self._platform.compile(self, **kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/hardhat.py", line 195, in compile
hardhat_like_parsing(crytic_compile, self._target, build_directory, hardhat_working_dir)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/hardhat.py", line 49, in hardhat_like_parsing
os.listdir(build_directory), key=lambda x: os.path.getmtime(Path(build_directory, x))
FileNotFoundError: [Errno 2] No such file or directory: 'packages/hardhat/packages/hardhat/artifacts/build-info'
- name: Run Slither
uses: crytic/slither-action@v0.2.0
with:
node-version: 16
ignore-compile: true
slither-config: packages/hardhat/slither.config.json
slither-version: dev-workaround-action-48
target: packages/hardhat/
EDIT: It does not look expected. If I remove it, I get a different error:
[-] Slither config provided: packages/hardhat/slither.config.json
Traceback (most recent call last):
File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 834, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 87, in process_all
compilations = compile_all(target, **vars(args))
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 641, in compile_all
compilations.append(CryticCompile(filename, **kwargs))
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 110, in __init__
self._compile(**kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 530, in _compile
self._platform.compile(self, **kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/solc.py", line 154, in compile
targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/solc.py", line 283, in _get_targets_json
return _run_solc(
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/solc.py", line 483, in _run_solc
raise InvalidCompilation(f"{filename} does not exist (are you in the correct directory?)")
crytic_compile.platform.exceptions.InvalidCompilation: . does not exist (are you in the correct directory?)
Error in .
Traceback (most recent call last):
File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 834, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 87, in process_all
compilations = compile_all(target, **vars(args))
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 641, in compile_all
compilations.append(CryticCompile(filename, **kwargs))
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 110, in __init__
self._compile(**kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 530, in _compile
self._platform.compile(self, **kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/solc.py", line 154, in compile
targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/solc.py", line 283, in _get_targets_json
return _run_solc(
File "/opt/slither/lib/python3.9/site-packages/crytic_compile/platform/solc.py", line 483, in _run_solc
raise InvalidCompilation(f"{filename} does not exist (are you in the correct directory?)")
crytic_compile.platform.exceptions.InvalidCompilation: . does not exist (are you in the correct directory?)
@0xmichalis that looks like a different bug on the crytic-compile hardhat code. I've pushed an extra fix to https://github.com/crytic/crytic-compile/pull/364 which should resolve it. Could you try again and let me know if it works now? (just rerunning the workflow with the correct path and slither-version set should be enough)
@elopez works now, thanks!
@elopez just a note, the branch that contains your fix also uses the latest version of Slither. Are there any plans to backport this fix to work with 0.8.3?
@0xmichalis we don't usually re-release older versions with backported fixes, is there any reason why you'd like to keep using 0.8.3 instead of upgrading?
For the time being I've prepared a second branch you can select with slither-version: dev-workaround-action-48-0.8.3
which is 0.8.3 + a fix to have it continue using the older crytic-compile (0.2.x series). Let me know if that helps.
@elopez amazing, works like a charm! Thanks for the support!
The only reason we don't want to upgrade yet is that 0.9.x has a bunch of new warnings for us to comb through and we'd prefer to upgrade at a latter point in time as currently we are swamped with higher priority work. Definitely plan to upgrade to latest as soon as we can.
@elopez It seems that 'dev-workaround-action-48' branch has been deleted so now the workaround for v0.9.0+ fails
@fullkomnun I've replaced the reference in the workaround branch with a commit hash that should not disappear going forward. No change should be required from your side, just rerun any affected workflows.
Hi, I have a similar issue with a brownie project.
My project structure is the following:
- root/
- - brownie/
- - - contracts/
Whether I'm using the 0.3.0
version of the action or the workaround discussed in this issue (the 0.2.0
action version with the dev-workaround-action-48
slither-version set on the action), I get a No such file or directory brownie
. See the logs below.
Hi @sebastiendan, that looks unrelated to this issue. Brownie is not pre-installed in the action environment, instead it is expected to be installed through the projects' requirements.txt
if required. You appear to be missing a requirements.txt file (which in this case should list eth-brownie
and any other python deps your project requires to build). Or alternatively, the action target
property might be pointing to a different folder?
[-] Did not find a requirements.txt, proceeding without installing Python dependencies.
The requirements.txt file should be on the same folder as your brownie config file, and the action target
should point to that folder. See e.g. the brownie token mix for a sample file structure.
I believe there's no pending items here so I'll close the issue, but feel free to open a new one if you experience further issues.
Our Slither action has started failing at some point during the last two days with the following error:
Our action config (hardhat workspace is part of a monorepo):
Our Slither config: