Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
db701d8
fix: canonicalize root-workspace position in yarn-project/yarn.lock
charlielye Jun 25, 2026
5ef7d58
refactor: extract wsdb server + world_state + persistent merkle to na…
charlielye Jun 25, 2026
921c725
build: standalone aztec-wsdb build wired against prebuilt barretenberg
charlielye Jun 25, 2026
fd1591f
refactor: merge wsdb client into vm2_wsdb
charlielye Jun 25, 2026
5c5db8b
fix: give native-packages wsdb server its own wire-convert-client copy
charlielye Jun 25, 2026
4e35232
fix: make standalone wsdb cpp build self-contained for third-party deps
charlielye Jun 25, 2026
a677ee1
fix: wsdb standalone libc++ link + repoint yarn-project wsdb portal
charlielye Jun 25, 2026
0722441
refactor: tidy native-packages/wsdb cpp layout
charlielye Jun 26, 2026
a44c3b1
fix: repoint release-image/aztec-up wsdb references to native-packages
charlielye Jun 26, 2026
867ccdb
fix: statically link libc++ in standalone aztec-wsdb
charlielye Jun 26, 2026
81b5b8e
refactor: extract lmdblib + kvdb (kv-store NAPI) out of barretenberg
charlielye Jun 27, 2026
d83a271
refactor: make lmdblib + kvdb fully barretenberg-free
charlielye Jun 28, 2026
58d32a8
fix: create kvdb arch workspace packages before yarn install
charlielye Jun 28, 2026
d227dae
fix: drop aztec-wsdb from bb cross-build preset targets
charlielye Jun 28, 2026
94f4739
fix: build native-packages Release/NDEBUG to match barretenberg (ODR)
charlielye Jun 28, 2026
fc81f79
fix: serialise wsdb node-delete key as canonical uint256
charlielye Jun 28, 2026
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
19 changes: 14 additions & 5 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 bb-avm-sim
.PHONY: noir barretenberg noir-projects l1-contracts release-image boxes playground docs aztec-up spartan lmdblib kvdb wsdb bb-avm-sim

#==============================================================================
# BOOTSTRAP TARGETS
Expand Down Expand Up @@ -321,11 +321,20 @@ ipc-runtime-cross-arm64-macos:
ipc-runtime-cross: ipc-runtime ipc-runtime-cross-arm64-linux ipc-runtime-cross-amd64-macos ipc-runtime-cross-arm64-macos

#==============================================================================
# WSDB
# Native packages (lmdblib, kvdb, wsdb)
#==============================================================================

wsdb: ipc-codegen ipc-runtime bb-cpp-native
$(call build,$@,wsdb)
# lmdblib and kvdb are barretenberg-free: they build against their own deps
# (lmdb, msgpack-c, node-addon-api) only, never bb.
.PHONY: lmdblib kvdb
lmdblib:
$(call build,$@,native-packages/lmdblib)

kvdb: lmdblib
$(call build,$@,native-packages/kvdb)

wsdb: ipc-codegen ipc-runtime bb-cpp-native lmdblib
$(call build,$@,native-packages/wsdb)

#==============================================================================
# .claude tooling
Expand Down Expand Up @@ -393,7 +402,7 @@ l1-contracts-tests: l1-contracts-verifier
# Yarn Project - TypeScript monorepo with all TS packages
#==============================================================================

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

yarn-project-tests: yarn-project
Expand Down
14 changes: 11 additions & 3 deletions aztec-up/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#!/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) $(../barretenberg/ts/bootstrap.sh hash) $(../yarn-project/bootstrap.sh hash))
hash=$(hash_str $(cache_content_hash ^aztec-up/) $(../ipc-runtime/bootstrap.sh hash) $(../native-packages/kvdb/bootstrap.sh hash) $(../native-packages/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}

function wsdb_package_dirs {
for package_dir in "$root"/wsdb/ts/packages/*; do
for package_dir in "$root"/native-packages/wsdb/ts/packages/*; do
[ -d "$package_dir" ] && echo "$package_dir"
done
echo "$root/wsdb/ts"
echo "$root/native-packages/wsdb/ts"
}

function kvdb_package_dirs {
for package_dir in "$root"/native-packages/kvdb/ts/packages/*; do
[ -d "$package_dir" ] && echo "$package_dir"
done
echo "$root/native-packages/kvdb/ts"
}

function barretenberg_ts_package_dirs {
Expand Down Expand Up @@ -117,6 +124,7 @@ EOF
echo $root/ipc-runtime/ts
barretenberg_ts_package_dirs
wsdb_package_dirs
kvdb_package_dirs
$root/noir/bootstrap.sh get_projects
$root/yarn-project/bootstrap.sh get_projects
} | DRY_RUN= parallel --tag --line-buffer --halt now,fail=1 "retry 'cd {} && dump_fail \"deploy_npm $version\" >/dev/null'"
Expand Down
4 changes: 2 additions & 2 deletions barretenberg/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ project(
# === Platform Guard Reference ===
# __wasm__ : Compiler-defined for WebAssembly. Guards threading, file I/O, networking.
# _WIN32 : Compiler-defined for Windows. Guards POSIX APIs (mmap, signals, IPC).
# BB_LITE : CMake option. Excludes server-side subsystems (lmdb, world_state, ipc, nodejs_module).
# BB_LITE : CMake option. Excludes server-side subsystems (ipc, vm2_wsdb, cdb, avm).
# Enabled for: iOS, Android, Windows cross-compiles.
# WASM : CMake variable mirroring __wasm__ for CMake-level logic.

Expand Down Expand Up @@ -45,7 +45,7 @@ option(ENABLE_PIC "Builds with position independent code" OFF)
option(SYNTAX_ONLY "only check syntax (-fsyntax-only)" OFF)
option(ENABLE_WASM_BENCH "Enable BB_BENCH benchmarking support in WASM builds (dev only, not for releases)" OFF)
option(AVM "enable building of vm2 module and bb-avm" ON)
option(BB_LITE "Exclude server-side subsystems: lmdb, world_state, ipc, nodejs_module" OFF)
option(BB_LITE "Exclude server-side subsystems: ipc, vm2_wsdb, cdb, avm" OFF)

if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
message(STATUS "Compiling for ARM.")
Expand Down
8 changes: 4 additions & 4 deletions barretenberg/cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -801,25 +801,25 @@
"name": "amd64-linux",
"configurePreset": "amd64-linux",
"inheritConfigureEnvironment": true,
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb", "bb-avm-sim"]
"targets": ["bb", "nodejs_module", "bb-external", "bb-avm-sim"]
},
{
"name": "arm64-linux",
"configurePreset": "arm64-linux",
"inheritConfigureEnvironment": true,
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb", "bb-avm-sim"]
"targets": ["bb", "nodejs_module", "bb-external", "bb-avm-sim"]
},
{
"name": "amd64-macos",
"configurePreset": "amd64-macos",
"inheritConfigureEnvironment": true,
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb", "bb-avm-sim"]
"targets": ["bb", "nodejs_module", "bb-external", "bb-avm-sim"]
},
{
"name": "arm64-macos",
"configurePreset": "arm64-macos",
"inheritConfigureEnvironment": true,
"targets": ["bb", "nodejs_module", "bb-external", "aztec-wsdb", "bb-avm-sim"]
"targets": ["bb", "nodejs_module", "bb-external", "bb-avm-sim"]
},
{
"name": "amd64-windows",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Note: Paths relative to `aztec-packages/barretenberg/cpp/src/barretenberg`
### Node Store (Cache + Metadata)
8. `crypto/merkle_tree/node_store/cached_content_addressed_tree_store.hpp`
9. `crypto/merkle_tree/node_store/content_addressed_cache.hpp`
10. `crypto/merkle_tree/node_store/tree_meta.hpp`
10. `crypto/merkle_tree/tree_meta.hpp`

### Append-Only Tree
11. `crypto/merkle_tree/append_only_tree/content_addressed_append_only_tree.hpp`

### Indexed Tree
12. `crypto/merkle_tree/indexed_tree/content_addressed_indexed_tree.hpp`
13. `crypto/merkle_tree/indexed_tree/indexed_leaf.hpp`
13. `crypto/merkle_tree/indexed_leaf.hpp`

## Summary of Module

Expand Down
16 changes: 4 additions & 12 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,17 @@ add_subdirectory(barretenberg/ultra_honk)
add_subdirectory(barretenberg/vm2_stub)
add_subdirectory(barretenberg/wasi)

if(NOT BB_LITE)
add_subdirectory(barretenberg/lmdblib)
endif()

if(NOT FUZZING AND NOT WASM AND NOT BB_LITE)
# Fuzzing preset cannot be built with world_state as world_state cannot compile with MULTITHREADING=OFF
# Mobile builds exclude these modules that require LMDB or aren't needed on mobile
# Mobile builds exclude these modules that aren't needed on mobile
add_subdirectory(barretenberg/aztec)
add_subdirectory(barretenberg/world_state)
# NOTE: Do not conditionally base this on the AVM flag as it defines a necessary vm2_sim library.
add_subdirectory(barretenberg/vm2)
add_subdirectory(barretenberg/ipc)
add_subdirectory(barretenberg/wsdb)
add_subdirectory(barretenberg/vm2_wsdb)
add_subdirectory(barretenberg/cdb)
add_subdirectory(barretenberg/avm)
# nodejs_module hosts only the msgpack_client NAPI wrappers now (bb.js's SHM
# transport). The lmdb_store kv-store NAPI moved to native-packages/kvdb.
add_subdirectory(barretenberg/nodejs_module)
endif()

Expand All @@ -146,7 +141,6 @@ if(FUZZING_AVM)
if(FUZZING)
# Only add these if they weren't added above (when NOT FUZZING AND NOT WASM)
add_subdirectory(barretenberg/aztec)
add_subdirectory(barretenberg/world_state)
add_subdirectory(barretenberg/vm2)
endif()
add_subdirectory(barretenberg/avm_fuzzer)
Expand Down Expand Up @@ -215,11 +209,9 @@ set(BARRETENBERG_TARGET_OBJECTS
set(BB_EXTERNAL_TARGET_OBJECTS ${BARRETENBERG_TARGET_OBJECTS})

if(NOT WASM AND NOT FUZZING AND NOT BB_LITE)
# enable merkle trees and lmdb (not for mobile builds)
# enable merkle trees (not for mobile builds)
list(APPEND BARRETENBERG_TARGET_OBJECTS $<TARGET_OBJECTS:crypto_merkle_tree_objects>)
list(APPEND BARRETENBERG_TARGET_OBJECTS $<TARGET_OBJECTS:lmdblib_objects>)
list(APPEND BARRETENBERG_TARGET_OBJECTS $<TARGET_OBJECTS:api_objects>)
list(APPEND BARRETENBERG_TARGET_OBJECTS $<TARGET_OBJECTS:world_state_objects>)
endif()

add_library(
Expand Down
1 change: 0 additions & 1 deletion barretenberg/cpp/src/barretenberg/avm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ target_link_libraries(
barretenberg
vm2_sim
wsdb_ipc_merkle_db
wsdb_ipc_client
cdb_ipc_client
ipc_runtime
env
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/avm/avm_execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace bb::avm {

using namespace bb::avm2;
using namespace bb::world_state;
using bb::crypto::merkle_tree::WorldStateRevision;

// Cancellation for the single in-flight simulation. bb-avm-sim runs exactly one
// simulation at a time; the SIGUSR1 handler (which may run on any thread) cancels
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/avm/avm_execute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "barretenberg/avm/generated/avm_ipc_server.hpp"
#include "barretenberg/cdb/cdb_ipc_client.hpp"
#include "barretenberg/vm2/simulation/lib/cancellation_token.hpp"
#include "barretenberg/wsdb/generated/wsdb_ipc_client.hpp"
#include "barretenberg/vm2_wsdb/generated/wsdb_ipc_client.hpp"

#include <atomic>

Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/avm/avm_ipc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "barretenberg/avm/avm_execute.hpp"
#include "barretenberg/cdb/cdb_ipc_client.hpp"
#include "barretenberg/common/log.hpp"
#include "barretenberg/wsdb/generated/wsdb_ipc_client.hpp"
#include "barretenberg/vm2_wsdb/generated/wsdb_ipc_client.hpp"
#include "ipc_runtime/ipc_server.hpp"
#include "ipc_runtime/serve_helper.hpp"
#include "ipc_runtime/signal_handlers.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "barretenberg/avm_fuzzer/fuzz_lib/constants.hpp"
#include "barretenberg/aztec/aztec_constants.hpp"
#include "barretenberg/common/throw_or_abort.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/poseidon2/poseidon2.hpp"
#include "barretenberg/vm2/common/aztec_types.hpp"
#include "barretenberg/vm2/simulation/lib/contract_crypto.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <memory>
#include <stack>

#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_leaf.hpp"
#include "barretenberg/vm2/common/aztec_types.hpp"
#include "barretenberg/vm2/simulation/interfaces/db.hpp"
#include "barretenberg/vm2/simulation/lib/memory_merkle_db.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "barretenberg/avm_fuzzer/common/interfaces/dbs.hpp"
#include "barretenberg/avm_fuzzer/common/process.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_leaf.hpp"
#include "barretenberg/vm2/common/avm_io.hpp"
#include "barretenberg/vm2/common/aztec_types.hpp"
#include "barretenberg/vm2/common/field.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "barretenberg/avm_fuzzer/fuzz_lib/simulator.hpp"
#include "barretenberg/avm_fuzzer/mutations/bytecode.hpp"
#include "barretenberg/avm_fuzzer/mutations/tx_data.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_leaf.hpp"
#include "barretenberg/serialize/msgpack_impl.hpp"
#include "barretenberg/vm2/common/avm_io.hpp"
#include "barretenberg/vm2/common/aztec_types.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_leaf.hpp"
#include "barretenberg/vm2/common/aztec_types.hpp"
#include <random>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "barretenberg/aztec/aztec_constants.hpp"
#include "barretenberg/crypto/merkle_tree/hash.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_leaf.hpp"

namespace bb::aztec {

Expand Down
2 changes: 0 additions & 2 deletions barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ add_subdirectory(relations_bench)
add_subdirectory(sumcheck_bench)
add_subdirectory(translator_bench)
add_subdirectory(poseidon2_bench)
add_subdirectory(indexed_tree_bench)
add_subdirectory(append_only_tree_bench)
add_subdirectory(ultra_bench)
add_subdirectory(circuit_construction_bench)

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# merkle tree is agnostic to hash function
barretenberg_module(
crypto_merkle_tree
lmdblib
)
# Need -fPIC because it's linked into the nodejs_module shared library
set_target_properties(crypto_merkle_tree_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand Down
41 changes: 2 additions & 39 deletions barretenberg/cpp/src/barretenberg/crypto/merkle_tree/response.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
#pragma once

#include "barretenberg/crypto/merkle_tree/hash_path.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/lmdb_store/lmdb_tree_store.hpp"
#include "barretenberg/crypto/merkle_tree/node_store/tree_meta.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/tree_meta.hpp"
#include "barretenberg/crypto/merkle_tree/types.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/serialize/msgpack.hpp"
Expand Down Expand Up @@ -218,42 +217,6 @@ struct GetLowIndexedLeafResponse {
}
};

struct CommitResponse {
TreeMeta meta;
TreeDBStats stats;

CommitResponse() = default;
~CommitResponse() = default;
CommitResponse(const CommitResponse& other) = default;
CommitResponse(CommitResponse&& other) noexcept = default;
CommitResponse& operator=(const CommitResponse& other) = default;
CommitResponse& operator=(CommitResponse&& other) noexcept = default;
};

struct UnwindResponse {
TreeMeta meta;
TreeDBStats stats;

UnwindResponse() = default;
~UnwindResponse() = default;
UnwindResponse(const UnwindResponse& other) = default;
UnwindResponse(UnwindResponse&& other) noexcept = default;
UnwindResponse& operator=(const UnwindResponse& other) = default;
UnwindResponse& operator=(UnwindResponse&& other) noexcept = default;
};

struct RemoveHistoricResponse {
TreeMeta meta;
TreeDBStats stats;

RemoveHistoricResponse() = default;
~RemoveHistoricResponse() = default;
RemoveHistoricResponse(const RemoveHistoricResponse& other) = default;
RemoveHistoricResponse(RemoveHistoricResponse&& other) noexcept = default;
RemoveHistoricResponse& operator=(const RemoveHistoricResponse& other) = default;
RemoveHistoricResponse& operator=(RemoveHistoricResponse&& other) noexcept = default;
};

template <typename ResponseType> struct TypedResponse {
ResponseType inner;
bool success{ true };
Expand Down
Loading
Loading