Repository navigation
Conversation
Ports aztec-packages labs patches 0016-0018 (AztecProtocol/aztec-packages#25876, #25878) onto v6, for an experiment only: - kv-store runs its browser store on @aztec-labs/kv-sqlite and gains a react-native export of @aztec-labs/kv-store/sqlite-opfs. - wallets resolves the embedded wallet's browser entry under React Native. - PXE_DATA_SCHEMA_VERSION goes to 17, so the PXE opens a fresh store. pins.mjs and the root resolutions take the kv-sqlite packages at v6's pin. No release publishes them yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Points the kv-sqlite resolutions at ../../aztec-packages-rn-parity, a checkout of AztecProtocol/aztec-packages cl/react-native, for a local experiment only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pins check maps only @aztec-foundation resolutions. kv-sqlite is an @aztec-labs package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
The React Native store needs only kv-sqlite and the sqlite-opfs react-native entry. Rebuilding the browser OPFS store on kv-sqlite's wasm build changed the multimap hash and forced a PXE re-sync, so this restores the v6 browser store. - Restore src/sqlite-opfs to v6 and delete opfs_files.ts. - Revert PXE_DATA_SCHEMA_VERSION to 16 and its compat snapshot. - Restore the indexeddb array and the shared array suite to v6. - Move sqlite3mc-wasm back to dependencies. Drop kv-sqlite-files. - Export the encryption and corruption errors of kv-sqlite from the react-native entry, because the kv-sqlite store throws those classes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elpers - kv-sqlite re-exports the v6 sqlite-opfs error classes, so the package has one SqliteEncryptionError and one SqliteCorruptionError again. - listStores and deletePoolDirectory are async, so a bad directory rejects as in the browser. The embedded wallet's corruption self-heal relies on `.catch` there. listStores lists only directories. - The duplicate-value array case runs on the kv-sqlite store only, because the v6 browser and IndexedDB arrays do not support it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Points the kv-sqlite portals at ../../aztec-packages-ipc-audit-fixes, a checkout of AztecProtocol/aztec-packages cl/ipc-audit-fixes at 1484720b69, for a local experiment only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kv-sqlite portals now point at the aztec-packages checkout of PR 25887 at 1385dc5bce, where kv-sqlite has no wasm module. The store tests run on the process and napi backends, and the docs no longer list wasm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The v6 sqlite-opfs store now sends its requests to a port. In a browser the port is the OPFS worker, as before. On React Native it is an adapter over op-sqlite, so the app runs the v6 store and containers unchanged. - The store takes the port from a connect function. Its open() keeps the pool lock, the quarantine and the worker. - The worker's import.meta moves behind #sqlite-worker, so Metro never parses it. - The schema and the encryption error mapping move to modules that the worker and the adapter share. - kv-sqlite, its containers and its portals are removed. op-sqlite is an optional peer dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The OPFS worker's wiring moves to connect_worker.ts, so the store's open() passes connectSqliteWorker and does not wire the worker itself. - The key checks become a function outside the class. - The op-sqlite adapter moves to op_sqlite_port.ts. react_native.ts keeps the store's entry and the data-directory helpers. - The test's op-sqlite stand-in moves to fake_op_sqlite.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The store now calls port.request(req) and awaits the response. The browser worker connector owns the request ids and pending map, and op-sqlite returns its responses directly instead of through a callback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
op-sqlite's native open reads encryptionKey as a string whenever the option is present, so passing undefined failed every unencrypted open on a device. The node:sqlite stand-in now rejects it the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Note
TL;DR Lets the v6 embedded wallet run inside a phone app by running its storage on the phone's own SQLite library. Browser wallets keep v6's storage and their data, and do not re-sync.
Experiment only. Do not merge.
This branch backports the labs side of AztecProtocol/aztec-packages#25878 (
@aztec-foundation/react-native) to v6, so the v6 embedded wallet runs in an app's Hermes. On React Native the wallet's storage runs the v6 browser store and containers unchanged, with their SQL on op-sqlite instead of an OPFS worker. It replaces the earlier approach, which reimplemented the store over the kv-sqlite C++ Kv service.Changes
sqlite-opfsstore sends each request to a port,SqlitePortinstore.ts, whoserequest(req)resolves with the response. In a browser,open()still takes the pool lock and runs the quarantine, then opens onconnectSqliteWorker(log)(connect_worker.ts). That port starts the OPFS worker and matches its replies to requests by id, as the store did before. That module sits behind the#sqlite-workerpackage import, whosereact-nativetarget is a stub, so Metro never parses the worker'simport.meta.sqlite-opfs/op_sqlite_port.tsanswers the same nine requests with op-sqlite.sqlite-opfs/react_native.tsopens the store on it and keeps the data-directory helpers. Thereact-nativeexport condition on@aztec-labs/kv-store/sqlite-opfs(and on#msgpackrand#ordered-binary) selects it, so the PXE and the embedded wallet open it unchanged. Each store is a database file in<app data dir>/kv-store/<pool directory>/. The port leaves out op-sqlite'sencryptionKeyoption for an unencrypted store, because op-sqlite's native open reads the option as a string whenever it is present, and an undefined key failed every unencrypted open on a device.@op-engineering/op-sqliteis an optional peer dependency (^19.0.5), and a pinned dev dependency for the tests. The app must list it in its own dependencies and set"op-sqlite": { "sqlcipher": true }in its package.json for encrypted stores../embeddedentry thereact-nativecondition.PXE_DATA_SCHEMA_VERSION(16) as in v6. Web wallets see no change and do not re-sync.kv-store/src/kv-sqlite/, the./kv-sqliteexport and theportal:links to an aztec-packages checkout. The lockfile differs from v6 only by op-sqlite.Differences from labs patches 0016–0018
listStores,deleteStore,deletePoolDirectory) are kept, but the store is v6's over op-sqlite rather than kv-sqlite over JSI. Encryption is SQLCipher rather than sqlite3mc's ChaCha20, so a database the kv-sqlite build encrypted does not open under this one.react-nativecondition): taken as is.Results
In
aztecprotocol/build:3.2(linux-arm64), at0abe6339af:older_version_compat,store_management, and the pool lock and integrity tests.node:sqlite(react-native/fake_op_sqlite.ts). The stand-in rejects anencryptionKeyoption that is not a string, as op-sqlite does: without the port fix, 65 of the 69 fail. Atc4018d60e2, breaking the adapter's blob conversion failed 32 of them.@aztec-labs/kv-store/sqlite-opfswith thereact-nativecondition has noimport.meta, no Worker and no sqlite3mc-wasm. Atc4018d60e2, the obsidion-wallet smoke build (aztec-labs-eng/obsidion-wallet#4421) bundled with Metro and compiled to Hermes bytecode.On a device, at
0abe6339af: a local build of the obsidion-wallet engine app (aztec-labs-eng/obsidion-wallet#4427) ran a token deploy, mint and private transfer on an iPhone 17 Pro against staging-v6, with the wallet on op-sqlite and proving in Hermes. It passed in 248.2s, of which 52.5s was outside waiting for blocks.Not yet run with op-sqlite: proof parity and the Hermes tests.
Known issues
node:sqlitestand-in, not on a device.exportDbthrows, and binding a bigint throws because op-sqlite cannot bind one. No container binds one.open()calls it.awaitinside a template literal atkey-store/src/key_store.ts:408. Release builds work.🤖 Generated with Claude Code