-
Notifications
You must be signed in to change notification settings - Fork 325
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: remove addNullifiedNote
from pxe
#11822
refactor: remove addNullifiedNote
from pxe
#11822
Conversation
5c19733
to
69bec66
Compare
3370666
to
e3b3a76
Compare
cceedb2
to
c97f0ac
Compare
@@ -162,21 +162,19 @@ export class AcirSimulator { | |||
} | |||
|
|||
/** | |||
* Computes the inner nullifier of a note. |
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.
Seems like this was stale from before
a80a79e
to
ba81b83
Compare
await acirSimulator.computeNoteHash(contractAddress, newNote.storageSlot, newNote.noteTypeId, newNote.note), | ||
await acirSimulator.computeNoteHashAndNullifier( | ||
contractAddress, | ||
Fr.ZERO, |
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.
Previously computeNoteHash
, which we removed from the simulator, was just passing Fr.ZERO
here anyways.
ba81b83
to
5109c01
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.
Lovely thanks!
* master: (245 commits) chore: Fix unbound CI variable on release image bootstrap (#12095) fix: dry run on grind (#12088) fix(spartan): eth-execution logging (#12094) fix: aws_handle_evict recovery & termination (#12086) chore: Use native acvm when available on orchestrator tests (#11560) refactor: function macros cleanup (#12066) refactor: remove `addNullifiedNote` from pxe (#11822) fix: `#[aztec]` macro warnings (#12038) refactor!: Notes implementing `Packable<N>` (#12004) chore(ops): add gcloud cli into devbox base image (#12082) fix: hotfix grinding fix: L1 deployment on reth (#12060) fix: Add missing bootstrap fast aliases (#12078) fix: hash_str caching (#12074) fix: Naive attempt to fix nightly deployments (#12079) fix: kind smoke (#12084) refactor!: nuking `NoteHeader` (#11942) fix: inject dockerhub creds (#12072) feat(docs): Note discovery concepts page (#11760) chore: cleanup libp2p logger (#12058) ...
This removes the `addNote` function from PXE (`addNullifiedNote` had been removed in #11822). With this change, PXE no longer needs to understand how to compute note hashes and perform nonce discovery, which means we can also get rid of all of that code, _plus_ we can delete the mandatory `compute_note_hash_and_optionally_a_nullifier` contract function, _plus_ all of the auxiliary code used to call those. Instead, contracts that wish to deliver notes to their recipients via offchain mechanisms (i.e. not the protocol logs) must create custom unconstrained functions that know how to construct said notes and add them to PXE. For cases such as `TransparentNote`, where all of the note contents are public already, this is quite simple: `aztec::discovery::process_private_log` can be leveraged to a great degree by mimicking the log encoding aztec-nr uses - see the TokenBlacklist and Test contracts for examples of this. More fine grained control could be achieved by calling `aztec::discovery::attempt_note_nonce_discovery` and then the `deliver_note` oracle (which is essentially what `process_private_log` does, sans the decoding). The removal of `compute_note_hash_and_optionally_a_nullifier` freed us from some legacy burdens in having to produce the 4 field array, dealing with optional nullifier computation, etc., which in turn allowed for the contract library method `_compute_note_hash_and_optionally_a_nullifier` to be streamlined and converted into the new `compute_note_hash_and_nullifier`, which matches `aztec::discovery::ComputeNoteHashAndNullifier` and hence results in much easier use of the discovery functions. Tagging @critesjosh since `addNote` was quite a basic and old primitive. Closes #11638.
This PR removes
addNullifiedNote
from the PXE as it is unused.It was also suggested to rework
getNoteHashAndOptionallyANullifier
intogetNoteHashAndNullifier
, in TS as now the second case where we don't get a nullifier is almost trivially used.I have kept
get_note_hash_and_optionally_a_nullifier
in nr intact as I wasn't sure this desired changing. If so, I will do that in another PR to keep things relatively isolated.Resolves #11821