Skip to content

feat: @aztec-foundation/react-native, to run a labs PXE in a React Native app - #25878

Open
charlielye wants to merge 20 commits into
cl/kv-sqlitefrom
cl/react-native
Open

charlielye wants to merge 20 commits into
cl/kv-sqlitefrom
cl/react-native

Conversation

@charlielye

@charlielye charlielye commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Adds @aztec-foundation/react-native, so a React Native app can run a labs PXE or embedded wallet, bb.js and Noir. It sits on #25876 (kv-sqlite), which sits on #25728 (the ACVM package).

How an app uses it. It installs the package, wraps its Metro config in withAztec, and imports @aztec-foundation/react-native first in its entry file. The stack then runs as on the web (native-packages/react-native/README.md).

What runs where. Hermes has no WebAssembly and no workers, so the native code is linked into the app and reached through ipc-runtime's JSI binding (ipc-runtime/cpp/jsi; generated TS packages fall back to it in React Native):

  • bb: bb.js's react-native build calls the linked bb. The release prebuilds it per platform.
  • ACVM: @aztec-labs/acvm's crate is built as a static library for iOS and Android (make acvm-mobile). It is pure Rust there, using blake3's pure feature. withAztec resolves Noir's acvm_js and noirc_abi to js/noir/, which implements their API over the ACVM service: executions with foreign calls, witness (de)compression, and ABI encode/decode/error decoding.
  • PXE store: kv-sqlite is compiled into the module from the sources that scripts/vendor.sh copies from native-packages/kv-sqlite. SQLite's symbols are renamed so the app can link another SQLite. Labs patch 0017 gives @aztec-labs/kv-store/sqlite-opfs a react-native export with the browser store's API over AztecKvSqliteStore. Each store is a file in the app's data directory, in the browser's per-store layout. Patch 0018 resolves the embedded wallet's browser entry.

Release. @aztec-labs/acvm and @aztec-labs/kv-sqlite join the public and private release lists. They publish before the RN package, which depends on them.

Testing

  • make react-native-tests runs three suites under Hermes 0.88 in a test host:
    • the module's own, with kv-sqlite's encryption, wrong key and concurrency (11/11);
    • bb.js through JSI;
    • acvm_js/noirc_abi against Noir's own acvm_js and noirc_abi_wasm fixtures (11/11).
  • kv-store's new react_native.test.ts runs the RN store over node's backend, with the app's files stubbed (26/26).
  • Labs' token example (deploy, mint 333, private transfer 33, balances) was bundled by Metro with RN 0.88's config and withAztec. It passes under Hermes against a local network:
    • 27 s with fake proofs;
    • 61 s with real Chonk proofs. On the same busy machine, the previous design (noir-native and a raw SQLite FFI) took 64 s.
  • Not run here: device builds (iOS/Android). The ACVM static library builds for aarch64-linux-android and aarch64-apple-ios and exports its FFI.

🤖 Generated with Claude Code

https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb

charlielye and others added 5 commits November 19, 2026 15:44
…tive app

Hermes has no WebAssembly and no workers, so a service runs in a React Native app as its native
library, linked in, and its JavaScript client reaches it through JSI:

- ipc-runtime/cpp/jsi: `__ipcRuntimeJsi.createInstance(ffiName)` (an instance on a thread of its
  own; call() returns a promise) and `createInstanceSync` (on the JavaScript thread). Host calls
  are answered by JavaScript, asynchronously for an asynchronous instance while its thread waits.
  A library is found by its FFI name: registered by the app (statically linked), else dlopened.
- ipc-runtime/ts: the `react-native` entry, with the JSI backends (jsi.ts).
- ipc-codegen: the generated TS packages choose the JSI backends under React Native.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb
bb.js's "react-native" entry (dest/react-native) runs bb as the native library the app links,
through ipc-runtime's JSI binding (BackendType.Jsi, the in-process backend there instead of
Wasm). The CRS is downloaded with XMLHttpRequest and cached in the app's data directory, under
the file names bb uses in node, and random bytes come from crypto.getRandomValues. bb.js's
bootstrap builds it with the other outputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb
…tive app

Hermes has no WebAssembly and no workers, so the package links the client
stack's native code into the app and reaches it through ipc-runtime's JSI
binding:

- bb, for bb.js (prebuilt per platform by the release);
- the ACVM (@aztec-labs/acvm's crate as a static library: `make acvm-mobile`,
  pure Rust there, blake3 included). withAztec resolves Noir's acvm_js and
  noirc_abi to js/noir, their API over the ACVM service;
- kv-sqlite, the PXE's store, compiled into the module from the sources
  scripts/vendor.sh copies from native-packages/kv-sqlite, with SQLite's
  symbols renamed. Labs' kv-store resolves its browser store to it under
  React Native (labs patch 0017), and the wallets their browser entry (0018).

The tests run in a host program over Hermes, as an app does: the module's own
with kv-sqlite's, bb.js's, and acvm_js's and noirc_abi's against Noir's own
fixtures. acvm and kv-sqlite join the release, ahead of the package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb
@socket-security

socket-security Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

@charlielye
charlielye marked this pull request as ready for review November 19, 2026 16:14
…ackage

Its node_modules portal to @aztec-labs/acvm's and kv-sqlite's TS packages,
which their builds generate; on a fresh checkout `yarn install --immutable`
found no manifest there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb
charlielye and others added 3 commits November 21, 2026 14:37
A library that exports the asynchronous FFI runs under JSI as an asynchronous
instance on its service thread, its host calls answered by JS promises, so a
handler awaiting one keeps the instance serving (a Brillig foreign call that
re-enters the caller, for one). A library without it keeps the blocking
instance. The Hermes echo test nests relays on one instance and checks an
unbound target's message; the test host's event loop outlives main, since a
service thread may still post to it after a failed test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb
…1990 KB

#25878's browser kv-store already had it at 1964.07 KB on CI, over the 1960 KB
limit, and ipc-runtime's asynchronous instances take it to 1965.87 KB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DSxF9AgGYcAcCTjXEeJT4L
@AztecBot

Copy link
Copy Markdown
Collaborator

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/973572787e9968b3�973572787e9968b38;;�): cd labs && export root= ci3= && ANVIL_HARDFORK=amsterdam  yarn-project/end-to-end/scripts/run_test.sh simple src/multi-node/rewards/registry_reduction_calculator.test.ts (287s) (code: 0) group:e2e-p2p-epoch-flakes

@charlielye
charlielye removed this pull request from stack #25889 November 30, 2026 13:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants