aztec-nr - noir_aztec::messages::processing

Function enqueue_note_for_validation

pub unconstrained fn enqueue_note_for_validation(
    contract_address: AztecAddress,
    owner: AztecAddress,
    storage_slot: Field,
    randomness: Field,
    note_nonce: Field,
    packed_note: BoundedVec<Field, 8>,
    note_hash: Field,
    nullifier: Field,
    tx_hash: Field,
    recipient: AztecAddress,
)

Enqueues a note for validation and storage by PXE.

Once validated, the note becomes retrievable via the get_notes oracle. The note will be scoped to contract_address, meaning other contracts will not be able to access it unless authorized.

In order for the note validation and insertion to occur, validate_and_store_enqueued_notes_and_events must be later called. For optimal performance, accumulate as many note validation requests as possible and then validate them all at the end (which results in PXE minimizing the number of network round-trips).

The packed_note is what getNotes will later return. PXE indexes notes by storage_slot, so this value is typically used to filter notes that correspond to different state variables. note_hash and nullifier are the inner hashes, i.e. the raw hashes returned by NoteHash::compute_note_hash and NoteHash::compute_nullifier. PXE will verify that the siloed unique note hash was inserted into the tree at tx_hash, and will store the nullifier to later check for nullification.

owner is the address used in note hash and nullifier computation, often requiring knowledge of their nullifier secret key.

recipient is the account to which the note message was delivered (i.e. the address the message was encrypted to). This determines which PXE account can see the note - other accounts will not be able to access it (e.g. other accounts will not be able to see one another's token balance notes, even in the same PXE) unless authorized. In most cases recipient equals owner, but they can differ in scenarios like delegated discovery.