diff --git a/.test_patterns.yml b/.test_patterns.yml index a055f2dfc353..2c2bf0ed6209 100644 --- a/.test_patterns.yml +++ b/.test_patterns.yml @@ -104,6 +104,10 @@ tests: error_regex: "TimeoutError: Timeout awaiting blocks mined" owners: - *palla + - regex: "simple e2e_p2p/reqresp" + error_regex: "TimeoutError: Timeout awaiting isMined" + owners: + - *palla - regex: "simple e2e_fees/private_payments" owners: - *phil diff --git a/yarn-project/kv-store/package.json b/yarn-project/kv-store/package.json index a404c0ca1707..7964d6565685 100644 --- a/yarn-project/kv-store/package.json +++ b/yarn-project/kv-store/package.json @@ -32,6 +32,7 @@ "idb": "^8.0.0", "lmdb": "^3.2.0", "msgpackr": "^1.11.2", + "ohash": "^2.0.11", "ordered-binary": "^1.5.3" }, "devDependencies": { diff --git a/yarn-project/kv-store/src/indexeddb/array.ts b/yarn-project/kv-store/src/indexeddb/array.ts index ac9af264e587..19b2c71465b9 100644 --- a/yarn-project/kv-store/src/indexeddb/array.ts +++ b/yarn-project/kv-store/src/indexeddb/array.ts @@ -1,12 +1,14 @@ import type { IDBPDatabase, IDBPObjectStore } from 'idb'; +import { hash } from 'ohash'; import type { AztecAsyncArray } from '../interfaces/array.js'; +import type { Value } from '../interfaces/common.js'; import type { AztecIDBSchema } from './store.js'; /** * A persistent array backed by IndexedDB. */ -export class IndexedDBAztecArray implements AztecAsyncArray { +export class IndexedDBAztecArray implements AztecAsyncArray { #_db?: IDBPObjectStore; #rootDB: IDBPDatabase; #container: string; @@ -39,6 +41,7 @@ export class IndexedDBAztecArray implements AztecAsyncArray { for (const val of vals) { await this.db.put({ value: val, + hash: hash(val), container: this.#container, key: this.#name, keyCount: length + 1, @@ -86,6 +89,7 @@ export class IndexedDBAztecArray implements AztecAsyncArray { await this.db.put({ value: val, + hash: hash(val), container: this.#container, key: this.#name, keyCount: index + 1, diff --git a/yarn-project/kv-store/src/indexeddb/map.ts b/yarn-project/kv-store/src/indexeddb/map.ts index 41d0fb7fe7b9..25b1d766d5a2 100644 --- a/yarn-project/kv-store/src/indexeddb/map.ts +++ b/yarn-project/kv-store/src/indexeddb/map.ts @@ -1,13 +1,14 @@ import type { IDBPDatabase, IDBPObjectStore } from 'idb'; +import { hash } from 'ohash'; -import type { Key, Range } from '../interfaces/common.js'; +import type { Key, Range, Value } from '../interfaces/common.js'; import type { AztecAsyncMap } from '../interfaces/map.js'; import type { AztecIDBSchema } from './store.js'; /** * A map backed by IndexedDB. */ -export class IndexedDBAztecMap implements AztecAsyncMap { +export class IndexedDBAztecMap implements AztecAsyncMap { protected name: string; protected container: string; @@ -41,6 +42,7 @@ export class IndexedDBAztecMap implements AztecAsyncMap async set(key: K, val: V): Promise { await this.db.put({ value: val, + hash: hash(val), container: this.container, key: this.normalizeKey(key), keyCount: 1, diff --git a/yarn-project/kv-store/src/indexeddb/multi_map.ts b/yarn-project/kv-store/src/indexeddb/multi_map.ts index de7829671a6d..3b8325cc7c95 100644 --- a/yarn-project/kv-store/src/indexeddb/multi_map.ts +++ b/yarn-project/kv-store/src/indexeddb/multi_map.ts @@ -1,20 +1,34 @@ -import type { Key } from '../interfaces/common.js'; +import { hash } from 'ohash'; + +import type { Key, Value } from '../interfaces/common.js'; import type { AztecAsyncMultiMap } from '../interfaces/multi_map.js'; import { IndexedDBAztecMap } from './map.js'; /** * A multi map backed by IndexedDB. */ -export class IndexedDBAztecMultiMap +export class IndexedDBAztecMultiMap extends IndexedDBAztecMap implements AztecAsyncMultiMap { override async set(key: K, val: V): Promise { + const exists = !!(await this.db + .index('hash') + .get( + IDBKeyRange.bound( + [this.container, this.normalizeKey(key), hash(val)], + [this.container, this.normalizeKey(key), hash(val)], + ), + )); + if (exists) { + return; + } const count = await this.db .index('key') .count(IDBKeyRange.bound([this.container, this.normalizeKey(key)], [this.container, this.normalizeKey(key)])); await this.db.put({ value: val, + hash: hash(val), container: this.container, key: this.normalizeKey(key), keyCount: count + 1, @@ -36,18 +50,16 @@ export class IndexedDBAztecMultiMap } async deleteValue(key: K, val: V): Promise { - const index = this.db.index('keyCount'); - const rangeQuery = IDBKeyRange.bound( - [this.container, this.normalizeKey(key), 0], - [this.container, this.normalizeKey(key), Number.MAX_SAFE_INTEGER], - false, - false, - ); - for await (const cursor of index.iterate(rangeQuery)) { - if (JSON.stringify(cursor.value.value) === JSON.stringify(val)) { - await cursor.delete(); - return; - } + const fullKey = await this.db + .index('hash') + .getKey( + IDBKeyRange.bound( + [this.container, this.normalizeKey(key), hash(val)], + [this.container, this.normalizeKey(key), hash(val)], + ), + ); + if (fullKey) { + await this.db.delete(fullKey); } } } diff --git a/yarn-project/kv-store/src/indexeddb/singleton.ts b/yarn-project/kv-store/src/indexeddb/singleton.ts index b0e3d45aa7b3..1cf2fd2fb32d 100644 --- a/yarn-project/kv-store/src/indexeddb/singleton.ts +++ b/yarn-project/kv-store/src/indexeddb/singleton.ts @@ -1,12 +1,14 @@ import type { IDBPDatabase, IDBPObjectStore } from 'idb'; +import { hash } from 'ohash'; +import type { Value } from '../interfaces/common.js'; import type { AztecAsyncSingleton } from '../interfaces/singleton.js'; import type { AztecIDBSchema } from './store.js'; /** * Stores a single value in IndexedDB. */ -export class IndexedDBAztecSingleton implements AztecAsyncSingleton { +export class IndexedDBAztecSingleton implements AztecAsyncSingleton { #_db?: IDBPObjectStore; #rootDB: IDBPDatabase; #container: string; @@ -38,6 +40,7 @@ export class IndexedDBAztecSingleton implements AztecAsyncSingleton { key: this.#slot, keyCount: 1, value: val, + hash: hash(val), }); return result !== undefined; } diff --git a/yarn-project/kv-store/src/indexeddb/store.ts b/yarn-project/kv-store/src/indexeddb/store.ts index d4a8f50dfc8d..aa4365114647 100644 --- a/yarn-project/kv-store/src/indexeddb/store.ts +++ b/yarn-project/kv-store/src/indexeddb/store.ts @@ -3,7 +3,7 @@ import type { Logger } from '@aztec/foundation/log'; import { type DBSchema, type IDBPDatabase, deleteDB, openDB } from 'idb'; import type { AztecAsyncArray } from '../interfaces/array.js'; -import type { Key, StoreSize } from '../interfaces/common.js'; +import type { Key, StoreSize, Value } from '../interfaces/common.js'; import type { AztecAsyncCounter } from '../interfaces/counter.js'; import type { AztecAsyncMap } from '../interfaces/map.js'; import type { AztecAsyncMultiMap } from '../interfaces/multi_map.js'; @@ -16,13 +16,20 @@ import { IndexedDBAztecMultiMap } from './multi_map.js'; import { IndexedDBAztecSet } from './set.js'; import { IndexedDBAztecSingleton } from './singleton.js'; -export type StoredData = { value: V; container: string; key: string; keyCount: number; slot: string }; +export type StoredData = { + value: V; + container: string; + key: string; + keyCount: number; + slot: string; + hash: string; +}; export interface AztecIDBSchema extends DBSchema { data: { value: StoredData; key: string; - indexes: { container: string; key: string; keyCount: number }; + indexes: { container: string; key: string; keyCount: number; hash: string }; }; } @@ -67,6 +74,7 @@ export class AztecIndexedDBStore implements AztecAsyncKVStore { objectStore.createIndex('key', ['container', 'key'], { unique: false }); objectStore.createIndex('keyCount', ['container', 'key', 'keyCount'], { unique: false }); + objectStore.createIndex('hash', ['container', 'key', 'hash'], { unique: true }); }, }); @@ -79,7 +87,7 @@ export class AztecIndexedDBStore implements AztecAsyncKVStore { * @param name - Name of the map * @returns A new AztecMap */ - openMap(name: string): AztecAsyncMap { + openMap(name: string): AztecAsyncMap { const map = new IndexedDBAztecMap(this.#rootDB, name); this.#containers.add(map); return map; @@ -101,7 +109,7 @@ export class AztecIndexedDBStore implements AztecAsyncKVStore { * @param name - Name of the map * @returns A new AztecMultiMap */ - openMultiMap(name: string): AztecAsyncMultiMap { + openMultiMap(name: string): AztecAsyncMultiMap { const multimap = new IndexedDBAztecMultiMap(this.#rootDB, name); this.#containers.add(multimap); return multimap; @@ -116,7 +124,7 @@ export class AztecIndexedDBStore implements AztecAsyncKVStore { * @param name - Name of the array * @returns A new AztecArray */ - openArray(name: string): AztecAsyncArray { + openArray(name: string): AztecAsyncArray { const array = new IndexedDBAztecArray(this.#rootDB, name); this.#containers.add(array); return array; @@ -127,7 +135,7 @@ export class AztecIndexedDBStore implements AztecAsyncKVStore { * @param name - Name of the singleton * @returns A new AztecSingleton */ - openSingleton(name: string): AztecAsyncSingleton { + openSingleton(name: string): AztecAsyncSingleton { const singleton = new IndexedDBAztecSingleton(this.#rootDB, name); this.#containers.add(singleton); return singleton; diff --git a/yarn-project/kv-store/src/interfaces/array.ts b/yarn-project/kv-store/src/interfaces/array.ts index 70e98a24c3e9..7b0647bef608 100644 --- a/yarn-project/kv-store/src/interfaces/array.ts +++ b/yarn-project/kv-store/src/interfaces/array.ts @@ -1,7 +1,9 @@ +import type { Value } from './common.js'; + /** * An array backed by a persistent store. Can not have any holes in it. */ -interface BaseAztecArray { +interface BaseAztecArray { /** * Pushes values to the end of the array * @param vals - The values to push to the end of the array @@ -27,7 +29,7 @@ interface BaseAztecArray { /** * An array backed by a persistent store. Can not have any holes in it. */ -export interface AztecAsyncArray extends BaseAztecArray { +export interface AztecAsyncArray extends BaseAztecArray { /** * The size of the array */ @@ -58,7 +60,7 @@ export interface AztecAsyncArray extends BaseAztecArray { [Symbol.asyncIterator](): AsyncIterableIterator; } -export interface AztecArray extends BaseAztecArray { +export interface AztecArray extends BaseAztecArray { /** * The size of the array */ diff --git a/yarn-project/kv-store/src/interfaces/common.ts b/yarn-project/kv-store/src/interfaces/common.ts index f7123038f839..a8d6b28f9459 100644 --- a/yarn-project/kv-store/src/interfaces/common.ts +++ b/yarn-project/kv-store/src/interfaces/common.ts @@ -3,6 +3,8 @@ */ export type Key = string | number | Array; +export type Value = NonNullable; + /** * A range of keys to iterate over. */ diff --git a/yarn-project/kv-store/src/interfaces/map.ts b/yarn-project/kv-store/src/interfaces/map.ts index e498185df0ea..2cec186697f4 100644 --- a/yarn-project/kv-store/src/interfaces/map.ts +++ b/yarn-project/kv-store/src/interfaces/map.ts @@ -1,9 +1,9 @@ -import type { Key, Range } from './common.js'; +import type { Key, Range, Value } from './common.js'; /** * A map backed by a persistent store. */ -interface AztecBaseMap { +interface AztecBaseMap { /** * Sets the value at the given key. * @param key - The key to set the value at @@ -24,7 +24,7 @@ interface AztecBaseMap { */ delete(key: K): Promise; } -export interface AztecMap extends AztecBaseMap { +export interface AztecMap extends AztecBaseMap { /** * Gets the value at the given key. * @param key - The key to get the value from @@ -65,7 +65,7 @@ export interface AztecMap extends AztecBaseMap { /** * A map backed by a persistent store. */ -export interface AztecAsyncMap extends AztecBaseMap { +export interface AztecAsyncMap extends AztecBaseMap { /** * Gets the value at the given key. * @param key - The key to get the value from diff --git a/yarn-project/kv-store/src/interfaces/multi_map.ts b/yarn-project/kv-store/src/interfaces/multi_map.ts index 4e3d7e922c7f..b54b773b4bd3 100644 --- a/yarn-project/kv-store/src/interfaces/multi_map.ts +++ b/yarn-project/kv-store/src/interfaces/multi_map.ts @@ -1,10 +1,10 @@ -import type { Key } from './common.js'; +import type { Key, Value } from './common.js'; import type { AztecAsyncMap, AztecMap } from './map.js'; /** * A map backed by a persistent store that can have multiple values for a single key. */ -export interface AztecMultiMap extends AztecMap { +export interface AztecMultiMap extends AztecMap { /** * Gets all the values at the given key. * @param key - The key to get the values from @@ -22,7 +22,7 @@ export interface AztecMultiMap extends AztecMap { /** * A map backed by a persistent store that can have multiple values for a single key. */ -export interface AztecAsyncMultiMap extends AztecAsyncMap { +export interface AztecAsyncMultiMap extends AztecAsyncMap { /** * Gets all the values at the given key. * @param key - The key to get the values from diff --git a/yarn-project/kv-store/src/interfaces/multi_map_test_suite.ts b/yarn-project/kv-store/src/interfaces/multi_map_test_suite.ts index 8e23a11d4eb7..37a2ee6c4cf8 100644 --- a/yarn-project/kv-store/src/interfaces/multi_map_test_suite.ts +++ b/yarn-project/kv-store/src/interfaces/multi_map_test_suite.ts @@ -116,6 +116,13 @@ export function describeAztecMultiMap( expect(await getValues('foo')).to.deep.equal(['bar', 'baz']); }); + it('should ignore multiple identical values', async () => { + await multiMap.set('foo', 'bar'); + await multiMap.set('foo', 'bar'); + + expect(await getValues('foo')).to.deep.equal(['bar']); + }); + it('should be able to delete individual values for a single key', async () => { await multiMap.set('foo', 'bar'); await multiMap.set('foo', 'baz'); diff --git a/yarn-project/kv-store/src/interfaces/store.ts b/yarn-project/kv-store/src/interfaces/store.ts index 0733b48f01e5..4bc41a391c98 100644 --- a/yarn-project/kv-store/src/interfaces/store.ts +++ b/yarn-project/kv-store/src/interfaces/store.ts @@ -1,5 +1,5 @@ import type { AztecArray, AztecAsyncArray } from './array.js'; -import type { Key, StoreSize } from './common.js'; +import type { Key, StoreSize, Value } from './common.js'; import type { AztecAsyncCounter, AztecCounter } from './counter.js'; import type { AztecAsyncMap, AztecMap } from './map.js'; import type { AztecAsyncMultiMap, AztecMultiMap } from './multi_map.js'; @@ -14,7 +14,7 @@ export interface AztecKVStore { * @param name - The name of the map * @returns The map */ - openMap(name: string): AztecMap; + openMap(name: string): AztecMap; /** * Creates a new set. @@ -28,21 +28,21 @@ export interface AztecKVStore { * @param name - The name of the multi-map * @returns The multi-map */ - openMultiMap(name: string): AztecMultiMap; + openMultiMap(name: string): AztecMultiMap; /** * Creates a new array. * @param name - The name of the array * @returns The array */ - openArray(name: string): AztecArray; + openArray(name: string): AztecArray; /** * Creates a new singleton. * @param name - The name of the singleton * @returns The singleton */ - openSingleton(name: string): AztecSingleton; + openSingleton(name: string): AztecSingleton; /** * Creates a new count map. @@ -83,7 +83,7 @@ export interface AztecAsyncKVStore { * @param name - The name of the map * @returns The map */ - openMap(name: string): AztecAsyncMap; + openMap(name: string): AztecAsyncMap; /** * Creates a new set. @@ -97,21 +97,21 @@ export interface AztecAsyncKVStore { * @param name - The name of the multi-map * @returns The multi-map */ - openMultiMap(name: string): AztecAsyncMultiMap; + openMultiMap(name: string): AztecAsyncMultiMap; /** * Creates a new array. * @param name - The name of the array * @returns The array */ - openArray(name: string): AztecAsyncArray; + openArray(name: string): AztecAsyncArray; /** * Creates a new singleton. * @param name - The name of the singleton * @returns The singleton */ - openSingleton(name: string): AztecAsyncSingleton; + openSingleton(name: string): AztecAsyncSingleton; /** * Creates a new count map. diff --git a/yarn-project/kv-store/src/lmdb-v2/array.ts b/yarn-project/kv-store/src/lmdb-v2/array.ts index b1362f34f7fb..8ce6da0cf076 100644 --- a/yarn-project/kv-store/src/lmdb-v2/array.ts +++ b/yarn-project/kv-store/src/lmdb-v2/array.ts @@ -1,13 +1,14 @@ import { Encoder } from 'msgpackr/pack'; import type { AztecAsyncArray } from '../interfaces/array.js'; +import type { Value } from '../interfaces/common.js'; import type { AztecAsyncSingleton } from '../interfaces/singleton.js'; import type { ReadTransaction } from './read_transaction.js'; // eslint-disable-next-line import/no-cycle import { AztecLMDBStoreV2, execInReadTx, execInWriteTx } from './store.js'; import { deserializeKey, serializeKey } from './utils.js'; -export class LMDBArray implements AztecAsyncArray { +export class LMDBArray implements AztecAsyncArray { private length: AztecAsyncSingleton; private encoder = new Encoder(); private prefix: string; diff --git a/yarn-project/kv-store/src/lmdb-v2/map.ts b/yarn-project/kv-store/src/lmdb-v2/map.ts index 36d8f39e3e87..9e29e0c28d48 100644 --- a/yarn-project/kv-store/src/lmdb-v2/map.ts +++ b/yarn-project/kv-store/src/lmdb-v2/map.ts @@ -1,13 +1,13 @@ import { Encoder } from 'msgpackr'; -import type { Key, Range } from '../interfaces/common.js'; +import type { Key, Range, Value } from '../interfaces/common.js'; import type { AztecAsyncMap } from '../interfaces/map.js'; import type { ReadTransaction } from './read_transaction.js'; // eslint-disable-next-line import/no-cycle import { type AztecLMDBStoreV2, execInReadTx, execInWriteTx } from './store.js'; import { deserializeKey, maxKey, minKey, serializeKey } from './utils.js'; -export class LMDBMap implements AztecAsyncMap { +export class LMDBMap implements AztecAsyncMap { private prefix: string; private encoder = new Encoder(); diff --git a/yarn-project/kv-store/src/lmdb-v2/multi_map.ts b/yarn-project/kv-store/src/lmdb-v2/multi_map.ts index b6d863929e73..a680b80a1664 100644 --- a/yarn-project/kv-store/src/lmdb-v2/multi_map.ts +++ b/yarn-project/kv-store/src/lmdb-v2/multi_map.ts @@ -1,12 +1,12 @@ import { Encoder } from 'msgpackr/pack'; -import type { Key, Range } from '../interfaces/common.js'; +import type { Key, Range, Value } from '../interfaces/common.js'; import type { AztecAsyncMultiMap } from '../interfaces/multi_map.js'; import type { ReadTransaction } from './read_transaction.js'; import { type AztecLMDBStoreV2, execInReadTx, execInWriteTx } from './store.js'; import { deserializeKey, maxKey, minKey, serializeKey } from './utils.js'; -export class LMDBMultiMap implements AztecAsyncMultiMap { +export class LMDBMultiMap implements AztecAsyncMultiMap { private prefix: string; private encoder = new Encoder(); constructor(private store: AztecLMDBStoreV2, name: string) { diff --git a/yarn-project/kv-store/src/lmdb-v2/store.ts b/yarn-project/kv-store/src/lmdb-v2/store.ts index 3b2c7030c418..07123a25595f 100644 --- a/yarn-project/kv-store/src/lmdb-v2/store.ts +++ b/yarn-project/kv-store/src/lmdb-v2/store.ts @@ -6,7 +6,7 @@ import { AsyncLocalStorage } from 'async_hooks'; import { mkdir, rm } from 'fs/promises'; import type { AztecAsyncArray } from '../interfaces/array.js'; -import type { Key, StoreSize } from '../interfaces/common.js'; +import type { Key, StoreSize, Value } from '../interfaces/common.js'; import type { AztecAsyncCounter } from '../interfaces/counter.js'; import type { AztecAsyncMap } from '../interfaces/map.js'; import type { AztecAsyncMultiMap } from '../interfaces/multi_map.js'; @@ -102,19 +102,19 @@ export class AztecLMDBStoreV2 implements AztecAsyncKVStore, LMDBMessageChannel { return currentWrite; } - openMap(name: string): AztecAsyncMap { + openMap(name: string): AztecAsyncMap { return new LMDBMap(this, name); } - openMultiMap(name: string): AztecAsyncMultiMap { + openMultiMap(name: string): AztecAsyncMultiMap { return new LMDBMultiMap(this, name); } - openSingleton(name: string): AztecAsyncSingleton { + openSingleton(name: string): AztecAsyncSingleton { return new LMDBSingleValue(this, name); } - openArray(name: string): AztecAsyncArray { + openArray(name: string): AztecAsyncArray { return new LMDBArray(this, name); } diff --git a/yarn-project/kv-store/src/lmdb/array.ts b/yarn-project/kv-store/src/lmdb/array.ts index 5734e4d6ecb0..0f6bf03a8059 100644 --- a/yarn-project/kv-store/src/lmdb/array.ts +++ b/yarn-project/kv-store/src/lmdb/array.ts @@ -1,6 +1,7 @@ import type { Database, Key } from 'lmdb'; import type { AztecArray, AztecAsyncArray } from '../interfaces/array.js'; +import type { Value } from '../interfaces/common.js'; import { LmdbAztecSingleton } from './singleton.js'; /** The shape of a key that stores a value in an array */ @@ -9,7 +10,7 @@ type ArrayIndexSlot = ['array', string, 'slot', number]; /** * An persistent array backed by LMDB. */ -export class LmdbAztecArray implements AztecArray, AztecAsyncArray { +export class LmdbAztecArray implements AztecArray, AztecAsyncArray { #db: Database; #name: string; #length: LmdbAztecSingleton; diff --git a/yarn-project/kv-store/src/lmdb/map.ts b/yarn-project/kv-store/src/lmdb/map.ts index 148d91361557..d80974903393 100644 --- a/yarn-project/kv-store/src/lmdb/map.ts +++ b/yarn-project/kv-store/src/lmdb/map.ts @@ -1,6 +1,6 @@ import type { Database, RangeOptions } from 'lmdb'; -import type { Key, Range } from '../interfaces/common.js'; +import type { Key, Range, Value } from '../interfaces/common.js'; import type { AztecAsyncMap, AztecMap } from '../interfaces/map.js'; /** The slot where a key-value entry would be stored */ @@ -9,7 +9,7 @@ type MapValueSlot = ['map', string, 'slot', K]; /** * A map backed by LMDB. */ -export class LmdbAztecMap implements AztecMap, AztecAsyncMap { +export class LmdbAztecMap implements AztecMap, AztecAsyncMap { protected db: Database<[K, V], MapValueSlot>; protected name: string; diff --git a/yarn-project/kv-store/src/lmdb/multi_map.ts b/yarn-project/kv-store/src/lmdb/multi_map.ts index fad497032028..4b0ecceb9e22 100644 --- a/yarn-project/kv-store/src/lmdb/multi_map.ts +++ b/yarn-project/kv-store/src/lmdb/multi_map.ts @@ -1,11 +1,11 @@ -import type { Key } from '../interfaces/common.js'; +import type { Key, Value } from '../interfaces/common.js'; import type { AztecAsyncMultiMap, AztecMultiMap } from '../interfaces/multi_map.js'; import { LmdbAztecMap } from './map.js'; /** * A map backed by LMDB. */ -export class LmdbAztecMultiMap +export class LmdbAztecMultiMap extends LmdbAztecMap implements AztecMultiMap, AztecAsyncMultiMap { diff --git a/yarn-project/kv-store/src/lmdb/store.ts b/yarn-project/kv-store/src/lmdb/store.ts index fc83245f4640..39084657c716 100644 --- a/yarn-project/kv-store/src/lmdb/store.ts +++ b/yarn-project/kv-store/src/lmdb/store.ts @@ -7,7 +7,7 @@ import { tmpdir } from 'os'; import { join } from 'path'; import type { AztecArray, AztecAsyncArray } from '../interfaces/array.js'; -import type { Key, StoreSize } from '../interfaces/common.js'; +import type { Key, StoreSize, Value } from '../interfaces/common.js'; import type { AztecAsyncCounter, AztecCounter } from '../interfaces/counter.js'; import type { AztecAsyncMap, AztecMap } from '../interfaces/map.js'; import type { AztecAsyncMultiMap, AztecMultiMap } from '../interfaces/multi_map.js'; @@ -80,7 +80,7 @@ export class AztecLmdbStore implements AztecKVStore, AztecAsyncKVStore { * @param name - Name of the map * @returns A new AztecMap */ - openMap(name: string): AztecMap & AztecAsyncMap { + openMap(name: string): AztecMap & AztecAsyncMap { return new LmdbAztecMap(this.#data, name); } @@ -98,7 +98,7 @@ export class AztecLmdbStore implements AztecKVStore, AztecAsyncKVStore { * @param name - Name of the map * @returns A new AztecMultiMap */ - openMultiMap(name: string): AztecMultiMap & AztecAsyncMultiMap { + openMultiMap(name: string): AztecMultiMap & AztecAsyncMultiMap { return new LmdbAztecMultiMap(this.#multiMapData, name); } @@ -111,7 +111,7 @@ export class AztecLmdbStore implements AztecKVStore, AztecAsyncKVStore { * @param name - Name of the array * @returns A new AztecArray */ - openArray(name: string): AztecArray & AztecAsyncArray { + openArray(name: string): AztecArray & AztecAsyncArray { return new LmdbAztecArray(this.#data, name); } diff --git a/yarn-project/pxe/src/pxe_oracle_interface/pxe_oracle_interface.ts b/yarn-project/pxe/src/pxe_oracle_interface/pxe_oracle_interface.ts index 865de15be689..69f306143399 100644 --- a/yarn-project/pxe/src/pxe_oracle_interface/pxe_oracle_interface.ts +++ b/yarn-project/pxe/src/pxe_oracle_interface/pxe_oracle_interface.ts @@ -675,9 +675,10 @@ export class PXEOracleInterface implements ExecutionDataProvider { await this.noteDataProvider.addNotes([noteDao], recipient); this.log.verbose('Added note', { - contract: noteDao.contractAddress, - slot: noteDao.storageSlot, - noteHash: noteDao.noteHash, + index: noteDao.index, + contract: noteDao.contractAddress.toString(), + slot: noteDao.storageSlot.toString(), + noteHash: noteDao.noteHash.toString(), nullifier: noteDao.siloedNullifier.toString(), }); diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index 031ed6b9cded..4a6cf09d3de5 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -877,6 +877,7 @@ __metadata: mocha: "npm:^10.8.2" mocha-each: "npm:^2.0.1" msgpackr: "npm:^1.11.2" + ohash: "npm:^2.0.11" ordered-binary: "npm:^1.5.3" sinon: "npm:^19.0.2" ts-node: "npm:^10.9.1" @@ -17347,6 +17348,13 @@ __metadata: languageName: node linkType: hard +"ohash@npm:^2.0.11": + version: 2.0.11 + resolution: "ohash@npm:2.0.11" + checksum: 10/6b0423f42cc95c3d643f390a88364aac824178b7788dccb4e8c64e2124463d0069e60d4d90bad88ed9823808368d051e088aa27058ca4722b1397a201ffbfa4b + languageName: node + linkType: hard + "on-exit-leak-free@npm:^2.1.0": version: 2.1.2 resolution: "on-exit-leak-free@npm:2.1.2"