Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
6f9b1d6
circuits builds.
charlielye May 27, 2023
d997bcf
Merge remote-tracking branch 'origin/master' into cl/bb_bump
charlielye May 27, 2023
0528f61
Bump wasi
charlielye May 27, 2023
1562794
Fixes.
charlielye May 27, 2023
6ed1fd1
Fix.
charlielye May 30, 2023
c1fa60f
Merge remote-tracking branch 'origin/master' into cl/bb_bump
charlielye Jun 7, 2023
b92ac96
bump
charlielye Jun 7, 2023
2dc82cc
Fix.
charlielye Jun 7, 2023
eed322e
fix.
charlielye Jun 7, 2023
cc4a87a
Undo attempt to fix red squiggles everywhere in vscode TODOs (not cool).
charlielye Jun 7, 2023
e938af3
Build barretenberg.wasm
codygunton Jun 7, 2023
f773776
Ditto
codygunton Jun 7, 2023
11d90a2
Build tests as well.
codygunton Jun 7, 2023
972739d
Whoops that didn't make sense.
codygunton Jun 7, 2023
7a42d80
Fix dummy_previous_kernel test
codygunton Jun 7, 2023
c2ad78a
Should work but gives bad alloc
codygunton Jun 7, 2023
e1ca56d
More global srs
codygunton Jun 7, 2023
fdab6e8
Make test use fixture.
codygunton Jun 7, 2023
1dbca53
Fix segfault in test
codygunton Jun 8, 2023
21b793c
Fix
charlielye Jun 8, 2023
2d408cf
Merge remote-tracking branch 'origin/master' into cl/bb_bump
charlielye Jun 8, 2023
56d6aad
Fix.
charlielye Jun 8, 2023
f389174
Fix
charlielye Jun 8, 2023
3baa571
Fix.
charlielye Jun 8, 2023
28ecd55
Wip
charlielye Jun 8, 2023
0823b30
fix: get circuits.js building against
ludamad Jun 8, 2023
dc7b432
Move to bb master now that changes have landed
ludamad Jun 8, 2023
81cd996
Update: progress on fixery
ludamad Jun 8, 2023
de1d86e
chore: more refactory
ludamad Jun 8, 2023
c2891f2
chore: more refactory
ludamad Jun 8, 2023
5bb8f1f
Fix: broken mac build
ludamad Jun 8, 2023
8035e3d
Compiling again.
ludamad Jun 8, 2023
482ea13
Compiling again.
ludamad Jun 8, 2023
eadb8fd
Fix mysterious fail
ludamad Jun 8, 2023
7f50f9c
WASM stack traces, finally.
ludamad Jun 8, 2023
b508c22
srs cbind
ludamad Jun 9, 2023
b49a1f7
work on circuits tests
ludamad Jun 9, 2023
11bbbb8
Bump bb
ludamad Jun 9, 2023
14d97f6
Downgrade bb
ludamad Jun 9, 2023
8dcce37
Redo tests
ludamad Jun 9, 2023
9033a4d
Redo tests
ludamad Jun 9, 2023
02ba59d
fix: bad null-termination in C strings
ludamad Jun 9, 2023
040959b
redo yarn.lock
ludamad Jun 9, 2023
2761d8b
fix: everything hopefully
ludamad Jun 9, 2023
4b52dff
fix: yarn prepare
ludamad Jun 9, 2023
8300520
Fix wasm module.test.ts
ludamad Jun 9, 2023
a970267
fix: formatting
ludamad Jun 9, 2023
bcc1db5
fix: lint
ludamad Jun 9, 2023
163beb4
fix: init crs in native private kernel tests
ludamad Jun 9, 2023
e03e9a0
fix: init crs in native private kernel tests
ludamad Jun 9, 2023
5149ef2
fix: init crs in native private kernel tests
ludamad Jun 9, 2023
dec17dd
Fix crs string...
ludamad Jun 9, 2023
33a4fef
Update submodule
ludamad Jun 9, 2023
832cd05
Merge remote-tracking branch 'origin/master' into cl/bb_bump
ludamad Jun 9, 2023
cf08288
Fix build post-merge
ludamad Jun 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,6 @@ jobs:
name: "Build and test"
command: build aztec.js

barretenberg-js:
machine:
image: ubuntu-2004:202010-01
resource_class: large
steps:
- *checkout
- *setup_env
- run:
name: "Build and test"
command: build barretenberg.js

types:
machine:
image: ubuntu-2004:202010-01
Expand Down Expand Up @@ -584,7 +573,6 @@ workflows:
- acir-simulator: *yarn_project
- archiver: *yarn_project
- aztec-rpc: *yarn_project
- barretenberg-js: *yarn_project
- merkle-tree: *yarn_project
- p2p: *yarn_project
- p2p-bootstrap: *yarn_project
Expand All @@ -605,7 +593,6 @@ workflows:
- acir-simulator
- archiver
- aztec-rpc
- barretenberg-js
- merkle-tree
- p2p
- p2p-bootstrap
Expand Down
22 changes: 2 additions & 20 deletions build_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"^yarn-project/acir-simulator/"
],
"dependencies": [
"barretenberg.js",
"circuits.js",
"foundation",
"merkle-tree",
Expand Down Expand Up @@ -136,7 +135,6 @@
"dependencies": [
"acir-simulator",
"aztec-node",
"barretenberg.js",
"circuits.js",
"foundation",
"key-store",
Expand All @@ -158,18 +156,6 @@
"noir-contracts"
]
},
"barretenberg.js": {
"buildDir": "yarn-project",
"projectDir": "yarn-project/barretenberg.js",
"dockerfile": "barretenberg.js/Dockerfile",
"rebuildPatterns": [
"^yarn-project/barretenberg.js/"
],
"dependencies": [
"foundation",
"yarn-project-base"
]
},
"circuits.js": {
"buildDir": "yarn-project",
"projectDir": "yarn-project/circuits.js",
Expand All @@ -178,9 +164,7 @@
"^yarn-project/circuits.js/"
],
"dependencies": [
"barretenberg.js",
"foundation",
"merkle-tree",
"yarn-project-base"
]
},
Expand Down Expand Up @@ -233,7 +217,6 @@
"^yarn-project/key-store/"
],
"dependencies": [
"barretenberg.js",
"circuits.js",
"foundation",
"types"
Expand All @@ -247,7 +230,7 @@
"^yarn-project/merkle-tree/"
],
"dependencies": [
"barretenberg.js",
"circuits.js",
"foundation"
]
},
Expand Down Expand Up @@ -328,7 +311,7 @@
],
"dependencies": [
"archiver",
"barretenberg.js",
"circuits.js",
"foundation",
"l1-artifacts",
"merkle-tree",
Expand Down Expand Up @@ -378,7 +361,6 @@
"^yarn-project/world-state/"
],
"dependencies": [
"barretenberg.js",
"circuits.js",
"foundation",
"merkle-tree",
Expand Down
1 change: 0 additions & 1 deletion build_manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
PROJECTS=(
circuits:circuits/cpp:./dockerfiles/Dockerfile.wasm-linux-clang:circuits-wasm-linux-clang
yarn-project-base:yarn-project
# barretenberg.js:yarn-project
end-to-end:yarn-project
)
3 changes: 2 additions & 1 deletion circuits/cpp/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ barretenberg/cpp/src/aztec/rollup/proofs/root_*/fixtures/account
barretenberg/cpp/src/aztec/rollup/proofs/root_*/fixtures/join_split
barretenberg/cpp/src/aztec/rollup/proofs/root_*/fixtures/**/proving_key
barretenberg/cpp/srs_db/*
!barretenberg/cpp/srs_db/download_ignition.sh
!barretenberg/cpp/srs_db/download_ignition.sh
!barretenberg/cpp/scripts/install-wasi-sdk.sh
2 changes: 1 addition & 1 deletion circuits/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ include(cmake/threading.cmake)
include(cmake/gtest.cmake)
include(cmake/benchmark.cmake)
include(cmake/module.cmake)
add_subdirectory(src)
add_subdirectory(src)
59 changes: 56 additions & 3 deletions circuits/cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,37 @@
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "clang16",
"displayName": "Build with Clang-16",
"description": "Build with globally installed Clang-16",
"inherits": "default",
"environment": {
"CC": "clang-16",
"CXX": "clang++-16"
},
"cacheVariables": {
"CMAKE_BBERG_PRESET": "clang16"
}
},
{
"name": "clang16-assert",
"displayName": "Build with Clang-16 and assertions enabled",
"description": "Build with globally installed Clang-16 and assertions",
"inherits": "clang16",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithAssert"
}
},
{
"name": "clang16-dbg",
"displayName": "Debugging build with Clang-16",
"description": "Build with globally installed Clang-16 in debug mode",
"inherits": "clang16",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "gcc",
"displayName": "Build with GCC",
Expand Down Expand Up @@ -131,7 +162,7 @@
"binaryDir": "build-wasm",
"toolchainFile": "cmake/toolchains/wasm32-wasi.cmake",
"environment": {
"WASI_SDK_PREFIX": "${sourceDir}/barretenberg/cpp/src/wasi-sdk-12.0",
"WASI_SDK_PREFIX": "${sourceDir}/barretenberg/cpp/src/wasi-sdk-20.0",
"CC": "$env{WASI_SDK_PREFIX}/bin/clang",
"CXX": "$env{WASI_SDK_PREFIX}/bin/clang++",
"AR": "$env{WASI_SDK_PREFIX}/bin/llvm-ar",
Expand All @@ -146,6 +177,7 @@
"CMAKE_FIND_ROOT_PATH_MODE_PACKAGE": "ONLY",
"CMAKE_C_COMPILER_WORKS": "ON",
"CMAKE_CXX_COMPILER_WORKS": "ON",
"CMAKE_EXE_LINKER_FLAGS": "-O3",
"CMAKE_BBERG_PRESET": "wasm",
"CMAKE_BUILD_TYPE": "Release"
}
Expand All @@ -156,7 +188,8 @@
"description": "Build in debug mode with a specific wasm-sdk to create wasm",
"inherits": "wasm",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXE_LINKER_FLAGS": ""
}
}
],
Expand All @@ -182,6 +215,16 @@
"inherits": "default",
"configurePreset": "clang15-dbg"
},
{
"name": "clang16",
"inherits": "default",
"configurePreset": "clang16"
},
{
"name": "clang16-dbg",
"inherits": "default",
"configurePreset": "clang16-dbg"
},
{
"name": "gcc",
"inherits": "default",
Expand Down Expand Up @@ -239,6 +282,16 @@
"inherits": "default",
"configurePreset": "clang15-dbg"
},
{
"name": "clang16",
"inherits": "default",
"configurePreset": "clang16"
},
{
"name": "clang16-dbg",
"inherits": "default",
"configurePreset": "clang16-dbg"
},
{
"name": "gcc",
"inherits": "default",
Expand Down Expand Up @@ -274,4 +327,4 @@
"inherits": "wasm"
}
]
}
}
2 changes: 1 addition & 1 deletion circuits/cpp/barretenberg
Submodule barretenberg updated 351 files
6 changes: 2 additions & 4 deletions circuits/cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Takes CLEAN as an environment variable. If passed, cleans build artifacts
set -eu

export WASI_VERSION=12
export WASI_VERSION=20

cd "$(dirname "$0")"

Expand Down Expand Up @@ -74,9 +74,7 @@ cmake --preset $PRESET -DCMAKE_BUILD_TYPE=RelWithAssert
cmake --build --preset $PRESET ${@/#/--target }

# Install the webassembly toolchain.
if ! [ -d "./barretenberg/cpp/src/wasi-sdk-$WASI_VERSION.0" ] ; then
(cd ./barretenberg/cpp/src && curl -s -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_VERSION/wasi-sdk-$WASI_VERSION.0-$OS.tar.gz | tar zxfv -)
fi
(cd ./barretenberg/cpp && ./scripts/install-wasi-sdk.sh)

# Build WASM.
cmake --preset wasm
Expand Down
15 changes: 10 additions & 5 deletions circuits/cpp/cmake/barretenberg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ include(ExternalProject)
# Reference barretenberg artifacts (like library archives) via this dir:
if (WASM)
set(BBERG_BUILD_DIR ${BBERG_DIR}/build-wasm)
set(BBERG_TARGETS --target barretenberg --target env --target primitives.wasm)
set(BBERG_TARGETS --target barretenberg --target env --target wasi --target barretenberg.wasm)
else()
set(BBERG_BUILD_DIR ${BBERG_DIR}/build)
set(BBERG_TARGETS --target barretenberg --target env)
set(BBERG_TARGETS --target barretenberg --target env --target wasi)
endif()

if(NOT CMAKE_BBERG_PRESET)
Expand All @@ -34,15 +34,15 @@ ExternalProject_Add(Barretenberg
BUILD_ALWAYS TRUE
UPDATE_COMMAND ""
INSTALL_COMMAND ""
CONFIGURE_COMMAND
${CMAKE_COMMAND}
CONFIGURE_COMMAND
${CMAKE_COMMAND}
--preset ${CMAKE_BBERG_PRESET}
-DCMAKE_CXX_FLAGS=${CMAKE_BBERG_CXX_FLAGS}
-DSERIALIZE_CANARY=${SERIALIZE_CANARY}
-DMULTITHREADING=${MULTITHREADING}
-DENABLE_ASAN=${ENABLE_ASAN}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
BUILD_COMMAND
BUILD_COMMAND
${CMAKE_COMMAND}
--build
--preset ${CMAKE_BBERG_PRESET}
Expand All @@ -66,3 +66,8 @@ add_dependencies(barretenberg Barretenberg)
add_library(env STATIC IMPORTED)
set_target_properties(env PROPERTIES IMPORTED_LOCATION ${BBERG_BUILD_DIR}/lib/libenv.a)
add_dependencies(env Barretenberg)

# wasi is needed to initialize global statics and ensure we're following the reactor wasi pattern.
add_library(wasi STATIC IMPORTED)
set_target_properties(wasi PROPERTIES IMPORTED_LOCATION ${BBERG_BUILD_DIR}/lib/libwasi.a)
add_dependencies(wasi Barretenberg)
9 changes: 6 additions & 3 deletions circuits/cpp/dockerfiles/Dockerfile.wasm-linux-clang
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM ubuntu:kinetic AS builder
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential wget git libssl-dev cmake ninja-build curl binaryen
WORKDIR /usr/src/circuits/cpp/barretenberg/cpp/src
RUN curl -s -L https://github.com/CraneStation/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz | tar zxfv -

WORKDIR /usr/src/circuits/cpp/barretenberg/cpp
COPY ./barretenberg/cpp/scripts/install-wasi-sdk.sh ./scripts/install-wasi-sdk.sh
RUN ./scripts/install-wasi-sdk.sh
WORKDIR /usr/src/circuits/cpp
COPY . .

RUN cmake --preset wasm && cmake --build --preset wasm --target aztec3-circuits.wasm

FROM alpine:3.17
COPY --from=builder /usr/src/circuits/cpp/build-wasm/bin/aztec3-circuits.wasm /usr/src/circuits/cpp/build-wasm/bin/aztec3-circuits.wasm
COPY --from=builder /usr/src/circuits/cpp/barretenberg/cpp/build-wasm/bin/primitives.wasm /usr/src/circuits/cpp/barretenberg/cpp/build-wasm/bin/primitives.wasm
COPY --from=builder /usr/src/circuits/cpp/barretenberg/cpp/build-wasm/bin/barretenberg.wasm /usr/src/circuits/cpp/barretenberg/cpp/build-wasm/bin/primitives.wasm
COPY --from=builder /usr/src/circuits/cpp/barretenberg/cpp/srs_db /usr/src/circuits/cpp/barretenberg/cpp/srs_db
5 changes: 3 additions & 2 deletions circuits/cpp/dockerfiles/Dockerfile.wasm-linux-clang-assert
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM ubuntu:kinetic AS builder
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git libssl-dev cmake ninja-build curl binaryen

WORKDIR /usr/src/circuits/cpp/barretenberg/cpp/src
RUN curl -s -L https://github.com/CraneStation/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz | tar zxfv -
WORKDIR /usr/src/circuits/cpp/barretenberg/cpp
COPY ./barretenberg/cpp/scripts/install-wasi-sdk.sh ./scripts/install-wasi-sdk.sh
RUN ./scripts/install-wasi-sdk.sh
WORKDIR /usr/src/circuits/cpp
COPY . .

Expand Down
23 changes: 3 additions & 20 deletions circuits/cpp/src/aztec3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,16 @@ if (WASM)
aztec3-circuits.wasm
$<TARGET_OBJECTS:aztec3_circuits_apps_objects>
$<TARGET_OBJECTS:aztec3_circuits_abis_objects>
$<TARGET_OBJECTS:aztec3_circuits_kernel_objects>
$<TARGET_OBJECTS:aztec3_circuits_kernel_objects>
$<TARGET_OBJECTS:aztec3_circuits_rollup_objects>
)
target_link_libraries(aztec3-circuits.wasm barretenberg)
target_link_libraries(aztec3-circuits.wasm barretenberg wasi)

# With binaryen installed, it seems its wasm backend optimiser gets invoked automatically.
# Due to either a bug in the optimiser, or non-standards compliant c++ in crypto/aes, tests start failing with
# -O3 level optimisations. We force down to -O2 for current workaround.
# Presumably the -O3 when compiling the object files is fine as it's llvms IR optimiser.
# The backend optimiser is presumably triggered after linking.
target_link_options(
aztec3-circuits.wasm
PRIVATE
# TODO revisit implications of whole-archive
-nostartfiles -O2 -Wl,--whole-archive -Wl,--no-entry -Wl,--export-dynamic -Wl,--import-memory -Wl,--allow-undefined -Wl,--stack-first -Wl,-z,stack-size=1048576
-nostartfiles -Wl,--whole-archive -Wl,--no-entry -Wl,--export-dynamic -Wl,--import-memory -Wl,--allow-undefined -Wl,--stack-first -Wl,-z,stack-size=1048576
)

find_program(WASM_OPT wasm-opt)

if(NOT WASM_OPT)
message(FATAL_ERROR "wasm-opt executable not found. Please install binaryen.")
endif()

add_custom_command(
TARGET aztec3-circuits.wasm
POST_BUILD
COMMAND wasm-opt "$<TARGET_FILE:aztec3-circuits.wasm>" -O2 --asyncify -o "$<TARGET_FILE:aztec3-circuits.wasm>"
VERBATIM
)
endif()
2 changes: 1 addition & 1 deletion circuits/cpp/src/aztec3/circuits/abis/c_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,4 @@ WASM_EXPORT const char* abis__test_roundtrip_serialize_function_leaf_preimage(ui
uint32_t* size)
{
return as_string_output<aztec3::circuits::abis::FunctionLeafPreimage<NT>>(function_leaf_preimage_buf, size);
}
}
1 change: 0 additions & 1 deletion circuits/cpp/src/aztec3/circuits/abis/c_bind.test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "c_bind.h"

#include "function_leaf_preimage.hpp"
#include "tx_request.hpp"

Expand Down
Loading