Function do_private_message_delivery
pub fn do_private_message_delivery<Env, let MESSAGE_PLAINTEXT_LEN: u32>(
context: &mut PrivateContext,
encode_into_message_plaintext: fn[Env]() -> [Field; MESSAGE_PLAINTEXT_LEN],
maybe_note_hash_counter: Option<u32>,
recipient: AztecAddress,
delivery_mode: u8,
)
Performs private delivery of a message to
recipientaccording todelivery_mode.The message is encoded into plaintext and then encrypted for
recipient. This function takes a function that returns the plaintext instead of taking the plaintext directly in order to not waste constraints encoding the message in scenarios where the plaintext will be encrypted with unconstrained encryption.maybe_note_hash_counteris only relevant for on-chain delivery modes (i.e. via protocol logs): if a newly created note hash's side effect counter is passed, then the log will be squashed alongside the note should its nullifier be emitted in the current transaction. This is typically only used for note messages: since the note will not actually be created, there is no point in delivering the message.delivery_modemust be one ofMessageDeliveryEnum.Privacy
The emitted log always has the same length regardless of
MESSAGE_PLAINTEXT_LEN, because all message ciphertexts also have the same length. This prevents accidental privacy leakage via the log length.