forked from ebfull/powersoftau
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_16.sh
executable file
·78 lines (54 loc) · 1.98 KB
/
test_16.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
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
set -e
FLAGS="--release -- -n 16"
# Run 3 rounds and the beacon
rm -f challenge response
cargo run --bin new ${FLAGS}
# Wrote a fresh accumulator to `./challenge`
# Round 1
echo random1 | cargo run --bin compute ${FLAGS}
# Your contribution has been written to `./response`
cargo run --bin verify_transform ${FLAGS}
# Verification succeeded! Writing to `./new_challenge`
mv challenge challenge.0
mv response response.1
mv new_challenge challenge
# Round 2
echo random2 | cargo run --bin compute ${FLAGS} --digest response.2.digest
# Your contribution has been written to `./response`
cargo run --bin verify_transform ${FLAGS}
# Verification succeeded! Writing to `./new_challenge`
mv challenge challenge.1
mv response response.2
mv new_challenge challenge
# Round 3
echo random3 | cargo run --bin compute ${FLAGS}
# Your contribution has been written to `./response`
cargo run --bin verify_transform ${FLAGS}
# Verification succeeded! Writing to `./new_challenge`
mv challenge challenge.2
mv response response.3
mv new_challenge challenge
# Round 4 (Beacon)
echo random4 | cargo run --bin compute ${FLAGS}
# Your contribution has been written to `./response`
cargo run --bin verify_transform ${FLAGS}
# Verification succeeded! Writing to `./new_challenge`
mv challenge challenge.3
mv response response.4.beacon
mv new_challenge challenge
echo Creating transcript ...
rm -f transcript
for f in response.1 response.2 response.3 response.4.beacon ; do
dd if=$f bs=64 skip=1 >> transcript
done
echo Verifying transcript ...
cargo run --bin verify ${FLAGS} -r 4 --skip-lagrange
echo Verifying transcript contains contribution ...
cargo run --bin verify ${FLAGS} -r 4 --skip-lagrange --digest response.2.digest
echo Verifying transcript does not contain invalid contribution ...
sed -e 's/0/1/g' response.2.digest > response.2.invalid.digest
if (cargo run --bin verify ${FLAGS} -r 4 --skip-lagrange --digest response.2.invalid.digest) ; then
echo Verification failed
exit 1
fi