-
Notifications
You must be signed in to change notification settings - Fork 997
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
Slither doesn't resolve references across compilation units #2102
Comments
There will be two contracts called A as they potentially have different behavior and are thus analyzed separately e.g. a staticcall is used for view versus call. Right now your script only looks at the first one (using |
|
Guys, Slither does not have a reference resolver. This is not good practice and will lead to problems down the road. Some like #2107 may be easy to solve, others not. Slither cannot even answer the simplest questions in static analysis:
All of Slither's results are with respect to a compilation unit, which is not intuitive for users. EDIT: I think I was a bit too courteous here. It's not just unintuitive, it's plain simply wrong. If you give 100 developers/auditors the above codebase and ask them what are the derived contracts of A (and give them unbounded time), they would all say B and C. Slither unfortunately doesn't abstract compilation units from the users and so gives answers that are just wrong. Nobody audits code with the compilation graph in their head. This will be an even bigger problem for frameworks that prefer large numbers of compilation units (eg woke lsp), bc one file might be in 10 compilation units. If you guys understand the value of resolving references to identical objects across compilation units, you can build slither on top of woke. |
Reference resolving is currently one of the hardest problems in Solidity static analysis. |
What do you mean by I believe Slither has solved this a long time ago, and it can actually answer the two questions you asked ;) (#2107 is a UI problem, not a feature problem) |
Hey @montyly , I can provide a detailed explanation early next week but just a sanity check - which ((C.a_main.references will return only c_main and B.a_main.references will return only b_main)) |
We don't have a direct API for that, but it just requires looping over the compilation units and gather the information if it's what you are looking for ;) However we can add user-facing API if this is useful |
As discussed on telegram, it seems to me that Slither does not resolve references across compilation units. Here is a reproduction repo: https://github.com/hacker-DOM/reference-resolving. The tldr is multiple
Contract
instances will exist inSlither.contracts
for each contract that spans multiple compilation units, and so a regular usage of the Api like finding a contract with a given name (if there's just one in my codebase) and looking for its derived contracts will report inaccurate results.The text was updated successfully, but these errors were encountered: