Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: not breaking note processing on missing hash and nullifier func #1364

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/src/client/simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}.`,
);
}
}
Expand Down
32 changes: 18 additions & 14 deletions yarn-project/aztec-rpc/src/note_processor/note_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: It would be nice have an if statement to catch the error cases ahead of time with custom error messages. The try and catch is still good though IMO.

} catch (e) {
this.log.warn(`Could not process note because of "${e}". Skipping note...`);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/package.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"scripts": {
"build": "yarn clean && tsc -b && webpack"
}
}
}
6 changes: 2 additions & 4 deletions yarn-project/aztec.js/tsconfig.dest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@
"path": "../types/tsconfig.dest.json"
}
],
"exclude": [
"src/**/*.test.ts"
]
}
"exclude": ["src/**/*.test.ts"]
}
7 changes: 2 additions & 5 deletions yarn-project/circuits.js/tsconfig.dest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
"path": "../foundation/tsconfig.dest.json"
}
],
"exclude": [
"src/**/*.test.ts",
"src/**/*.in.ts"
]
}
"exclude": ["src/**/*.test.ts", "src/**/*.in.ts"]
}
6 changes: 2 additions & 4 deletions yarn-project/foundation/tsconfig.dest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"extends": ".",
"references": [],
"exclude": [
"src/**/*.test.ts"
]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

"exclude": ["src/**/*.test.ts"]
}
6 changes: 2 additions & 4 deletions yarn-project/types/tsconfig.dest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
"path": "../foundation/tsconfig.dest.json"
}
],
"exclude": [
"src/**/*.test.ts"
]
}
"exclude": ["src/**/*.test.ts"]
}