Skip to content

Commit 9dd7d62

Browse files
committed
smt check for ci + container-build
Pinning cvc5 to stable commit. Resolve building errors. Update boostrap Add Required packages to ci environment
1 parent 1d9538b commit 9dd7d62

File tree

6 files changed

+68
-8
lines changed

6 files changed

+68
-8
lines changed

barretenberg/cpp/bootstrap.sh

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,19 @@ function build_fuzzing_syntax_check_only {
147147
cache_upload barretenberg-fuzzing-$hash.zst build-fuzzing/syntax-check-success.flag
148148
}
149149

150+
# Do basic tests that the smt preset still compiles and runs
151+
function build_smt_verification {
152+
set -eu
153+
if cache_download barretenberg-smt-$hash.zst; then
154+
return
155+
fi
156+
157+
sudo apt update && sudo apt install -y python3-pip python3-venv m4
158+
cmake --preset smt-verification
159+
cmake --build build-smt --target smt_verification_tests
160+
cache_upload barretenberg-smt-$hash.zst build-smt
161+
}
162+
150163
function build_release {
151164
local arch=$(arch)
152165
rm -rf build-release
@@ -165,7 +178,7 @@ function build_release {
165178
fi
166179
}
167180

168-
export -f build_preset build_native build_asan_fast build_darwin build_nodejs_module build_wasm build_wasm_threads build_gcc_syntax_check_only build_fuzzing_syntax_check_only
181+
export -f build_preset build_native build_asan_fast build_darwin build_nodejs_module build_wasm build_wasm_threads build_gcc_syntax_check_only build_fuzzing_syntax_check_only build_smt_verification
169182

170183
function build {
171184
echo_header "bb cpp build"
@@ -176,7 +189,7 @@ function build {
176189
build_wasm_threads
177190
)
178191
if [ "$(arch)" == "amd64" ] && [ "$CI" -eq 1 ]; then
179-
builds+=(build_gcc_syntax_check_only build_fuzzing_syntax_check_only build_asan_fast)
192+
builds+=(build_gcc_syntax_check_only build_fuzzing_syntax_check_only build_asan_fast build_smt_verification)
180193
fi
181194
if [ "$CI_FULL" -eq 1 ]; then
182195
builds+=(build_darwin)
@@ -225,6 +238,13 @@ function test_cmds {
225238
echo -e "$prefix barretenberg/cpp/build-asan-fast/bin/$bin_name --gtest_filter=$filter"
226239
done
227240
fi
241+
242+
# Run the SMT compatibility tests
243+
if [ "$(arch)" == "amd64" ] && [ "$CI" -eq 1 ]; then
244+
local prefix="$hash:CPUS=4:MEM=8g"
245+
echo -e "$prefix barretenberg/cpp/build-smt/bin/smt_verification_tests"
246+
fi
247+
228248
echo "$hash barretenberg/cpp/scripts/test_civc_standalone_vks_havent_changed.sh"
229249
}
230250

@@ -334,7 +354,7 @@ case "$cmd" in
334354
"hash")
335355
echo $hash
336356
;;
337-
test|test_cmds|bench|bench_cmds|build_bench|release|build_native|build_nodejs_module|build_asan_fast|build_wasm|build_wasm_threads|build_gcc_syntax_check_only|build_fuzzing_syntax_check_only|build_darwin|build_release|inject_version)
357+
test|test_cmds|bench|bench_cmds|build_bench|release|build_native|build_nodejs_module|build_asan_fast|build_wasm|build_wasm_threads|build_gcc_syntax_check_only|build_fuzzing_syntax_check_only|build_darwin|build_release|build_smt_verification|inject_version)
338358
$cmd "$@"
339359
;;
340360
*)

barretenberg/cpp/src/barretenberg/smt_verification/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ set(CVC5_PREFIX "${CMAKE_BINARY_DIR}/_deps/cvc5")
55
set(CVC5_BUILD "${CVC5_PREFIX}/src/cvc5-build")
66
set(CVC5_LIB "${CVC5_BUILD}/lib/libcvc5.so")
77
set(CVC5_INCLUDE "${CVC5_BUILD}/include")
8+
set(CVC5_STABLE_COMMIT "5fcdb48eb26dee9385e0d0e6377fcc7e4afee85a")
89

910
if(ENABLE_ASAN)
1011
ExternalProject_Add(
1112
cvc5
1213
PREFIX ${CVC5_PREFIX}
1314
GIT_REPOSITORY "https://github.com/cvc5/cvc5.git"
14-
GIT_TAG main
15+
GIT_TAG ${CVC5_STABLE_COMMIT}
1516
BUILD_IN_SOURCE YES
16-
CONFIGURE_COMMAND ${SHELL} ./configure.sh debug --gpl --auto-download --cocoa --cryptominisat --kissat -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ --prefix=${CVC5_BUILD} --asan
17+
CONFIGURE_COMMAND ${SHELL} ./configure.sh debug --gpl --auto-download --cocoa --cryptominisat --kissat -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} --prefix=${CVC5_BUILD} --asan
1718
BUILD_COMMAND make -C build -j8
1819
INSTALL_COMMAND make -C build install
1920
UPDATE_COMMAND "" # No update step
@@ -26,9 +27,9 @@ else()
2627
cvc5
2728
PREFIX ${CVC5_PREFIX}
2829
GIT_REPOSITORY "https://github.com/cvc5/cvc5.git"
29-
GIT_TAG main
30+
GIT_TAG ${CVC5_STABLE_COMMIT}
3031
BUILD_IN_SOURCE YES
31-
CONFIGURE_COMMAND ${SHELL} ./configure.sh production --gpl --auto-download --cocoa --cryptominisat --kissat -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ --prefix=${CVC5_BUILD}
32+
CONFIGURE_COMMAND ${SHELL} ./configure.sh production --gpl --auto-download --cocoa --cryptominisat --kissat -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} --prefix=${CVC5_BUILD}
3233
BUILD_COMMAND make -C build -j8
3334
INSTALL_COMMAND make -C build install
3435
UPDATE_COMMAND "" # No update step

barretenberg/cpp/src/barretenberg/smt_verification/circuit/ultra_circuit.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ TEST(UltraCircuitSMT, EllipticRelationDBL)
160160
builder.set_variable_name(p2.x.get_witness_index(), "x2");
161161
builder.set_variable_name(p1.y.get_witness_index(), "y1");
162162
builder.set_variable_name(p2.y.get_witness_index(), "y2");
163-
builder.set_variable_name(p1.is_point_at_infinity().witness_index, "is_inf");
163+
builder.set_variable_name(p1.is_point_at_infinity().get_normalized_witness_index(), "is_inf");
164164

165165
auto circuit_info = unpack_from_buffer(builder.export_circuit());
166166
Solver s(circuit_info.modulus, ultra_solver_config);

build-images/src/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ RUN apt update && \
238238
inotify-tools \
239239
# Annoyingly unminimize upgrades nodejs.
240240
nodejs=22.16.0-1nodesource1 \
241+
# smt_verification dependencies
242+
python3-venv \
243+
python3-pip \
244+
m4 \
241245
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
242246

243247
# Install osxcross. Requires developer to mount SDK from their mac host.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
image_name="smt-build-static"
4+
COMMIT="f3ff6161155ba5e07d14ea1c52a218494eb8bb96"
5+
docker build -t "$image_name" --target reuse --build-arg COMMIT="$COMMIT" src
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM ubuntu:noble as base
2+
3+
RUN apt-get update && \
4+
apt-get install -y build-essential python3 wget unzip git cmake clang ninja-build curl python3-venv python3-pip m4 && \
5+
apt-get -y autoremove && \
6+
apt-get clean && \
7+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
8+
RUN useradd -m smt -G sudo
9+
WORKDIR /home/smt
10+
11+
FROM base AS cvc5
12+
RUN git clone https://github.com/AztecProtocol/aztec-packages.git
13+
WORKDIR /home/smt/aztec-packages/barretenberg/cpp
14+
RUN cmake -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 --preset smt-verification
15+
RUN cmake --build ./build-smt --target cvc5
16+
17+
FROM base AS reuse
18+
19+
ARG COMMIT=latest
20+
RUN git clone https://github.com/AztecProtocol/aztec-packages.git && \
21+
cd aztec-packages && \
22+
if [ "$COMMIT" != "latest" ]; then \
23+
git checkout $COMMIT || exit 1; \
24+
fi
25+
26+
WORKDIR /home/smt/aztec-packages/barretenberg/cpp
27+
RUN cmake -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 --preset smt-verification
28+
RUN rm -rf ./build-smt/_deps/cvc5
29+
COPY --from=cvc5 /home/smt/aztec-packages/barretenberg/cpp/build-smt/_deps/cvc5 ./build-smt/_deps/cvc5
30+
RUN cmake --build ./build-smt --target smt_verification_tests

0 commit comments

Comments
 (0)