Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Configure slither and add to CI #1109

Merged
merged 24 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ jobs:
key: cape-v5-${{ hashFiles('Cargo.lock') }}

- name: Linting
run: nix-shell --run "prepend-timestamps lint-ci"
run: nix-shell --run "lint-ci"

- name: Build Slow Tests
# Make sure the slow tests build, but don't run them (we have another workflow for that).
run: nix-shell --run "prepend-timestamps cargo test --release --features=slow-tests --no-run"
run: nix-shell --run "cargo test --release --features=slow-tests --no-run"

- name: Run Tests
run: nix-shell --run "prepend-timestamps cape-test-geth"
run: nix-shell --run "cape-test-geth"

- name: Generate Docs
run: nix-shell --run "prepend-timestamps make-doc"
run: nix-shell --run "make-doc"

- name: Build all executables
run: nix-shell --run "cargo build --release"
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Slither

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
slither:
runs-on: [self-hosted, X64]
container:
image: ghcr.io/espressosystems/nix:main
volumes:
- github_nix_281:/nix
steps:
- uses: styfle/[email protected]
name: Cancel Outdated Builds
with:
access_token: ${{ github.token }}

- uses: cachix/cachix-action@v10
with:
name: espresso-systems-private
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- uses: actions/checkout@v2
name: Checkout Repository

- name: Work around git issue after git CVE-2022-24765 fix.
run: git config --global --add safe.directory "$PWD"

- name: Run slither
run: nix-shell --run "slither ./contracts --sarif slither.sarif"
continue-on-error: true

- name: Upload slither SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: slither.sarif

4 changes: 2 additions & 2 deletions .github/workflows/slow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: cachix/cachix-action@v10
with:
name: espresso-systems-private
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: Potential broken submodules fix
run: |
Expand All @@ -53,4 +53,4 @@ jobs:
key: cape-v5-${{ hashFiles('Cargo.lock') }}

- name: Run Tests
run: nix-shell --run "prepend-timestamps cape-test-geth-slow"
run: nix-shell --run "cape-test-geth-slow"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ __pycache__/
.*.sw*

scratch/

# Slither analysis results
slither.sarif
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ lint:
tags:
- docker
script:
- nix-shell --run "prepend-timestamps lint-ci"
- nix-shell --run "lint-ci"

test:
tags:
- docker
script:
- nix-shell --run "prepend-timestamps cape-test-geth"
- nix-shell --run "cape-test-geth"
cache:
key: cape-test
paths:
Expand All @@ -33,7 +33,7 @@ doc:
tags:
- docker
script:
- nix-shell --run "prepend-timestamps make-doc"
- nix-shell --run "make-doc"
artifacts:
paths:
- doc
21 changes: 21 additions & 0 deletions Slither.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
~ Copyright (c) 2022 Espresso Systems (espressosys.com)
~ This file is part of the Configurable Asset Privacy for Ethereum (CAPE) library.
~
~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
~ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

# Slither

Run `run-slither` to analyze the contracts.

To disable warnings add a code comment, for example

// slither-disable-next-line variable-scope

The configuration file is [slither.config.json](./slither.config.json).

The slither github workflow file is
[.github/workflows/slither.yml](./.github/workflows/slither.yml).
11 changes: 0 additions & 11 deletions bin/prepend-timestamps

This file was deleted.

1 change: 1 addition & 0 deletions bin/run-ci-tests
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set -euo pipefail

make-doc
lint-ci
run-slither
cape-test-geth

echo Ok!
3 changes: 1 addition & 2 deletions bin/run-slither
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@

set -euo pipefail

slither --solc-remaps @openzeppelin/=`pwd`/node_modules/.pnpm/@[email protected]/node_modules/@openzeppelin/,@rari-capital/=`pwd`/node_modules/.pnpm/@[email protected]/node_modules/@rari-capital/,solidity-bytes-utils/=`pwd`/node_modules/.pnpm/[email protected]/node_modules/solidity_bytes_utils/ contracts

slither contracts
Loading