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
[Bug-Candidate]: Unable to use foundry out of the box with relative imports in lib #270
Comments
EDIT: Nvm, I see what you mean. I suspect it has something to do with how crytic-compile or Foundry resolves this import. I got slither to work using the following patch to the codebase:
Sidenote: @montyly I've never seen slither run this slowly on a small codebase. It looks like it's the similar variables detector
|
Having the same problem with the Solmate library.
|
Thanks @Elyx0 for the minimal testcase, it was really useful. I think that this is due to foundry-rs/foundry#1488. I can see in the compilation artefacts that both
Are included when https://github.com/Elyx0/foundry-slither-oz-choke is compiled. However I have no idea why forge includes Unfortunately, as this is a due to a bug in foundry, I am not sure that there is a lot we can do. |
@montyly I seem to running into a similar issue with foundry
What's interesting is that the subprocess command Saw that a PR was merged to resolve foundry-rs/foundry#1488, but maybe it's because forge hasn't included this in a new release yet |
is this resolved? |
Slither 0.9.2 works on the OP's repo. Note, running slither on directories/contracts with dependencies may not work because often a build system like Foundry is needed. I would run |
Describe the issue:
Slither(foundry) chokes on libs/ with relative import inside.
Command:
slither .
Using:
Example slitherable minimal repo: https://github.com/Elyx0/foundry-slither-oz-choke/blob/main/src/Contract.sol#L6
See file comments on how to make unslitherable by uncommenting 2 lines of
Contract.sol
Built with:
forge init forge install openzeppelin/openzeppelin-contracts forge remappings > remappings.txt
Error log:
forge test
passes correctly while in the "unslitherable" state. No issues.Potentially related: crytic/slither#1214 I grepped the
ast
and they seem to be there.out/IERC20.sol/IERC20.json only present path is
out/Contract.sol/Greeter.json has
Additional Notes:
In the slitherable state (no IERC20 uncommented):
slither src/Contract.sol
while trying to target a specific file chokes as well:Likewise for
slither src/Contract.sol --compile-force-framework foundry
Out of ideas for now. Good luck!
Code example to reproduce the issue:
https://github.com/Elyx0/foundry-slither-oz-choke/blob/main/src/Contract.sol#L6
Version:
0.8.3
Relevant log output:
No response
The text was updated successfully, but these errors were encountered: