Skip to content

Commit

Permalink
update rapidsnark path
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Nov 27, 2023
1 parent 899f289 commit 7e56fd6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,27 @@ jobs:
cd circom
cargo build --release
cargo install --path circom
- name: Checkout rapidsnark
- name: Checkout rapidsnark source code
uses: actions/checkout@v3
with:
repository: iden3/rapidsnark
repository: clrfund/rapidsnark
path: rapidsnark
- name: Build rapidsnark
- name: Install rapidsnark
run: |
cd rapidsnark
cd $GITHUB_WORKSPACE/rapidsnark
npm install
git submodule init
git submodule update
npx task createFieldSources
npx task buildProver
./build_gmp.sh host
mkdir build_prover && cd build_prover
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package
make -j4 && make install
- name: Find rapidsnark
run: |
cd rapidsnark
pwd
echo "$GITHUB_WORKSPACE"
find . -name "prover"
- name: Checkout Clrfund
uses: actions/checkout@v3
with:
Expand All @@ -70,7 +78,7 @@ jobs:
- name: Run tests
run: |
export CIRCUIT_DIRECTORY="$GITHUB_WORKSPACE/params"
export RAPIDSNARK_DIRECTORY="$GITHUB_WORKSPACE/rapidsnark/build"
export RAPID_SNARK="$GITHUB_WORKSPACE/rapidsnark/package/bin/prover"
cd monorepo
yarn test:e2e
6 changes: 5 additions & 1 deletion .github/workflows/test-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ jobs:
mkdir build_prover && cd build_prover
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package
make -j4 && make install
- name: Find rapidsnark
run: |
cd rapidsnark
pwd
echo "$GITHUB_WORKSPACE"
find . -name "prover"
- name: Checkout source code
uses: actions/checkout@v3
Expand All @@ -65,7 +69,7 @@ jobs:
yarn start:node &
- name: Run script tests
run: |
export RAPIDSNARK_DIRECTORY=$GITHUB_WORKSPACE/rapidsnark/package/bin
export RAPID_SNARK=$GITHUB_WORKSPACE/rapidsnark/package/bin/prover
export CIRCUIT_DIRECTORY=$GITHUB_WORKSPACE/params
cd monorepo/contracts
./sh/runScriptTests.sh
4 changes: 2 additions & 2 deletions contracts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ CIRCUIT_TYPE=prod
# The IPFS gateway url used by the prepare-results.ts script
IPFS_GATEWAY_URL=

# Parameters used in the tally script
# Parameters used in the e2e testing
CIRCUIT_TYPE=
CIRCUIT_DIRECTORY=
RAPIDSNARK_DIRECTORY=
RAPID_SNARK=
# Used in MACI queue merging operation before genProofs, default is 4
NUM_QUEUE_OPS=
# Used in e2e testing to store intermediate states
Expand Down
6 changes: 3 additions & 3 deletions contracts/cli/tally.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ program
)
.requiredOption('-o --output-dir <dir>', 'The proof output directory')
.option('-h --maci-tx-hash <hash>', 'The MACI creation transaction hash')
.option('-r --rapid-snark-directory <dir>', 'The rapidsnark directory')
.option('-r --rapid-snark <path>', 'The rapidsnark prover path')
.option(
'-n --num-queue-ops <num>',
'The number of operation for tree merging',
Expand All @@ -70,7 +70,7 @@ async function main(args: any) {
outputDir,
circuit,
circuitDirectory,
rapidSnarkDirectory,
rapidSnark,
maciTxHash,
numQueueOps,
} = args
Expand Down Expand Up @@ -125,7 +125,7 @@ async function main(args: any) {
pollId,
coordinatorMacisk,
maciTxHash,
rapidSnarkDirectory,
rapidSnark,
circuitType: circuit,
circuitDirectory,
outputDir,
Expand Down
2 changes: 1 addition & 1 deletion contracts/e2e/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const roundDuration = 7 * 86400
const circuit = process.env.CIRCUIT_TYPE || DEFAULT_CIRCUIT
const circuitDirectory = process.env.CIRCUIT_DIRECTORY || '../../params'
const rapidSnarkDirectory =
process.env.RAPIDSNARK_DIRECTORY || '../../rapidsnark/build'
process.env.RAPID_SNARK || '~/rapidsnark/package/bin/prover'
const proofOutputDirectory = process.env.PROOF_OUTPUT_DIR || './proof_output'
const tallyBatchSize = Number(process.env.TALLY_BATCH_SIZE || 8)

Expand Down
6 changes: 4 additions & 2 deletions contracts/sh/runScriptTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export NETWORK=localhost
export CIRCUIT_DIRECTORY=${CIRCUIT_DIRECTORY:-"./snark-params"}
export STATE_FILE=${OUTPUT_DIR}/state.json
export HARDHAT_NETWORK=localhost
export RAPID_SNARK=${RAPID_SNARK:-~/rapidsnark/package/bin/prover}

# 20 mins
ROUND_DURATION=1800
Expand Down Expand Up @@ -65,10 +66,11 @@ MACI_TRANSACTION_HASH=$(extract 'maciTxHash')
NODE_OPTIONS="--max-old-space-size=4096"
yarn ts-node cli/tally.ts \
--clrfund ${CLRFUND} \
--circuit-directory "${CIRCUIT_DIRECTORY}" \
--circuit-directory ${CIRCUIT_DIRECTORY} \
--circuit "${CIRCUIT}" \
--rapid-snark ${RAPID_SNARK} \
--batch-size 8 \
--output-dir "${OUTPUT_DIR}" \
--output-dir ${OUTPUT_DIR} \
--maci-tx-hash "${MACI_TRANSACTION_HASH}" \
--state-file ${STATE_FILE}

Expand Down

0 comments on commit 7e56fd6

Please sign in to comment.