import { Fr } from '@aztec/foundation/curves/bn254'; import { BufferReader, FieldReader } from '@aztec/foundation/serialize'; import type { FieldsOf } from '@aztec/foundation/types'; import { z } from 'zod'; import { Gas } from './gas.js'; import { GasFees } from './gas_fees.js'; /** Approximate max DA gas limit. Arbitrary, assuming 4 blocks per checkpoint — users should use gas estimation. */ export declare const APPROXIMATE_MAX_DA_GAS_PER_BLOCK: number; /** Fallback teardown L2 gas limit. Arbitrary — users should use gas estimation. */ export declare const FALLBACK_TEARDOWN_L2_GAS_LIMIT: number; /** Fallback teardown DA gas limit. Arbitrary — users should use gas estimation. */ export declare const FALLBACK_TEARDOWN_DA_GAS_LIMIT: number; export declare const GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT = 6540000; export declare const GAS_ESTIMATION_L2_GAS_LIMIT: number; export declare const GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT = 786432; export declare const GAS_ESTIMATION_DA_GAS_LIMIT: number; /** Gas usage and fees limits set by the transaction sender for different dimensions and phases. */ export declare class GasSettings { readonly gasLimits: Gas; readonly teardownGasLimits: Gas; readonly maxFeesPerGas: GasFees; readonly maxPriorityFeesPerGas: GasFees; constructor(gasLimits: Gas, teardownGasLimits: Gas, maxFeesPerGas: GasFees, maxPriorityFeesPerGas: GasFees); static get schema(): z.ZodEffects, z.ZodNumber>; l2Gas: z.ZodPipeline, z.ZodNumber>; }, "strip", z.ZodTypeAny, { daGas: number; l2Gas: number; }, { daGas: string | number | bigint; l2Gas: string | number | bigint; }>, Gas, { daGas: string | number | bigint; l2Gas: string | number | bigint; }>; teardownGasLimits: z.ZodEffects, z.ZodNumber>; l2Gas: z.ZodPipeline, z.ZodNumber>; }, "strip", z.ZodTypeAny, { daGas: number; l2Gas: number; }, { daGas: string | number | bigint; l2Gas: string | number | bigint; }>, Gas, { daGas: string | number | bigint; l2Gas: string | number | bigint; }>; maxFeesPerGas: z.ZodEffects, z.ZodBigInt>; feePerL2Gas: z.ZodPipeline, z.ZodBigInt>; }, "strip", z.ZodTypeAny, { feePerDaGas: bigint; feePerL2Gas: bigint; }, { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }>, GasFees, { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }>; maxPriorityFeesPerGas: z.ZodEffects, z.ZodBigInt>; feePerL2Gas: z.ZodPipeline, z.ZodBigInt>; }, "strip", z.ZodTypeAny, { feePerDaGas: bigint; feePerL2Gas: bigint; }, { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }>, GasFees, { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }>; }, "strip", z.ZodTypeAny, { gasLimits: Gas; teardownGasLimits: Gas; maxFeesPerGas: GasFees; maxPriorityFeesPerGas: GasFees; }, { gasLimits: { daGas: string | number | bigint; l2Gas: string | number | bigint; }; teardownGasLimits: { daGas: string | number | bigint; l2Gas: string | number | bigint; }; maxFeesPerGas: { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }; maxPriorityFeesPerGas: { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }; }>, GasSettings, { gasLimits: { daGas: string | number | bigint; l2Gas: string | number | bigint; }; teardownGasLimits: { daGas: string | number | bigint; l2Gas: string | number | bigint; }; maxFeesPerGas: { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }; maxPriorityFeesPerGas: { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }; }>; getSize(): number; static from(args: { gasLimits: FieldsOf; teardownGasLimits: FieldsOf; maxFeesPerGas: FieldsOf; maxPriorityFeesPerGas: FieldsOf; }): GasSettings; /** * Creates a GasSettings 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 GasSettings fields * @returns A GasSettings instance */ static fromPlainObject(obj: any): GasSettings; clone(): GasSettings; /** Returns the maximum fee to be paid according to gas limits and max fees set. */ getFeeLimit(): Fr; /** Zero-value gas settings. */ static empty(): GasSettings; /** * Fills in gas limits high enough for transactions to be included in most cases. * gasLimits is set to the maximum the protocol allows; since teardown gas is reserved * from gasLimits during private execution (see gas_meter.nr), the effective gas available * for app logic will be gasLimits - teardownGasLimits - privateOverhead. * The DA gas limit is set to an approximate max per block assuming 4 blocks per checkpoint, * since using the maximum per checkpoint would cause nodes to reject transactions. * These values won't work if: * - Teardown consumes more than the arbitrarily assigned fallback limits * - The rest of the transaction consumes more than the remaining gas after teardown * - The DA gas limit is too low for the transaction, while still within the checkpoint limit */ static fallback(overrides: { gasLimits?: Gas; teardownGasLimits?: Gas; maxFeesPerGas: GasFees; maxPriorityFeesPerGas?: GasFees; }): GasSettings; /** * Gas settings for simulation/estimation only. * Since teardown gas is reserved upfront from gasLimits during private execution (see gas_meter.nr), * the effective gas available for app logic is gasLimits - teardownGasLimits - privateOverhead. * To ensure estimation never hits gas caps, we set both limits above what the protocol allows: * teardown gets MAX_PROCESSABLE and gasLimits gets teardown + MAX_PROCESSABLE, so the full * processable amount remains available for each phase independently. To be used in conjunction * with skipTxValidation: true during public simulation, or the node would reject the transaction * outright due to gas limits being above protocol max. */ static forEstimation(overrides: { gasLimits?: Gas; teardownGasLimits?: Gas; maxFeesPerGas: GasFees; maxPriorityFeesPerGas?: GasFees; }): GasSettings; isEmpty(): boolean; equals(other: GasSettings): boolean; static fromBuffer(buffer: Buffer | BufferReader): GasSettings; toBuffer(): Buffer; static fromFields(fields: Fr[] | FieldReader): GasSettings; toFields(): Fr[]; static getFields(fields: FieldsOf): readonly [Gas, Gas, GasFees, GasFees]; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2FzX3NldHRpbmdzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZ2FzL2dhc19zZXR0aW5ncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQ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