Skip to content

feat: make sqlite the path of least resistance backend option for PXE and wallet#24179

Merged
mverzilli merged 13 commits into
merge-train/fairies-v5from
martin/f-716-make-sqlite-the-path-of-least-resistance-backend-option-for
Jun 29, 2026
Merged

feat: make sqlite the path of least resistance backend option for PXE and wallet#24179
mverzilli merged 13 commits into
merge-train/fairies-v5from
martin/f-716-make-sqlite-the-path-of-least-resistance-backend-option-for

Conversation

@mverzilli

Copy link
Copy Markdown
Contributor

Closes F-716

@mverzilli mverzilli changed the base branch from next to merge-train/fairies-v5 June 18, 2026 12:28
@mverzilli mverzilli requested review from Thunkar and removed request for Thunkar June 18, 2026 12:32
…OPFS

The browser PXE data store and the embedded wallet store now persist to
SQLite-OPFS (unencrypted) instead of IndexedDB, via the new
@aztec/kv-store/browser entrypoint. Apply the node-polyfill shim fix to the
playground's worker bundle so the SQLite-OPFS worker resolves under Vite.
… its export

The IndexedDB backend now lives at @aztec/kv-store/deprecated/indexeddb (was
@aztec/kv-store/indexeddb, now removed) and its exports are marked @deprecated.
New browser code should use @aztec/kv-store/browser (SQLite-OPFS).
The /browser entrypoint is a pure re-export of sqlite-opfs; its behavior is
already covered by the sqlite-opfs suite and the build enforces that the
re-exported names exist (consumers import them). The smoke test added no
unique coverage.
bootstrap.sh's test_cmds still pointed at src/indexeddb/*.test.ts after the
backend moved to src/deprecated/indexeddb/. That glob matched nothing and the
node-test loop excludes any indexeddb/ dir, so the IndexedDB browser suite was
silently dropped from CI. Point the browser-test loop at the new location.
…missed consumer, docs)

Making SQLite-OPFS the default browser KV-store backend pulls its WASM Web Worker
into every vite bundle that builds the wallet/PXE SDK. Vite bundles workers in a
separate Rollup pass that does not inherit the main `plugins`, so the node-polyfill
shim must be repeated under `worker.plugins`. Apply it to the docs webapp-tutorial
example and the vite box (the playground already had it).

Also:
- repoint the playground NetworkSelector store from the removed
  `@aztec/kv-store/indexeddb` path to `@aztec/kv-store/browser`.
- fix the now-stale `@aztec/kv-store/indexeddb` reference in the wallet-sdk README
  and mention the `@aztec/kv-store/browser` alias.
- add "OPFS" to the docs cspell dictionary and document the vite worker
  requirement in the migration notes.
…FS worker bundles config-free

The bundler-friendly sqlite3mc build feature-detects Node via a bare `process`
global. vite-plugin-node-polyfills (@rollup/plugin-inject) rewrites that bare
identifier to a shim import that Vite's separate Web Worker rollup pass cannot
resolve, breaking every downstream vite build that bundles the OPFS worker.

Patch the vendored bundle at vendor time, rewriting `process` to the member access
`globalThis.process`. This is semantically identical (the `typeof` short-circuits
before any property access) but invisible to @rollup/plugin-inject, so no shim is
injected. The patch is guarded so a future upstream change to the detection line
fails the vendor step loudly, and SHA256SUMS is regenerated to cover it.

With this, SQLite-OPFS bundles cleanly with no per-consumer worker config, so the
worker workarounds for the playground, docs webapp-tutorial, and vite box are
removed along with the migration note's bundler caveat.
@mverzilli mverzilli force-pushed the martin/f-716-make-sqlite-the-path-of-least-resistance-backend-option-for branch from 8faffe9 to 57f3e7f Compare June 29, 2026 09:34
@AztecBot

AztecBot commented Jun 29, 2026

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/6083ebad1c581c2b�6083ebad1c581c2b8;;�): yarn-project/kv-store/scripts/run_test.sh src/bench/sqlite-opfs-encrypted/map_bench.test.ts (1s) (code: 0)

@mverzilli mverzilli requested review from Thunkar and nchamo June 29, 2026 13:58

@nchamo nchamo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! ❤️


## TBD

### [PXE] Browser KV-store default is now SQLite-OPFS; the IndexedDB entrypoint moved and will be deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES!

@nchamo nchamo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, meant to approve

@mverzilli mverzilli merged commit e785ebf into merge-train/fairies-v5 Jun 29, 2026
12 checks passed
@mverzilli mverzilli deleted the martin/f-716-make-sqlite-the-path-of-least-resistance-backend-option-for branch June 29, 2026 17:56
github-merge-queue Bot pushed a commit that referenced this pull request Jun 29, 2026
BEGIN_COMMIT_OVERRIDE
fix(aztec-nr): Prevent handshake nullifier griefing and nullifier
sequence tests (#24258)
feat(aztec-nr): derive message tag from a resolved secret source
(#24312)
feat(keys)!: add derivation for message-signing and fallback keys
(#24348)
feat: make sqlite the path of least resistance backend option for PXE
and wallet (#24179)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants