crytic / crytic/crytic-compile

[Bug-Candidate]: Foundry repos erroring with `ValueError: <file> does not exist in [ <lots of paths here> ]`

Open
#271 5 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
197
Forks
97
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

I'm seeing an error when running `slither .` in two foundry repos (both are currently private or I'd link to them). `crytic-compile .` runs successfully, but `slither .` exits with:

```
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/slither/__main__.py", line 744, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/usr/local/lib/python3.9/site-packages/slither/__main__.py", line 87, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/usr/local/lib/python3.9/site-packages/slither/__main__.py", line 70, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "/usr/local/lib/python3.9/site-packages/slither/slither.py", line 95, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "/usr/local/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 256, in parse_top_level_from_loaded_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "/usr/local/lib/python3.9/site-packages/slither/core/compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "/usr/local/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 199, in filename_lookup
raise ValueError(
ValueError: /path/to/my/project/lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol does not exist in [ ]
```

That IERC20 file does exist at the path shown, but it is not present in the list of files within the brackets. Same error but different file in the second repo where this happens. There are no symbolic links, one repo uses default remappings, and the other has `remappings = ["test/=test/"]` in the foundy.toml file

### Code example to reproduce the issue:

See above

### Version:

Versions:
- slither 0.8.3
- crytic-compile 0.2.3
- macOS 12.3.1
- solc 0.8.13+commit.abaa5c0e.Darwin.appleclang
- forge 0.2.0 (4604a42 2022-05-12T00:08:20.870532+00:00)

### Relevant log output:

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.