feat: aztec-wsdb binary and IPC supporting code (inert)#23035
Merged
Conversation
Lays the groundwork for moving world state out of the Node.js process into a standalone aztec-wsdb binary that communicates over UDS or shared memory. This PR is inert: nothing yet uses the new binary. C++: - aztec-wsdb binary (barretenberg/cpp/src/barretenberg/wsdb/) — runs the world state DB as an IPC server, exposes the same WorldState surface over msgpack - wsdb_client library (barretenberg/cpp/src/barretenberg/wsdb_client/) — LowLevelMerkleDBInterface impl over WSDB IPC; lets the AVM simulator talk to a standalone aztec-wsdb instead of in-process - ipc/ — adds MPSC shared-memory transport for lower latency TypeScript (bb.js): - aztec-wsdb/ — WsdbBackend that spawns the binary and routes msgpack commands via a generated AsyncApi - cbind/cpp_codegen.ts — C++ codegen used by aztec-wsdb's generate.ts; small shared updates to schema_visitor / typescript_codegen / rust_codegen yarn-project: - world-state/src/native/ipc_world_state_instance.ts — IpcWorldState implements NativeWorldStateInstance over WSDB IPC. Not yet wired in. A follow-up PR cuts the NAPI AVM and TS world state over to use this.
ipc_world_state_instance.ts imports from @aztec/bb.js/aztec-wsdb and msgpackr but the package didn't declare them — caused import-x/no-extraneous-dependencies lint failures in CI.
NativeWorldStateService.tmp/.new resolves the binary via findWsdbBinary() which looks at <bb.js packageRoot>/build/<platform>/ aztec-wsdb. copy_native.sh was only copying bb and nodejs_module.node, so consumers (e.g. world-state) hit "aztec-wsdb binary not found" at runtime. Mirror the existing bb copy.
ludamad
approved these changes
May 8, 2026
Collaborator
ludamad
left a comment
There was a problem hiding this comment.
I did a skim. The patterns are familiar enough. I didn't read super deeply though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the standalone
aztec-wsdbbinary plus all supporting code (C++ client library, TS spawner, IPC adapter) needed to move world state out of the Node.js process. This PR is inert: nothing yet uses the new binary. A follow-up PR (cl/ipc-3-avm-wsdb-cutover) will cut the NAPI AVM and the TS world state over to use it.What's added
C++:
barretenberg/cpp/src/barretenberg/wsdb/— `aztec-wsdb` standalone binary that runs the world state DB as an IPC server. Same WorldState surface as the in-process NAPI module, but exposed over msgpack via UDS or shared memory.barretenberg/cpp/src/barretenberg/wsdb_client/— `WsdbIpcMerkleDB` implements `LowLevelMerkleDBInterface` over WSDB IPC. The standalone AVM (or NAPI AVM after cutover) will use this in place of an in-process `WorldState` reference.barretenberg/cpp/src/barretenberg/ipc/mpsc_shm_{client,server}.hpp— multi-producer single-consumer shared-memory transport. Lower latency than UDS for the AVM↔WSDB hop.TypeScript (bb.js):
barretenberg/ts/src/aztec-wsdb/— `WsdbBackend` spawns the `aztec-wsdb` binary and routes msgpack commands via the generated `AsyncApi`. Implements `IMsgpackBackendAsync`.barretenberg/ts/src/cbind/cpp_codegen.ts— C++ codegen used by `aztec-wsdb`'s `generate.ts` to produce `wsdb_ipc_client_generated.{cpp,hpp}`. Small shared updates to `schema_visitor` / `typescript_codegen` / `rust_codegen`.yarn-project:
yarn-project/world-state/src/native/ipc_world_state_instance.ts— `IpcWorldState` implements `NativeWorldStateInstance` over WSDB IPC. Not yet wired in.Why split this way
The full WSDB-out-of-process cutover involves rewiring the NAPI AVM (which currently dereferences an in-process `WorldState*` pointer) to talk to `aztec-wsdb` over IPC, plus replacing TS NAPI WorldState with `IpcWorldState` everywhere it's used. This PR keeps the diff bounded by landing the binary and supporting code first; the cutover lands separately and should be a tiny diff.
Verification
aztec-wsdbbuilds: `cd barretenberg/cpp/build && ninja aztec-wsdb`Stack
This is part of a stack splitting up #21331. Plan: `/mnt/user-data/charlie/.claude/plans/glittery-snuggling-horizon.md`.