You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that we are performing nonce discovery inside aztec-nr we have multiple places in which we need to invoke this function. Ideally we'd simply remove the top-level unconstrained compute_note_hash_and_nullif fn, have the macros inject a contract library method with the note::discovery::ComputeNoteHashAndNullifier signature and just use that everywhere. We could also delete the utility in notes/utils.nr since it just adds more calls back and forth, resulting in making it hard to follow what's going on.
This would also be a good opportunity to make sure we're not trusting the contract to perform correct siloing of note hashes and instead do it ourselves in PXE.
The text was updated successfully, but these errors were encountered:
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.
Now that we are performing nonce discovery inside aztec-nr we have multiple places in which we need to invoke this function. Ideally we'd simply remove the top-level unconstrained
compute_note_hash_and_nullif
fn, have the macros inject a contract library method with thenote::discovery::ComputeNoteHashAndNullifier
signature and just use that everywhere. We could also delete the utility innotes/utils.nr
since it just adds more calls back and forth, resulting in making it hard to follow what's going on.This would also be a good opportunity to make sure we're not trusting the contract to perform correct siloing of note hashes and instead do it ourselves in PXE.
The text was updated successfully, but these errors were encountered: