import { AuthWitness, FunctionL2Logs, UnencryptedL2Log } from '@aztec/circuit-types'; import { CallContext, FunctionSelector, Header, PublicCallRequest, ReadRequestMembershipWitness, SideEffect, TxContext } from '@aztec/circuits.js'; import { Grumpkin } from '@aztec/circuits.js/barretenberg'; import { FunctionAbi } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr, Point } from '@aztec/foundation/fields'; import { NoteData } from '../acvm/index.js'; import { PackedArgsCache } from '../common/packed_args_cache.js'; import { DBOracle } from './db_oracle.js'; import { ExecutionNoteCache } from './execution_note_cache.js'; import { ExecutionResult, NoteAndSlot } from './execution_result.js'; import { ViewDataOracle } from './view_data_oracle.js'; /** * The execution context for a client tx simulation. */ export declare class ClientExecutionContext extends ViewDataOracle { protected readonly contractAddress: AztecAddress; private readonly argsHash; private readonly txContext; private readonly callContext; /** Header of a block whose state is used during private execution. */ protected readonly historicalHeader: Header; /** List of transient auth witnesses to be used during this simulation */ protected readonly authWitnesses: AuthWitness[]; private readonly packedArgsCache; private readonly noteCache; protected readonly db: DBOracle; private readonly curve; protected log: import("@aztec/foundation/log").DebugLogger; /** * New notes created during this execution. * It's possible that a note in this list has been nullified (in the same or other executions) and doesn't exist in the ExecutionNoteCache and the final proof data. * But we still include those notes in the execution result because their commitments are still in the public inputs of this execution. * This information is only for references (currently used for tests), and is not used for any sort of constrains. * Users can also use this to get a clearer idea of what's happened during a simulation. */ private newNotes; /** * Notes from previous transactions that are returned to the oracle call `getNotes` during this execution. * The mapping maps from the unique siloed note hash to the index for notes created in private executions. * It maps from siloed note hash to the index for notes created by public functions. * * They are not part of the ExecutionNoteCache and being forwarded to nested contexts via `extend()` * because these notes are meant to be maintained on a per-call basis * They should act as references for the read requests output by an app circuit via public inputs. */ private gotNotes; private encryptedLogs; private unencryptedLogs; private nestedExecutions; private enqueuedPublicFunctionCalls; constructor(contractAddress: AztecAddress, argsHash: Fr, txContext: TxContext, callContext: CallContext, /** Header of a block whose state is used during private execution. */ historicalHeader: Header, /** List of transient auth witnesses to be used during this simulation */ authWitnesses: AuthWitness[], packedArgsCache: PackedArgsCache, noteCache: ExecutionNoteCache, db: DBOracle, curve: Grumpkin, log?: import("@aztec/foundation/log").DebugLogger); /** * Writes the function inputs to the initial witness. * @param abi - The function ABI. * @returns The initial witness. */ getInitialWitness(abi: FunctionAbi): Map; /** * This function will populate readRequestPartialWitnesses which * here is just used to flag reads as "transient" for new notes created during this execution * or to flag non-transient reads with their leafIndex. * The KernelProver will use this to fully populate witnesses and provide hints to * the kernel regarding which commitments each transient read request corresponds to. * @param readRequests - SideEffect containing Note hashed of the notes being read and counter. * @returns An array of partially filled in read request membership witnesses. */ getReadRequestPartialWitnesses(readRequests: SideEffect[]): ReadRequestMembershipWitness[]; /** * Get the data for the newly created notes. * @param innerNoteHashes - Inner note hashes for the notes. */ getNewNotes(): NoteAndSlot[]; /** * Return the encrypted logs emitted during this execution. */ getEncryptedLogs(): FunctionL2Logs; /** * Return the encrypted logs emitted during this execution. */ getUnencryptedLogs(): FunctionL2Logs; /** * Return the nested execution results during this execution. */ getNestedExecutions(): ExecutionResult[]; /** * Return the enqueued public function calls during this execution. */ getEnqueuedPublicFunctionCalls(): PublicCallRequest[]; /** * Pack the given arguments. * @param args - Arguments to pack */ packArguments(args: Fr[]): Promise; /** * Gets some notes for a storage slot. * * @remarks * Check for pending notes with matching slot. * Real notes coming from DB will have a leafIndex which * represents their index in the note hash tree. * * @param storageSlot - The storage slot. * @param numSelects - The number of valid selects in selectBy and selectValues. * @param selectBy - An array of indices of the fields to selects. * @param selectValues - The values to match. * @param selectComparators - The comparators to match by. * @param sortBy - An array of indices of the fields to sort. * @param sortOrder - The order of the corresponding index in sortBy. (1: DESC, 2: ASC, 0: Do nothing) * @param limit - The number of notes to retrieve per query. * @param offset - The starting index for pagination. * @returns Array of note data. */ getNotes(storageSlot: Fr, numSelects: number, selectBy: number[], selectValues: Fr[], selectComparators: number[], sortBy: number[], sortOrder: number[], limit: number, offset: number): Promise; /** * Keep track of the new note created during execution. * It can be used in subsequent calls (or transactions when chaining txs is possible). * @param contractAddress - The contract address. * @param storageSlot - The storage slot. * @param noteItems - The items to be included in a Note. * @param innerNoteHash - The inner note hash of the new note. * @returns */ notifyCreatedNote(storageSlot: Fr, noteItems: Fr[], innerNoteHash: Fr): void; /** * Adding a siloed nullifier into the current set of all pending nullifiers created * within the current transaction/execution. * @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address). * @param innerNoteHash - The inner note hash of the new note. */ notifyNullifiedNote(innerNullifier: Fr, innerNoteHash: Fr): Promise; /** * Encrypt a note and emit it as a log. * @param contractAddress - The contract address of the note. * @param storageSlot - The storage slot the note is at. * @param publicKey - The public key of the account that can decrypt the log. * @param log - The log contents. */ emitEncryptedLog(contractAddress: AztecAddress, storageSlot: Fr, publicKey: Point, log: Fr[]): void; /** * Emit an unencrypted log. * @param log - The unencrypted log to be emitted. */ emitUnencryptedLog(log: UnencryptedL2Log): void; /** * Calls a private function as a nested execution. * @param targetContractAddress - The address of the contract to call. * @param functionSelector - The function selector of the function to call. * @param argsHash - The packed arguments to pass to the function. * @param sideffectCounter - The side effect counter at the start of the call. * @returns The execution result. */ callPrivateFunction(targetContractAddress: AztecAddress, functionSelector: FunctionSelector, argsHash: Fr, sideffectCounter: number): Promise; /** * Creates a PublicCallStackItem object representing the request to call a public function. No function * is actually called, since that must happen on the sequencer side. All the fields related to the result * of the execution are empty. * @param targetContractAddress - The address of the contract to call. * @param functionSelector - The function selector of the function to call. * @param argsHash - The packed arguments to pass to the function. * @param sideEffectCounter - The side effect counter at the start of the call. * @returns The public call stack item with the request information. */ enqueuePublicFunctionCall(targetContractAddress: AztecAddress, functionSelector: FunctionSelector, argsHash: Fr, sideEffectCounter: number): Promise; /** * Derives the call context for a nested execution. * @param targetContractAddress - The address of the contract being called. * @param targetArtifact - The artifact of the function being called. * @param startSideEffectCounter - The side effect counter at the start of the call. * @param isDelegateCall - Whether the call is a delegate call. * @param isStaticCall - Whether the call is a static call. * @returns The derived call context. */ private deriveCallContext; } //# sourceMappingURL=client_execution_context.d.ts.map