forked from matter-labs/zksync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplonk-setup
executable file
·70 lines (58 loc) · 1.77 KB
/
plonk-setup
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
68
69
70
#!/bin/bash
USAGE='Usage: zksync plonk-setup [ check | download ] [monomial | all] [powers]
Used to download and check plonk universal setup files.
Options:
check (default) | download checks or downloads missing setup files for powers defined in powers argument
monomial (default) | all option to download setup files in monomial form or monomial and lagrange form (for current prover lagrange form is not required)
powers (optional) comma separated setup powers of two to download/check
'
set -e
SETUP_DO_SPACE_DIR=https://universal-setup.ams3.digitaloceanspaces.com
COMMAND=${1:-check}
KEY_TYPE=${2:-monomial}
POWERS=${3-`eval echo {20..26}`}
case $KEY_TYPE in
monomial|all)
;;
*)
echo "$USAGE" && exit 1
;;
esac
cd $ZKSYNC_HOME
mkdir -p keys/setup && cd keys/setup
download() {
for i in ${POWERS//,/ }; do
axel -c $SETUP_DO_SPACE_DIR/setup_2%5E$i.key || true #dont download file if it is already there
sleep 1 # to not receive “503 Slow Down”
if [ "$1" = "all" ]; then
axel -c $SETUP_DO_SPACE_DIR/setup_2%5E"$i"_lagrange.key || true
sleep 1 # to not receive “503 Slow Down”
fi
done
echo Setup is downloaded
}
check() {
for i in ${POWERS//,/ }; do
F1=setup_2"^$i".key
[ -f "$F1" ] || (echo Setup file $F1 not found. && exit 1)
if [ "$1" = "all" ]; then
F2=setup_2"^$i"_lagrange.key
[ -f "$F2" ] || (echo Setup file $F2 not found. && exit 1)
fi
done
echo Setup is fine
}
case $COMMAND in
check)
check $KEY_TYPE
;;
download)
download $KEY_TYPE
;;
-h|--h)
echo "$USAGE" && exit 0
;;
*)
echo "$USAGE" && exit 1
;;
esac