-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathverify-proofs.nix
More file actions
94 lines (77 loc) · 2.48 KB
/
Copy pathverify-proofs.nix
File metadata and controls
94 lines (77 loc) · 2.48 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{ lib,
stdenv,
ninja,
pkg-config,
cmake,
boost,
gdb,
lldb,
mold,
protobuf,
glibc,
cmake_modules,
enableDebugging,
enableDebug ? false,
staticBuild ? false,
sanitize ? false,
crypto3_tests ? false
}:
let
inherit (lib) optional;
# Aux function that assembles a shell line for running test binary for specific (test suite, test case, circuit subset) combination
buildTestRunLines = {binary, test_suite, test_runs}:
builtins.map
(test_name: "${binary} '--run_test=${test_suite}/${test_name}' -- --no-sat-check --proof --run-for-circuits=${lib.strings.concatStringsSep "," test_runs.${test_name}}\n")
(builtins.attrNames test_runs)
;
in stdenv.mkDerivation rec {
name = "Proof verifier test";
pname = "proof-verifier-test";
src = lib.sourceByRegex ./. [ "^crypto3(/.*)?$" "CMakeLists.txt" ];
hardeningDisable = [ "fortify" ];
nativeBuildInputs = [ cmake ninja pkg-config ] ++
(lib.optional (!stdenv.isDarwin) gdb) ++
(lib.optional (stdenv.isDarwin) lldb);
# enableDebugging will keep debug symbols in boost
propagatedBuildInputs = [ (if enableDebug then (enableDebugging boost) else boost) ];
buildInputs = [cmake_modules];
cmakeFlags =
[
(if sanitize then "-DSANITIZE=ON" else "-DSANITIZE=OFF")
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" # to allow VSCode navigation/completion/etc
"-DBUILD_TESTS=TRUE"
"-G Ninja"
];
buildPhase = ''
ninja blueprint_zkevm_bbf_debugtt_test
'';
cmakeBuildType = if enableDebug then "Debug" else "Release";
doCheck = true;
test_lines = buildTestRunLines {
binary = "./crypto3/libs/blueprint/test/zkevm_bbf/blueprint_zkevm_bbf_debugtt_test";
test_suite = "zkevm_bbf_debugtt";
test_runs = {
# test case name
keccak = [ # circuit names
"copy"
"keccak"
"rw"
"bytecode"
"zkevm"
"rw-s"
"copy-s"
"bytecode-s"
];
minimal_math = [ "zkevm" "zkevm-wide" "copy" "keccak" "rw" "zkevm-s" "rw-s" "copy-s" "bytecode-s" ];
try_catch = [ "zkevm" "zkevm-wide" "copy" "bytecode" "rw" "rw-s" "copy-s" "bytecode-s"];
exp = [ "copy" "rw" "bytecode" "zkevm" "exp" "rw-s" "copy-s" "bytecode-s"];
};
};
checkPhase = lib.concatLines (["set -x"] ++ test_lines);
dontInstall = true;
installPhase = "true";
shellHook = ''
PS1="\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
echo "Welcome to verify-proofs environment!"
'';
}