Skip to content

Commit

Permalink
re-enable using slither for vyper files (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrieco-tob authored Aug 31, 2023
1 parent 21e6e52 commit 9ea8a2c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/Echidna.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ prepareContract env contracts solFiles specifiedContract seed = do
-- run processors
slitherInfo <- runSlither (NE.head solFiles) solConf
case find (< minSupportedSolcVersion) slitherInfo.solcVersions of
Just outdatedVersion -> throwM $ OutdatedSolcVersion outdatedVersion
Just version | detectVyperVersion version -> pure ()
Just version -> throwM $ OutdatedSolcVersion version
Nothing -> pure ()

let
Expand Down
3 changes: 1 addition & 2 deletions lib/Echidna/Processor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Data.Maybe (catMaybes, fromMaybe)
import Data.SemVer (Version, fromText)
import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text (pack, isSuffixOf)
import Data.Text (pack)
import System.Directory (findExecutable)
import System.Exit (ExitCode(..))
import System.Process (StdStream(..), readCreateProcessWithExitCode, proc, std_err)
Expand Down Expand Up @@ -124,7 +124,6 @@ instance FromJSON SlitherInfo where

-- Slither processing
runSlither :: FilePath -> SolConf -> IO SlitherInfo
runSlither fp _ | ".vy" `isSuffixOf` pack fp = pure noInfo
runSlither fp solConf = do
path <- findExecutable "slither" >>= \case
Nothing -> throwM $
Expand Down
3 changes: 3 additions & 0 deletions lib/Echidna/Types/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import EVM.Types (Addr)
minSupportedSolcVersion :: Version
minSupportedSolcVersion = version 0 4 25 [] []

detectVyperVersion :: Version -> Bool
detectVyperVersion x = x > version 0 3 0 [] [] && x < version 0 4 0 [] []

data Filter = Blacklist [Text] | Whitelist [Text] deriving Show

-- | Things that can go wrong trying to load a Solidity file for Echidna testing.
Expand Down

0 comments on commit 9ea8a2c

Please sign in to comment.