Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: crytic/echidna
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6a12078cce9bf90184a58f7c916c13a6ac2e392d
Choose a base ref
..
head repository: crytic/echidna
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0ee721f05197cb11d771d1d6885209f91c086848
Choose a head ref
Showing with 170 additions and 53 deletions.
  1. +47 −2 .github/container-linux-static/Dockerfile
  2. +83 −19 .github/workflows/ci.yml
  3. +7 −7 .github/workflows/docker.yml
  4. +1 −1 docker/Dockerfile
  5. +10 −9 flake.lock
  6. +9 −6 flake.nix
  7. +1 −1 lib/Echidna/UI.hs
  8. +3 −3 lib/Echidna/UI/Widgets.hs
  9. +6 −2 package.yaml
  10. +3 −3 stack.yaml
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 \
@@ -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
102 changes: 83 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ on:

env:
# Tag for cache invalidation
CACHE_VERSION: v6
CACHE_VERSION: v1

jobs:
build:
@@ -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: macos-latest-xlarge
@@ -43,8 +43,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
@@ -55,7 +56,8 @@ jobs:
pacboy: >-
cmake:p
ninja:p
gcc:p
clang:p
lld:p
autotools:p
gmp:p
openssl:p
@@ -65,10 +67,50 @@ jobs:
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 "$EXTRA_INCLUDE_MAC_AARCH64";
echo;
echo "extra-lib-dirs:";
echo "- $HOME/.local/lib";
echo "$EXTRA_LIB_WIN";
echo "$EXTRA_LIB_MAC_AARCH64";
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' }}
EXTRA_INCLUDE_MAC_AARCH64: ${{ (runner.os == 'macOS' && runner.arch == 'ARM64' && '- /opt/homebrew/include') || '' }}
EXTRA_LIB_MAC_AARCH64: ${{ (runner.os == 'macOS' && runner.arch == 'ARM64' && '- /opt/homebrew/lib') || '' }}
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

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

- name: Cache Stack & Cabal
@@ -89,6 +131,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 }}-${{ runner.arch }}-stack-${{ env.CACHE_VERSION }}-${{ hashFiles('package.yaml', 'stack.yaml') }}

- name: Build Libraries
@@ -100,15 +143,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 $EXTRA_ARGS
env:
EXTRA_ARGS: ${{ (runner.arch == 'ARM64' && '--extra-include-dirs=/opt/homebrew/include --extra-lib-dirs=/opt/homebrew/lib') || '' }}
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 $EXTRA_ARGS
env:
EXTRA_ARGS: ${{ (runner.arch == 'ARM64' && '--extra-include-dirs=/opt/homebrew/include --extra-lib-dirs=/opt/homebrew/lib') || '' }}
export PATH="$HASKELL_PATHS:$PATH"
stack install --flag echidna:static --ghc-options="-Werror"
- name: Amend and compress binaries (macOS)
if: runner.os == 'macOS'
@@ -122,21 +163,44 @@ jobs:
if: runner.os == 'Windows'
run: GZIP=-9 tar -czf echidna.tar.gz -C $APPDATA/local/bin/ echidna.exe

- name: Generate artifact name
id: artifact-name
run: |
case "$OS-$ARCH" in
macOS-ARM64)
NAME="aarch64-macos"
;;
macOS-X64)
NAME="x86_64-macos"
;;
Windows-X64)
NAME="x86_64-windows"
;;
Linux-X64)
NAME="x86_64-linux"
;;
*)
echo "Unknown os-arch combo: ${OS}-${ARCH}"
exit 1
;;
esac
echo "name=${NAME}" >> "$GITHUB_OUTPUT"
env:
OS: ${{ runner.os }}
ARCH: ${{ runner.arch }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: echidna-${{ runner.os }}-${{ runner.arch }}
name: echidna-${{ steps.artifact-name.outputs.name }}
path: echidna.tar.gz

- 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'
14 changes: 7 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -18,14 +18,14 @@ jobs:
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
id: buildx
with:
install: true

- name: Set Docker metadata (Ubuntu & NVM variant)
id: meta-ubuntu
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/echidna
@@ -37,7 +37,7 @@ jobs:
- name: Set Docker metadata (Distroless variant)
id: meta-distroless
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
if: ${{ env.WORKFLOW_BUILD_DISTROLESS == true }}
with:
images: ghcr.io/${{ github.repository }}/distroless
@@ -47,21 +47,21 @@ jobs:
type=edge
- name: GitHub Container Registry Login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Hub Login
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.repository == 'crytic/echidna'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

- name: Docker Build and Push (Ubuntu & NVM variant)
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
target: final-ubuntu
@@ -74,7 +74,7 @@ jobs:
cache-to: type=gha,mode=max

- name: Docker Build and Push (Distroless variant)
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: ${{ env.WORKFLOW_BUILD_DISTROLESS == true }}
with:
platforms: linux/amd64
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ RUN apt-get update && \
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1
RUN python3 -m venv /venv && /venv/bin/pip3 install --no-cache --upgrade setuptools pip
RUN /venv/bin/pip3 install --no-cache slither-analyzer solc-select "crytic-compile @ https://github.com/crytic/crytic-compile/archive/53167f3f3d63b73916b1660312a53fd952f2e3dd.zip"
RUN /venv/bin/pip3 install --no-cache slither-analyzer solc-select


FROM gcr.io/distroless/python3-debian11:nonroot AS final-distroless
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";
@@ -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;
2 changes: 1 addition & 1 deletion lib/Echidna/UI.hs
Original file line number Diff line number Diff line change
@@ -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
Loading