For the complete documentation index, see llms.txt.
aztec-nr - uint_note

Struct PartialUintNote

pub struct PartialUintNote
{ /* private fields */ }

A partial instance of a UintNote. This value represents a private commitment to the owner and randomness, but the storage slot and value fields have not yet been set. A partial note can be completed in public with the complete function (revealing the storage slot and value to the public), resulting in a UintNote that can be used like any other one (except of course that its value is known).

Implementations

impl PartialUintNote

pub fn complete( self, context: PublicContext, completer: AztecAddress, storage_slot: Field, value: u128, )

Completes the partial note, creating a new note that can be used like any other UintNote.

The validity commitment only proves that this contract created this exact partial note designating completer (see compute_validity_commitment). The storage_slot and value arguments are not bound by it, so the caller is trusted to provide correct values for them. Nothing checks that the completer is the entity performing the call. Contracts must authenticate the caller themselves, typically by passing msg_sender() as completer.

WARNING: completion is not single-use. Nothing prevents the completer from completing the same partial note multiple times, inserting a new note hash each time. Every completion must therefore be independently paid for or authorized in the completing function itself (e.g. by debiting the completer's balance on each call), never granting value at creation to be redeemed at completion. Completing more than once is otherwise harmless to the contract, but wasteful for the completer. The recipient only discovers the first completion, so anything carried by further ones is lost.

pub fn complete_from_private( self, context: &mut PrivateContext, completer: AztecAddress, storage_slot: Field, value: u128, )

Completes the partial note, creating a new note that can be used like any other UintNote. Same as complete function but works from private context.

pub fn compute_validity_commitment(self, completer: AztecAddress) -> Field

Computes a validity commitment for this partial note.

The commitment cryptographically binds the note's private content with the designated completer address. When the note is later completed, the commitment is looked up in the nullifier tree to verify that this contract created this exact partial note designating that completer.

Trait implementations

impl Deserialize for PartialUintNote

pub fn deserialize(fields: [Field; 1]) -> Self pub fn stream_deserialize<let K: u32>(reader: &mut Reader<K>) -> Self

impl Eq for PartialUintNote

pub fn eq(_self: Self, _other: Self) -> bool

impl FromField for PartialUintNote

pub fn from_field(field: Field) -> Self

impl Packable for PartialUintNote

pub fn pack(self) -> [Field; 1] pub fn unpack(packed: [Field; 1]) -> Self

impl Serialize for PartialUintNote

pub fn serialize(self) -> [Field; 1] pub fn stream_serialize<let K: u32>(self, writer: &mut Writer<K>)

impl ToField for PartialUintNote

pub fn to_field(self) -> Field