diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 627e94fed..9725af99a 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -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: @@ -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 diff --git a/.github/workflows/test-scripts.yml b/.github/workflows/test-scripts.yml index c7fd09df7..c115edf7b 100644 --- a/.github/workflows/test-scripts.yml +++ b/.github/workflows/test-scripts.yml @@ -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 @@ -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 diff --git a/contracts/.env.example b/contracts/.env.example index 5c61baf56..15ea56d1e 100644 --- a/contracts/.env.example +++ b/contracts/.env.example @@ -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 diff --git a/contracts/cli/tally.ts b/contracts/cli/tally.ts index 4b6d3a04e..4032bef96 100644 --- a/contracts/cli/tally.ts +++ b/contracts/cli/tally.ts @@ -51,7 +51,7 @@ program ) .requiredOption('-o --output-dir ', 'The proof output directory') .option('-h --maci-tx-hash ', 'The MACI creation transaction hash') - .option('-r --rapid-snark-directory ', 'The rapidsnark directory') + .option('-r --rapid-snark ', 'The rapidsnark prover path') .option( '-n --num-queue-ops ', 'The number of operation for tree merging', @@ -70,7 +70,7 @@ async function main(args: any) { outputDir, circuit, circuitDirectory, - rapidSnarkDirectory, + rapidSnark, maciTxHash, numQueueOps, } = args @@ -125,7 +125,7 @@ async function main(args: any) { pollId, coordinatorMacisk, maciTxHash, - rapidSnarkDirectory, + rapidSnark, circuitType: circuit, circuitDirectory, outputDir, diff --git a/contracts/e2e/index.ts b/contracts/e2e/index.ts index 4738c4755..1b611ef60 100644 --- a/contracts/e2e/index.ts +++ b/contracts/e2e/index.ts @@ -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) diff --git a/contracts/sh/runScriptTests.sh b/contracts/sh/runScriptTests.sh index 1dc1b37fe..6e7b218a2 100755 --- a/contracts/sh/runScriptTests.sh +++ b/contracts/sh/runScriptTests.sh @@ -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 @@ -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}