feat(ipc-runtime/ts): TS UDS transport package; migrate bb.js + codegen template#23498
Open
charlielye wants to merge 1 commit into
Open
feat(ipc-runtime/ts): TS UDS transport package; migrate bb.js + codegen template#23498charlielye wants to merge 1 commit into
charlielye wants to merge 1 commit into
Conversation
…gen template
New @aztec/ipc-runtime workspace package mirrors ipc-runtime/{rust,zig}:
- UdsIpcClient: pipelined async UDS client with connect retry. Wire
protocol (4-byte LE length prefix + msgpack payload) matches the C++
ipc::IpcServer socket transport, so any TS consumer talks to any
bb/wsdb-style server with no per-service framing code.
- UdsIpcServer: per-connection FIFO handler dispatch with the same wire.
- NapiShmSyncClient / NapiShmAsyncClient: thin wrappers around any NAPI
module exposing call(Buffer)/close(). The NAPI binding itself stays in
the consumer (bb.js's nodejs_module.node), so this package is
native-free.
ipc-codegen no longer ships templates/ts/ipc_{client,server}.ts. Both
were copy-pasted into every per-service generated/ directory and
duplicated the same length-prefix framing. The codegen still emits the
typed AsyncApi/SyncApi/Handler/dispatch wrappers; consumers provide the
transport.
Consumer migrations:
- ipc-codegen/examples/ts/echo: client + server now use UdsIpcClient /
UdsIpcServer directly with manual msgpack. All 18 cross-language
matrix tests (4x4 + 2 golden) pass.
- barretenberg/ts/src/bb_backends/node/native_socket.ts: the 365-LOC
hand-rolled UDS client (state machine, FIFO queue, connect retry)
collapses to ~115 LOC of bb-specific lifecycle (spawn, wait, kill)
delegating transport to UdsIpcClient.
Deferred: bb.js's native_shm.ts already routes through bb's existing
MsgpackClient NAPI (which itself wraps ipc::IpcClient), so SHM is
already runtime-backed — just not through this package's wrapper.
Migration to NapiShmSyncClient is mechanical and can land separately.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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
Stacked on #23497 (cl/ipc-bbapi-server-signals → cl/ipc-codegen-migrate-bb-wsdb).
New `@aztec/ipc-runtime` workspace package mirroring `ipc-runtime/{rust,zig}` — one TS UDS implementation shared by every consumer instead of the three near-identical copies we had:
Consumer migrations
Deferred
bb.js's `native_shm.ts` already goes through bb's NAPI `MsgpackClient`, which wraps `ipc::IpcClient` — so SHM is already runtime-backed, just not via this package's `NapiShmSyncClient` wrapper. Mechanical migration; can land separately.
Test plan