@aztec/kv-store 0.66.0 → 0.67.1-devnet

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 (103) hide show
  1. package/dest/indexeddb/array.d.ts +21 -0
  2. package/dest/indexeddb/array.d.ts.map +1 -0
  3. package/dest/indexeddb/array.js +96 -0
  4. package/dest/indexeddb/index.d.ts +7 -0
  5. package/dest/indexeddb/index.d.ts.map +1 -0
  6. package/dest/indexeddb/index.js +22 -0
  7. package/dest/indexeddb/map.d.ts +26 -0
  8. package/dest/indexeddb/map.d.ts.map +1 -0
  9. package/dest/indexeddb/map.js +104 -0
  10. package/dest/indexeddb/set.d.ts +17 -0
  11. package/dest/indexeddb/set.d.ts.map +1 -0
  12. package/dest/indexeddb/set.js +25 -0
  13. package/dest/indexeddb/singleton.d.ts +16 -0
  14. package/dest/indexeddb/singleton.d.ts.map +1 -0
  15. package/dest/indexeddb/singleton.js +42 -0
  16. package/dest/indexeddb/store.d.ts +100 -0
  17. package/dest/indexeddb/store.d.ts.map +1 -0
  18. package/dest/indexeddb/store.js +157 -0
  19. package/dest/interfaces/array.d.ts +43 -11
  20. package/dest/interfaces/array.d.ts.map +1 -1
  21. package/dest/interfaces/array_test_suite.d.ts +3 -0
  22. package/dest/interfaces/array_test_suite.d.ts.map +1 -0
  23. package/dest/interfaces/array_test_suite.js +100 -0
  24. package/dest/interfaces/counter.d.ts +21 -1
  25. package/dest/interfaces/counter.d.ts.map +1 -1
  26. package/dest/interfaces/map.d.ts +80 -12
  27. package/dest/interfaces/map.d.ts.map +1 -1
  28. package/dest/interfaces/map_test_suite.d.ts +3 -0
  29. package/dest/interfaces/map_test_suite.d.ts.map +1 -0
  30. package/dest/interfaces/map_test_suite.js +117 -0
  31. package/dest/interfaces/set.d.ts +23 -7
  32. package/dest/interfaces/set.d.ts.map +1 -1
  33. package/dest/interfaces/set_test_suite.d.ts +3 -0
  34. package/dest/interfaces/set_test_suite.d.ts.map +1 -0
  35. package/dest/interfaces/set_test_suite.js +59 -0
  36. package/dest/interfaces/singleton.d.ts +14 -5
  37. package/dest/interfaces/singleton.d.ts.map +1 -1
  38. package/dest/interfaces/singleton_test_suite.d.ts +3 -0
  39. package/dest/interfaces/singleton_test_suite.d.ts.map +1 -0
  40. package/dest/interfaces/singleton_test_suite.js +33 -0
  41. package/dest/interfaces/store.d.ts +83 -8
  42. package/dest/interfaces/store.d.ts.map +1 -1
  43. package/dest/interfaces/store_test_suite.d.ts +3 -0
  44. package/dest/interfaces/store_test_suite.d.ts.map +1 -0
  45. package/dest/interfaces/store_test_suite.js +40 -0
  46. package/dest/interfaces/utils.d.ts +16 -0
  47. package/dest/interfaces/utils.d.ts.map +1 -0
  48. package/dest/interfaces/utils.js +19 -0
  49. package/dest/lmdb/array.d.ts +7 -2
  50. package/dest/lmdb/array.d.ts.map +1 -1
  51. package/dest/lmdb/array.js +20 -1
  52. package/dest/lmdb/counter.d.ts +5 -2
  53. package/dest/lmdb/counter.d.ts.map +1 -1
  54. package/dest/lmdb/counter.js +10 -1
  55. package/dest/lmdb/index.d.ts +10 -0
  56. package/dest/lmdb/index.d.ts.map +1 -1
  57. package/dest/lmdb/index.js +28 -1
  58. package/dest/lmdb/map.d.ts +25 -3
  59. package/dest/lmdb/map.d.ts.map +1 -1
  60. package/dest/lmdb/map.js +112 -26
  61. package/dest/lmdb/set.d.ts +4 -2
  62. package/dest/lmdb/set.d.ts.map +1 -1
  63. package/dest/lmdb/set.js +9 -1
  64. package/dest/lmdb/singleton.d.ts +3 -2
  65. package/dest/lmdb/singleton.d.ts.map +1 -1
  66. package/dest/lmdb/singleton.js +4 -1
  67. package/dest/lmdb/store.d.ts +35 -15
  68. package/dest/lmdb/store.d.ts.map +1 -1
  69. package/dest/lmdb/store.js +47 -27
  70. package/dest/stores/l2_tips_store.d.ts +2 -2
  71. package/dest/stores/l2_tips_store.d.ts.map +1 -1
  72. package/dest/stores/l2_tips_store.js +13 -13
  73. package/dest/utils.d.ts +8 -7
  74. package/dest/utils.d.ts.map +1 -1
  75. package/dest/utils.js +6 -29
  76. package/package.json +54 -37
  77. package/src/indexeddb/array.ts +118 -0
  78. package/src/indexeddb/index.ts +29 -0
  79. package/src/indexeddb/map.ts +142 -0
  80. package/src/indexeddb/set.ts +37 -0
  81. package/src/indexeddb/singleton.ts +49 -0
  82. package/src/indexeddb/store.ts +193 -0
  83. package/src/interfaces/array.ts +48 -12
  84. package/src/interfaces/array_test_suite.ts +130 -0
  85. package/src/interfaces/counter.ts +23 -1
  86. package/src/interfaces/map.ts +90 -14
  87. package/src/interfaces/map_test_suite.ts +158 -0
  88. package/src/interfaces/set.ts +25 -8
  89. package/src/interfaces/set_test_suite.ts +81 -0
  90. package/src/interfaces/singleton.ts +14 -6
  91. package/src/interfaces/singleton_test_suite.ts +46 -0
  92. package/src/interfaces/store.ts +99 -8
  93. package/src/interfaces/store_test_suite.ts +56 -0
  94. package/src/interfaces/utils.ts +21 -0
  95. package/src/lmdb/array.ts +26 -2
  96. package/src/lmdb/counter.ts +14 -2
  97. package/src/lmdb/index.ts +36 -0
  98. package/src/lmdb/map.ts +130 -23
  99. package/src/lmdb/set.ts +12 -2
  100. package/src/lmdb/singleton.ts +6 -2
  101. package/src/lmdb/store.ts +73 -43
  102. package/src/stores/l2_tips_store.ts +17 -17
  103. package/src/utils.ts +8 -37
package/src/lmdb/store.ts CHANGED
@@ -1,33 +1,43 @@
1
- import { createDebugLogger } from '@aztec/foundation/log';
1
+ import { randomBytes } from '@aztec/foundation/crypto';
2
+ import { createLogger } from '@aztec/foundation/log';
2
3
 
3
- import { mkdirSync } from 'fs';
4
- import { mkdtemp, rm } from 'fs/promises';
5
- import { type Database, type Key, type RootDatabase, open } from 'lmdb';
4
+ import { promises as fs, mkdirSync } from 'fs';
5
+ import { type Database, type RootDatabase, open } from 'lmdb';
6
6
  import { tmpdir } from 'os';
7
- import { dirname, join } from 'path';
8
-
9
- import { type AztecArray } from '../interfaces/array.js';
10
- import { type AztecCounter } from '../interfaces/counter.js';
11
- import { type AztecMap, type AztecMultiMap } from '../interfaces/map.js';
12
- import { type AztecSet } from '../interfaces/set.js';
13
- import { type AztecSingleton } from '../interfaces/singleton.js';
14
- import { type AztecKVStore } from '../interfaces/store.js';
7
+ import { join } from 'path';
8
+
9
+ import { type AztecArray, type AztecAsyncArray } from '../interfaces/array.js';
10
+ import { type Key } from '../interfaces/common.js';
11
+ import { type AztecAsyncCounter, type AztecCounter } from '../interfaces/counter.js';
12
+ import {
13
+ type AztecAsyncMap,
14
+ type AztecAsyncMultiMap,
15
+ type AztecMap,
16
+ type AztecMapWithSize,
17
+ type AztecMultiMap,
18
+ type AztecMultiMapWithSize,
19
+ } from '../interfaces/map.js';
20
+ import { type AztecAsyncSet, type AztecSet } from '../interfaces/set.js';
21
+ import { type AztecAsyncSingleton, type AztecSingleton } from '../interfaces/singleton.js';
22
+ import { type AztecAsyncKVStore, type AztecKVStore } from '../interfaces/store.js';
15
23
  import { LmdbAztecArray } from './array.js';
16
24
  import { LmdbAztecCounter } from './counter.js';
17
- import { LmdbAztecMap } from './map.js';
25
+ import { LmdbAztecMap, LmdbAztecMapWithSize } from './map.js';
18
26
  import { LmdbAztecSet } from './set.js';
19
27
  import { LmdbAztecSingleton } from './singleton.js';
20
28
 
21
29
  /**
22
30
  * A key-value store backed by LMDB.
23
31
  */
24
- export class AztecLmdbStore implements AztecKVStore {
32
+ export class AztecLmdbStore implements AztecKVStore, AztecAsyncKVStore {
33
+ syncGetters = true as const;
34
+
25
35
  #rootDb: RootDatabase;
26
36
  #data: Database<unknown, Key>;
27
37
  #multiMapData: Database<unknown, Key>;
28
- #log = createDebugLogger('aztec:kv-store:lmdb');
38
+ #log = createLogger('kv-store:lmdb');
29
39
 
30
- constructor(rootDb: RootDatabase, public readonly isEphemeral: boolean, private path?: string) {
40
+ constructor(rootDb: RootDatabase, public readonly isEphemeral: boolean, private path: string) {
31
41
  this.#rootDb = rootDb;
32
42
 
33
43
  // big bucket to store all the data
@@ -60,15 +70,14 @@ export class AztecLmdbStore implements AztecKVStore {
60
70
  path?: string,
61
71
  mapSizeKb = 1 * 1024 * 1024, // defaults to 1 GB map size
62
72
  ephemeral: boolean = false,
63
- log = createDebugLogger('aztec:kv-store:lmdb'),
73
+ log = createLogger('kv-store:lmdb'),
64
74
  ): AztecLmdbStore {
65
- if (path) {
66
- mkdirSync(path, { recursive: true });
67
- }
75
+ const dbPath = path ?? join(tmpdir(), randomBytes(8).toString('hex'));
76
+ mkdirSync(dbPath, { recursive: true });
68
77
  const mapSize = 1024 * mapSizeKb;
69
78
  log.debug(`Opening LMDB database at ${path || 'temporary location'} with map size ${mapSize}`);
70
- const rootDb = open({ path, noSync: ephemeral, mapSize });
71
- return new AztecLmdbStore(rootDb, ephemeral, path);
79
+ const rootDb = open({ path: dbPath, noSync: ephemeral, mapSize });
80
+ return new AztecLmdbStore(rootDb, ephemeral, dbPath);
72
81
  }
73
82
 
74
83
  /**
@@ -76,10 +85,9 @@ export class AztecLmdbStore implements AztecKVStore {
76
85
  * @returns A new AztecLmdbStore.
77
86
  */
78
87
  async fork() {
79
- const baseDir = this.path ? dirname(this.path) : tmpdir();
88
+ const baseDir = this.path;
80
89
  this.#log.debug(`Forking store with basedir ${baseDir}`);
81
- const forkPath =
82
- (await mkdtemp(join(baseDir, 'aztec-store-fork-'))) + (this.isEphemeral || !this.path ? '/data.mdb' : '');
90
+ const forkPath = await fs.mkdtemp(join(baseDir, 'aztec-store-fork-'));
83
91
  this.#log.verbose(`Forking store to ${forkPath}`);
84
92
  await this.#rootDb.backup(forkPath, false);
85
93
  const forkDb = open(forkPath, { noSync: this.isEphemeral });
@@ -92,7 +100,7 @@ export class AztecLmdbStore implements AztecKVStore {
92
100
  * @param name - Name of the map
93
101
  * @returns A new AztecMap
94
102
  */
95
- openMap<K extends string | number, V>(name: string): AztecMap<K, V> {
103
+ openMap<K extends Key, V>(name: string): AztecMap<K, V> & AztecAsyncMap<K, V> {
96
104
  return new LmdbAztecMap(this.#data, name);
97
105
  }
98
106
 
@@ -101,7 +109,7 @@ export class AztecLmdbStore implements AztecKVStore {
101
109
  * @param name - Name of the set
102
110
  * @returns A new AztecSet
103
111
  */
104
- openSet<K extends string | number>(name: string): AztecSet<K> {
112
+ openSet<K extends Key>(name: string): AztecSet<K> & AztecAsyncSet<K> {
105
113
  return new LmdbAztecSet(this.#data, name);
106
114
  }
107
115
 
@@ -110,20 +118,37 @@ export class AztecLmdbStore implements AztecKVStore {
110
118
  * @param name - Name of the map
111
119
  * @returns A new AztecMultiMap
112
120
  */
113
- openMultiMap<K extends string | number, V>(name: string): AztecMultiMap<K, V> {
121
+ openMultiMap<K extends Key, V>(name: string): AztecMultiMap<K, V> & AztecAsyncMultiMap<K, V> {
114
122
  return new LmdbAztecMap(this.#multiMapData, name);
115
123
  }
116
124
 
117
- openCounter<K extends string | number | Array<string | number>>(name: string): AztecCounter<K> {
125
+ openCounter<K extends Key>(name: string): AztecCounter<K> & AztecAsyncCounter<K> {
118
126
  return new LmdbAztecCounter(this.#data, name);
119
127
  }
128
+ /**
129
+ * Creates a new AztecMultiMapWithSize in the store. A multi-map with size stores multiple values for a single key automatically.
130
+ * @param name - Name of the map
131
+ * @returns A new AztecMultiMapWithSize
132
+ */
133
+ openMultiMapWithSize<K extends Key, V>(name: string): AztecMultiMapWithSize<K, V> {
134
+ return new LmdbAztecMapWithSize(this.#multiMapData, name);
135
+ }
136
+
137
+ /**
138
+ * Creates a new AztecMapWithSize in the store.
139
+ * @param name - Name of the map
140
+ * @returns A new AztecMapWithSize
141
+ */
142
+ openMapWithSize<K extends Key, V>(name: string): AztecMapWithSize<K, V> {
143
+ return new LmdbAztecMapWithSize(this.#data, name);
144
+ }
120
145
 
121
146
  /**
122
147
  * Creates a new AztecArray in the store.
123
148
  * @param name - Name of the array
124
149
  * @returns A new AztecArray
125
150
  */
126
- openArray<T>(name: string): AztecArray<T> {
151
+ openArray<T>(name: string): AztecArray<T> & AztecAsyncArray<T> {
127
152
  return new LmdbAztecArray(this.#data, name);
128
153
  }
129
154
 
@@ -132,7 +157,7 @@ export class AztecLmdbStore implements AztecKVStore {
132
157
  * @param name - Name of the singleton
133
158
  * @returns A new AztecSingleton
134
159
  */
135
- openSingleton<T>(name: string): AztecSingleton<T> {
160
+ openSingleton<T>(name: string): AztecSingleton<T> & AztecAsyncSingleton<T> {
136
161
  return new LmdbAztecSingleton(this.#data, name);
137
162
  }
138
163
 
@@ -145,6 +170,15 @@ export class AztecLmdbStore implements AztecKVStore {
145
170
  return this.#rootDb.transaction(callback);
146
171
  }
147
172
 
173
+ /**
174
+ * Runs a callback in a transaction.
175
+ * @param callback - Function to execute in a transaction
176
+ * @returns A promise that resolves to the return value of the callback
177
+ */
178
+ async transactionAsync<T>(callback: () => Promise<T>): Promise<T> {
179
+ return await this.#rootDb.transaction(callback);
180
+ }
181
+
148
182
  /**
149
183
  * Clears all entries in the store & sub DBs.
150
184
  */
@@ -177,7 +211,7 @@ export class AztecLmdbStore implements AztecKVStore {
177
211
  await this.drop();
178
212
  await this.close();
179
213
  if (this.path) {
180
- await rm(this.path, { recursive: true, force: true });
214
+ await fs.rm(this.path, { recursive: true, force: true });
181
215
  this.#log.verbose(`Deleted database files at ${this.path}`);
182
216
  }
183
217
  }
@@ -201,11 +235,7 @@ export class AztecLmdbStore implements AztecKVStore {
201
235
 
202
236
  private estimateSubDBSize(db: Database<unknown, Key>): { actualSize: number; numItems: number } {
203
237
  const stats = db.getStats();
204
- let branchPages = 0;
205
- let leafPages = 0;
206
- let overflowPages = 0;
207
- let pageSize = 0;
208
- let totalSize = 0;
238
+ let actualSize = 0;
209
239
  let numItems = 0;
210
240
  // This is the total number of key/value pairs present in the DB
211
241
  if ('entryCount' in stats && typeof stats.entryCount === 'number') {
@@ -222,12 +252,12 @@ export class AztecLmdbStore implements AztecKVStore {
222
252
  'pageSize' in stats &&
223
253
  typeof stats.pageSize === 'number'
224
254
  ) {
225
- branchPages = stats.treeBranchPageCount;
226
- leafPages = stats.treeLeafPageCount;
227
- overflowPages = stats.overflowPages;
228
- pageSize = stats.pageSize;
229
- totalSize = (branchPages + leafPages + overflowPages) * pageSize;
255
+ const branchPages = stats.treeBranchPageCount;
256
+ const leafPages = stats.treeLeafPageCount;
257
+ const overflowPages = stats.overflowPages;
258
+ const pageSize = stats.pageSize;
259
+ actualSize = (branchPages + leafPages + overflowPages) * pageSize;
230
260
  }
231
- return { actualSize: totalSize, numItems };
261
+ return { actualSize, numItems };
232
262
  }
233
263
  }
@@ -7,37 +7,37 @@ import {
7
7
  type L2Tips,
8
8
  } from '@aztec/circuit-types';
9
9
 
10
- import { type AztecMap } from '../interfaces/map.js';
11
- import { type AztecKVStore } from '../interfaces/store.js';
10
+ import { type AztecAsyncMap } from '../interfaces/map.js';
11
+ import { type AztecAsyncKVStore } from '../interfaces/store.js';
12
12
 
13
13
  /** Stores currently synced L2 tips and unfinalized block hashes. */
14
14
  export class L2TipsStore implements L2BlockStreamEventHandler, L2BlockStreamLocalDataProvider {
15
- private readonly l2TipsStore: AztecMap<L2BlockTag, number>;
16
- private readonly l2BlockHashesStore: AztecMap<number, string>;
15
+ private readonly l2TipsStore: AztecAsyncMap<L2BlockTag, number>;
16
+ private readonly l2BlockHashesStore: AztecAsyncMap<number, string>;
17
17
 
18
- constructor(store: AztecKVStore, namespace: string) {
18
+ constructor(store: AztecAsyncKVStore, namespace: string) {
19
19
  this.l2TipsStore = store.openMap([namespace, 'l2_tips'].join('_'));
20
20
  this.l2BlockHashesStore = store.openMap([namespace, 'l2_block_hashes'].join('_'));
21
21
  }
22
22
 
23
23
  public getL2BlockHash(number: number): Promise<string | undefined> {
24
- return Promise.resolve(this.l2BlockHashesStore.get(number));
24
+ return this.l2BlockHashesStore.getAsync(number);
25
25
  }
26
26
 
27
- public getL2Tips(): Promise<L2Tips> {
28
- return Promise.resolve({
29
- latest: this.getL2Tip('latest'),
30
- finalized: this.getL2Tip('finalized'),
31
- proven: this.getL2Tip('proven'),
32
- });
27
+ public async getL2Tips(): Promise<L2Tips> {
28
+ return {
29
+ latest: await this.getL2Tip('latest'),
30
+ finalized: await this.getL2Tip('finalized'),
31
+ proven: await this.getL2Tip('proven'),
32
+ };
33
33
  }
34
34
 
35
- private getL2Tip(tag: L2BlockTag): L2BlockId {
36
- const blockNumber = this.l2TipsStore.get(tag);
35
+ private async getL2Tip(tag: L2BlockTag): Promise<L2BlockId> {
36
+ const blockNumber = await this.l2TipsStore.getAsync(tag);
37
37
  if (blockNumber === undefined || blockNumber === 0) {
38
38
  return { number: 0, hash: undefined };
39
39
  }
40
- const blockHash = this.l2BlockHashesStore.get(blockNumber);
40
+ const blockHash = await this.l2BlockHashesStore.getAsync(blockNumber);
41
41
  if (!blockHash) {
42
42
  throw new Error(`Block hash not found for block number ${blockNumber}`);
43
43
  }
@@ -47,10 +47,10 @@ export class L2TipsStore implements L2BlockStreamEventHandler, L2BlockStreamLoca
47
47
  public async handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
48
48
  switch (event.type) {
49
49
  case 'blocks-added':
50
- await this.l2TipsStore.set('latest', event.blocks.at(-1)!.number);
51
50
  for (const block of event.blocks) {
52
51
  await this.l2BlockHashesStore.set(block.number, block.header.hash().toString());
53
52
  }
53
+ await this.l2TipsStore.set('latest', event.blocks.at(-1)!.number);
54
54
  break;
55
55
  case 'chain-pruned':
56
56
  await this.l2TipsStore.set('latest', event.blockNumber);
@@ -60,7 +60,7 @@ export class L2TipsStore implements L2BlockStreamEventHandler, L2BlockStreamLoca
60
60
  break;
61
61
  case 'chain-finalized':
62
62
  await this.l2TipsStore.set('finalized', event.blockNumber);
63
- for (const key of this.l2BlockHashesStore.keys({ end: event.blockNumber })) {
63
+ for await (const key of this.l2BlockHashesStore.keysAsync({ end: event.blockNumber })) {
64
64
  await this.l2BlockHashesStore.delete(key);
65
65
  }
66
66
  break;
package/src/utils.ts CHANGED
@@ -1,30 +1,9 @@
1
1
  import { type EthAddress } from '@aztec/foundation/eth-address';
2
- import { type Logger, createDebugLogger } from '@aztec/foundation/log';
2
+ import { type Logger } from '@aztec/foundation/log';
3
3
 
4
- import { join } from 'path';
5
-
6
- import { type DataStoreConfig } from './config.js';
7
- import { type AztecKVStore } from './interfaces/store.js';
8
- import { AztecLmdbStore } from './lmdb/store.js';
9
-
10
- export function createStore(name: string, config: DataStoreConfig, log: Logger = createDebugLogger('aztec:kv-store')) {
11
- let { dataDirectory } = config;
12
- if (typeof dataDirectory !== 'undefined') {
13
- dataDirectory = join(dataDirectory, name);
14
- }
15
-
16
- log.info(
17
- dataDirectory
18
- ? `Creating ${name} data store at directory ${dataDirectory} with map size ${config.dataStoreMapSizeKB} KB`
19
- : `Creating ${name} ephemeral data store with map size ${config.dataStoreMapSizeKB} KB`,
20
- );
21
-
22
- const store = AztecLmdbStore.open(dataDirectory, config.dataStoreMapSizeKB, false);
23
- if (config.l1Contracts?.rollupAddress) {
24
- return initStoreForRollup(store, config.l1Contracts.rollupAddress, log);
25
- }
26
- return store;
27
- }
4
+ import { type AztecAsyncSingleton, type AztecSingleton } from './interfaces/singleton.js';
5
+ import { type AztecAsyncKVStore, type AztecKVStore } from './interfaces/store.js';
6
+ import { isSyncStore } from './interfaces/utils.js';
28
7
 
29
8
  /**
30
9
  * Clears the store if the rollup address does not match the one stored in the database.
@@ -33,7 +12,7 @@ export function createStore(name: string, config: DataStoreConfig, log: Logger =
33
12
  * @param rollupAddress - The ETH address of the rollup contract
34
13
  * @returns A promise that resolves when the store is cleared, or rejects if the rollup address does not match
35
14
  */
36
- async function initStoreForRollup<T extends AztecKVStore>(
15
+ export async function initStoreForRollup<T extends AztecKVStore | AztecAsyncKVStore>(
37
16
  store: T,
38
17
  rollupAddress: EthAddress,
39
18
  log?: Logger,
@@ -43,7 +22,9 @@ async function initStoreForRollup<T extends AztecKVStore>(
43
22
  }
44
23
  const rollupAddressValue = store.openSingleton<ReturnType<EthAddress['toString']>>('rollupAddress');
45
24
  const rollupAddressString = rollupAddress.toString();
46
- const storedRollupAddressString = rollupAddressValue.get();
25
+ const storedRollupAddressString = isSyncStore(store)
26
+ ? (rollupAddressValue as AztecSingleton<ReturnType<EthAddress['toString']>>).get()
27
+ : await (rollupAddressValue as AztecAsyncSingleton<ReturnType<EthAddress['toString']>>).getAsync();
47
28
 
48
29
  if (typeof storedRollupAddressString !== 'undefined' && storedRollupAddressString !== rollupAddressString) {
49
30
  log?.warn(`Rollup address mismatch. Clearing entire database...`, {
@@ -57,13 +38,3 @@ async function initStoreForRollup<T extends AztecKVStore>(
57
38
  await rollupAddressValue.set(rollupAddressString);
58
39
  return store;
59
40
  }
60
-
61
- /**
62
- * Opens a temporary store for testing purposes.
63
- * @param ephemeral - true if the store should only exist in memory and not automatically be flushed to disk. Optional
64
- * @returns A new store
65
- */
66
- export function openTmpStore(ephemeral: boolean = false): AztecLmdbStore {
67
- const mapSize = 1024 * 1024 * 10; // 10 GB map size
68
- return AztecLmdbStore.open(undefined, mapSize, ephemeral);
69
- }