From 861db2a6bdb0b94d8722539b1159bb8b903b7d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bene=C5=A1?= Date: Wed, 2 Aug 2023 17:06:37 +0200 Subject: [PATCH] refactor: not breaking note processing on missing hash and nullifier func (#1364) # Description Fixes #1303 Fixes formatting --- .../acir-simulator/src/client/simulator.ts | 2 +- .../src/note_processor/note_processor.ts | 32 +++++++++++-------- yarn-project/aztec.js/package.local.json | 2 +- yarn-project/aztec.js/tsconfig.dest.json | 6 ++-- yarn-project/circuits.js/tsconfig.dest.json | 7 ++-- yarn-project/foundation/tsconfig.dest.json | 6 ++-- yarn-project/types/tsconfig.dest.json | 6 ++-- 7 files changed, 28 insertions(+), 33 deletions(-) diff --git a/yarn-project/acir-simulator/src/client/simulator.ts b/yarn-project/acir-simulator/src/client/simulator.ts index 6911a1c4e0a..425d1caf27b 100644 --- a/yarn-project/acir-simulator/src/client/simulator.ts +++ b/yarn-project/acir-simulator/src/client/simulator.ts @@ -173,7 +173,7 @@ export class AcirSimulator { }; } catch (e) { throw new Error( - `Please define an unconstrained function "${computeNoteHashAndNullifierSignature}" in the noir contract. Bubbled error message: ${e}`, + `Mandatory implementation of "${computeNoteHashAndNullifierSignature}" missing in noir contract ${contractAddress.toString()}.`, ); } } diff --git a/yarn-project/aztec-rpc/src/note_processor/note_processor.ts b/yarn-project/aztec-rpc/src/note_processor/note_processor.ts index 712e0477fc7..fff0de1703f 100644 --- a/yarn-project/aztec-rpc/src/note_processor/note_processor.ts +++ b/yarn-project/aztec-rpc/src/note_processor/note_processor.ts @@ -114,20 +114,24 @@ export class NoteProcessor { indexOfTxInABlock * MAX_NEW_NULLIFIERS_PER_TX, (indexOfTxInABlock + 1) * MAX_NEW_NULLIFIERS_PER_TX, ); - userPertainingTxIndices.add(indexOfTxInABlock); - const { index, nonce, nullifier } = await this.findNoteIndexAndNullifier( - dataStartIndexForTx, - newCommitments, - newNullifiers[0], - noteSpendingInfo, - ); - noteSpendingInfoDaos.push({ - ...noteSpendingInfo, - index, - nonce, - nullifier, - publicKey: this.publicKey, - }); + try { + const { index, nonce, nullifier } = await this.findNoteIndexAndNullifier( + dataStartIndexForTx, + newCommitments, + newNullifiers[0], + noteSpendingInfo, + ); + noteSpendingInfoDaos.push({ + ...noteSpendingInfo, + index, + nonce, + nullifier, + publicKey: this.publicKey, + }); + userPertainingTxIndices.add(indexOfTxInABlock); + } catch (e) { + this.log.warn(`Could not process note because of "${e}". Skipping note...`); + } } } } diff --git a/yarn-project/aztec.js/package.local.json b/yarn-project/aztec.js/package.local.json index 11f862cc48a..ae44d5384f7 100644 --- a/yarn-project/aztec.js/package.local.json +++ b/yarn-project/aztec.js/package.local.json @@ -2,4 +2,4 @@ "scripts": { "build": "yarn clean && tsc -b && webpack" } -} \ No newline at end of file +} diff --git a/yarn-project/aztec.js/tsconfig.dest.json b/yarn-project/aztec.js/tsconfig.dest.json index f47bbdd408d..34485a9f9f6 100644 --- a/yarn-project/aztec.js/tsconfig.dest.json +++ b/yarn-project/aztec.js/tsconfig.dest.json @@ -11,7 +11,5 @@ "path": "../types/tsconfig.dest.json" } ], - "exclude": [ - "src/**/*.test.ts" - ] -} \ No newline at end of file + "exclude": ["src/**/*.test.ts"] +} diff --git a/yarn-project/circuits.js/tsconfig.dest.json b/yarn-project/circuits.js/tsconfig.dest.json index 80f53b30eea..5ce7408ee2d 100644 --- a/yarn-project/circuits.js/tsconfig.dest.json +++ b/yarn-project/circuits.js/tsconfig.dest.json @@ -5,8 +5,5 @@ "path": "../foundation/tsconfig.dest.json" } ], - "exclude": [ - "src/**/*.test.ts", - "src/**/*.in.ts" - ] -} \ No newline at end of file + "exclude": ["src/**/*.test.ts", "src/**/*.in.ts"] +} diff --git a/yarn-project/foundation/tsconfig.dest.json b/yarn-project/foundation/tsconfig.dest.json index 86c22947530..032674c6f9f 100644 --- a/yarn-project/foundation/tsconfig.dest.json +++ b/yarn-project/foundation/tsconfig.dest.json @@ -1,7 +1,5 @@ { "extends": ".", "references": [], - "exclude": [ - "src/**/*.test.ts" - ] -} \ No newline at end of file + "exclude": ["src/**/*.test.ts"] +} diff --git a/yarn-project/types/tsconfig.dest.json b/yarn-project/types/tsconfig.dest.json index 831ec419be6..849be7da93e 100644 --- a/yarn-project/types/tsconfig.dest.json +++ b/yarn-project/types/tsconfig.dest.json @@ -8,7 +8,5 @@ "path": "../foundation/tsconfig.dest.json" } ], - "exclude": [ - "src/**/*.test.ts" - ] -} \ No newline at end of file + "exclude": ["src/**/*.test.ts"] +}