diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cee2c1d6..550362b8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: id: stack if: matrix.container == '' with: - ghc-version: '9.4' + ghc-version: '9.6' enable-stack: true stack-version: 'latest' diff --git a/flake.lock b/flake.lock index 6f81b13f4..27cbdfd65 100644 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703499205, - "narHash": "sha256-lF9rK5mSUfIZJgZxC3ge40tp1gmyyOXZ+lRY3P8bfbg=", + "lastModified": 1713284584, + "narHash": "sha256-rRuPBJD9+yjz7tY3xC/BvFUwloutynR9piiVE6fhGqo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870", + "rev": "2b6ee326ad047870526d9a3ae88dfd0197da898d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2b3bcd043..0b4e0ca3a 100644 --- a/flake.nix +++ b/flake.nix @@ -47,13 +47,22 @@ ncurses-static = pkgsStatic.ncurses.override { enableStatic = true; }; - hevm = pkgs: pkgs.haskell.lib.dontCheck ( + cc-workaround-nix-23138 = + pkgs.writeScriptBin "cc-workaround-nix-23138" '' + if [ "$1" = "--print-file-name" ] && [ "$2" = "c++" ]; then + echo c++ + else + exec cc "$@" + fi + ''; + + hevm = pkgs: pkgs.haskell.lib.appendConfigureFlag (pkgs.haskell.lib.dontCheck ( pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub { - owner = "trail-of-forks"; + owner = "elopez"; repo = "hevm"; - rev = "4605dd0f2ed958f2cabe055bd4d5dac8c0e2b77e"; - sha256 = "sha256-NLdqY3DIb9G2JJRZrXBBh9LxxylZM8Mnr7rqSJdrPUg="; - }) { secp256k1 = pkgs.secp256k1; }); + rev = "3065046b2a3d2ac0ea23347ba2699a0f008d26c7"; + sha256 = "sha256-tTgtOgNzmjaLQjJj1/bYvEp0DXabswpl47usTmfqLP8="; + }) { secp256k1 = pkgs.secp256k1; })) "--ghc-options=-pgml=${cc-workaround-nix-23138}/bin/cc-workaround-nix-23138"; # FIXME: figure out solc situation, it conflicts with the one from # solc-select that is installed with slither, disable tests in the meantime @@ -63,6 +72,7 @@ [ (haskell.lib.compose.addTestToolDepends [ haskellPackages.hpack slither-analyzer solc ]) (haskell.lib.compose.disableCabalFlag "static") + (haskell.lib.compose.appendConfigureFlag "--ghc-options=-pgml=${cc-workaround-nix-23138}/bin/cc-workaround-nix-23138") ]); echidna-static = with pkgsStatic; lib.pipe @@ -145,7 +155,10 @@ devShell = with pkgs; haskellPackages.shellFor { packages = _: [ (echidna pkgs) ]; - shellHook = "hpack"; + shellHook = '' + hpack + cabal configure --ghc-options=-pgml=${cc-workaround-nix-23138}/bin/cc-workaround-nix-23138 + ''; buildInputs = [ solc slither-analyzer diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index 257aaee9e..f489cd6f7 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -8,7 +8,10 @@ import Brick import Brick.BChan import Brick.Widgets.Dialog qualified as B import Data.Sequence ((|>)) -import Graphics.Vty (Config, Event(..), Key(..), Modifier(..), defaultConfig, inputMap, mkVty) +import Graphics.Vty.Config (VtyUserConfig, defaultConfig, configInputMap) +import Graphics.Vty.CrossPlatform (mkVty) +import Graphics.Vty.Input.Events +import Graphics.Vty (Event(..), Key(..), Modifier(..)) import Graphics.Vty qualified as Vty import System.Posix import Echidna.UI.Widgets @@ -245,12 +248,12 @@ stopWorkers :: MonadIO m => [(ThreadId, a)] -> m () stopWorkers workers = forM_ workers $ \(threadId, _) -> liftIO $ killThread threadId -vtyConfig :: IO Config +vtyConfig :: IO VtyUserConfig vtyConfig = do - config <- Vty.standardIOConfig - pure config { inputMap = (Nothing, "\ESC[6;2~", EvKey KPageDown [MShift]) : - (Nothing, "\ESC[5;2~", EvKey KPageUp [MShift]) : - inputMap defaultConfig } + pure defaultConfig { configInputMap = [ + (Nothing, "\ESC[6;2~", EvKey KPageDown [MShift]), + (Nothing, "\ESC[5;2~", EvKey KPageUp [MShift]) + ] } -- | Check if we should stop drawing (or updating) the dashboard, then do the right thing. monitor :: MonadReader Env m => m (App UIState UIEvent Name) diff --git a/package.yaml b/package.yaml index 926c6b8ec..81090b541 100644 --- a/package.yaml +++ b/package.yaml @@ -13,51 +13,20 @@ ghc-options: - -optP-Wno-nonportable-include-path - -fspecialize-aggressively - -fexpose-all-unfoldings + - -Wunused-packages dependencies: - - base - aeson - - base16-bytestring - - binary - - bytestring - - code-page + - base - containers - - data-bword - - data-dword - - deepseq - - extra - directory - - exceptions - filepath - hashable - - hevm - - html-entities - - ListLike + - hevm >= 0 - MonadRandom - mtl - - optparse-applicative - - optics - - optics-core - - process - - random - - rosezipper - - semver - - split - text - - transformers - time - - unliftio - - utf8-string - - vector - - with-utf8 - - word-wrap - - yaml - - http-conduit - - html-conduit - - warp - - wai-extra - - xml-conduit - - strip-ansi-escape language: GHC2021 @@ -73,20 +42,54 @@ default-extensions: library: source-dirs: lib/ - -when: - - condition: "!os(windows)" - cpp-options: -DINTERACTIVE_UI - dependencies: - - brick - - unix - - vty + dependencies: + - base16-bytestring + - binary + - bytestring + - data-bword + - data-dword + - deepseq + - exceptions + - extra + - html-conduit + - html-entities + - http-conduit + - ListLike + - optics + - optics-core + - process + - random + - rosezipper + - semver + - split + - strip-ansi-escape + - unliftio + - utf8-string + - vector + - wai-extra + - warp + - word-wrap + - xml-conduit + - yaml + when: + - condition: "!os(windows)" + cpp-options: -DINTERACTIVE_UI + dependencies: + - brick + - unix + - vty + - vty-crossplatform executables: echidna: main: Main.hs source-dirs: src/ - dependencies: echidna + dependencies: + - base + - code-page + - echidna + - optparse-applicative + - with-utf8 ghc-options: - -threaded - '"-with-rtsopts=-A64m -N"' @@ -99,13 +102,8 @@ executables: - -O2 - -optl-pthread - condition: os(darwin) - extra-libraries: c++ ld-options: -Wl,-keep_dwarf_unwind ghc-options: -fcompact-unwind - - condition: os(windows) && impl(ghc >= 9.4) - dependencies: system-cxx-std-lib - - condition: os(windows) && impl(ghc < 9.4) - extra-libraries: stdc++ tests: echidna-testsuite: @@ -125,13 +123,8 @@ tests: - -O2 - -optl-pthread - condition: os(darwin) - extra-libraries: c++ ld-options: -Wl,-keep_dwarf_unwind ghc-options: -fcompact-unwind - - condition: os(windows) && impl(ghc >= 9.4) - dependencies: system-cxx-std-lib - - condition: os(windows) && impl(ghc < 9.4) - extra-libraries: stdc++ flags: static: diff --git a/stack.yaml b/stack.yaml index 932acff27..6fd52b6da 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,17 +1,8 @@ -resolver: lts-21.17 +resolver: lts-22.19 packages: - '.' extra-deps: -- git: https://github.com/trail-of-forks/hevm.git - commit: 4605dd0f2ed958f2cabe055bd4d5dac8c0e2b77e - -- restless-git-0.7@sha256:346a5775a586f07ecb291036a8d3016c3484ccdc188b574bcdec0a82c12db293,968 -- s-cargot-0.1.4.0@sha256:61ea1833fbb4c80d93577144870e449d2007d311c34d74252850bb48aa8c31fb,3525 -- semver-range-0.2.8@sha256:44918080c220cf67b6e7c8ad16f01f3cfe1ac69d4f72e528e84d566348bb23c3,1941 -- HSH-2.1.3@sha256:71ded11b224f5066373ce985ec63b10c87129850b33916736dd64fa2bea9ea0a,1705 -- spool-0.1@sha256:77780cbfc2c0be23ff2ea9e474062f3df97fcd9db946ee0b3508280a923b83e2,1461 -- smt2-parser-0.1.0.1@sha256:1e1a4565915ed851c13d1e6b8bb5185cf5d454da3b43170825d53e221f753d77,1421 -- spawn-0.3@sha256:b91e01d8f2b076841410ae284b32046f91471943dc799c1af77d666c72101f02,1162 -- strip-ansi-escape-0.1.0.0@sha256:08f2ed93b16086a837ec46eab7ce8d27cf39d47783caaeb818878ea33c2ff75f,1628 +- git: https://github.com/elopez/hevm.git + commit: 3065046b2a3d2ac0ea23347ba2699a0f008d26c7