Skip to content

Commit

Permalink
test(circom): Fix snarkit2 circom tests won't fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimo99 committed Jun 27, 2023
1 parent e853c0d commit 98a56c3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ test-solidity-beacon-light-client-verifier:
yarn hardhat test test/BeaconLightClientReadyProofs.test.ts

test-circom-circuits:
cd beacon-light-client/circom && \
./test/run_snarkit2_tests.sh
./beacon-light-client/circom/test/run_snarkit2_tests.sh --force_recompile
20 changes: 18 additions & 2 deletions beacon-light-client/circom/test/run_snarkit2_tests.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
#!/usr/bin/env bash

DENDRETH_DIR=$(git rev-parse --show-toplevel)

# Get the list of all directories one level deep inside the "test" folder
folders=$(find test/* -maxdepth 0 -type d)
folders=$(find ${DENDRETH_DIR}/beacon-light-client/circom/test/* -maxdepth 0 -type d)

# Check if --force_recompile argument was passed
if [ "$1" == "--force_recompile" ]; then
extra_args="--force_recompile"
else
extra_args=""
fi

# Loop through the directories and run tests for each folder
for folder in $folders; do
echo "Running tests for: $folder"
yarn snarkit2 test "$folder" --witness_type bin
yarn snarkit2 test "$folder" --witness_type bin $extra_args

# Check if the command was successful
if [ $? -ne 0 ]; then
echo "Test failed for: $folder"
exit 1
fi

echo "----------------------------------------"
done

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"r1csfile": "^0.0.40",
"redis": "^4.6.5",
"redis-commander": "^0.8.0",
"snarkit2": "^0.2.0",
"snarkjs": "github:metacraft-labs/snarkjs",
"yargs": "^17.7.1"
}
Expand Down
22 changes: 22 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3101,6 +3101,7 @@ __metadata:
r1csfile: ^0.0.40
redis: ^4.6.5
redis-commander: ^0.8.0
snarkit2: ^0.2.0
snarkjs: "github:metacraft-labs/snarkjs"
ts-jest: ^28.0.5
ts-node: ^10.9.1
Expand Down Expand Up @@ -11470,6 +11471,27 @@ __metadata:
languageName: node
linkType: hard

"snarkit2@npm:^0.2.0":
version: 0.2.0
resolution: "snarkit2@npm:0.2.0"
dependencies:
"@iden3/binfileutils": ^0.0.8
chai: ^4.3.4
commander: ^7.2.0
ffiasm: ^0.1.1
ffjavascript: ^0.2.35
r1csfile: 0.0.16
shelljs: ^0.8.4
snarkjs: ^0.3.60
systeminformation: ^5.6.10
tmp-promise: ^3.0.2
walk-sync: ^2.2.0
bin:
snarkit2: dist/cli.js
checksum: bad701f7208ca91cf10626fb0662746ecfdbe79f871b3f47014600c0a40d14bd8ace1e544b77c97bb323b2d369607d9dba472d25b7a3db0516786833b05cfb28
languageName: node
linkType: hard

"snarkjs@github:metacraft-labs/snarkjs":
version: 0.6.3
resolution: "snarkjs@https://github.com/metacraft-labs/snarkjs.git#commit=44d4cc150c30a388d9bd8fb4ba9deb39dfb9c57e"
Expand Down

0 comments on commit 98a56c3

Please sign in to comment.