-
Notifications
You must be signed in to change notification settings - Fork 9
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
Idea: Prune all unnecessary functions #1
Comments
Even better if you could export the files after this pruning and still have them be compilable |
Yes, it's a good idea to add exporting capability like such. I also wanted to generate some basic reports for each contract scanned, like: "What are the main entry points?" and "What other functions and variables do those entry points taint?". Including cleaner source code without the dead-code functions could go into it. As for excluding unused library functions, it's already partially achieved under the hood! library_functions.webmFirst, if detectors successfully ran, there will be a "dead-code" detector/check available from Slither. It's an informational level detector. Notice that "jump-to-line" will work fine on such findings; it will focus on the library function in the source code view. However, the same functions won't be displayed in the list of functions (search results). That's because Betterscan only includes target contract functions that are declared in the target contract or its immediate inheritance. Lines 395 to 429 in ef5cb7c
So, if needed, we have the full original source code with unused functions, but those never get included in the search results/function list display (as they have no effect on anything). Those also won't be included in |
Many functions in a solidity project can be deployed but have no actual use onchain.
For instance, a library file may have 100 functions, but only 1 is actually used by the contracts.
What if this tool could prune all functions that have no actual way to run the logic onchain? Removing those would save effort when reviewing.
Here is one way to do it
The text was updated successfully, but these errors were encountered: