aztec-nr - noir_aztec::macros::functions

Function noinitcheck

pub comptime fn noinitcheck(f: FunctionDefinition)

A no-init-check external function can be called even if none of the initializer functions have been called yet.

Contracts that have no initializer functions do not require this attribute: all of their functions behave as if they implicitly had it (i.e. they don't check for initialization nullifiers).

Use Case

This is an optimization as it skips the initialization check, possibly reducing proving time for private functions and L2 gas for public ones.

It is dangerous attribute however, as the contract will not be able to rely on its storage having been initialized. Valid use cases include those in which the contract indirectly infers initialization, e.g. by reading one of its state variables and testing for a non-default value.