nixpkgs/pkgs/tools/security/echidna/echidna-update-aeson.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.5 KiB
Diff
Raw Normal View History

2022-09-07 14:41:48 +00:00
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)