For the complete documentation index, see llms.txt.
aztec-nr - noir_aztec::contract_self::contract_self_private

Struct PrivateUtilityCalls

pub struct PrivateUtilityCalls<CallSelf> {
    pub call_self: CallSelf,
}

A struct that allows for ergonomic calling of utility functions from a private context.

Accessible via self.utility in private functions. Results are not part of any circuit proof; use them to inform logic, not as inputs to constrained assertions.

Type Parameters

  • CallSelf: Macro-generated type for calling the contract's own utility functions (same type as CallSelf in [ContractSelfUtility])

Fields

call_self: CallSelf

Provides type-safe methods for calling this contract's own utility functions.

Example API:

// Safety: result is unconstrained
unsafe { self.utility.call_self.some_utility_function(args) }

Implementations

impl<CallSelf> PrivateUtilityCalls<CallSelf>

pub unconstrained fn call<let M: u32, let N: u32, T>( _self: Self, call: UtilityCall<M, N, T>, ) -> T
where T: Deserialize

Makes a utility contract call from a private function.

The call executes unconstrained code, so it must be wrapped in unsafe, and its result is not part of any circuit proof: use it to inform logic, never as an input to a constrained assertion without validating it first.

The callee observes this contract's address as its msg_sender: see the msg_sender docs on ContractSelfUtility.

To call one of this contract's own utility functions, prefer the type-safe self.utility.call_self stubs.

Authorization

A call to this contract itself always succeeds. A call to a different contract can expose that contract's private state to the caller, so it requires explicit authorization. A call that is not authorized fails.

Example

// Safety: result is unconstrained
unsafe { self.utility.call(Token::at(address).get_balance_of(owner)) }