aztec-nr - noir_aztec::transient

Type alias TransientArray

pub type TransientArray<T> = UnconstrainedArray<T, TransientOracles>;

A dynamically sized array that lives for the duration of a single top-level PXE call.

Like EphemeralArray, transient arrays are backed by in-memory storage on the PXE side rather than a persistent database, and each logical operation is a single oracle call. The difference is lifetime and visibility: a TransientArray is shared across all call frames of the same contract (private and utility alike) within one top-level PXE call (transaction simulation or utility call), whereas an EphemeralArray is confined to a single call frame.

In order of increasing lifetime: an EphemeralArray lives for one call frame, a TransientArray for one top-level PXE call, and a CapsuleArray is persistent.

Privacy / Isolation

Arrays are keyed by (executing contract address, slot). The contract address is supplied by PXE from the executing context, so a contract can only ever access its own transient arrays; other contracts called within the same top-level PXE call cannot see them, and this isolation holds across the private/utility boundary.

Note on re-entrancy: because visibility is flat within a contract, if the same contract is entered more than once in a top-level PXE call (e.g. it calls back into itself, or a private frame calls one of its own functions), those frames share the same arrays at the same slots. This differs from EphemeralArray, where even two frames of the same contract are isolated.

Use Cases

Use this to pass not-to-be-persisted data between a contract's own frames (private or utility) within one top-level PXE call. For data confined to a single call frame, prefer EphemeralArray. For data that must persist indefinitely, use CapsuleArray.