import { Fr } from '@aztec/foundation/fields'; import { HostStorage } from './host_storage.js'; /** * Data held within the journal */ export type JournalData = { newNoteHashes: Fr[]; newNullifiers: Fr[]; newL1Messages: Fr[][]; newLogs: Fr[][]; /** contract address -\> key -\> value */ storageWrites: Map>; }; /** * A cache of the current state of the AVM * The interpreter should make any state queries through this object * * When a sub context's call succeeds, it's journal is merge into the parent * When a a call fails, it's journal is discarded and the parent is used from this point forward * When a call succeeds's we can merge a child into its parent */ export declare class AvmJournal { /** Reference to node storage */ readonly hostStorage: HostStorage; private storageReads; private newNoteHashes; private newNullifiers; private newL1Messages; private newLogs; private storageWrites; private parentJournal; constructor(hostStorage: HostStorage, parentJournal?: AvmJournal); /** * Create a new root journal, without a parent * @param hostStorage - */ static rootJournal(hostStorage: HostStorage): AvmJournal; /** * Create a new journal from a parent * @param parentJournal - */ static branchParent(parentJournal: AvmJournal): AvmJournal; /** * Write storage into journal * * @param contractAddress - * @param key - * @param value - */ writeStorage(contractAddress: Fr, key: Fr, value: Fr): void; /** * Read storage from journal * Read from host storage on cache miss * * @param contractAddress - * @param key - * @returns current value */ readStorage(contractAddress: Fr, key: Fr): Promise; writeNoteHash(noteHash: Fr): void; writeL1Message(message: Fr[]): void; writeNullifier(nullifier: Fr): void; writeLog(log: Fr[]): void; /** * Merge Journal into parent * - Utxo objects are concatenated * - Public state is merged, with the value in the incoming journal taking precedent */ mergeWithParent(): void; /** * Access the current state of the journal * * @returns a JournalData object */ flush(): JournalData; } //# sourceMappingURL=journal.d.ts.map