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

fix: echidna tests for good #131

Merged
merged 4 commits into from
Dec 7, 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
107 changes: 53 additions & 54 deletions .github/workflows/fuzz-testing.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,58 @@
name: Fuzz Testing

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

jobs:
echidna:
name: Echidna
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
testName:
- TestFactory
- TestSwaplace

env:
DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }}

steps:
- uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v1
with:
node-version: 18.16.0

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install node dependencies
run: yarn install

- name: Install pip3
run: |
python -m pip install --upgrade pip

- name: Install slither
run: |
pip3 install slither-analyzer

- name: Install echidna
run: |
sudo wget -O /tmp/echidna-2.2.1-Linux.zip https://github.com/crytic/echidna/releases/download/v2.2.1/echidna-2.2.1-Linux.zip
sudo unzip /tmp/echidna-2.2.1-Linux.zip -d /usr/bin
cd /usr/bin
ls -a
sudo chmod +x /usr/bin/echidna

- name: Run ${{ matrix.testName }} as properties
run: echidna . --contract ${{ matrix.testName }} --test-mode property --config echidna.config.yml

- name: Run ${{ matrix.testName }} as assertion
run: echidna . --contract ${{ matrix.testName }} --test-mode assertion --config echidna.config.yml
echidna:
name: Echidna
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
testName:
- TestFactory
- TestSwaplace

env:
DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }}

steps:
- uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v1
with:
node-version: 18.16.0

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install node dependencies
run: yarn install

- name: Install pip3
run: |
python -m pip install --upgrade pip

- name: Install slither
run: |
pip3 install slither-analyzer

- name: Install echidna
run: |
sudo wget -O /tmp/echidna-2.2.1-Linux.zip https://github.com/crytic/echidna/releases/download/v2.2.1/echidna-2.2.1-Linux.zip
sudo unzip /tmp/echidna-2.2.1-Linux.zip -d /usr/bin
sudo tar -xf /usr/bin/echidna.tar.gz -C /usr/bin
sudo chmod +x /usr/bin/echidna

- name: Run ${{ matrix.testName }} as properties
run: echidna . --contract ${{ matrix.testName }} --test-mode property --config echidna.config.yml

- name: Run ${{ matrix.testName }} as assertion
run: echidna . --contract ${{ matrix.testName }} --test-mode assertion --config echidna.config.yml
1 change: 0 additions & 1 deletion contracts/echidna/TestSwapFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ contract TestFactory is SwapFactory {
make_asset_array(addr, amountOrId)
);

assert(owner != address(0));
assert(swap.expiry > block.timestamp);
assert(swap.biding.length > 0);
assert(swap.asking.length > 0);
Expand Down
Loading