Skip to content

Commit

Permalink
add rapidsnark installation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Sep 20, 2023
1 parent 84009c0 commit 52906d8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
NODE_VERSION: 16.x
CIRCUIT_TYPE: prod
CIRCUIT_TYPE: micro

jobs:
e2e-test:
Expand All @@ -27,21 +27,40 @@ jobs:
- name: Install g++ library dependencies
run: |
sudo apt update
sudo apt-get install build-essential libgmp-dev libsodium-dev nlohmann-json3-dev nasm g++ curl
sudo apt-get install cmake build-essential libgmp-dev libsodium-dev nlohmann-json3-dev nasm g++ curl
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install zkutil
- name: Checkout circom
uses: actions/checkout@v3
with:
repository: iden3/circom
path: circom
- name: Build circom
run: |
cd circom
cargo build --release
cargo install --path circom
- name: Checkout snarkrapid
uses: actions/checkout@v3
with:
repository: iden3/rapidsnark
path: rapidsnark
- name: Build rapidsnark
run: |
cargo install zkutil --version 0.3.2
npm install
git submodule init
git submodule update
npx task createFieldSources
npx task buildProver
- name: Checkout Clrfund
uses: actions/checkout@v3
with:
path: monorepo
- name: Download batch micro zk circuit params
run: |
$GITHUB_WORKSPACE/monorepo/.github/scripts/download-zkeys-micro.sh
$GITHUB_WORKSPACE/monorepo/.github/scripts/download-zkeys-${CIRCUIT_TYPE}.sh
- name: Build Clrfund
run: |
cd monorepo
Expand All @@ -52,9 +71,9 @@ jobs:
yarn start:node &
- name: Run tests
run: |
export CIRCUIT_TYPE=micro
export CIRCUIT_DIRECTORY==$GITHUB_WORKSPAC + '/params'
echo $NODE_CONFIG
export CIRCUIT_DIRECTORY=$GITHUB_WORKSPACE + '/params'
export RAPIDSNARK_DIRECTORY=$GITHUB_WORKSPACE + '/rapidsnark/build'
npm install
cd monorepo
yarn test:e2e
7 changes: 5 additions & 2 deletions contracts/e2e/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ethers, waffle } from 'hardhat'
import { use, expect } from 'chai'
import { solidity } from 'ethereum-waffle'
import { BigNumber, Contract, Signer, Wallet, utils } from 'ethers'
import { BigNumber, Contract, Signer, Wallet } from 'ethers'
import { Keypair, createMessage, Message, PubKey } from '@clrfund/common'

import { UNIT } from '../utils/constants'
Expand Down Expand Up @@ -34,6 +34,9 @@ const roundDuration = 7 * 86400
const circuit = process.env.CIRCUIT_TYPE || 'micro'
const params = MaciParameters.fromConfig(circuit)
const circuitDirectory = process.env.CIRCUIT_DIRECTORY || '~/params'
const rapidSnarkDirectory =
process.env.RAPIDSNARK_DIRECTORY || '~/rapidsnark/build'
const rapidSnarkExe = path.join(rapidSnarkDirectory, 'prover')
const { processZkFile, tallyZkFile, processWitness, tallyWitness } =
getCircuitFiles(circuitDirectory, circuit)
let maciTransactionHash: string
Expand Down Expand Up @@ -261,7 +264,7 @@ describe('End-to-end Tests', function () {
eth_provider: providerUrl,
'poll-id': pollId.toString(),
'tally-file': tallyFile,
rapidsnark: '',
rapidsnark: rapidSnarkExe,
'process-witnessgen': processWitness,
'tally-witnessgen': tallyWitness,
'process-zkey': processZkFile,
Expand Down

0 comments on commit 52906d8

Please sign in to comment.