diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/contract_class_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/contract_class_store.ts index 0d17369dcd62..a07dd5f3de7e 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/contract_class_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/contract_class_store.ts @@ -17,7 +17,7 @@ export class ContractClassStore { this.#contractClasses = db.openMap('archiver_contract_classes'); } - addContractClass(contractClass: ContractClassPublic): Promise { + addContractClass(contractClass: ContractClassPublic): Promise { return this.#contractClasses.set(contractClass.id.toString(), serializeContractClassPublic(contractClass)); } diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/contract_instance_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/contract_instance_store.ts index fb020eb3c353..cebdad65df9b 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/contract_instance_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/contract_instance_store.ts @@ -12,7 +12,7 @@ export class ContractInstanceStore { this.#contractInstances = db.openMap('archiver_contract_instances'); } - addContractInstance(contractInstance: ContractInstanceWithAddress): Promise { + addContractInstance(contractInstance: ContractInstanceWithAddress): Promise { return this.#contractInstances.set( contractInstance.address.toString(), new SerializableContractInstance(contractInstance).toBuffer(), diff --git a/yarn-project/kv-store/src/interfaces/counter.ts b/yarn-project/kv-store/src/interfaces/counter.ts index 0f68626e6911..3cd3ca60a97b 100644 --- a/yarn-project/kv-store/src/interfaces/counter.ts +++ b/yarn-project/kv-store/src/interfaces/counter.ts @@ -12,7 +12,7 @@ export interface AztecCounter { * @param key - The key to reset * @param value - The value to reset the key to */ - set(key: K, value: number): Promise; + set(key: K, value: number): Promise; /** * Updates the count of the given key by the given delta. This can be used to increment or decrement the count. @@ -21,7 +21,7 @@ export interface AztecCounter { * @param key - The key to update * @param delta - The amount to modify the key by */ - update(key: K, delta: number): Promise; + update(key: K, delta: number): Promise; /** * Gets the current count. diff --git a/yarn-project/kv-store/src/interfaces/map.ts b/yarn-project/kv-store/src/interfaces/map.ts index 0916146a4ab9..357ebdcbb256 100644 --- a/yarn-project/kv-store/src/interfaces/map.ts +++ b/yarn-project/kv-store/src/interfaces/map.ts @@ -22,14 +22,14 @@ export interface AztecMap { * @param key - The key to set the value at * @param val - The value to set */ - set(key: K, val: V): Promise; + set(key: K, val: V): Promise; /** * Atomically swap the value at the given key * @param key - The key to swap the value at * @param fn - The function to swap the value with */ - swap(key: K, fn: (val: V | undefined) => V): Promise; + swap(key: K, fn: (val: V | undefined) => V): Promise; /** * Sets the value at the given key if it does not already exist. @@ -42,7 +42,7 @@ export interface AztecMap { * Deletes the value at the given key. * @param key - The key to delete the value at */ - delete(key: K): Promise; + delete(key: K): Promise; /** * Iterates over the map's key-value entries in the key's natural order diff --git a/yarn-project/kv-store/src/lmdb/counter.ts b/yarn-project/kv-store/src/lmdb/counter.ts index 74886e89dbf3..b25231bdc6f0 100644 --- a/yarn-project/kv-store/src/lmdb/counter.ts +++ b/yarn-project/kv-store/src/lmdb/counter.ts @@ -18,11 +18,11 @@ export class LmdbAztecCounter implements AztecCounter { this.#map = new LmdbAztecMap(db, name); } - set(key: K, value: number): Promise { - return this.#map.set(key, value); + async set(key: K, value: number): Promise { + await this.#map.set(key, value); } - update(key: K, delta = 1): Promise { + update(key: K, delta = 1): Promise { return this.#db.childTransaction(() => { const current = this.#map.get(key) ?? 0; const next = current + delta; @@ -38,8 +38,6 @@ export class LmdbAztecCounter implements AztecCounter { // of the key when iterating over the database void this.#map.set(key, next); } - - return true; }); } diff --git a/yarn-project/kv-store/src/lmdb/map.ts b/yarn-project/kv-store/src/lmdb/map.ts index 6e5fa67ef1e1..74b2aa0c882f 100644 --- a/yarn-project/kv-store/src/lmdb/map.ts +++ b/yarn-project/kv-store/src/lmdb/map.ts @@ -46,17 +46,15 @@ export class LmdbAztecMap implements AztecMultiMap { return this.db.doesExist(this.#slot(key)); } - set(key: K, val: V): Promise { - return this.db.put(this.#slot(key), [key, val]); + async set(key: K, val: V): Promise { + await this.db.put(this.#slot(key), [key, val]); } - swap(key: K, fn: (val: V | undefined) => V): Promise { + swap(key: K, fn: (val: V | undefined) => V): Promise { return this.db.childTransaction(() => { const slot = this.#slot(key); const entry = this.db.get(slot); void this.db.put(slot, [key, fn(entry?.[1])]); - - return true; }); } @@ -67,8 +65,8 @@ export class LmdbAztecMap implements AztecMultiMap { }); } - delete(key: K): Promise { - return this.db.remove(this.#slot(key)); + async delete(key: K): Promise { + await this.db.remove(this.#slot(key)); } async deleteValue(key: K, val: V): Promise { diff --git a/yarn-project/pxe/src/database/kv_pxe_database.ts b/yarn-project/pxe/src/database/kv_pxe_database.ts index 8fabdf148729..cb23c2cb4151 100644 --- a/yarn-project/pxe/src/database/kv_pxe_database.ts +++ b/yarn-project/pxe/src/database/kv_pxe_database.ts @@ -391,7 +391,7 @@ export class KVPxeDatabase implements PxeDatabase { return this.#syncedBlockPerPublicKey.get(publicKey.toString()); } - setSynchedBlockNumberForPublicKey(publicKey: Point, blockNumber: number): Promise { + setSynchedBlockNumberForPublicKey(publicKey: Point, blockNumber: number): Promise { return this.#syncedBlockPerPublicKey.set(publicKey.toString(), blockNumber); } diff --git a/yarn-project/pxe/src/database/pxe_database.ts b/yarn-project/pxe/src/database/pxe_database.ts index a755f7103319..4b091eee228b 100644 --- a/yarn-project/pxe/src/database/pxe_database.ts +++ b/yarn-project/pxe/src/database/pxe_database.ts @@ -150,7 +150,7 @@ export interface PxeDatabase extends ContractArtifactDatabase, ContractInstanceD * @param publicKey - The public key to set the synched block number for. * @param blockNumber - The block number to set. */ - setSynchedBlockNumberForPublicKey(publicKey: PublicKey, blockNumber: number): Promise; + setSynchedBlockNumberForPublicKey(publicKey: PublicKey, blockNumber: number): Promise; /** * Get the synched block number for a given public key. diff --git a/yarn-project/pxe/src/note_processor/note_processor.ts b/yarn-project/pxe/src/note_processor/note_processor.ts index 82a02a36151b..32c25579c961 100644 --- a/yarn-project/pxe/src/note_processor/note_processor.ts +++ b/yarn-project/pxe/src/note_processor/note_processor.ts @@ -125,6 +125,7 @@ export class NoteProcessor { for (const functionLogs of txFunctionLogs) { for (const log of functionLogs.logs) { this.stats.seen++; + console.log('log.data', log.toString('hex')); const taggedNote = TaggedNote.fromEncryptedBuffer(log, privateKey, curve); if (taggedNote?.notePayload) { const { notePayload: payload } = taggedNote; diff --git a/yarn-project/pxe/src/synchronizer/synchronizer.ts b/yarn-project/pxe/src/synchronizer/synchronizer.ts index 7ae66192402b..59e07a30c3ab 100644 --- a/yarn-project/pxe/src/synchronizer/synchronizer.ts +++ b/yarn-project/pxe/src/synchronizer/synchronizer.ts @@ -99,6 +99,16 @@ export class Synchronizer { } const encryptedLogs = blocks.flatMap(block => block.body.encryptedLogs); + console.log( + `GOT ENCRYPTED LOGS FROM BLOCKS:\n${encryptedLogs.flatMap(log => + log.txLogs.flatMap(log => + log + .unrollLogs() + .map(log => log.toString('hex')) + .join('\n'), + ), + )}`, + ); // Wrap blocks in block contexts & only keep those that match our query const blockContexts = blocks.filter(block => block.number >= from).map(block => new L2BlockContext(block));