Skip to content

Commit 1ef6a26

Browse files
authored
Merge pull request tornadocash#97 from tornadocash/sol-coverage
add sol-coverage
2 parents 896fc22 + f9f19b7 commit 1ef6a26

File tree

7 files changed

+653
-15
lines changed

7 files changed

+653
-15
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
- run: yarn test
2424
- run: node src/cli.js test
2525
- run: yarn lint
26+
- run: yarn coverage
27+
- name: Coveralls
28+
uses: coverallsapp/github-action@master
29+
with:
30+
github-token: ${{ secrets.GITHUB_TOKEN }}
2631
- name: Telegram Failure Notification
2732
uses: appleboy/[email protected]
2833
if: failure()

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,5 @@ typings/
9696

9797
ERC20Tornado_flat.sol
9898
ETHTornado_flat.sol
99+
100+
coverage.json

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ contracts/Verifier.sol
55
scripts/ganacheHelper.js
66
cli.js
77
index.js
8+
coverage
9+
coverage.json

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Tornado Cash Privacy Solution [![build status](https://github.com/tornadocash/tornado-core/actions/workflows/build.yml/badge.svg)](https://github.com/tornadocash/tornado-core/actions/workflows/build.yml)
1+
# Tornado Cash Privacy Solution [![build status](https://github.com/tornadocash/tornado-core/actions/workflows/build.yml/badge.svg)](https://github.com/tornadocash/tornado-core/actions/workflows/build.yml) [![Coverage Status](https://coveralls.io/repos/github/tornadocash/tornado-core/badge.svg?branch=master)](https://coveralls.io/github/tornadocash/tornado-core?branch=master)
22

33
Tornado Cash is a non-custodial Ethereum and ERC20 privacy solution based on zkSNARKs. It improves transaction privacy by breaking the on-chain link between the recipient and destination addresses. It uses a smart contract that accepts ETH deposits that can be withdrawn by a different address. Whenever ETH is withdrawn by the new address, there is no way to link the withdrawal to the deposit, ensuring complete privacy.
44

@@ -143,6 +143,30 @@ and @jbaylina for awesome [Circom](https://github.com/iden3/circom) & [Websnark]
143143
1. `npm run migrate:dev`
144144
1. `node minimal-demo.js`
145145

146+
## Run tests/coverage
147+
148+
Prepare test environment:
149+
150+
```
151+
yarn install
152+
yarn download
153+
cp .env.example .env
154+
npx ganache-cli > /dev/null &
155+
npm run migrate:dev
156+
```
157+
158+
Run tests:
159+
160+
```
161+
yarn test
162+
```
163+
164+
Run coverage:
165+
166+
```
167+
yarn coverage
168+
```
169+
146170
## Emulate MPC trusted setup ceremony
147171

148172
```bash

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"prettier:fix": "prettier --write . --config .prettierrc",
2525
"lint": "yarn eslint && yarn prettier:check",
2626
"flat": "npx truffle-flattener contracts/ETHTornado.sol > ETHTornado_flat.sol && npx truffle-flattener contracts/ERC20Tornado.sol > ERC20Tornado_flat.sol",
27-
"download": "node scripts/downloadKeys.js"
27+
"download": "node scripts/downloadKeys.js",
28+
"coverage": "yarn truffle run coverage"
2829
},
2930
"keywords": [],
3031
"author": "",
@@ -57,6 +58,7 @@
5758
"truffle-flattener": "^1.4.2",
5859
"web3": "^1.3.4",
5960
"web3-utils": "^1.3.4",
60-
"websnark": "git+https://github.com/tornadocash/websnark.git#4c0af6a8b65aabea3c09f377f63c44e7a58afa6d"
61+
"websnark": "git+https://github.com/tornadocash/websnark.git#4c0af6a8b65aabea3c09f377f63c44e7a58afa6d",
62+
"solidity-coverage": "^0.7.20"
6163
}
6264
}

truffle-config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,6 @@ module.exports = {
9393
],
9494
},
9595
},
96+
97+
plugins: ['solidity-coverage'],
9698
}

0 commit comments

Comments
 (0)