Skip to content
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

deregister_printer #1724

Merged
merged 5 commits into from
Mar 10, 2023
Merged

deregister_printer #1724

merged 5 commits into from
Mar 10, 2023

Conversation

sidarth16
Copy link
Contributor

This function would be helpful to de-register a printer class from the list of _printers already registered with the slither object.

This function would be helpful to de-register a printer class from the list of _printers already registered with the slither object.
@0xalpharush
Copy link
Contributor

0xalpharush commented Mar 8, 2023

What is the use case? Can't you only register specific detectors and leave out the ones that are not desired?

@sidarth16
Copy link
Contributor Author

What is the use case? Can't you only register specific detectors and leave out the ones that are not desired?

The major issue it solves is the reusing of the same slither Object for multiple printer and detector classes.
Example:

from slither.detectors.all_detectors import *
from slither.slither import Slither

sl = Slither("<contract_address>")

detectors = [
    TxOrigin, ReentrancyBenign, ReentrancyEth, 
    UncheckedLowLevel, UncheckedTransfer, UncheckedSend
]
for d in detectors:
    sl.register_detector(d)  
r1 = sl.run_detectors()

# Now I no more want TxOrigin in the context slither object detectors

sl.deregister_detector(TxOrigin)

r2 = sl.run_detectors()

Thus, We are now able to re-run detectors and printers , reusing the same slither object. We don't need to declare new slither object for each combination of detector / printer classes.

Here r1, contains results of TxOrigin , while r2 does not contain results of TxOrigin

@montyly montyly merged commit 6ff1774 into crytic:dev Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants