From 4567fcbbcd8be6b0426f8122da9441aca6726289 Mon Sep 17 00:00:00 2001 From: ggrieco-tob Date: Wed, 30 Aug 2023 14:07:31 +0200 Subject: [PATCH] re-enable using slither for vyper files --- lib/Echidna.hs | 3 ++- lib/Echidna/Processor.hs | 3 +-- lib/Echidna/Types/Solidity.hs | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Echidna.hs b/lib/Echidna.hs index 63ed44ee5..4c79102c7 100644 --- a/lib/Echidna.hs +++ b/lib/Echidna.hs @@ -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 diff --git a/lib/Echidna/Processor.hs b/lib/Echidna/Processor.hs index e00f04cc9..9bd48107a 100644 --- a/lib/Echidna/Processor.hs +++ b/lib/Echidna/Processor.hs @@ -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) @@ -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 $ diff --git a/lib/Echidna/Types/Solidity.hs b/lib/Echidna/Types/Solidity.hs index 74a606e0c..82bcc7a59 100644 --- a/lib/Echidna/Types/Solidity.hs +++ b/lib/Echidna/Types/Solidity.hs @@ -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.