-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify-diem-v2
executable file
·75 lines (62 loc) · 1.84 KB
/
verify-diem-v2
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
#!/bin/bash
WORKSPACE="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# mvp
MVP=${WORKSPACE}/mvp-v2
# deps
PATH_DOTNET=${WORKSPACE}/dep/dotnet
PATH_BOOGIE=${PATH_DOTNET}/tools/boogie
PATH_Z3=${WORKSPACE}/dep/z3
# diem framework code
DIEM=${WORKSPACE}/data/diem-v2
# measurement
HYPERFINE=${WORKSPACE}/dep/hyperfine
function verify() {
${MVP} $1 -d ${DIEM}
}
function verify_with_details() {
# print stats about the Move code
num_inv="$(grep -E '( invariant )|( invariant<.*> )' $1 | wc -l)"
num_vc="$(grep -E '( aborts_if )|( ensures )|( requires )' $1 | wc -l)"
echo "Number of invariants: ${num_inv}"
echo "Number of verification conditions: ${num_vc}"
# generate the boogie file
module_name=$(${MVP} $1 -d ${DIEM} --generate-only --keep | grep -P -o "translating module \K\w+")
# build the command for verification
boogie_cmdl="${PATH_BOOGIE} \
-doModSetAnalysis \
-printVerifiedProceduresCount:0 \
-printModel:1 \
-enhancedErrorMessages:1 \
-errorLimit:1 \
-monomorphize \
-proverOpt:PROVER_PATH=${PATH_Z3} \
-proverOpt:O:smt.QI.EAGER_THRESHOLD=100 \
-proverOpt:O:smt.QI.LAZY_THRESHOLD=100 \
-proverOpt:O:parallel.enable=false \
-vcsCores:1 \
-proc:'\$1_${module_name}_*\$verify' \
-noProc:'\$1_${module_name}_*\$1_*\$verify' \
output.bpl"
# measure the time required for verification
echo "Verification will run multiple times for a stable performance measurement"
echo ""
DOTNET_ROOT=${PATH_DOTNET} ${HYPERFINE} --show-output --warmup 1 --runs 10 "${boogie_cmdl}"
# clean-up
rm output.bpl
}
if [ "$#" -eq 0 ]; then
for entry in "${DIEM}"/*; do
verify $entry
done
else
if [ "$1" == "perf" ]; then
shift
for entry in "$@"; do
verify_with_details $entry
done
else
for entry in "$@"; do
verify $entry
done
fi
fi