aztec-nr - noir_aztec::messages::discovery::private_notes

Function process_private_note_msg

pub unconstrained fn process_private_note_msg(
    contract_address: AztecAddress,
    tx_hash: Field,
    unique_note_hashes_in_tx: BoundedVec<Field, 64>,
    first_nullifier_in_tx: Field,
    compute_note_hash: ComputeNoteHash,
    compute_note_nullifier: ComputeNoteNullifier,
    msg_metadata: u64,
    msg_content: BoundedVec<Field, 11>,
)

Processes a private note message, attempting to discover and enqueue any notes it contains.

For each note recovered from the message whose computed note hash matches a unique note hash in the transaction, a NoteValidationRequest is pushed onto the ephemeral array at NOTE_VALIDATION_REQUESTS_ARRAY_BASE_SLOT via enqueue_note_for_validation. PXE later drains this array during validate_and_store_enqueued_notes_and_events, after which the notes are retrievable via get_notes.

Messages that fail to decode, or whose computed note hash matches nothing in the transaction, are discarded (with a debug or warning log respectively) and produce no validation requests. Decode failures are not treated as errors since messages may originate from malicious senders and we don't want them to be able to brick message processing.

Use Cases

This function is invoked automatically by aztec-nr when handling messages with the built-in private note type id, so contracts do not normally need to call it directly. It is exposed for use by custom message handlers (see CustomMessageHandler) that might want to use the standard note message processing pipeline while extending it with custom logic.