aztec-nr - noir_aztec::ephemeral

Type alias EphemeralArray

pub type EphemeralArray<T> = UnconstrainedArray<T, EphemeralOracles>;

A dynamically sized array that exists only during a single contract call frame.

Ephemeral arrays are backed by in-memory storage on the PXE side rather than a persistent database. Each contract call frame gets its own isolated slot space of ephemeral arrays. Child simulations cannot see the parent's ephemeral arrays, and vice versa.

Each logical array operation (push, pop, get, etc.) is a single oracle call, making ephemeral arrays significantly cheaper than capsule arrays.

Use Cases

Ephemeral arrays are designed for passing data between PXE (TypeScript) and contracts (Noir) during simulation, for example, note validation requests or event validation responses. This data type is appropriate for data that is not supposed to be persisted.

For data that needs to persist across simulations, contract calls, etc, use CapsuleArray instead.

For data that must be shared across all frames of the same contract (private and utility) within one top-level PXE call (transaction simulation or utility call) but not persisted, use TransientArray.