-
Notifications
You must be signed in to change notification settings - Fork 234
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
940 - getNotes filter nullified notes #1186
Conversation
✅ Deploy Preview for preeminent-bienenstitch-606ad0 canceled.
|
570a240
to
cd761fe
Compare
b190be2
to
17bd3e6
Compare
c5b19a7
to
635f2aa
Compare
635f2aa
to
1f34198
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Not much feedback at all. Really great work!
* Update the list of pending notes by chopping a note which is nullified. | ||
* The identifier used to determine matching is the inner note hash value. | ||
* However, we adopt a defensive approach and ensure that the contract address | ||
* and storage slot do match. | ||
* Note that this method might be called with an innerNoteHash referring to | ||
* a note created in a previous transaction which will result in this array | ||
* of pending notes left unchanged. | ||
* @param innerNoteHash - The inner note hash value to which note will be chopped. | ||
* @param contractAddress - The contract address | ||
* @param storageSlot - The storage slot as a Field Fr element | ||
*/ | ||
public nullifyPendingNotes(innerNoteHash: Fr, contractAddress: AztecAddress, storageSlot: Fr) { | ||
// IMPORTANT: We do need an in-place array mutation of this.pendingNotes as this array is shared | ||
// by reference among the nested calls. That is the main reason for 'splice' usage below. | ||
this.pendingNotes.splice( | ||
0, | ||
this.pendingNotes.length, | ||
...this.pendingNotes.filter( | ||
n => | ||
!( | ||
n.innerNoteHash.equals(innerNoteHash) && | ||
n.contractAddress.equals(contractAddress) && | ||
n.storageSlot.equals(storageSlot) | ||
), | ||
), | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! As a followup task, we can probably replace the PrivateFunctionExecution's newNotes and then clean up this chunk of code in the kernel prover
Description
Resolves #940
Checklist: