Skip to content
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

Build echidna with GHC 9.8 #1334

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Build echidna with GHC 9.8
  • Loading branch information
elopez committed Dec 5, 2024
commit 3aa07981a441e3d8c3616157499592615dcdd765
10 changes: 5 additions & 5 deletions .github/container-linux-static/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18.6
FROM alpine:3.18.9
# Based on https://github.com/fpco/alpine-haskell-stack/blob/9.2.8v2/ghc-Dockerfile

RUN apk upgrade --no-cache &&\
@@ -27,7 +27,7 @@ RUN apk upgrade --no-cache &&\
lld \
shadow # for stack --docker, provides groupadd

RUN curl -sSLo /usr/local/bin/stack https://github.com/commercialhaskell/stack/releases/download/v2.13.1/stack-2.13.1-linux-x86_64-bin && \
RUN curl -sSLo /usr/local/bin/stack https://github.com/commercialhaskell/stack/releases/download/v3.1.1/stack-3.1.1-linux-x86_64-bin && \
chmod +x /usr/local/bin/stack

# https://stackoverflow.com/a/41517423
@@ -36,12 +36,12 @@ RUN ln -s /usr/lib/libncurses.a /usr/lib/libtinfo.a
COPY stack-config.yaml /root/.stack/config.yaml

RUN cd /tmp && \
curl -sSLo /tmp/ghc.tar.xz https://downloads.haskell.org/~ghc/9.6.5/ghc-9.6.5-x86_64-alpine3_12-linux.tar.xz && \
curl -sSLo /tmp/ghc.tar.xz https://downloads.haskell.org/~ghc/9.8.2/ghc-9.8.2-x86_64-alpine3_12-linux.tar.xz && \
tar xf ghc.tar.xz && \
cd ghc-9.6.5-x86_64-unknown-linux && \
cd ghc-9.8.2-x86_64-unknown-linux && \
./configure --prefix=/usr/local && \
make install && \
rm -rf /tmp/ghc.tar.xz /tmp/ghc-9.6.5-x86_64-unknown-linux
rm -rf /tmp/ghc.tar.xz /tmp/ghc-9.8.2-x86_64-unknown-linux

RUN apk upgrade --no-cache &&\
apk add --no-cache \
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ jobs:
include:
- os: ubuntu-20.04
shell: bash
container: "{\"image\": \"elopeztob/alpine-haskell-stack-echidna:ghc-9.6.5\", \"options\": \"--user 1001\"}"
container: "{\"image\": \"elopeztob/alpine-haskell-stack-echidna:ghc-9.8.2\", \"options\": \"--user 1001\"}"
- os: macos-13 # x86_64 macOS
shell: bash
- os: windows-latest
@@ -64,7 +64,7 @@ jobs:
id: stack
if: matrix.container == ''
with:
ghc-version: '9.6.5'
ghc-version: '9.8.2'
enable-stack: true
stack-version: 'latest'

@@ -90,7 +90,7 @@ jobs:
echo "- $HOME/.local/lib";
echo;
echo "ghc-options:";
echo ' "$locals": -Werror'
echo ' "$locals": -Werror -Wno-error=x-partial'
"$REPLACE_LINKER_WIN" && echo ' "$everything": -pgml='$(cygpath -m "$GHC_MINGW_PATH/bin/clang.exe");
echo;
"$SKIP_MSYS" && echo "skip-msys: true" || true
@@ -156,12 +156,12 @@ jobs:
- name: Build Dependencies
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack build --ghc-options="-Werror" --only-dependencies
stack build --ghc-options="-Werror -Wno-error=x-partial" --only-dependencies

- name: Build and install echidna
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack install --ghc-options="-Werror"
stack install --ghc-options="-Werror -Wno-error=x-partial"

- name: Amend and compress binaries (macOS)
if: runner.os == 'macOS'
@@ -185,7 +185,7 @@ jobs:
if: runner.os != 'macOS'
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack build --test --no-run-tests --ghc-options="-Werror"
stack build --test --no-run-tests --ghc-options="-Werror -Wno-error=x-partial"
cp "$(find "$PWD" -name 'echidna-testsuite*' -type f)" .

- name: Upload testsuite
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 17 additions & 14 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -38,22 +38,25 @@
ncurses-static = pkgsStatic.ncurses.override { enableStatic = true; };

hsPkgs = ps :
ps.haskellPackages.override {
ps.haskell.packages.ghc98.override {
overrides = hfinal: hprev: {
with-utf8 =
if (with ps.stdenv; hostPlatform.isDarwin && hostPlatform.isx86)
then ps.haskell.lib.compose.overrideCabal (_ : { extraLibraries = [ps.libiconv]; }) hprev.with-utf8
else hprev.with-utf8;
# TODO: temporary fix for static build which is still on 9.4
witch = ps.haskell.lib.doJailbreak hprev.witch;
with-utf8 = ps.haskell.lib.compose.overrideCabal (drv: {
version = "1.1.0.0";
src = pkgs.fetchFromGitHub {
owner = "serokell";
repo = "haskell-with-utf8";
rev = "cf6e31475da3d9f54439650a70170819daa35f54";
sha256 = "sha256-hxUiZbbcA6RvrVgGk4Vbt/rZT6wnBF3bfYbbQflzQ24=";
};
}) hprev.with-utf8;
};
};

hevm = pkgs: pkgs.lib.pipe ((hsPkgs pkgs).callCabal2nix "hevm" (pkgs.fetchFromGitHub {
owner = "ethereum";
repo = "hevm";
rev = "443c9040f6a8bde7d8b2cfafd99c0cb7dd7d049f";
sha256 = "sha256-IC/q+2SJoyDansmbTHXfkKFfnhmMy97G13aTPNOkR30=";
rev = "53bccde13eeb6712eb9bc1d99b53529614a33690";
sha256 = "sha256-sd7DEWz7hrs8AO+0juFz5S7Y5l/cWmQmullFeJH7FeE=";
}) { secp256k1 = pkgs.secp256k1; })
([
pkgs.haskell.lib.compose.dontCheck
@@ -65,7 +68,7 @@
# FIXME: figure out solc situation, it conflicts with the one from
# solc-select that is installed with slither, disable tests in the meantime
haskell.lib.compose.dontCheck
(haskell.lib.compose.addTestToolDepends [ haskellPackages.hpack slither-analyzer solc ])
(haskell.lib.compose.addTestToolDepends [ (hsPkgs pkgs).hpack slither-analyzer solc ])
(haskell.lib.compose.disableCabalFlag "static")
]);

@@ -148,17 +151,17 @@
packages.echidna-redistributable = echidnaRedistributable;

devShell = with pkgs;
haskellPackages.shellFor {
(hsPkgs pkgs).shellFor {
packages = _: [ (echidna pkgs) ];
shellHook = ''
hpack
'';
buildInputs = [
solc
slither-analyzer
haskellPackages.hlint
haskellPackages.cabal-install
haskellPackages.haskell-language-server
(hsPkgs pkgs).hlint
(hsPkgs pkgs).cabal-install
(hsPkgs pkgs).haskell-language-server
];
withHoogle = true;
};
2 changes: 1 addition & 1 deletion lib/Echidna/Campaign.hs
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ import Echidna.Types.Config
import Echidna.Types.Signature (FunctionName)
import Echidna.Types.Test
import Echidna.Types.Test qualified as Test
import Echidna.Types.Tx (TxCall(..), Tx(..), call)
import Echidna.Types.Tx (TxCall(..), Tx(..))
import Echidna.Utility (getTimestamp)

instance MonadThrow m => MonadThrow (RandT g m) where
2 changes: 1 addition & 1 deletion lib/Echidna/Exec.hs
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ import Echidna.Types (ExecException(..), Gas, fromEVM, emptyAccount)
import Echidna.Types.Config (Env(..), EConfig(..), UIConf(..), OperationMode(..), OutputFormat(Text))
import Echidna.Types.Coverage (CoverageInfo)
import Echidna.Types.Solidity (SolConf(..))
import Echidna.Types.Tx (TxCall(..), Tx, TxResult(..), call, dst, initialTimestamp, initialBlockNumber, getResult)
import Echidna.Types.Tx (TxCall(..), Tx(call, dst), TxResult(..), initialTimestamp, initialBlockNumber, getResult)
import Echidna.Utility (getTimestamp, timePrefix)

-- | Broad categories of execution failures: reversions, illegal operations, and ???.
2 changes: 1 addition & 1 deletion src/test/Common.hs
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ import Echidna.Types.Campaign
import Echidna.Types.Signature (ContractName)
import Echidna.Types.Solidity (SolConf(..))
import Echidna.Types.Test
import Echidna.Types.Tx (Tx(..), TxCall(..), call)
import Echidna.Types.Tx (Tx(..), TxCall(..))
import Echidna.Types.World (World(..))

import EVM.Solidity (Contracts(..), BuildOutput(..), SolcContract(..))
4 changes: 2 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
resolver: lts-22.34
resolver: nightly-2024-10-21

packages:
- '.'

extra-deps:
- git: https://github.com/ethereum/hevm.git
commit: 443c9040f6a8bde7d8b2cfafd99c0cb7dd7d049f
commit: 53bccde13eeb6712eb9bc1d99b53529614a33690

- smt2-parser-0.1.0.1@sha256:1e1a4565915ed851c13d1e6b8bb5185cf5d454da3b43170825d53e221f753d77,1421
- spawn-0.3@sha256:b91e01d8f2b076841410ae284b32046f91471943dc799c1af77d666c72101f02,1162
Loading