Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 25 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert bb-tests
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 bb-tests
- *save_logs

stdlib-primitives-tests:
Expand All @@ -157,10 +157,10 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert stdlib_primitives_tests
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 stdlib_primitives_tests
- *save_logs

stdlib-recursion-tests:
stdlib-recursion-turbo-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
Expand All @@ -169,7 +169,19 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert stdlib_recursion_tests
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 stdlib_recursion_tests --gtest_filter=*turbo*
- *save_logs

stdlib-recursion-ultra-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 3 stdlib_recursion_tests --gtest_filter=-*turbo*
- *save_logs

tx-rollup-tests:
Expand All @@ -181,7 +193,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_tx_rollup_tests --gtest_filter=-rollup_full_tests.*
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 rollup_proofs_tx_rollup_tests --gtest_filter=-rollup_full_tests.*
- *save_logs

tx-rollup-full-tests:
Expand All @@ -193,7 +205,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_tx_rollup_tests --gtest_filter=rollup_full_tests.*
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 rollup_proofs_tx_rollup_tests --gtest_filter=rollup_full_tests.*
- *save_logs

root-rollup-tests:
Expand All @@ -205,7 +217,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_root_rollup_tests --gtest_filter=-root_rollup_full_tests.*
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 rollup_proofs_root_rollup_tests --gtest_filter=-root_rollup_full_tests.*
- *save_logs

root-rollup-full-tests:
Expand All @@ -217,7 +229,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_root_rollup_tests --gtest_filter=root_rollup_full_tests.*
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 rollup_proofs_root_rollup_tests --gtest_filter=root_rollup_full_tests.*
- *save_logs

root-verifier-tests:
Expand All @@ -229,7 +241,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert rollup_proofs_root_verifier_tests
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 3 rollup_proofs_root_verifier_tests
- *save_logs

benchmark-aggregator:
Expand Down Expand Up @@ -260,7 +272,8 @@ workflows:
- wasm-linux-clang
- barretenberg-tests: *bb_test
- stdlib-primitives-tests: *bb_test
- stdlib-recursion-tests: *bb_test
- stdlib-recursion-turbo-tests: *bb_test
- stdlib-recursion-ultra-tests: *bb_test
- tx-rollup-tests: *bb_test
- tx-rollup-full-tests: *bb_test
- root-rollup-tests: *bb_test
Expand All @@ -270,7 +283,8 @@ workflows:
requires:
- barretenberg-tests
- stdlib-primitives-tests
- stdlib-recursion-tests
- stdlib-recursion-turbo-tests
- stdlib-recursion-ultra-tests
- tx-rollup-tests
- tx-rollup-full-tests
- root-verifier-tests
Expand Down
17 changes: 17 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/cpp/src/aztec"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++20",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-vscode.cpptools",
"eamodio.gitlens"
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"files.associations": {
"*.tf": "terraform",
"*.tfvars": "terraform",
"Makefile.*": "makefile",
"iosfwd": "cpp"
}
}
8 changes: 6 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ option(DISABLE_ADX "Disable ADX assembly variant" OFF)
option(MULTITHREADING "Enable multi-threading" ON)
option(TESTING "Build tests" ON)
option(BENCHMARKS "Build benchmarks" ON)
option(DISABLE_TBB "Intel Thread Building Blocks" ON)

if(ARM)
message(STATUS "Compiling for ARM.")
set(DISABLE_ASM ON)
set(DISABLE_ADX ON)
set(RUN_HAVE_STD_REGEX 0)
set(RUN_HAVE_POSIX_REGEX 0)
set(DISABLE_TBB 0)
endif()

if(FUZZING)
Expand All @@ -40,7 +42,7 @@ if(FUZZING)
if(UNDEFINED_BEHAVIOUR_SANITIZER)
set(SANITIZER_OPTIONS ${SANITIZER_OPTIONS} -fsanitize=undefined -fno-sanitize=alignment)
endif()

add_compile_options(-fsanitize=fuzzer-no-link ${SANITIZER_OPTIONS})

set(WASM OFF)
Expand All @@ -53,6 +55,7 @@ if(WASM)
set(DISABLE_ASM ON)
set(MULTITHREADING OFF)
set(BENCHMARKS OFF)
set(DISABLE_TBB 1)
endif()

set(CMAKE_C_STANDARD 11)
Expand All @@ -62,10 +65,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS ON)

include(cmake/build.cmake)
include(GNUInstallDirs)
include(cmake/arch.cmake)
include(cmake/threading.cmake)
include(cmake/gtest.cmake)
include(cmake/benchmark.cmake)
include(cmake/module.cmake)

add_subdirectory(src/aztec)
add_subdirectory(src/aztec)
10 changes: 3 additions & 7 deletions cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ rm -rf ./build
rm -rf ./build-wasm

# Install formatting git hook.
HOOKS_DIR=$(git rev-parse --git-path hooks)
# The pre-commit script will live in a barretenberg-specific hooks directory
# That may be just in the top level of this repository,
# or may be in a .git/modules/barretenberg subdirectory when this is actually a submodule
# Either way, running `git rev-parse --show-toplevel` from the hooks directory gives the path to barretenberg
echo "cd \$(git rev-parse --show-toplevel)/cpp && ./format.sh staged" > $HOOKS_DIR/pre-commit
chmod +x $HOOKS_DIR/pre-commit
echo "cd ./cpp && ./format.sh staged" > ../.git/hooks/pre-commit
chmod +x ../.git/hooks/pre-commit

# Determine system.
if [[ "$OSTYPE" == "darwin"* ]]; then
Expand All @@ -27,6 +22,7 @@ fi
# Download ignition transcripts.
cd ./srs_db
./download_ignition.sh 3
./download_ignition_lagrange.sh 12
cd ..

# Pick native toolchain file.
Expand Down
5 changes: 5 additions & 0 deletions cpp/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function(barretenberg_module MODULE_NAME)
${MODULE_NAME}
PUBLIC
${ARGN}
${TBB_IMPORTED_TARGETS}
)

set(MODULE_LINK_NAME ${MODULE_NAME})
Expand All @@ -51,6 +52,7 @@ function(barretenberg_module MODULE_NAME)
${MODULE_NAME}_test_objects
PRIVATE
gtest
${TBB_IMPORTED_TARGETS}
)

add_executable(
Expand Down Expand Up @@ -89,6 +91,7 @@ function(barretenberg_module MODULE_NAME)
${ARGN}
gtest
gtest_main
${TBB_IMPORTED_TARGETS}
)

if(NOT WASM AND NOT CI)
Expand Down Expand Up @@ -139,6 +142,7 @@ function(barretenberg_module MODULE_NAME)
${MODULE_NAME}_bench_objects
PRIVATE
benchmark
${TBB_IMPORTED_TARGETS}
)

add_executable(
Expand All @@ -152,6 +156,7 @@ function(barretenberg_module MODULE_NAME)
${MODULE_LINK_NAME}
${ARGN}
benchmark
${TBB_IMPORTED_TARGETS}
)

add_custom_target(
Expand Down
13 changes: 13 additions & 0 deletions cpp/cmake/threading.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,16 @@ else()
message(STATUS "Multithreading is disabled.")
add_definitions(-DNO_MULTITHREADING -DBOOST_SP_NO_ATOMIC_ACCESS)
endif()

if(DISABLE_TBB)
message(STATUS "Intel Thread Building Blocks is disabled.")
add_definitions(-DNO_TBB)
else()
find_package(TBB REQUIRED tbb)
if(${TBB_FOUND})
message(STATUS "Intel Thread Building Blocks is enabled.")
else()
message(STATUS "Could not locate TBB.")
add_definitions(-DNO_TBB)
endif()
endif()
1 change: 1 addition & 0 deletions cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN git clone -b release/10.x --depth 1 https://github.com/llvm/llvm-project.git
&& make install \
&& cd ../.. && rm -rf llvm-project
WORKDIR /usr/src/barretenberg/cpp

COPY . .
# Build everything to ensure everything builds. All tests will be run from the result of this build.
RUN mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=RelWithAssert -DOpenMP_omp_LIBRARY=/usr/local/lib/libomp.a -DCI=ON .. && make -j$(nproc)
Expand Down
3 changes: 2 additions & 1 deletion cpp/scripts/bb-tests
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ci_failsafe_tests
crypto_aes128_tests
crypto_blake2s_tests
crypto_blake3s_tests
crypto_ecdsa_tests
crypto_pedersen_tests
crypto_schnorr_tests
Expand All @@ -18,6 +18,7 @@ rollup_proofs_standard_example_tests
srs_tests
stdlib_aes128_tests
stdlib_blake2s_tests
stdlib_blake3s_tests
stdlib_ecdsa_tests
stdlib_merkle_tree_tests
stdlib_pedersen_tests
Expand Down
9 changes: 6 additions & 3 deletions cpp/scripts/run_tests
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

TESTS=$1
NUM_TRANSCRIPTS=$1
TESTS=$2
shift
shift

$(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null
Expand All @@ -17,6 +19,7 @@ fi
docker run --rm -t $IMAGE_URI /bin/sh -c "\
set -e; \
cd /usr/src/barretenberg/cpp/srs_db; \
./download_ignition.sh 1; \
./download_ignition.sh $NUM_TRANSCRIPTS; \
./download_ignition_lagrange.sh 12; \
cd /usr/src/barretenberg/cpp/build; \
for BIN in $TESTS; do ./bin/\$BIN $@; done"
for BIN in $TESTS; do ./bin/\$BIN $@; done"
3 changes: 3 additions & 0 deletions cpp/src/aztec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ add_subdirectory(polynomials)
add_subdirectory(plonk)
add_subdirectory(stdlib)
add_subdirectory(rollup)
add_subdirectory(lagrange_base_gen)

if(BENCHMARKS)
add_subdirectory(benchmark)
Expand All @@ -52,6 +53,7 @@ if(WASM)
$<TARGET_OBJECTS:crypto_sha256_objects>
$<TARGET_OBJECTS:crypto_aes128_objects>
$<TARGET_OBJECTS:crypto_blake2s_objects>
$<TARGET_OBJECTS:crypto_blake3s_objects>
$<TARGET_OBJECTS:crypto_keccak_objects>
$<TARGET_OBJECTS:crypto_schnorr_objects>
$<TARGET_OBJECTS:crypto_pedersen_objects>
Expand All @@ -62,6 +64,7 @@ if(WASM)
$<TARGET_OBJECTS:stdlib_schnorr_objects>
$<TARGET_OBJECTS:stdlib_pedersen_objects>
$<TARGET_OBJECTS:stdlib_blake2s_objects>
$<TARGET_OBJECTS:stdlib_blake3s_objects>
$<TARGET_OBJECTS:rollup_proofs_inner_proof_data_objects>
$<TARGET_OBJECTS:rollup_proofs_notes_objects>
$<TARGET_OBJECTS:rollup_proofs_account_objects>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/aztec/benchmark/pippenger_bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_executable(pippenger_bench main.cpp)
target_link_libraries(
pippenger_bench
polynomials
plonk
srs
env
)

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/aztec/benchmark/pippenger_bench/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <common/assert.hpp>
#include <cstdlib>
#include <ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp>
#include <plonk/reference_string/file_reference_string.hpp>
#include <srs/reference_string/file_reference_string.hpp>
#include <polynomials/polynomial_arithmetic.hpp>

//#include <valgrind/callgrind.h>
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/aztec/crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
add_subdirectory(hmac)
add_subdirectory(blake2s)
add_subdirectory(blake3s)
add_subdirectory(blake3s_full)
add_subdirectory(keccak)
add_subdirectory(pedersen)
add_subdirectory(schnorr)
Expand Down
1 change: 1 addition & 0 deletions cpp/src/aztec/crypto/blake3s/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
barretenberg_module(crypto_blake3s crypto_blake2s)
Loading