-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
echidna: 1.7.3 -> 2.0.2 #190144
echidna: 1.7.3 -> 2.0.2 #190144
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
diff --git a/hevm.cabal b/hevm.cabal | ||
index cf36961e..3b31f595 100644 | ||
--- a/hevm.cabal | ||
+++ b/hevm.cabal | ||
@@ -71,6 +71,10 @@ library | ||
-Wall -Wno-deprecations | ||
extra-libraries: | ||
secp256k1, ff | ||
+ if os(darwin) | ||
+ extra-libraries: c++ | ||
+ else | ||
+ extra-libraries: stdc++ | ||
c-sources: | ||
ethjet/tinykeccak.c, ethjet/ethjet.c | ||
cxx-sources: | ||
@@ -88,7 +92,7 @@ library | ||
transformers >= 0.5.6 && < 0.6, | ||
tree-view >= 0.5 && < 0.6, | ||
abstract-par >= 0.3.3 && < 0.4, | ||
- aeson >= 1.5.6 && < 1.6, | ||
+ aeson >= 2.0 && < 2.1, | ||
bytestring >= 0.10.8 && < 0.11, | ||
scientific >= 0.3.6 && < 0.4, | ||
binary >= 0.8.6 && < 0.9, | ||
@@ -97,7 +101,7 @@ library | ||
vector >= 0.12.1 && < 0.13, | ||
ansi-wl-pprint >= 0.6.9 && < 0.7, | ||
base16-bytestring >= 1.0.0 && < 2.0, | ||
- brick >= 0.58 && < 0.63, | ||
+ brick >= 0.58 && < 0.69, | ||
megaparsec >= 9.0.0 && < 10.0, | ||
mtl >= 2.2.2 && < 2.3, | ||
directory >= 1.3.3 && < 1.4, | ||
@@ -105,13 +109,13 @@ library | ||
vty >= 5.25.1 && < 5.34, | ||
cereal >= 0.5.8 && < 0.6, | ||
cryptonite >= 0.27 && <= 0.29, | ||
- memory >= 0.14.18 && < 0.16, | ||
+ memory >= 0.14.18 && < 0.20, | ||
data-dword >= 0.3.1 && < 0.4, | ||
fgl >= 5.7.0 && < 5.8, | ||
free >= 5.1.3 && < 5.2, | ||
haskeline >= 0.8.0 && < 0.9, | ||
process >= 1.6.5 && < 1.7, | ||
- lens >= 4.17.1 && < 4.20, | ||
+ lens >= 4.17.1 && < 5.1, | ||
lens-aeson >= 1.0.2 && < 1.2, | ||
monad-par >= 0.3.5 && < 0.4, | ||
multiset >= 0.3.4 && < 0.4, | ||
@@ -124,7 +128,6 @@ library | ||
sbv >= 8.9, | ||
semver-range >= 0.2.7 && < 0.3, | ||
temporary >= 1.3 && < 1.4, | ||
- text-format >= 0.3.2 && < 0.4, | ||
witherable >= 0.3.5 && < 0.5, | ||
wreq >= 0.5.3 && < 0.6, | ||
regex-tdfa >= 1.2.3 && < 1.4, | ||
@@ -190,7 +193,6 @@ executable hevm | ||
sbv, | ||
temporary, | ||
text, | ||
- text-format, | ||
unordered-containers, | ||
vector, | ||
vty | ||
diff --git a/src/EVM/Solidity.hs b/src/EVM/Solidity.hs | ||
index b7d0f36b..4e9d6892 100644 | ||
--- a/src/EVM/Solidity.hs | ||
+++ b/src/EVM/Solidity.hs | ||
@@ -70,6 +70,7 @@ import Control.Monad | ||
import Control.Lens hiding (Indexed, (.=)) | ||
import qualified Data.String.Here as Here | ||
import Data.Aeson hiding (json) | ||
+import qualified Data.Aeson.KeyMap as KeyMap | ||
import Data.Aeson.Types | ||
import Data.Aeson.Lens | ||
import Data.Scientific | ||
@@ -714,8 +715,8 @@ astIdMap = foldMap f | ||
f :: Value -> Map Int Value | ||
f (Array x) = foldMap f x | ||
f v@(Object x) = | ||
- let t = foldMap f (HMap.elems x) | ||
- in case HMap.lookup "id" x of | ||
+ let t = foldMap f (KeyMap.elems x) | ||
+ in case KeyMap.lookup "id" x of | ||
Nothing -> t | ||
Just (Number i) -> t <> Map.singleton (round i) v | ||
Just _ -> t | ||
diff --git a/src/EVM/SymExec.hs b/src/EVM/SymExec.hs | ||
index 5bbf1c03..b828098e 100644 | ||
--- a/src/EVM/SymExec.hs | ||
+++ b/src/EVM/SymExec.hs | ||
@@ -40,8 +40,8 @@ type EquivalenceResult = ProofResult ([VM], [VM]) VM () | ||
|
||
-- | Convenience functions for generating large symbolic byte strings | ||
sbytes32, sbytes128, sbytes256, sbytes512, sbytes1024 :: Query ([SWord 8]) | ||
-sbytes32 = toBytes <$> freshVar_ @ (WordN 256) | ||
-sbytes128 = toBytes <$> freshVar_ @ (WordN 1024) | ||
+sbytes32 = toBytes <$> freshVar_ @(WordN 256) | ||
+sbytes128 = toBytes <$> freshVar_ @(WordN 1024) | ||
sbytes256 = liftA2 (++) sbytes128 sbytes128 | ||
sbytes512 = liftA2 (++) sbytes256 sbytes256 | ||
sbytes1024 = liftA2 (++) sbytes512 sbytes512 | ||
diff --git a/src/EVM/Types.hs b/src/EVM/Types.hs | ||
index fdd2368d..1dc29e83 100644 | ||
--- a/src/EVM/Types.hs | ||
+++ b/src/EVM/Types.hs | ||
@@ -434,17 +434,17 @@ readN s = fromIntegral (read s :: Integer) | ||
readNull :: Read a => a -> String -> a | ||
readNull x = fromMaybe x . Text.Read.readMaybe | ||
|
||
-wordField :: JSON.Object -> Text -> JSON.Parser W256 | ||
+wordField :: JSON.Object -> Key -> JSON.Parser W256 | ||
wordField x f = ((readNull 0) . Text.unpack) | ||
<$> (x .: f) | ||
|
||
-addrField :: JSON.Object -> Text -> JSON.Parser Addr | ||
+addrField :: JSON.Object -> Key -> JSON.Parser Addr | ||
addrField x f = (read . Text.unpack) <$> (x .: f) | ||
|
||
-addrFieldMaybe :: JSON.Object -> Text -> JSON.Parser (Maybe Addr) | ||
+addrFieldMaybe :: JSON.Object -> Key -> JSON.Parser (Maybe Addr) | ||
addrFieldMaybe x f = (Text.Read.readMaybe . Text.unpack) <$> (x .: f) | ||
|
||
-dataField :: JSON.Object -> Text -> JSON.Parser ByteString | ||
+dataField :: JSON.Object -> Key -> JSON.Parser ByteString | ||
dataField x f = hexText <$> (x .: f) | ||
|
||
toWord512 :: W256 -> Word512 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ lib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to speak with the rest of the echidna team, but I think we can do this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it okay if we merge this and I'll work on hackage for the next update? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that sounds good, thanks! |
||
, fetchpatch | ||
, fetchFromGitHub | ||
# Haskell deps | ||
, mkDerivation, aeson, ansi-terminal, base, base16-bytestring, binary, brick | ||
|
@@ -8,19 +7,24 @@ | |
, MonadRandom, mtl, optparse-applicative, process, random, stm, tasty | ||
, tasty-hunit, tasty-quickcheck, temporary, text, transformers , unix, unliftio | ||
, unliftio-core, unordered-containers, vector, vector-instances, vty | ||
, wl-pprint-annotated, word8, yaml , extra, ListLike, semver | ||
, wl-pprint-annotated, word8, yaml, extra, ListLike, semver | ||
}: | ||
mkDerivation rec { | ||
pname = "echidna"; | ||
version = "1.7.3"; | ||
version = "2.0.2"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "crytic"; | ||
repo = "echidna"; | ||
rev = "v${version}"; | ||
sha256 = "sha256-NkAAXYa1bbCNUO0eDM7LQbyC3//RRFAKmEHGH2Dhl/M="; | ||
sha256 = "sha256-WmlQWgn4qfRmx3PdzY7wzT9AyU7Re2T1CWJ7yGjcVac="; | ||
}; | ||
|
||
# NOTE: echidna is behind with aeson because of hevm, this patch updates | ||
# the code to work with the major aeson update that broke the build | ||
# it's temporary until hevm version 0.50.0 is released - https://github.com/ethereum/hevm/milestone/1 | ||
patches = [ ./echidna-update-aeson.patch ]; | ||
|
||
isLibrary = true; | ||
isExecutable = true; | ||
libraryHaskellDepends = [ | ||
|
@@ -51,4 +55,5 @@ mkDerivation rec { | |
license = lib.licenses.agpl3Plus; | ||
maintainers = with lib.maintainers; [ arturcygan ]; | ||
platforms = lib.platforms.unix; | ||
mainProgram = "echidna-test"; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git a/lib/Echidna/Config.hs b/lib/Echidna/Config.hs | ||
index f8d5777..3d761fe 100644 | ||
--- a/lib/Echidna/Config.hs | ||
+++ b/lib/Echidna/Config.hs | ||
@@ -13,8 +13,8 @@ import Control.Monad.State (StateT(..), runStateT) | ||
import Control.Monad.Trans (lift) | ||
import Data.Bool (bool) | ||
import Data.Aeson | ||
+import Data.Aeson.KeyMap (keys) | ||
import Data.Has (Has(..)) | ||
-import Data.HashMap.Strict (keys) | ||
import Data.HashSet (fromList, insert, difference) | ||
import Data.Maybe (fromMaybe) | ||
import Data.Text (isPrefixOf) | ||
@@ -23,11 +23,13 @@ import EVM.Types (w256) | ||
|
||
import qualified Control.Monad.Fail as M (MonadFail(..)) | ||
import qualified Data.ByteString as BS | ||
+import qualified Data.Aeson.Key as Key | ||
+import qualified Data.HashSet as HS | ||
import qualified Data.List.NonEmpty as NE | ||
import qualified Data.Yaml as Y | ||
|
||
import Echidna.Test | ||
-import Echidna.Types.Campaign | ||
+import Echidna.Types.Campaign | ||
import Echidna.Mutator.Corpus (defaultMutationConsts) | ||
import Echidna.Types.Config (EConfigWithUsage(..), EConfig(..)) | ||
import Echidna.Types.Solidity | ||
@@ -52,7 +54,7 @@ instance FromJSON EConfigWithUsage where | ||
_ -> mempty | ||
(c, ks) <- runStateT (parser v') $ fromList [] | ||
let found = fromList (keys v') | ||
- return $ EConfigWithUsage c (found `difference` ks) (ks `difference` found) | ||
+ return $ EConfigWithUsage c (HS.map Key.toText $ found `difference` ks) (HS.map Key.toText $ ks `difference` found) | ||
-- this parser runs in StateT and comes equipped with the following | ||
-- equivalent unary operators: | ||
-- x .:? k (Parser) <==> x ..:? k (StateT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doJailbreak
. That should require less maintenance in the long-run (but be slightly harder to debug when it ends up no longer working).