import { Fr } from '@aztec/foundation/curves/bn254'; import { BufferReader, FieldReader } from '@aztec/foundation/serialize'; import { inspect } from 'util'; import { z } from 'zod'; import type { UInt32 } from '../types/shared.js'; /** * Snapshot of an append only tree. * * Used in circuits to verify that tree insertions are performed correctly. */ export declare class AppendOnlyTreeSnapshot { /** * Root of the append only tree when taking the snapshot. */ root: Fr; /** * Index of the next available leaf in the append only tree. * * Note: We include the next available leaf index in the snapshot so that the snapshot can be used to verify that * the insertion was performed at the correct place. If we only verified tree root then it could happen that * some leaves would get overwritten and the tree root check would still pass. * TLDR: We need to store the next available leaf index to ensure that the "append only" property was * preserved when verifying state transitions. */ nextAvailableLeafIndex: UInt32; constructor( /** * Root of the append only tree when taking the snapshot. */ root: Fr, /** * Index of the next available leaf in the append only tree. * * Note: We include the next available leaf index in the snapshot so that the snapshot can be used to verify that * the insertion was performed at the correct place. If we only verified tree root then it could happen that * some leaves would get overwritten and the tree root check would still pass. * TLDR: We need to store the next available leaf index to ensure that the "append only" property was * preserved when verifying state transitions. */ nextAvailableLeafIndex: UInt32); static get schema(): z.ZodEffects; nextAvailableLeafIndex: z.ZodPipeline, z.ZodNumber>; }, "strip", z.ZodTypeAny, { root: Fr; nextAvailableLeafIndex: number; }, { root: string; nextAvailableLeafIndex: string | number | bigint; }>, AppendOnlyTreeSnapshot, { root: string; nextAvailableLeafIndex: string | number | bigint; }>; getSize(): number; toBuffer(): Buffer; toFields(): Fr[]; toString(): string; static fromBuffer(buffer: Buffer | BufferReader): AppendOnlyTreeSnapshot; static fromString(str: string): AppendOnlyTreeSnapshot; static fromFields(fields: Fr[] | FieldReader): AppendOnlyTreeSnapshot; toAbi(): [`0x${string}`, number]; static empty(): AppendOnlyTreeSnapshot; /** * Creates an AppendOnlyTreeSnapshot instance from a plain object without Zod validation. * This method is optimized for performance and skips validation, making it suitable * for deserializing trusted data (e.g., from C++ via MessagePack). * @param obj - Plain object containing AppendOnlyTreeSnapshot fields * @returns An AppendOnlyTreeSnapshot instance */ static fromPlainObject(obj: any): AppendOnlyTreeSnapshot; isEmpty(): boolean; [inspect.custom](): string; equals(other: this): boolean; static random(): AppendOnlyTreeSnapshot; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwZW5kX29ubHlfdHJlZV9zbmFwc2hvdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3RyZWVzL2FwcGVuZF9vbmx5X3RyZWVfc25hcHNob3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXBELE9BQU8sRUFBRSxZQUFZLEVBQUUsV0FBVyxFQUFxQixNQUFNLDZCQUE2QixDQUFDO0FBRzNGLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDL0IsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLEtBQUssQ0FBQztBQUV4QixPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVqRDs7OztHQUlHO0FBQ0gscUJBQWEsc0JBQXNCO0lBRS9COztPQUVHO0lBQ0ksSUFBSSxFQUFFLEVBQUU7SUFDZjs7Ozs7Ozs7T0FRRztJQUNJLHNCQUFzQixFQUFFLE1BQU07SUFkdkM7SUFDRTs7T0FFRztJQUNJLElBQUksRUFBRSxFQUFFO0lBQ2Y7Ozs7Ozs7O09BUUc7SUFDSSxzQkFBc0IsRUFBRSxNQUFNLEVBQ25DO0lBRUosTUFBTSxLQUFLLE1BQU07Ozs7Ozs7Ozs7OztPQU9oQjtJQUVELE9BQU8sV0FFTjtJQUVELFFBQVEsNEJBRVA7SUFFRCxRQUFRLElBQUksRUFBRSxFQUFFLENBRWY7SUFFRCxRQUFRLElBQUksTUFBTSxDQUVqQjtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMs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