Skip to content

feat: AVM cutover — delete NAPI AVM, wire IPC simulator pool + CDB IPC server [PR 3b]#23697

Open
charlielye wants to merge 25 commits into
cl/ipc-4-avm-binaryfrom
cl/ipc-5-avm-cutover
Open

feat: AVM cutover — delete NAPI AVM, wire IPC simulator pool + CDB IPC server [PR 3b]#23697
charlielye wants to merge 25 commits into
cl/ipc-4-avm-binaryfrom
cl/ipc-5-avm-cutover

Conversation

@charlielye

@charlielye charlielye commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Cuts the simulator from the in-process NAPI AVM to the standalone aztec-avm service introduced in #23084. Contract data callbacks are served by the TS-hosted CdbIpcServer, and world-state access goes through the generated wsdb package/service from the lower stack.

This is the top PR in the current IPC stack.

Stack

  1. feat(ipc): add /ipc-codegen and /ipc-runtime foundation packages #23610 cl/ipc-foundation
  2. refactor(wsdb): migrate aztec-wsdb to ipc-codegen + ipc-runtime #23611 cl/ipc-wsdb-migrate
  3. refactor(bbapi): migrate bb binary to ipc-codegen + ipc-runtime #23612 cl/ipc-bb-migrate
  4. refactor(barretenberg-rs): migrate to ipc-codegen + ipc-runtime; drop PipeBackend #23613 cl/ipc-bb-rs-migrate
  5. refactor(bb.js): migrate to ipc-codegen + ipc-runtime; delete legacy bb::ipc #23614 cl/ipc-bb-js-migrate
  6. refactor: cut TS world state and NAPI AVM over to WSDB IPC; delete NAPI WSDB #23036 cl/ipc-3-avm-wsdb-cutover
  7. feat: add aztec-avm + aztec-cdb binaries and IPC supporting code (inert) #23084 cl/ipc-4-avm-binary
  8. feat: AVM cutover — delete NAPI AVM, wire IPC simulator pool + CDB IPC server [PR 3b] #23697 cl/ipc-5-avm-cutover — this PR

What changes

Deletes NAPI AVM

  • Deletes barretenberg/cpp/src/barretenberg/nodejs_module/avm_simulate/.
  • Removes AVM simulation exports from nodejs_module / @aztec/native.
  • Leaves nodejs_module focused on the remaining native pieces that still belong there.

Rewires simulator and node/prover paths

  • CppPublicTxSimulator drives an AvmIpcBackend backed by AvmSimulatorPool.
  • AvmSimulatorPool owns AvmBackend instances and uses explicit async disposal.
  • CdbIpcServer serves contract data to standalone aztec-avm.
  • aztec-node, validator, prover-node, and TXE startup paths create and clean up wsdb/avm/cdb resources explicitly.
  • Tests that own proving/simulator fixtures now close those resources instead of relying on process exit.

Cleanup and test alignment

  • Replaces cpp_vs_ts_public_tx_simulator with ipc_vs_ts_public_tx_simulator.
  • Removes tests that only covered the old in-process AVM/world-state race.
  • Keeps generated CDB/AVM client usage aligned with the lower codegen changes.

Validation

  • yarn-project/yarn install --immutable passed on lower cutover branch after generated package lock updates.
  • Root ./bootstrap.sh passed on this branch during stack validation.
  • Follow-up CI should exercise the full top-of-stack e2e surface: block building, AVM simulator, prover-node, validator, TXE.

@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 1c8d4f9 to a4e2e70 Compare May 29, 2026 14:19
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 6867e96 to 65f9aed Compare May 30, 2026 13:39
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from a4e2e70 to 0df283e Compare May 30, 2026 13:39
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 65f9aed to 47b1d3b Compare May 30, 2026 16:57
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 0df283e to 42d8d4f Compare May 30, 2026 16:57
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 47b1d3b to 43f900d Compare May 30, 2026 18:30
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 42d8d4f to 7f602eb Compare May 30, 2026 18:30
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 43f900d to 85b52b4 Compare May 30, 2026 22:27
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 7f602eb to 498b1ca Compare May 30, 2026 22:27
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 85b52b4 to fac9421 Compare May 31, 2026 13:23
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 498b1ca to 4597920 Compare May 31, 2026 13:23
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from fac9421 to 8b51cfa Compare June 1, 2026 09:48
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 4597920 to 4a53618 Compare June 1, 2026 09:48
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 8b51cfa to cbffb29 Compare June 1, 2026 11:39
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch 2 times, most recently from af3dc85 to 8cc9db5 Compare June 1, 2026 11:54
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch 2 times, most recently from a9908cb to 665dc82 Compare June 1, 2026 15:35
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 8cc9db5 to 3fe908c Compare June 1, 2026 15:54
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 665dc82 to 77496a4 Compare June 1, 2026 22:39
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch 2 times, most recently from 1ea909f to e7f5dc1 Compare June 2, 2026 15:45
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 77496a4 to 8b2448a Compare June 2, 2026 15:45
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 2358098 to b248948 Compare June 2, 2026 16:28
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 8de6b5d to 389063c Compare June 2, 2026 17:19
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from b248948 to 9835c8c Compare June 2, 2026 17:26
@charlielye charlielye added the ci-full Run all master checks. label Jun 4, 2026
…C server

Replaces the in-process NAPI AVM with the standalone aztec-avm binary
(spawned via AvmBackend from PR 3a) and a TS-hosted CdbIpcServer for the
contract data callbacks.

Stacked on top of PR 2b (cl/ipc-3-avm-wsdb-cutover, #23036) and PR 3a
(cl/ipc-4-avm-binary, #23084).
…rretenberg

The link line was reduced to `barretenberg ipc` when stripping the NAPI AVM,
but LMDBStore is still exported from nodejs_module and needs LMDB symbols
(mdb_cursor_open etc). The all-in-one barretenberg archive does not pull in
LMDB. world_state does (it owns the LMDB tree storage), and since LMDBStore
itself is the only thing in nodejs_module that needs LMDB, depending on
world_state is the right fit. Mirrors cl/wsdb_cdb.
PublicContractsDB.addContracts() was tightened on next to take typed
ContractInstanceWithAddress[]; addContractsFromLogs() takes the
ContractDeploymentData wrapper and parses the logs internally.
…vmIpcBackend to pool

Collapses the inline 'find aztec-avm + construct AvmBackend' ceremony at 10 call
sites into the AvmSimulatorPool.spawn() factory added in the prior commit on 3a.
Each site drops from ~16 lines to ~3.

Also moves the AvmIpcBackend interface definition to avm_simulator_pool.ts
(its canonical home) and updates importers to point there.
…convert inline type imports

avm_proving_tester.ts was refactored to call AvmSimulatorPool.spawn() but
the import wasn't added. cpp_public_tx_simulator.ts had inline 'type'
markers in a named import that lint requires to be 'import type'.
…ing IPC bug)

Token::mint_to_private public dispatch fails on the out-of-process aztec-avm
path with a full l2Gas burn and empty error stack — the AVM reports OOG with
revertCode=1 but functionErrorStack=[] and revertData=[], inconsistent with
real gas exhaustion (also only 41ms wall time). Reproduces deterministically
on cl/ipc-5-avm-cutover since 2026-05-11; passes on cl/ipc-3-avm-wsdb-cutover
(NAPI AVM still in place). Needs AVM-team investigation of the subprocess's
partial_note.complete dispatch. Skipping here so the IPC PR stack can land
while the underlying issue is fixed separately.
All e2e_fees tests share applyFundAliceWithBananas() in beforeAll, which
calls Token::mint_to_private — the same code path that fails deterministically
on the AVM IPC cutover. Skipping the whole directory instead of one-by-one.
… fork's current state

The AVM IPC subprocess was constructing its WorldStateRevision with blockNumber=0
both on the TS side (cpp_public_tx_simulator.ts) and on the C++ side
(avm_execute.cpp). With the WSDB cutover that made block 0 a first-class
historical block, blockNumber=0 makes the WSDB walk the empty genesis tree
instead of the fork's current state. Any leaf added in-fork (contracts deployed
by an earlier tx in the same block, nullifiers, public data writes) becomes
invisible to the AVM, surfacing as 'Failed to find leaf hash for root of block 0'
on the merkle-db side or 'Contract X is not deployed' / silent OOG on the AVM
side depending on the path.

Use LATEST (uint32 max) on both sides so the WSDB routes through its
non-historical path and includeUncommitted=true actually consults uncommitted
state.

Repro and verification: 'yarn test src/public/public_processor/apps_tests/deployments.test.ts'
went from 0 → 6 passing tests with this fix (covering deploy-and-call patterns
on both TS and Cpp simulators).
The b819b71 refactor of getPackageVersion() (May 5) on next changed
the function to read from package.json and substitute 'dev' for the
0.1.0 monorepo placeholder, instead of reading the
release-please-manifest.json target. The corresponding test update was
lost in a merge conflict during the AVM cutover work, leaving this
branch with the old test that expects the manifest's '5.0.0' target.
Restoring the merge-train/spartan version of the test.
The third describe block in custom_bc.test.ts created a PublicTxSimulationTester
(owns AvmSimulatorPool + CdbIpcServer) per test but only closed worldStateService
in afterEach, leaking the AVM pool and CDB server each iteration. Jest could not
exit after the suite completed and was killed at the 600s CI timeout.

Add the missing tester.close() to match the other two describe blocks.
…erEach

Same teardown leak as in simulator/.../apps_tests/custom_bc.test.ts:
the third describe block's afterEach was missing await tester.close(),
leaving the AvmProvingTester (which spawns an AvmSimulatorPool + CdbIpcServer)
alive. Jest could not exit after the suite completed and was killed at the
600s CI timeout.
@charlielye charlielye force-pushed the cl/ipc-4-avm-binary branch from 62d51d9 to cfc6ad9 Compare June 10, 2026 14:11
@charlielye charlielye force-pushed the cl/ipc-5-avm-cutover branch from 242ae5a to a5fddf3 Compare June 10, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant