@aztec/kv-store 0.0.1-commit.9ef841308 → 0.0.1-commit.a5db02d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +10 -1
  2. package/dest/bench/shared_map_bench.d.ts +19 -0
  3. package/dest/bench/shared_map_bench.d.ts.map +1 -0
  4. package/dest/bench/shared_map_bench.js +91 -0
  5. package/dest/deprecated/indexeddb/array.d.ts +22 -0
  6. package/dest/deprecated/indexeddb/array.d.ts.map +1 -0
  7. package/dest/deprecated/indexeddb/index.d.ts +7 -0
  8. package/dest/deprecated/indexeddb/index.d.ts.map +1 -0
  9. package/dest/deprecated/indexeddb/index.js +8 -0
  10. package/dest/deprecated/indexeddb/map.d.ts +38 -0
  11. package/dest/deprecated/indexeddb/map.d.ts.map +1 -0
  12. package/dest/deprecated/indexeddb/multi_map.d.ts +14 -0
  13. package/dest/deprecated/indexeddb/multi_map.d.ts.map +1 -0
  14. package/dest/deprecated/indexeddb/set.d.ts +17 -0
  15. package/dest/deprecated/indexeddb/set.d.ts.map +1 -0
  16. package/dest/deprecated/indexeddb/singleton.d.ts +17 -0
  17. package/dest/deprecated/indexeddb/singleton.d.ts.map +1 -0
  18. package/dest/deprecated/indexeddb/store.d.ts +98 -0
  19. package/dest/deprecated/indexeddb/store.d.ts.map +1 -0
  20. package/dest/{indexeddb → deprecated/indexeddb}/store.js +2 -0
  21. package/dest/interfaces/array_test_suite.d.ts +1 -1
  22. package/dest/interfaces/array_test_suite.d.ts.map +1 -1
  23. package/dest/interfaces/array_test_suite.js +33 -34
  24. package/dest/interfaces/index.d.ts +2 -2
  25. package/dest/interfaces/index.d.ts.map +1 -1
  26. package/dest/interfaces/map_test_suite.d.ts +1 -1
  27. package/dest/interfaces/map_test_suite.d.ts.map +1 -1
  28. package/dest/interfaces/map_test_suite.js +32 -33
  29. package/dest/interfaces/multi_map_test_suite.d.ts +1 -1
  30. package/dest/interfaces/multi_map_test_suite.d.ts.map +1 -1
  31. package/dest/interfaces/multi_map_test_suite.js +68 -69
  32. package/dest/interfaces/set_test_suite.d.ts +1 -1
  33. package/dest/interfaces/set_test_suite.d.ts.map +1 -1
  34. package/dest/interfaces/set_test_suite.js +13 -14
  35. package/dest/interfaces/singleton_test_suite.d.ts +1 -1
  36. package/dest/interfaces/singleton_test_suite.d.ts.map +1 -1
  37. package/dest/interfaces/singleton_test_suite.js +6 -7
  38. package/dest/lmdb/index.js +2 -2
  39. package/dest/lmdb-v2/factory.d.ts +29 -3
  40. package/dest/lmdb-v2/factory.d.ts.map +1 -1
  41. package/dest/lmdb-v2/factory.js +62 -10
  42. package/dest/lmdb-v2/read_transaction.js +21 -19
  43. package/dest/lmdb-v2/store.d.ts +2 -2
  44. package/dest/lmdb-v2/store.d.ts.map +1 -1
  45. package/dest/lmdb-v2/store.js +4 -4
  46. package/dest/sqlite-opfs/array.d.ts +21 -0
  47. package/dest/sqlite-opfs/array.d.ts.map +1 -0
  48. package/dest/sqlite-opfs/array.js +128 -0
  49. package/dest/sqlite-opfs/errors.d.ts +27 -0
  50. package/dest/sqlite-opfs/errors.d.ts.map +1 -0
  51. package/dest/sqlite-opfs/errors.js +34 -0
  52. package/dest/sqlite-opfs/index.d.ts +14 -0
  53. package/dest/sqlite-opfs/index.d.ts.map +1 -0
  54. package/dest/sqlite-opfs/index.js +16 -0
  55. package/dest/sqlite-opfs/internal/ordered-binary-browser.d.ts +32 -0
  56. package/dest/sqlite-opfs/internal/ordered-binary-browser.d.ts.map +1 -0
  57. package/dest/sqlite-opfs/internal/ordered-binary-browser.js +448 -0
  58. package/dest/sqlite-opfs/manage.d.ts +20 -0
  59. package/dest/sqlite-opfs/manage.d.ts.map +1 -0
  60. package/dest/sqlite-opfs/manage.js +31 -0
  61. package/dest/sqlite-opfs/map.d.ts +35 -0
  62. package/dest/sqlite-opfs/map.d.ts.map +1 -0
  63. package/dest/sqlite-opfs/map.js +163 -0
  64. package/dest/sqlite-opfs/messages.d.ts +66 -0
  65. package/dest/sqlite-opfs/messages.d.ts.map +1 -0
  66. package/dest/sqlite-opfs/messages.js +5 -0
  67. package/dest/sqlite-opfs/multi_map.d.ts +16 -0
  68. package/dest/sqlite-opfs/multi_map.d.ts.map +1 -0
  69. package/dest/sqlite-opfs/multi_map.js +67 -0
  70. package/dest/sqlite-opfs/set.d.ts +13 -0
  71. package/dest/sqlite-opfs/set.d.ts.map +1 -0
  72. package/dest/sqlite-opfs/set.js +19 -0
  73. package/dest/sqlite-opfs/singleton.d.ts +13 -0
  74. package/dest/sqlite-opfs/singleton.d.ts.map +1 -0
  75. package/dest/sqlite-opfs/singleton.js +48 -0
  76. package/dest/sqlite-opfs/store.d.ts +79 -0
  77. package/dest/sqlite-opfs/store.d.ts.map +1 -0
  78. package/dest/sqlite-opfs/store.js +281 -0
  79. package/dest/sqlite-opfs/worker.d.ts +2 -0
  80. package/dest/sqlite-opfs/worker.d.ts.map +1 -0
  81. package/dest/sqlite-opfs/worker.js +264 -0
  82. package/dest/stores/l2_tips_store.d.ts +7 -13
  83. package/dest/stores/l2_tips_store.d.ts.map +1 -1
  84. package/dest/stores/l2_tips_store.js +24 -43
  85. package/package.json +23 -20
  86. package/src/bench/shared_map_bench.ts +111 -0
  87. package/src/{indexeddb → deprecated/indexeddb}/array.ts +2 -2
  88. package/src/deprecated/indexeddb/index.ts +12 -0
  89. package/src/{indexeddb → deprecated/indexeddb}/map.ts +2 -2
  90. package/src/{indexeddb → deprecated/indexeddb}/multi_map.ts +2 -2
  91. package/src/{indexeddb → deprecated/indexeddb}/set.ts +2 -2
  92. package/src/{indexeddb → deprecated/indexeddb}/singleton.ts +2 -2
  93. package/src/{indexeddb → deprecated/indexeddb}/store.ts +10 -9
  94. package/src/interfaces/array_test_suite.ts +33 -35
  95. package/src/interfaces/index.ts +1 -1
  96. package/src/interfaces/map_test_suite.ts +32 -34
  97. package/src/interfaces/multi_map_test_suite.ts +65 -67
  98. package/src/interfaces/set_test_suite.ts +13 -15
  99. package/src/interfaces/singleton_test_suite.ts +6 -8
  100. package/src/lmdb/index.ts +2 -2
  101. package/src/lmdb-v2/factory.ts +85 -9
  102. package/src/lmdb-v2/read_transaction.ts +23 -23
  103. package/src/lmdb-v2/store.ts +4 -2
  104. package/src/sqlite-opfs/array.ts +124 -0
  105. package/src/sqlite-opfs/errors.ts +44 -0
  106. package/src/sqlite-opfs/index.ts +22 -0
  107. package/src/sqlite-opfs/internal/ordered-binary-browser.js +465 -0
  108. package/src/sqlite-opfs/manage.ts +36 -0
  109. package/src/sqlite-opfs/map.ts +163 -0
  110. package/src/sqlite-opfs/messages.ts +39 -0
  111. package/src/sqlite-opfs/multi_map.ts +74 -0
  112. package/src/sqlite-opfs/set.ts +29 -0
  113. package/src/sqlite-opfs/singleton.ts +48 -0
  114. package/src/sqlite-opfs/store.ts +296 -0
  115. package/src/sqlite-opfs/worker.ts +248 -0
  116. package/src/stores/l2_tips_store.ts +20 -41
  117. package/dest/indexeddb/array.d.ts +0 -22
  118. package/dest/indexeddb/array.d.ts.map +0 -1
  119. package/dest/indexeddb/index.d.ts +0 -7
  120. package/dest/indexeddb/index.d.ts.map +0 -1
  121. package/dest/indexeddb/index.js +0 -16
  122. package/dest/indexeddb/map.d.ts +0 -38
  123. package/dest/indexeddb/map.d.ts.map +0 -1
  124. package/dest/indexeddb/multi_map.d.ts +0 -14
  125. package/dest/indexeddb/multi_map.d.ts.map +0 -1
  126. package/dest/indexeddb/set.d.ts +0 -17
  127. package/dest/indexeddb/set.d.ts.map +0 -1
  128. package/dest/indexeddb/singleton.d.ts +0 -17
  129. package/dest/indexeddb/singleton.d.ts.map +0 -1
  130. package/dest/indexeddb/store.d.ts +0 -96
  131. package/dest/indexeddb/store.d.ts.map +0 -1
  132. package/src/indexeddb/index.ts +0 -31
  133. /package/dest/{indexeddb → deprecated/indexeddb}/array.js +0 -0
  134. /package/dest/{indexeddb → deprecated/indexeddb}/map.js +0 -0
  135. /package/dest/{indexeddb → deprecated/indexeddb}/multi_map.js +0 -0
  136. /package/dest/{indexeddb → deprecated/indexeddb}/set.js +0 -0
  137. /package/dest/{indexeddb → deprecated/indexeddb}/singleton.js +0 -0
@@ -0,0 +1,281 @@
1
+ import { SerialQueue } from '@aztec/foundation/queue';
2
+ import { SQLiteOPFSAztecArray } from './array.js';
3
+ import { SqliteEncryptionError } from './errors.js';
4
+ import { SQLiteOPFSAztecMap } from './map.js';
5
+ import { SQLiteOPFSAztecMultiMap } from './multi_map.js';
6
+ import { SQLiteOPFSAztecSet } from './set.js';
7
+ import { SQLiteOPFSAztecSingleton } from './singleton.js';
8
+ /**
9
+ * Main-thread handle for a SQLite database persisted to OPFS via the `opfs-sahpool`
10
+ * VFS. Owns a dedicated Web Worker (the SAH Pool VFS requires Worker context) and
11
+ * routes every SQL op through it via typed postMessage RPC.
12
+ *
13
+ * Transaction ordering is guaranteed by a `SerialQueue` on the main thread combined
14
+ * with an `#inTx` flag: outside a `transactionAsync` block, each op acquires the
15
+ * queue for its own auto-commit; inside a block, the outer call holds the queue and
16
+ * nested ops bypass it to avoid deadlock.
17
+ */ export class AztecSQLiteOPFSStore {
18
+ isEphemeral;
19
+ #worker;
20
+ #pending;
21
+ #txQueue;
22
+ #name;
23
+ #log;
24
+ #nextId;
25
+ #inTx;
26
+ #closed;
27
+ constructor(worker, name, log, isEphemeral){
28
+ this.isEphemeral = isEphemeral;
29
+ this.#pending = new Map();
30
+ this.#txQueue = new SerialQueue();
31
+ this.#nextId = 0;
32
+ this.#inTx = false;
33
+ this.#closed = false;
34
+ this.#worker = worker;
35
+ this.#name = name;
36
+ this.#log = log;
37
+ this.#worker.onmessage = (ev)=>{
38
+ const { id } = ev.data;
39
+ const handler = this.#pending.get(id);
40
+ if (!handler) {
41
+ this.#log.warn(`SQLite worker: no pending handler for id ${id}`);
42
+ return;
43
+ }
44
+ this.#pending.delete(id);
45
+ handler.resolve(ev.data);
46
+ };
47
+ this.#worker.onerror = (ev)=>{
48
+ this.#log.error(`SQLite worker crashed: ${ev.message}`);
49
+ this.#rejectPending(`SQLite worker crashed: ${ev.message}`);
50
+ };
51
+ this.#txQueue.start();
52
+ }
53
+ /**
54
+ * Opens (or creates) a SQLite database stored in the OPFS SAH Pool. When `ephemeral`
55
+ * is true the database lives only in memory and is lost when the worker terminates.
56
+ * Pass `poolDirectory` to place the SAH Pool in a non-default OPFS subdirectory —
57
+ * required when multiple stores coexist in the same tab, because the SAH Pool holds
58
+ * an exclusive lock on its directory.
59
+ *
60
+ * Pass `encryptionKey` (exactly 32 bytes) to enable at-rest encryption via sqlite3mc's
61
+ * ChaCha20 page cipher. The key buffer is **transferred** to the worker — its
62
+ * ArrayBuffer detaches on the caller side after `postMessage`. This is intentional:
63
+ * the API encodes a one-key-one-owner invariant. A caller that wants to use the same
64
+ * key for multiple stores must explicitly clone it per call (e.g.
65
+ * `new Uint8Array(savedKey)`), making the duplication a visible, deliberate decision
66
+ * rather than a silent structured-clone operation. The default path (one `.open()`,
67
+ * one consumption of the key) leaves zero key bytes on the main thread after the call.
68
+ */ static async open(log, name, ephemeral = false, poolDirectory, encryptionKey) {
69
+ if (encryptionKey !== undefined && encryptionKey.length !== 32) {
70
+ throw new SqliteEncryptionError('invalid_key_length', `encryptionKey must be 32 bytes (got ${encryptionKey.length})`);
71
+ }
72
+ if (encryptionKey !== undefined && ephemeral) {
73
+ throw new SqliteEncryptionError('encryption_not_supported_for_ephemeral', 'encryptionKey is not supported for ephemeral (:memory:) stores');
74
+ }
75
+ const dbName = name && !ephemeral ? name : `tmp-${globalThis.crypto.getRandomValues(new Uint8Array(8)).join('')}`;
76
+ log.debug(`Opening SQLite-OPFS ${ephemeral ? 'ephemeral ' : ''}${encryptionKey ? 'encrypted ' : ''}database ${dbName}`);
77
+ const worker = new Worker(new URL('./worker.js', import.meta.url), {
78
+ type: 'module'
79
+ });
80
+ const store = new AztecSQLiteOPFSStore(worker, dbName, log, ephemeral);
81
+ // Transfer (not clone) the key buffer to the worker so we don't leave a
82
+ // second copy on the main thread. Caveat: this detaches the caller's
83
+ // encryptionKey.buffer — subsequent reads from the same Uint8Array are empty.
84
+ const transfer = encryptionKey ? [
85
+ encryptionKey.buffer
86
+ ] : undefined;
87
+ try {
88
+ await store.#sendRequest({
89
+ type: 'init',
90
+ id: store.#allocId(),
91
+ dbName,
92
+ ephemeral,
93
+ poolDirectory,
94
+ encryptionKey
95
+ }, transfer);
96
+ } catch (err) {
97
+ worker.terminate();
98
+ throw err;
99
+ }
100
+ return store;
101
+ }
102
+ openMap(name) {
103
+ return new SQLiteOPFSAztecMap(this, name);
104
+ }
105
+ openSet(name) {
106
+ return new SQLiteOPFSAztecSet(this, name);
107
+ }
108
+ openMultiMap(name) {
109
+ return new SQLiteOPFSAztecMultiMap(this, name);
110
+ }
111
+ openCounter(_name) {
112
+ throw new Error('Method not implemented.');
113
+ }
114
+ openArray(name) {
115
+ return new SQLiteOPFSAztecArray(this, name);
116
+ }
117
+ openSingleton(name) {
118
+ return new SQLiteOPFSAztecSingleton(this, name);
119
+ }
120
+ transactionAsync(callback) {
121
+ // Nested calls join the outer transaction — SQLite does not support nested BEGIN,
122
+ // and re-acquiring the SerialQueue while the outer call holds it would deadlock.
123
+ // Errors in the nested callback propagate to the outer catch, which rolls back the
124
+ // whole thing (the standard "nested tx = savepoint-free join" semantic).
125
+ if (this.#inTx) {
126
+ return callback();
127
+ }
128
+ return this.#txQueue.put(async ()=>{
129
+ this.#inTx = true;
130
+ await this.#sendRequest({
131
+ type: 'begin',
132
+ id: this.#allocId()
133
+ });
134
+ try {
135
+ const result = await callback();
136
+ await this.#sendRequest({
137
+ type: 'commit',
138
+ id: this.#allocId()
139
+ });
140
+ return result;
141
+ } catch (err) {
142
+ await this.#sendRequest({
143
+ type: 'rollback',
144
+ id: this.#allocId()
145
+ }).catch((rollbackErr)=>this.#log.warn(`SQLite ROLLBACK failed: ${rollbackErr instanceof Error ? rollbackErr.message : rollbackErr}`));
146
+ throw err;
147
+ } finally{
148
+ this.#inTx = false;
149
+ }
150
+ });
151
+ }
152
+ async clear() {
153
+ await this.runAsync('DELETE FROM data');
154
+ }
155
+ async delete() {
156
+ if (this.#closed) {
157
+ return;
158
+ }
159
+ this.#closed = true;
160
+ await this.#txQueue.end();
161
+ await this.#sendRequest({
162
+ type: 'deleteDb',
163
+ id: this.#allocId(),
164
+ dbName: this.#name
165
+ }).catch((err)=>this.#log.warn(`SQLite deleteDb failed: ${err instanceof Error ? err.message : err}`));
166
+ this.#worker.terminate();
167
+ this.#rejectPending('SQLite store deleted');
168
+ }
169
+ /**
170
+ * Placeholder — returns zeros to mirror the IndexedDB backend. SQLite exposes real
171
+ * numbers cheaply via `PRAGMA page_count` / `page_size` / `freelist_count` and
172
+ * `SELECT COUNT(*) FROM data`, which would populate `physicalFileSize`, `actualSize`,
173
+ * and `numItems` meaningfully (`mappingSize` stays 0 — it's an LMDB mmap concept).
174
+ * Upgrade when any caller actually consumes these values; all current consumers
175
+ * tolerate zeros.
176
+ */ estimateSize() {
177
+ return Promise.resolve({
178
+ mappingSize: 0,
179
+ physicalFileSize: 0,
180
+ actualSize: 0,
181
+ numItems: 0
182
+ });
183
+ }
184
+ async close() {
185
+ if (this.#closed) {
186
+ return;
187
+ }
188
+ this.#closed = true;
189
+ await this.#txQueue.end();
190
+ await this.#sendRequest({
191
+ type: 'close',
192
+ id: this.#allocId()
193
+ }).catch(()=>{});
194
+ this.#worker.terminate();
195
+ this.#rejectPending('SQLite store closed');
196
+ }
197
+ backupTo(_dstPath, _compact) {
198
+ throw new Error('Method not implemented.');
199
+ }
200
+ /**
201
+ * Returns a raw SQLite image (bytes suitable for writing as a `.sqlite` file and
202
+ * opening in any SQLite tool). Works only for non-ephemeral DBs because the OPFS
203
+ * SAH Pool has to be initialized. Useful for inspection/debugging.
204
+ */ async exportDb() {
205
+ const resp = await this.#sendRequest({
206
+ type: 'export',
207
+ id: this.#allocId()
208
+ });
209
+ if (!('bytes' in resp) || !resp.bytes) {
210
+ throw new Error('exportDb: worker returned no bytes');
211
+ }
212
+ return resp.bytes;
213
+ }
214
+ /**
215
+ * Runs a write statement (INSERT/UPDATE/DELETE/DDL). If called inside a
216
+ * `transactionAsync` block, bypasses the queue; otherwise acquires it so the
217
+ * op runs in its own auto-commit.
218
+ */ runAsync(sql, bind) {
219
+ const send = ()=>this.#sendRequest({
220
+ type: 'run',
221
+ id: this.#allocId(),
222
+ sql,
223
+ bind
224
+ }).then((r)=>({
225
+ changes: 'changes' in r ? r.changes ?? 0 : 0
226
+ }));
227
+ return this.#inTx ? send() : this.#txQueue.put(send);
228
+ }
229
+ /** Runs a SELECT statement and returns rows in array row-mode. */ allAsync(sql, bind) {
230
+ const send = ()=>this.#sendRequest({
231
+ type: 'all',
232
+ id: this.#allocId(),
233
+ sql,
234
+ bind
235
+ }).then((r)=>'rows' in r ? r.rows ?? [] : []);
236
+ return this.#inTx ? send() : this.#txQueue.put(send);
237
+ }
238
+ #allocId() {
239
+ return ++this.#nextId;
240
+ }
241
+ /**
242
+ * Reject any in-flight requests with `reason`, so callers awaiting a response to a
243
+ * request sent to a now-terminated worker don't hang forever. Called from
244
+ * close()/delete() and from the worker.onerror handler.
245
+ */ #rejectPending(reason) {
246
+ if (this.#pending.size === 0) {
247
+ return;
248
+ }
249
+ const err = new Error(reason);
250
+ for (const { reject } of this.#pending.values()){
251
+ reject(err);
252
+ }
253
+ this.#pending.clear();
254
+ }
255
+ #sendRequest(req, transfer) {
256
+ return new Promise((resolve, reject)=>{
257
+ this.#pending.set(req.id, {
258
+ resolve: (resp)=>{
259
+ if (resp.type === 'err') {
260
+ // Re-hydrate encryption-shaped errors as the typed class so consumers
261
+ // can pattern-match on `instanceof SqliteEncryptionError`. Plain
262
+ // errors stay plain — the wire protocol only tags encryption paths.
263
+ if (resp.encryptionCode !== undefined) {
264
+ reject(new SqliteEncryptionError(resp.encryptionCode, resp.message));
265
+ } else {
266
+ reject(new Error(resp.message));
267
+ }
268
+ } else {
269
+ resolve(resp);
270
+ }
271
+ },
272
+ reject
273
+ });
274
+ if (transfer && transfer.length > 0) {
275
+ this.#worker.postMessage(req, transfer);
276
+ } else {
277
+ this.#worker.postMessage(req);
278
+ }
279
+ });
280
+ }
281
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3FsaXRlLW9wZnMvd29ya2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/sqlite-opfs/worker.ts"],"names":[],"mappings":""}
@@ -0,0 +1,264 @@
1
+ /// <reference lib="webworker" />
2
+ import sqlite3InitModule from '@aztec/sqlite3mc-wasm';
3
+ import { SqliteEncryptionError, isDecryptFailureMessage } from './errors.js';
4
+ const SCHEMA_SQL = `
5
+ CREATE TABLE IF NOT EXISTS data (
6
+ slot TEXT NOT NULL PRIMARY KEY,
7
+ container TEXT NOT NULL,
8
+ key BLOB NOT NULL,
9
+ key_count INTEGER NOT NULL,
10
+ hash TEXT NOT NULL,
11
+ value BLOB
12
+ ) WITHOUT ROWID;
13
+
14
+ CREATE INDEX IF NOT EXISTS idx_container_key ON data(container, key);
15
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_container_key_count ON data(container, key, key_count);
16
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_container_key_hash ON data(container, key, hash);
17
+ `;
18
+ const DEFAULT_SAH_POOL_DIRECTORY = '.aztec-kv';
19
+ const SAH_POOL_VFS_NAME = 'aztec-kv-opfs';
20
+ const MC_SAH_POOL_VFS_NAME = `multipleciphers-${SAH_POOL_VFS_NAME}`;
21
+ let sqlite3;
22
+ let pool;
23
+ let db;
24
+ let dbPath;
25
+ async function ensurePool(directory) {
26
+ const s = sqlite3 ??= await sqlite3InitModule();
27
+ if (!pool) {
28
+ pool = await s.installOpfsSAHPoolVfs({
29
+ name: SAH_POOL_VFS_NAME,
30
+ directory,
31
+ initialCapacity: 8
32
+ });
33
+ // Register a sqlite3mc-wrapped VFS pointing at our SAH Pool VFS.
34
+ // Encrypted DBs must be opened through this wrapper so sqlite3mc can
35
+ // intercept file I/O; plain DBs continue using the SAH Pool VFS directly.
36
+ // The wrapper name is `multipleciphers-<underlying>`.
37
+ s.capi.sqlite3mc_vfs_create(SAH_POOL_VFS_NAME, 0);
38
+ }
39
+ return pool;
40
+ }
41
+ /**
42
+ * Applies sqlite3mc's ChaCha20 page cipher using a pre-derived 32-byte key.
43
+ * The PRAGMAs must run before any schema DDL so sqlite3mc can decrypt existing
44
+ * pages and encrypt new ones. Zeroes the caller-held key array after the PRAGMA
45
+ * completes to minimize residency of the raw key bytes outside sqlite3mc's heap.
46
+ */ function applyEncryptionKey(conn, key) {
47
+ const hex = Array.from(key, (b)=>b.toString(16).padStart(2, '0')).join('');
48
+ conn.exec(`PRAGMA cipher = 'chacha20'`);
49
+ conn.exec(`PRAGMA key = "x'${hex}'"`);
50
+ key.fill(0);
51
+ }
52
+ async function handleInit(dbName, ephemeral, directory, encryptionKey) {
53
+ const s = sqlite3 ??= await sqlite3InitModule();
54
+ if (encryptionKey !== undefined && ephemeral) {
55
+ throw new SqliteEncryptionError('encryption_not_supported_for_ephemeral', 'encryptionKey is not supported for ephemeral (:memory:) stores');
56
+ }
57
+ if (ephemeral) {
58
+ db = new s.oo1.DB(':memory:', 'c');
59
+ } else {
60
+ const activePool = await ensurePool(directory ?? DEFAULT_SAH_POOL_DIRECTORY);
61
+ dbPath = normalizeDbPath(dbName);
62
+ if (encryptionKey !== undefined) {
63
+ const conn = new s.oo1.DB({
64
+ filename: dbPath,
65
+ flags: 'c',
66
+ vfs: MC_SAH_POOL_VFS_NAME
67
+ });
68
+ db = conn;
69
+ applyEncryptionKey(conn, encryptionKey);
70
+ } else {
71
+ db = new activePool.OpfsSAHPoolDb(dbPath);
72
+ }
73
+ }
74
+ runSql(SCHEMA_SQL);
75
+ }
76
+ function handleClose() {
77
+ db?.close();
78
+ db = undefined;
79
+ dbPath = undefined;
80
+ releasePool();
81
+ }
82
+ /**
83
+ * Releases the SAH pool's OPFS sync access handles before the terminal RPC is acked. Worker
84
+ * termination releases them only asynchronously, so without this a caller that deletes or reopens
85
+ * the store directory right after close()/delete() resolves races Chromium's cleanup
86
+ * (NoModificationAllowedError from removeEntry, or a hang installing a new pool on the directory).
87
+ * pauseVfs releases the handles without touching file contents; the worker is terminated right
88
+ * after, so the pool is never resumed.
89
+ */ function releasePool() {
90
+ pool?.pauseVfs();
91
+ pool = undefined;
92
+ }
93
+ async function handleExport() {
94
+ if (!db || !dbPath) {
95
+ throw new Error('SQLite worker: no database open to export');
96
+ }
97
+ if (!pool) {
98
+ throw new Error('SQLite worker: no SAH Pool available (ephemeral DBs cannot be exported)');
99
+ }
100
+ return await pool.exportFile(dbPath);
101
+ }
102
+ function handleDeleteDb(dbName) {
103
+ const path = normalizeDbPath(dbName);
104
+ if (db && dbPath === path) {
105
+ db.close();
106
+ db = undefined;
107
+ dbPath = undefined;
108
+ }
109
+ // Ephemeral :memory: DBs never back a file — skip installing a pool just to unlink
110
+ // nothing. installOpfsSAHPoolVfs acquires an exclusive lock on the OPFS SAH
111
+ // directory, and under heavy test churn that can contend with workers from
112
+ // previous tests whose OPFS handles Chromium hasn't yet released, hanging the RPC
113
+ // and then the whole test run.
114
+ if (!pool) {
115
+ return;
116
+ }
117
+ try {
118
+ pool.unlink(path);
119
+ } catch {
120
+ // File may not exist; ignore.
121
+ }
122
+ // Guarded because pauseVfs refuses (SQLITE_MISUSE) while any file is open through the VFS.
123
+ if (!db) {
124
+ releasePool();
125
+ }
126
+ }
127
+ function requireDb() {
128
+ if (!db) {
129
+ throw new Error('SQLite worker: no database open');
130
+ }
131
+ return db;
132
+ }
133
+ function runSql(sql, bind) {
134
+ const conn = requireDb();
135
+ conn.exec({
136
+ sql,
137
+ bind
138
+ });
139
+ return {
140
+ changes: conn.changes()
141
+ };
142
+ }
143
+ function selectAll(sql, bind) {
144
+ const conn = requireDb();
145
+ const rows = [];
146
+ conn.exec({
147
+ sql,
148
+ bind,
149
+ rowMode: 'array',
150
+ resultRows: rows
151
+ });
152
+ return rows;
153
+ }
154
+ function normalizeDbPath(dbName) {
155
+ return dbName.startsWith('/') ? dbName : `/${dbName}`;
156
+ }
157
+ function respond(msg) {
158
+ self.postMessage(msg);
159
+ }
160
+ self.onmessage = async (ev)=>{
161
+ const req = ev.data;
162
+ try {
163
+ switch(req.type){
164
+ case 'init':
165
+ await handleInit(req.dbName, req.ephemeral, req.poolDirectory, req.encryptionKey);
166
+ return respond({
167
+ type: 'ok',
168
+ id: req.id
169
+ });
170
+ case 'close':
171
+ handleClose();
172
+ return respond({
173
+ type: 'ok',
174
+ id: req.id
175
+ });
176
+ case 'deleteDb':
177
+ handleDeleteDb(req.dbName);
178
+ return respond({
179
+ type: 'ok',
180
+ id: req.id
181
+ });
182
+ case 'run':
183
+ {
184
+ const { changes } = runSql(req.sql, req.bind);
185
+ return respond({
186
+ type: 'ok',
187
+ id: req.id,
188
+ changes
189
+ });
190
+ }
191
+ case 'all':
192
+ {
193
+ const rows = selectAll(req.sql, req.bind);
194
+ return respond({
195
+ type: 'ok',
196
+ id: req.id,
197
+ rows
198
+ });
199
+ }
200
+ case 'export':
201
+ {
202
+ const bytes = await handleExport();
203
+ return respond({
204
+ type: 'ok',
205
+ id: req.id,
206
+ bytes
207
+ });
208
+ }
209
+ case 'begin':
210
+ runSql('BEGIN');
211
+ return respond({
212
+ type: 'ok',
213
+ id: req.id
214
+ });
215
+ case 'commit':
216
+ runSql('COMMIT');
217
+ return respond({
218
+ type: 'ok',
219
+ id: req.id
220
+ });
221
+ case 'rollback':
222
+ runSql('ROLLBACK');
223
+ return respond({
224
+ type: 'ok',
225
+ id: req.id
226
+ });
227
+ default:
228
+ {
229
+ const _exhaustive = req;
230
+ throw new Error(`Unknown request: ${JSON.stringify(_exhaustive)}`);
231
+ }
232
+ }
233
+ } catch (err) {
234
+ const message = err instanceof Error ? err.message : String(err);
235
+ respond({
236
+ type: 'err',
237
+ id: req.id,
238
+ message,
239
+ encryptionCode: detectEncryptionCode(req, err, message)
240
+ });
241
+ }
242
+ };
243
+ /**
244
+ * Maps a thrown error during request handling to a typed encryption code, so the
245
+ * main thread can re-hydrate it as a {@link SqliteEncryptionError}. Returns
246
+ * `undefined` for non-encryption errors (preserves the existing untyped path).
247
+ *
248
+ * Two sources:
249
+ * - The error was already a `SqliteEncryptionError` (pre-flight throws inside
250
+ * this worker — e.g. ephemeral + encryptionKey). Forward its code as-is.
251
+ * - The error came from SQLite/sqlite3mc with a known decrypt-failure message
252
+ * during an `init` request. Both "wrong key supplied" and "no key supplied
253
+ * to an encrypted DB" surface as SQLITE_NOTADB ("file is not a database") —
254
+ * we don't constrain on `req.encryptionKey` because the no-key-on-encrypted-DB
255
+ * case is exactly when the caller most needs the typed signal.
256
+ */ function detectEncryptionCode(req, err, message) {
257
+ if (err instanceof SqliteEncryptionError) {
258
+ return err.code;
259
+ }
260
+ if (req.type === 'init' && isDecryptFailureMessage(message)) {
261
+ return 'decrypt_failed';
262
+ }
263
+ return undefined;
264
+ }
@@ -1,6 +1,5 @@
1
- import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
- import { type L2BlockTag, L2TipsStoreBase } from '@aztec/stdlib/block';
3
- import { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { type BlockHash, type CheckpointId, type L2BlockTag, L2TipsStoreBase } from '@aztec/stdlib/block';
4
3
  import type { AztecAsyncKVStore } from '../interfaces/store.js';
5
4
  /**
6
5
  * Persistent implementation of L2 tips store backed by a KV store.
@@ -9,21 +8,16 @@ import type { AztecAsyncKVStore } from '../interfaces/store.js';
9
8
  export declare class L2TipsKVStore extends L2TipsStoreBase {
10
9
  private store;
11
10
  private readonly l2TipsStore;
11
+ private readonly l2TipCheckpointsStore;
12
12
  private readonly l2BlockHashesStore;
13
- private readonly l2BlockNumberToCheckpointNumberStore;
14
- private readonly l2CheckpointStore;
15
- constructor(store: AztecAsyncKVStore, namespace: string);
13
+ constructor(store: AztecAsyncKVStore, namespace: string, initialBlockHash: BlockHash);
16
14
  protected getTip(tag: L2BlockTag): Promise<BlockNumber | undefined>;
17
15
  protected setTip(tag: L2BlockTag, blockNumber: BlockNumber): Promise<void>;
16
+ protected getTipCheckpoint(tag: L2BlockTag): Promise<CheckpointId | undefined>;
17
+ protected setTipCheckpoint(tag: L2BlockTag, checkpoint: CheckpointId): Promise<void>;
18
18
  protected getStoredBlockHash(blockNumber: BlockNumber): Promise<string | undefined>;
19
19
  protected setBlockHash(blockNumber: BlockNumber, hash: string): Promise<void>;
20
20
  protected deleteBlockHashesBefore(blockNumber: BlockNumber): Promise<void>;
21
- protected getCheckpointNumberForBlock(blockNumber: BlockNumber): Promise<CheckpointNumber | undefined>;
22
- protected setCheckpointNumberForBlock(blockNumber: BlockNumber, checkpointNumber: CheckpointNumber): Promise<void>;
23
- protected deleteBlockToCheckpointBefore(blockNumber: BlockNumber): Promise<void>;
24
- protected getCheckpoint(checkpointNumber: CheckpointNumber): Promise<PublishedCheckpoint | undefined>;
25
- protected saveCheckpointData(checkpoint: PublishedCheckpoint): Promise<void>;
26
- protected deleteCheckpointsBefore(checkpointNumber: CheckpointNumber): Promise<void>;
27
21
  protected runInTransaction<T>(fn: () => Promise<T>): Promise<T>;
28
22
  }
29
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDJfdGlwc19zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N0b3Jlcy9sMl90aXBzX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsZ0JBQWdCLEVBQUU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