forked from matter-labs/zinc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·67 lines (59 loc) · 1.74 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -ex
# 'error' | 'warn' | 'info' | 'debug' | 'trace'
case "${1}" in
error)
export LOG_LEVEL=""
;;
warn)
export LOG_LEVEL=""
;;
info)
export LOG_LEVEL="-v"
export CARGO_LOG_LEVEL="--verbose"
;;
debug)
export LOG_LEVEL="-vv"
export RUST_BACKTRACE=1
export CARGO_LOG_LEVEL="--verbose"
;;
trace)
export LOG_LEVEL="-vvv"
export RUST_BACKTRACE="full"
export CARGO_LOG_LEVEL="--verbose"
;;
*)
export LOG_LEVEL=""
;;
esac
# 'debug' | 'release'
case "${2}" in
debug)
export TARGET_DIRECTORY="debug"
;;
release)
export RELEASE_MODE_FLAG="--release"
export TARGET_DIRECTORY="release"
;;
*)
export TARGET_DIRECTORY="debug"
;;
esac
export CIRCUIT_DIRECTORY='./zinc-examples/casual/'
export CIRCUIT_BUILD_DIRECTORY="${CIRCUIT_DIRECTORY}/build/"
export CIRCUIT_DATA_DIRECTORY="${CIRCUIT_DIRECTORY}/data/"
export ZARGO_PATH="./target/${TARGET_DIRECTORY}/zargo"
cargo fmt --all
cargo clippy
cargo build ${CARGO_LOG_LEVEL} ${RELEASE_MODE_FLAG}
cargo test
cargo run ${CARGO_LOG_LEVEL} ${RELEASE_MODE_FLAG} --bin 'zinc-tester' -- ${LOG_LEVEL}
"${ZARGO_PATH}" clean ${LOG_LEVEL} \
--manifest-path "${CIRCUIT_DIRECTORY}/Zargo.toml"
"${ZARGO_PATH}" proof-check ${LOG_LEVEL} \
--manifest-path "${CIRCUIT_DIRECTORY}/Zargo.toml" \
--circuit "${CIRCUIT_BUILD_DIRECTORY}/default.znb" \
--witness "${CIRCUIT_DATA_DIRECTORY}/witness.json" \
--public-data "${CIRCUIT_DATA_DIRECTORY}/public-data.json" \
--proving-key "${CIRCUIT_DATA_DIRECTORY}/proving-key" \
--verifying-key "${CIRCUIT_DATA_DIRECTORY}/verifying-key.txt"