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

Update to GHC 9.4 #1096

Merged
merged 6 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
49 changes: 47 additions & 2 deletions .github/container-linux-static/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
FROM fpco/alpine-haskell-stack:9.2.7
FROM alpine:3.18.4
# Based on https://github.com/fpco/alpine-haskell-stack/blob/9.2.8v2/ghc-Dockerfile

RUN apk upgrade --no-cache &&\
apk add --no-cache \
curl \
gcc \
git \
libc-dev \
xz \
gmp-dev \
autoconf \
automake \
binutils \
build-base \
coreutils \
cpio \
linux-headers \
libffi-dev \
musl-dev \
zlib-dev \
zlib-static \
ncurses-dev \
ncurses-libs \
ncurses-static \
bash \
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 && \
chmod +x /usr/local/bin/stack

# https://stackoverflow.com/a/41517423
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.4.7/ghc-9.4.7-x86_64-alpine3_12-linux.tar.xz && \
tar xf ghc.tar.xz && \
cd ghc-9.4.7-x86_64-unknown-linux && \
./configure --prefix=/usr/local && \
make install && \
rm -rf /tmp/ghc.tar.xz /tmp/ghc-9.4.7-x86_64-unknown-linux

RUN apk upgrade --no-cache &&\
apk add --no-cache \
Expand Down Expand Up @@ -26,4 +69,6 @@ RUN mkdir -p /etc/stack &&\
echo "system-ghc: true" ;\
echo "install-ghc: false" ;\
echo "skip-ghc-check: true" ;\
} >> /etc/stack/config.yaml
} >> /etc/stack/config.yaml &&\
chmod 664 /etc/stack/config.yaml &&\
chown root:runneruser /etc/stack/config.yaml
66 changes: 52 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
include:
- os: ubuntu-20.04
shell: bash
container: "{\"image\": \"elopeztob/alpine-haskell-stack-echidna:9.2.7\", \"options\": \"--user 1001\"}"
container: "{\"image\": \"elopeztob/alpine-haskell-stack-echidna:ghc-9.4.7\", \"options\": \"--user 1001\"}"
- os: macos-latest
shell: bash
- os: windows-latest
Expand All @@ -41,8 +41,9 @@ jobs:
uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
with:
msystem: UCRT64
path-type: inherit
msystem: CLANG64
release: false
path-type: minimal
update: true
install: >-
base-devel
Expand All @@ -53,20 +54,57 @@ jobs:
pacboy: >-
cmake:p
ninja:p
gcc:p
clang:p
lld:p
autotools:p
gmp:p
openssl:p

- name: Install Stack
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
id: stack
if: matrix.container == ''
with:
ghc-version: '9.2'
ghc-version: '9.4'
enable-stack: true
stack-version: 'latest'

- name: Configure Stack environment
run: |
HOME="${{ (runner.os == 'Windows' && '$(cygpath -m ~)') || '$HOME' }}"
mkdir -p "$STACK_ROOT"
{ echo "extra-include-dirs:";
echo "- $HOME/.local/include";
echo "$EXTRA_INCLUDE_WIN";
echo;
echo "extra-lib-dirs:";
echo "- $HOME/.local/lib";
echo "$EXTRA_LIB_WIN";
echo;
echo "ghc-options:";
echo -n ' "$locals": -Werror'
"$REPLACE_LINKER_WIN" && echo ' -pgml=C:/msys64/clang64/bin/clang.exe -pgml-supports-no-pie' || echo;
echo;
"$SKIP_MSYS" && echo "skip-msys: true" || true
} >> "$STACK_ROOT/config.yaml"
cat "$STACK_ROOT/config.yaml"
env:
STACK_ROOT: ${{ steps.stack.outputs.stack-root || '/etc/stack' }}
EXTRA_INCLUDE_WIN: ${{ (runner.os == 'Windows' && '- C:/msys64/clang64/include') || '' }}
EXTRA_LIB_WIN: ${{ (runner.os == 'Windows' && '- C:/msys64/clang64/lib') || '' }}
REPLACE_LINKER_WIN: ${{ (runner.os == 'Windows' && 'true') || 'false' }}
SKIP_MSYS: ${{ (runner.os == 'Windows' && 'true') || 'false' }}

- name: Configure Haskell paths (Windows)
if: runner.os == 'Windows'
run: |
HASKELL_PATHS="$(cygpath -u "$GHC_PATH"):$(cygpath -u "$CABAL_PATH"):$(cygpath -u "$STACK_PATH")"
echo "HASKELL_PATHS=$HASKELL_PATHS" >> "$GITHUB_ENV"
env:
GHC_PATH: ${{ steps.stack.outputs.ghc-path }}
CABAL_PATH: ${{ steps.stack.outputs.cabal-path }}
STACK_PATH: ${{ steps.stack.outputs.stack-path }}

- name: Checkout
uses: actions/checkout@v4

Expand All @@ -75,7 +113,7 @@ jobs:
with:
path: |
~/.local
D:\a\_temp\msys64\home\runneradmin\.local
C:\msys64\home\runneradmin\.local
key: ${{ runner.os }}-local-${{ env.CACHE_VERSION }}-${{ hashFiles('.github/scripts/install-*') }}

- name: Cache Stack & Cabal
Expand All @@ -87,6 +125,7 @@ jobs:
${{ steps.stack.outputs.stack-root || '~/.stack' }}/*
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/pantry/hackage/*.tar
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/pantry/hackage/*.tar.gz
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/config.yaml
key: ${{ runner.os }}-stack-${{ env.CACHE_VERSION }}-${{ hashFiles('package.yaml', 'stack.yaml') }}

- name: Build Libraries
Expand All @@ -98,11 +137,13 @@ jobs:

- name: Build Dependencies
run: |
stack build --ghc-options="-Werror" --extra-include-dirs=$HOME/.local/include --extra-lib-dirs=$HOME/.local/lib --only-dependencies
export PATH="$HASKELL_PATHS:$PATH"
stack build --ghc-options="-Werror" --only-dependencies

- name: Build and install echidna
run: |
stack install --flag echidna:static --ghc-options="-Werror" --extra-include-dirs=$HOME/.local/include --extra-lib-dirs=$HOME/.local/lib
export PATH="$HASKELL_PATHS:$PATH"
stack install --flag echidna:static --ghc-options="-Werror"

- name: Amend and compress binaries (macOS)
if: runner.os == 'macOS'
Expand All @@ -125,12 +166,9 @@ jobs:
- name: Build and copy test suite
if: runner.os != 'macOS'
run: |
stack build --flag echidna:static --test --no-run-tests --ghc-options="-Werror" --extra-include-dirs=$HOME/.local/include --extra-lib-dirs=$HOME/.local/lib
export PATH="$HASKELL_PATHS:$PATH"
stack build --flag echidna:static --test --no-run-tests --ghc-options="-Werror"
cp "$(find "$PWD" -name 'echidna-testsuite*' -type f)" .
if [ "${{ runner.os }}" = "Windows" ]; then
# work around https://gitlab.haskell.org/ghc/ghc/-/issues/21109
strip echidna-testsuite*
fi

- name: Upload testsuite
if: runner.os != 'macOS'
Expand Down
19 changes: 10 additions & 9 deletions flake.lock

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

15 changes: 9 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
Expand Down Expand Up @@ -40,18 +40,21 @@

hevm = pkgs.haskell.lib.dontCheck (
pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub {
owner = "ethereum";
owner = "elopez";
repo = "hevm";
rev = "release/0.51.3";
sha256 = "sha256-H6oURBGoQWSOuPhBB+UKg2UarVzXgv1tmfDBLnOtdhU=";
rev = "release/0.51.3-plus-ghc-9.4-support";
sha256 = "sha256-gJMFYfsPqf5XZyyPDGJLqr9q9RpXkemGeUQUvFT6V0E";
}) { secp256k1 = pkgs.secp256k1; });

echidna = with pkgs; lib.pipe
# FIXME: figure out solc situation, it conflicts with the one from
# solc-select that is installed with slither, disable tests in the meantime
echidna = pkgs.haskell.lib.dontCheck (
with pkgs; lib.pipe
(haskellPackages.callCabal2nix "echidna" ./. { inherit hevm; })
[
(haskell.lib.compose.addTestToolDepends [ haskellPackages.hpack slither-analyzer solc ])
(haskell.lib.compose.disableCabalFlag "static")
];
]);
in rec {
packages.echidna = echidna;
packages.default = echidna;
Expand Down
2 changes: 1 addition & 1 deletion lib/Echidna/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ ui vm world dict initialCorpus = do
, now = now
, fetchedContracts = mempty
, fetchedSlots = mempty
, fetchedDialog = B.dialog (Just " Fetched contracts/slots ") Nothing 80
, fetchedDialog = B.dialog (Just $ str " Fetched contracts/slots ") Nothing 80
, displayFetchedDialog = False
, workerEvents = mempty
, corpusSize = 0
Expand Down
6 changes: 3 additions & 3 deletions lib/Echidna/UI/Widgets.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Echidna.UI.Widgets where

#ifdef INTERACTIVE_UI

import Brick
import Brick hiding (style)
import Brick.AttrMap qualified as A
import Brick.Widgets.Border
import Brick.Widgets.Center
Expand Down Expand Up @@ -43,7 +43,7 @@ data UIState = UIState
, now :: LocalTime
, fetchedContracts :: Map Addr (Maybe Contract)
, fetchedSlots :: Map Addr (Map W256 (Maybe W256))
, fetchedDialog :: B.Dialog ()
, fetchedDialog :: B.Dialog () Name
, displayFetchedDialog :: Bool

, workerEvents :: Seq (Int, LocalTime, CampaignEvent)
Expand Down Expand Up @@ -222,7 +222,7 @@ perfWidget uiState =
ppSeed :: [WorkerState] -> String
ppSeed campaigns = show (head campaigns).genDict.defSeed

fetchedDialogWidget :: UIState -> Widget n
fetchedDialogWidget :: UIState -> Widget Name
fetchedDialogWidget uiState =
B.renderDialog uiState.fetchedDialog $ padLeftRight 1 $
foldl (<=>) emptyWidget (Map.mapWithKey renderContract uiState.fetchedContracts)
Expand Down
8 changes: 6 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ executables:
extra-libraries: c++
ld-options: -Wl,-keep_dwarf_unwind
ghc-options: -fcompact-unwind
- condition: os(windows)
- condition: os(windows) && impl(ghc >= 9.4)
dependencies: system-cxx-std-lib
- condition: os(windows) && impl(ghc < 9.4)
extra-libraries: stdc++

tests:
Expand All @@ -114,7 +116,9 @@ tests:
extra-libraries: c++
ld-options: -Wl,-keep_dwarf_unwind
ghc-options: -fcompact-unwind
- condition: os(windows)
- condition: os(windows) && impl(ghc >= 9.4)
dependencies: system-cxx-std-lib
- condition: os(windows) && impl(ghc < 9.4)
extra-libraries: stdc++

flags:
Expand Down
6 changes: 3 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
resolver: lts-20.17
resolver: lts-21.17

packages:
- '.'

extra-deps:
- git: https://github.com/ethereum/hevm.git
commit: 211fff90a32824c39bed48e61d4ef722b8d1bad1
- git: https://github.com/elopez/hevm.git
commit: 6ffb685574b556ef148c884b412a92c6909c2b4f

- restless-git-0.7@sha256:346a5775a586f07ecb291036a8d3016c3484ccdc188b574bcdec0a82c12db293,968
- s-cargot-0.1.4.0@sha256:61ea1833fbb4c80d93577144870e449d2007d311c34d74252850bb48aa8c31fb,3525
Expand Down