Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ endef
# PHONY TARGETS - List every target that has a file/dir of the same name.
#==============================================================================

.PHONY: noir barretenberg noir-projects l1-contracts release-image boxes playground docs aztec-up spartan wsdb
.PHONY: noir barretenberg noir-projects l1-contracts release-image boxes playground docs aztec-up spartan wsdb aztec-vm-sim

#==============================================================================
# BOOTSTRAP TARGETS
Expand All @@ -61,7 +61,7 @@ fast: release-image barretenberg boxes playground docs aztec-up \
full: fast bb-full-tests bb-cpp-full yarn-project-benches

# Release. Everything plus copy bb cross compiles to ts projects.
release: fast bb-cpp-release-dir bb-ts-cross-copy ipc-runtime-cross
release: fast bb-cpp-release-dir bb-ts-cross-copy aztec-vm-sim-cross-copy ipc-runtime-cross

#==============================================================================
# Noir
Expand Down Expand Up @@ -96,7 +96,7 @@ avm-transpiler-cross: avm-transpiler-cross-amd64-macos avm-transpiler-cross-arm6
#==============================================================================

# Barretenberg - Aggregate target for all barretenberg sub-projects.
barretenberg: bb-cpp bb-ts bb-rs bb-acir bb-docs bb-sol bb-bbup bb-crs
barretenberg: bb-cpp bb-ts aztec-vm-sim bb-rs bb-acir bb-docs bb-sol bb-bbup bb-crs

# BB C++ - Main aggregate target.
bb-cpp: bb-cpp-native bb-cpp-wasm bb-cpp-wasm-threads
Expand Down Expand Up @@ -212,11 +212,17 @@ bb-cpp-full: bb-cpp bb-cpp-gcc bb-cpp-fuzzing bb-cpp-asan bb-cpp-smt bb-cpp-cros

# BB TypeScript - TypeScript bindings
bb-ts: bb-cpp-wasm bb-cpp-wasm-threads bb-cpp-native ipc-runtime
$(call build,$@,barretenberg/ts)
$(call build,$@,barretenberg/ts,build_bb_js)

# Copies the cross-compiles into bb.js.
bb-ts-cross-copy: bb-ts bb-cpp-cross
$(call build,$@,barretenberg/ts,cross_copy)
$(call build,$@,barretenberg/ts,cross_copy_bb_js)

aztec-vm-sim: ipc-codegen ipc-runtime bb-cpp-native
$(call build,$@,barretenberg/ts,build_aztec_vm_sim)

aztec-vm-sim-cross-copy: aztec-vm-sim bb-cpp-cross
$(call build,$@,barretenberg/ts,cross_copy_aztec_vm_sim)

# BB Rust - barretenberg-rs FFI crate
bb-rs: bb-ts bb-cpp-native
Expand Down Expand Up @@ -379,7 +385,7 @@ l1-contracts-tests: l1-contracts-verifier
# Yarn Project - TypeScript monorepo with all TS packages
#==============================================================================

yarn-project: bb-ts noir-projects l1-contracts wsdb
yarn-project: bb-ts noir-projects l1-contracts wsdb aztec-vm-sim
$(call build,$@,yarn-project)

yarn-project-tests: yarn-project
Expand Down
11 changes: 8 additions & 3 deletions aztec-up/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
source $(git rev-parse --show-toplevel)/ci3/source_bootstrap

hash=$(hash_str $(cache_content_hash ^aztec-up/) $(../ipc-runtime/bootstrap.sh hash) $(../wsdb/bootstrap.sh hash) $(../yarn-project/bootstrap.sh hash))
hash=$(hash_str $(cache_content_hash ^aztec-up/) $(../ipc-runtime/bootstrap.sh hash) $(../wsdb/bootstrap.sh hash) $(../barretenberg/ts/bootstrap.sh hash) $(../yarn-project/bootstrap.sh hash))

# Bare aliases ("nightly", "latest") resolve to this major version.
DEFAULT_MAJOR_VERSION=${AZTEC_TOOLCHAIN_DEFAULT_MAJOR_VERSION:-4}
Expand All @@ -13,6 +13,10 @@ function wsdb_package_dirs {
echo "$root/wsdb/ts"
}

function barretenberg_ts_package_dirs {
"$root"/barretenberg/ts/bootstrap.sh get_projects
}

function build {
# Noop if user doesn't have docker.
if ! command -v docker &>/dev/null; then
Expand Down Expand Up @@ -111,7 +115,7 @@ EOF
echo "Deploying packages to local npm registry (version: $version)..."
{
echo $root/ipc-runtime/ts
echo $root/barretenberg/ts
barretenberg_ts_package_dirs
wsdb_package_dirs
$root/noir/bootstrap.sh get_projects
$root/yarn-project/bootstrap.sh get_projects
Expand Down Expand Up @@ -187,7 +191,8 @@ function prep_test_mac {

# Ensure we've cross-compiled bb for macos. Normally this is only done on releases.
../barretenberg/cpp/bootstrap.sh build_cross amd64-macos true
../barretenberg/ts/bootstrap.sh cross_copy amd64-macos
../barretenberg/ts/bootstrap.sh cross_copy_bb_js amd64-macos
../barretenberg/ts/bootstrap.sh cross_copy_aztec_vm_sim amd64-macos

# Ensure build artifacts exist.
if [ ! -f ./bin/0.0.1/versions ] || [ ! -d ./verdaccio-storage ]; then
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/acir_tests/bbjs-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "yarn tsgo"
},
"dependencies": {
"@aztec/bb.js": "portal:../../ts",
"@aztec/bb.js": "portal:../../ts/bb.js",
"commander": "^12.1.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/acir_tests/browser-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"serve": "serve -n -L -p ${PORT:-8080} -c ../serve.json dest"
},
"devDependencies": {
"@aztec/bb.js": "portal:../../ts",
"@aztec/bb.js": "portal:../../ts/bb.js",
"@types/pako": "^2.0.3",
"html-webpack-plugin": "^5.6.0",
"pako": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/acir_tests/scripts/bbjs_legacy_cli_prove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export HARDWARE_CONCURRENCY=8
cd ../acir_tests/$1

# NOTE The bb.js main file is deprecated!
bbjs_bin="../../../ts/dest/node/main.js"
bbjs_bin="../../../ts/bb.js/dest/node/main.js"

output_dir=$(mktemp -d ./output-XXXXXX)
trap "rm -rf $output_dir" EXIT
Expand Down
12 changes: 6 additions & 6 deletions barretenberg/acir_tests/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ __metadata:
languageName: unknown
linkType: soft

"@aztec/bb.js@portal:../../ts::locator=bbjs-test%40workspace%3Abbjs-test":
"@aztec/bb.js@portal:../../ts/bb.js::locator=bbjs-test%40workspace%3Abbjs-test":
version: 0.0.0-use.local
resolution: "@aztec/bb.js@portal:../../ts::locator=bbjs-test%40workspace%3Abbjs-test"
resolution: "@aztec/bb.js@portal:../../ts/bb.js::locator=bbjs-test%40workspace%3Abbjs-test"
dependencies:
comlink: "npm:^4.4.1"
commander: "npm:^12.1.0"
Expand All @@ -35,9 +35,9 @@ __metadata:
languageName: node
linkType: soft

"@aztec/bb.js@portal:../../ts::locator=browser-test-app%40workspace%3Abrowser-test-app":
"@aztec/bb.js@portal:../../ts/bb.js::locator=browser-test-app%40workspace%3Abrowser-test-app":
version: 0.0.0-use.local
resolution: "@aztec/bb.js@portal:../../ts::locator=browser-test-app%40workspace%3Abrowser-test-app"
resolution: "@aztec/bb.js@portal:../../ts/bb.js::locator=browser-test-app%40workspace%3Abrowser-test-app"
dependencies:
comlink: "npm:^4.4.1"
commander: "npm:^12.1.0"
Expand Down Expand Up @@ -1201,7 +1201,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "bbjs-test@workspace:bbjs-test"
dependencies:
"@aztec/bb.js": "portal:../../ts"
"@aztec/bb.js": "portal:../../ts/bb.js"
"@typescript/native-preview": "npm:7.0.0-dev.20251126.1"
commander: "npm:^12.1.0"
languageName: unknown
Expand Down Expand Up @@ -1308,7 +1308,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "browser-test-app@workspace:browser-test-app"
dependencies:
"@aztec/bb.js": "portal:../../ts"
"@aztec/bb.js": "portal:../../ts/bb.js"
"@types/pako": "npm:^2.0.3"
html-webpack-plugin: "npm:^5.6.0"
pako: "npm:^2.1.0"
Expand Down
2 changes: 2 additions & 0 deletions barretenberg/cpp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ go*.tar.gz
barretenberg_modules.dot
barretenberg_modules.png
src/barretenberg/bb/config.hpp
src/barretenberg/avm/generated/
src/barretenberg/cdb/generated/
bench-out
*.bak
src/barretenberg/avm_fuzzer/corpus/**
Expand Down
2 changes: 2 additions & 0 deletions barretenberg/cpp/.rebuild_patterns
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
^barretenberg/cpp/.*\.(cpp|cc|cxx|c\+\+|h|hpp|hxx|h\+\+|c|h|inl|inc|ipp|tpp|cmake)$
^barretenberg/cpp/.*CMakeLists\.txt$
^barretenberg/cpp/.*Dockerfile.*$
^barretenberg/cpp/src/barretenberg/avm/avm_schema\.json$
^barretenberg/cpp/src/barretenberg/cdb/cdb_schema\.json$
^barretenberg/cpp/scripts/
^barretenberg/cpp/bootstrap.sh
^barretenberg/cpp/CMakePresets.json
2 changes: 1 addition & 1 deletion barretenberg/cpp/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ For bb.js, run:

```bash
barretenberg/cpp/scripts/chonk_inputs.sh download
barretenberg/ts/scripts/run_test.sh bbapi/chonk_pinned_inputs.test.js
barretenberg/ts/bb.js/scripts/run_test.sh bbapi/chonk_pinned_inputs.test.js
```

Typical workflow
Expand Down
9 changes: 5 additions & 4 deletions barretenberg/cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@
"CC": "$env{WASI_SDK_PREFIX}/bin/clang",
"CXX": "$env{WASI_SDK_PREFIX}/bin/clang++",
"CXXFLAGS": "-DBB_VERBOSE -fvisibility=hidden",
"LDFLAGS": "--no-wasm-opt",
"AR": "$env{WASI_SDK_PREFIX}/bin/llvm-ar",
"RANLIB": "$env{WASI_SDK_PREFIX}/bin/llvm-ranlib"
},
Expand Down Expand Up @@ -800,25 +801,25 @@
"name": "amd64-linux",
"configurePreset": "amd64-linux",
"inheritConfigureEnvironment": true,
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb"]
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb", "aztec-vm-sim"]
},
{
"name": "arm64-linux",
"configurePreset": "arm64-linux",
"inheritConfigureEnvironment": true,
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb"]
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb", "aztec-vm-sim"]
},
{
"name": "amd64-macos",
"configurePreset": "amd64-macos",
"inheritConfigureEnvironment": true,
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb"]
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb", "aztec-vm-sim"]
},
{
"name": "arm64-macos",
"configurePreset": "arm64-macos",
"inheritConfigureEnvironment": true,
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb"]
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb", "aztec-vm-sim"]
},
{
"name": "amd64-windows",
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/scripts/ci_update_chonk_inputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function verify_refreshed_inputs {
CHONK_PINNED_IVC_FLOW="$flow" CHONK_PINNED_IVC_FLOW_LIMIT=1 \
barretenberg/cpp/scripts/run_test.sh bbapi_tests ChonkPinnedIvcInputsTest.AllPinnedFlows
CHONK_PINNED_IVC_FLOW="$flow" CHONK_PINNED_IVC_FLOW_LIMIT=1 CHONK_PINNED_IVC_WASM_FLOW_LIMIT=1 \
barretenberg/ts/scripts/run_test.sh bbapi/chonk_pinned_inputs.test.js
barretenberg/ts/bb.js/scripts/run_test.sh bbapi/chonk_pinned_inputs.test.js
}

remove_pr_label "$refresh_label"
Expand Down
2 changes: 2 additions & 0 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ if(NOT FUZZING AND NOT WASM AND NOT BB_LITE)
add_subdirectory(barretenberg/ipc)
add_subdirectory(barretenberg/wsdb)
add_subdirectory(barretenberg/vm2_wsdb)
add_subdirectory(barretenberg/cdb)
add_subdirectory(barretenberg/avm)
add_subdirectory(barretenberg/nodejs_module)
endif()

Expand Down
68 changes: 68 additions & 0 deletions barretenberg/cpp/src/barretenberg/avm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
set(AVM_SCHEMA ${CMAKE_CURRENT_SOURCE_DIR}/avm_schema.json)
set(AVM_GEN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/generated)
set(AVM_GEN_OUTPUTS
${AVM_GEN_DIR}/avm_ipc_server.hpp
${AVM_GEN_DIR}/avm_types.hpp
${AVM_GEN_DIR}/ipc_codegen/msgpack_adaptor.hpp
${AVM_GEN_DIR}/ipc_codegen/msgpack_include.hpp
${AVM_GEN_DIR}/ipc_codegen/throw.hpp
)
set(IPC_CODEGEN_DIR ${CMAKE_SOURCE_DIR}/../../ipc-codegen)
file(GLOB_RECURSE IPC_CODEGEN_SRC
${IPC_CODEGEN_DIR}/src/*.ts
${IPC_CODEGEN_DIR}/templates/cpp/*.hpp
)
add_custom_command(
OUTPUT ${AVM_GEN_OUTPUTS}
COMMAND node --experimental-strip-types --experimental-transform-types --no-warnings
${IPC_CODEGEN_DIR}/src/generate.ts
--schema ${AVM_SCHEMA}
--lang cpp
--out ${AVM_GEN_DIR}
--server
--cpp-namespace bb::avm
--cpp-include-dir barretenberg/avm/generated
--prefix Avm
--strip-method-prefix
DEPENDS ${AVM_SCHEMA} ${IPC_CODEGEN_SRC}
COMMENT "Generating AVM IPC server from avm_schema.json"
VERBATIM
)
add_custom_target(avm_ipc_generated DEPENDS ${AVM_GEN_OUTPUTS})

add_executable(
aztec-vm-sim
main.cpp
cli.cpp
avm_execute.cpp
avm_ipc_server.cpp
)
add_dependencies(aztec-vm-sim avm_ipc_generated)
target_include_directories(
aztec-vm-sim
PRIVATE
${AVM_GEN_DIR}
)
target_link_libraries(
aztec-vm-sim
PRIVATE
barretenberg
vm2_sim
wsdb_ipc_merkle_db
wsdb_ipc_client
cdb_ipc_client
ipc_runtime
env
)
if(ENABLE_STACKTRACES)
target_link_libraries(
aztec-vm-sim
PUBLIC
Backward::Interface
)
target_link_options(
aztec-vm-sim
PRIVATE
-ldw -lelf
)
endif()
Loading