From f85eb5b72547b1ef6e623195f394e0416eb0b4ee Mon Sep 17 00:00:00 2001 From: JulissaDantes Date: Thu, 31 Mar 2022 17:28:47 -0400 Subject: [PATCH] Use slither action (#3278) Co-authored-by: Francisco Giordano --- .github/workflows/slither.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 23 ----------------------- package.json | 3 +-- slither.config.json | 4 ++++ 4 files changed, 33 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/slither.yml create mode 100644 slither.config.json diff --git a/.github/workflows/slither.yml b/.github/workflows/slither.yml new file mode 100644 index 000000000..df312b948 --- /dev/null +++ b/.github/workflows/slither.yml @@ -0,0 +1,28 @@ +name: Slither Analysis +on: + push: + branches: + - master + - release-v* + pull_request: {} + workflow_dispatch: {} + +jobs: + analyze: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 12.x + - uses: actions/cache@v3 + id: cache + with: + path: '**/node_modules' + key: npm-v2-${{ hashFiles('**/package-lock.json') }} + restore-keys: npm-v2- + - run: npm ci + if: steps.cache.outputs.cache-hit != 'true' + - name: Clean project + run: npm run clean + - uses: crytic/slither-action@v0.1.0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0877b5fef..3ba8242fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,26 +54,3 @@ jobs: env: NODE_OPTIONS: --max_old_space_size=4096 - uses: codecov/codecov-action@v2 - - slither: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 12.x - - uses: actions/cache@v3 - id: cache - with: - path: '**/node_modules' - key: npm-v2-${{ hashFiles('**/package-lock.json') }} - restore-keys: npm-v2- - - run: npm ci - if: steps.cache.outputs.cache-hit != 'true' - - name: Set up Python - uses: actions/setup-python@v2 - - - name: Install dependencies - run: pip3 install slither-analyzer - - name: Summary of static analysis - run: npm run slither diff --git a/package.json b/package.json index e2c0b973f..750e7eafc 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,7 @@ "version": "scripts/release/version.sh", "test": "hardhat test", "test:inheritance": "node scripts/inheritanceOrdering artifacts/build-info/*", - "gas-report": "env ENABLE_GAS_REPORT=true npm run test", - "slither": "npm run clean && slither . --detect reentrancy-eth,reentrancy-no-eth,reentrancy-unlimited-gas --filter-paths contracts/mocks" + "gas-report": "env ENABLE_GAS_REPORT=true npm run test" }, "repository": { "type": "git", diff --git a/slither.config.json b/slither.config.json new file mode 100644 index 000000000..e52e3f5d5 --- /dev/null +++ b/slither.config.json @@ -0,0 +1,4 @@ +{ + "detectors_to_run": "reentrancy-eth,reentrancy-no-eth,reentrancy-unlimited-gas", + "filter_paths": "contracts/mocks" +} \ No newline at end of file