Skip to content

Commit

Permalink
Merge pull request #163 from pessimistic-io/obsolete
Browse files Browse the repository at this point in the history
obsolete detectors
  • Loading branch information
Yhtiyar committed Jun 4, 2024
2 parents 2777939 + 8feae1c commit 9833de9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
33 changes: 24 additions & 9 deletions slitherin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from slitherin.detectors.arbitrary_call.arbitrary_call import ArbitraryCall
from slitherin.detectors.double_entry_token_possibility import (
DoubleEntryTokenPossiblity,
Expand All @@ -9,12 +11,14 @@
from slitherin.detectors.unprotected_setter import UnprotectedSetter
from slitherin.detectors.nft_approve_warning import NftApproveWarning
from slitherin.detectors.inconsistent_nonreentrant import InconsistentNonreentrant
from slitherin.detectors.call_forward_to_protected import CallForwardToProtected
from slitherin.detectors.obsolete.call_forward_to_protected import (
CallForwardToProtected,
)
from slitherin.detectors.multiple_storage_read import MultipleStorageRead
from slitherin.detectors.timelock_controller import TimelockController
from slitherin.detectors.tx_gasprice_warning import TxGaspriceWarning
from slitherin.detectors.unprotected_initialize import UnprotectedInitialize
from slitherin.detectors.read_only_reentrancy import ReadOnlyReentrancy
from slitherin.detectors.obsolete.read_only_reentrancy import ReadOnlyReentrancy
from slitherin.detectors.event_setter import EventSetter
from slitherin.detectors.before_token_transfer import BeforeTokenTransfer
from slitherin.detectors.uni_v2 import UniswapV2
Expand All @@ -29,19 +33,28 @@
from slitherin.detectors.arbitrum.block_number_timestamp import (
ArbitrumBlockNumberTimestamp,
)
from slitherin.detectors.arbitrum.arbitrum_chainlink_price_feed import ArbitrumChainlinkPriceFeed
from slitherin.detectors.arbitrum.arbitrum_chainlink_price_feed import (
ArbitrumChainlinkPriceFeed,
)
from slitherin.detectors.potential_arith_overflow import PotentialArithmOverflow
from slitherin.detectors.curve.curve_readonly_reentrancy import CurveReadonlyReentrancy
from slitherin.detectors.balancer.balancer_readonly_reentrancy import BalancerReadonlyReentrancy
from slitherin.detectors.vyper.reentrancy_curve_vyper_version import CurveVyperReentrancy
from slitherin.detectors.balancer.balancer_readonly_reentrancy import (
BalancerReadonlyReentrancy,
)
from slitherin.detectors.vyper.reentrancy_curve_vyper_version import (
CurveVyperReentrancy,
)
from slitherin.detectors.price_manipulation import PriceManipulationDetector
from .consts import OBSOLETE_FLAG

artbitrum_detectors = [
ArbitrumPrevrandaoDifficulty,
ArbitrumBlockNumberTimestamp,
ArbitrumChainlinkPriceFeed
ArbitrumChainlinkPriceFeed,
]

obsolete_detectors = [CallForwardToProtected, ReadOnlyReentrancy]

plugin_detectors = artbitrum_detectors + [
DoubleEntryTokenPossiblity,
UnprotectedSetter,
Expand All @@ -51,12 +64,10 @@
OnlyEOACheck,
MagicNumber,
DubiousTypecast,
CallForwardToProtected,
MultipleStorageRead,
TimelockController,
TxGaspriceWarning,
UnprotectedInitialize,
ReadOnlyReentrancy,
EventSetter,
BeforeTokenTransfer,
UniswapV2,
Expand All @@ -70,8 +81,12 @@
CurveReadonlyReentrancy,
BalancerReadonlyReentrancy,
CurveVyperReentrancy,
PriceManipulationDetector
PriceManipulationDetector,
]

if os.getenv(OBSOLETE_FLAG):
plugin_detectors += obsolete_detectors

plugin_printers = []


Expand Down
1 change: 1 addition & 0 deletions slitherin/consts.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ARBITRUM_KEY = "SLITHERIN_ARBITRUM"
OBSOLETE_FLAG = "SLITHERIN_OBSOLETE"
SLITHERIN_VERSION = "0.7.0"
4 changes: 4 additions & 0 deletions slitherin/detectors/obsolete/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Obsolete detectors
These detectors are deprecated.
## How to still use it
Set a flag `SLITHERIN_OBSOLETE=true`
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _detect_low_level_custom_address_call(self, fun: Function) -> bool:
return True
return False

def _pess_is_excluded_from_detector(self, contract: "Contract") -> bool:
def _pess_is_excluded_from_detector(self, contract) -> bool:
path = Path(contract.source_mapping.filename.absolute).parts
is_zep = "openzeppelin-solidity" in path or \
("@openzeppelin" in path and path[path.index("@openzeppelin") + 1] == "contracts") or \
Expand Down
File renamed without changes.

0 comments on commit 9833de9

Please sign in to comment.