@aztec/txe 3.0.0-nightly.20250925 → 3.0.0-nightly.20250926

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/txe",
3
- "version": "3.0.0-nightly.20250925",
3
+ "version": "3.0.0-nightly.20250926",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "bin": "./dest/bin/index.js",
@@ -61,20 +61,20 @@
61
61
  ]
62
62
  },
63
63
  "dependencies": {
64
- "@aztec/accounts": "3.0.0-nightly.20250925",
65
- "@aztec/archiver": "3.0.0-nightly.20250925",
66
- "@aztec/aztec-node": "3.0.0-nightly.20250925",
67
- "@aztec/aztec.js": "3.0.0-nightly.20250925",
68
- "@aztec/bb-prover": "3.0.0-nightly.20250925",
69
- "@aztec/constants": "3.0.0-nightly.20250925",
70
- "@aztec/foundation": "3.0.0-nightly.20250925",
71
- "@aztec/key-store": "3.0.0-nightly.20250925",
72
- "@aztec/kv-store": "3.0.0-nightly.20250925",
73
- "@aztec/protocol-contracts": "3.0.0-nightly.20250925",
74
- "@aztec/pxe": "3.0.0-nightly.20250925",
75
- "@aztec/simulator": "3.0.0-nightly.20250925",
76
- "@aztec/stdlib": "3.0.0-nightly.20250925",
77
- "@aztec/world-state": "3.0.0-nightly.20250925",
64
+ "@aztec/accounts": "3.0.0-nightly.20250926",
65
+ "@aztec/archiver": "3.0.0-nightly.20250926",
66
+ "@aztec/aztec-node": "3.0.0-nightly.20250926",
67
+ "@aztec/aztec.js": "3.0.0-nightly.20250926",
68
+ "@aztec/bb-prover": "3.0.0-nightly.20250926",
69
+ "@aztec/constants": "3.0.0-nightly.20250926",
70
+ "@aztec/foundation": "3.0.0-nightly.20250926",
71
+ "@aztec/key-store": "3.0.0-nightly.20250926",
72
+ "@aztec/kv-store": "3.0.0-nightly.20250926",
73
+ "@aztec/protocol-contracts": "3.0.0-nightly.20250926",
74
+ "@aztec/pxe": "3.0.0-nightly.20250926",
75
+ "@aztec/simulator": "3.0.0-nightly.20250926",
76
+ "@aztec/stdlib": "3.0.0-nightly.20250926",
77
+ "@aztec/world-state": "3.0.0-nightly.20250926",
78
78
  "zod": "^3.23.8"
79
79
  },
80
80
  "devDependencies": {
@@ -0,0 +1,80 @@
1
+ import type { CompleteAddress, ContractArtifact, ContractInstanceWithAddress, TxHash } from '@aztec/aztec.js';
2
+ import type { Fr } from '@aztec/foundation/fields';
3
+ import type { FunctionSelector } from '@aztec/stdlib/abi';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import type { UInt32, UInt64 } from '@aztec/stdlib/types';
6
+
7
+ // These interfaces complement the ones defined in PXE, and combined with those contain the full list of oracles used by
8
+ // aztec-nr. In particular, these include the ones needed to run Brillig code associated to #[public] functions that has
9
+ // not been transpiled (e.g. in the context of a Noir test) as well as the ones associated with managing the state of
10
+ // such a Noir test (deploying contracts, manipulating block time, making calls, etc) - the so called 'top level test
11
+ // context'.
12
+
13
+ /**
14
+ * Oracle methods associated with the execution of an Aztec #[public] function.
15
+ *
16
+ * Note that real contracts have their Brillig calls to these be transpiled into opcodes, the oracles are only executed
17
+ * as such when running the original Brillig code, e.g. when invoking functions that interact with a PublicContext
18
+ * directly in a Noir test.
19
+ */
20
+ export interface IAvmExecutionOracle {
21
+ isAvm: true;
22
+
23
+ avmOpcodeAddress(): Promise<AztecAddress>;
24
+ avmOpcodeSender(): Promise<AztecAddress>;
25
+ avmOpcodeBlockNumber(): Promise<UInt32>;
26
+ avmOpcodeTimestamp(): Promise<bigint>;
27
+ avmOpcodeIsStaticCall(): Promise<boolean>;
28
+ avmOpcodeChainId(): Promise<Fr>;
29
+ avmOpcodeVersion(): Promise<Fr>;
30
+ avmOpcodeEmitNullifier(nullifier: Fr): Promise<void>;
31
+ avmOpcodeEmitNoteHash(noteHash: Fr): Promise<void>;
32
+ avmOpcodeNullifierExists(innerNullifier: Fr, targetAddress: AztecAddress): Promise<boolean>;
33
+ avmOpcodeStorageWrite(slot: Fr, value: Fr): Promise<void>;
34
+ avmOpcodeStorageRead(slot: Fr): Promise<Fr>;
35
+ }
36
+
37
+ /**
38
+ * Oracle methods associated with the execution of an Aztec Noir test.
39
+ */
40
+ export interface ITxeExecutionOracle {
41
+ isTxe: true;
42
+
43
+ txeGetNextBlockNumber(): Promise<number>;
44
+ txeGetNextBlockTimestamp(): Promise<UInt64>;
45
+ txeAdvanceBlocksBy(blocks: number): Promise<void>;
46
+ txeAdvanceTimestampBy(duration: UInt64): void;
47
+ txeDeploy(artifact: ContractArtifact, instance: ContractInstanceWithAddress, foreignSecret: Fr): Promise<void>;
48
+ txeCreateAccount(secret: Fr): Promise<CompleteAddress>;
49
+ txeAddAccount(
50
+ artifact: ContractArtifact,
51
+ instance: ContractInstanceWithAddress,
52
+ secret: Fr,
53
+ ): Promise<CompleteAddress>;
54
+ txeAddAuthWitness(address: AztecAddress, messageHash: Fr): Promise<void>;
55
+ txeGetLastBlockTimestamp(): Promise<bigint>;
56
+ txeGetLastTxEffects(): Promise<{
57
+ txHash: TxHash;
58
+ noteHashes: Fr[];
59
+ nullifiers: Fr[];
60
+ }>;
61
+ txePrivateCallNewFlow(
62
+ from: AztecAddress,
63
+ targetContractAddress: AztecAddress,
64
+ functionSelector: FunctionSelector,
65
+ args: Fr[],
66
+ argsHash: Fr,
67
+ isStaticCall: boolean,
68
+ ): Promise<Fr[]>;
69
+ txeSimulateUtilityFunction(
70
+ targetContractAddress: AztecAddress,
71
+ functionSelector: FunctionSelector,
72
+ args: Fr[],
73
+ ): Promise<Fr[]>;
74
+ txePublicCallNewFlow(
75
+ from: AztecAddress,
76
+ targetContractAddress: AztecAddress,
77
+ calldata: Fr[],
78
+ isStaticCall: boolean,
79
+ ): Promise<Fr[]>;
80
+ }
@@ -1,25 +1,38 @@
1
+ import { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
1
2
  import { Aes128 } from '@aztec/foundation/crypto';
2
3
  import { Fr, Point } from '@aztec/foundation/fields';
3
4
  import { type Logger, applyStringFormatting, createLogger } from '@aztec/foundation/log';
4
5
  import { PXEOracleInterface } from '@aztec/pxe/server';
5
- import { ExecutionNoteCache, HashedValuesCache, type NoteData, UtilityContext, pickNotes } from '@aztec/pxe/simulator';
6
- import type { NoteSelector } from '@aztec/stdlib/abi';
6
+ import {
7
+ ExecutionNoteCache,
8
+ HashedValuesCache,
9
+ type IPrivateExecutionOracle,
10
+ type IUtilityExecutionOracle,
11
+ MessageLoadOracleInputs,
12
+ type NoteData,
13
+ UtilityContext,
14
+ pickNotes,
15
+ } from '@aztec/pxe/simulator';
16
+ import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
7
17
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
18
  import { Body, L2Block } from '@aztec/stdlib/block';
9
19
  import type { ContractInstance } from '@aztec/stdlib/contract';
10
20
  import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
11
21
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
12
22
  import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
13
- import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
23
+ import { ContractClassLog, IndexedTaggingSecret } from '@aztec/stdlib/logs';
14
24
  import { Note, type NoteStatus } from '@aztec/stdlib/note';
15
25
  import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
16
26
  import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
17
27
  import { BlockHeader, GlobalVariables, TxEffect, TxHash } from '@aztec/stdlib/tx';
18
28
 
19
29
  import { insertTxEffectIntoWorldTrees, makeTXEBlockHeader } from '../utils/block_creation.js';
20
- import { TXETypedOracle } from './txe_typed_oracle.js';
21
30
 
22
- export class TXE extends TXETypedOracle {
31
+ export class TXE implements IUtilityExecutionOracle, IPrivateExecutionOracle {
32
+ isMisc = true as const;
33
+ isUtility = true as const;
34
+ isPrivate = true as const;
35
+
23
36
  private logger: Logger;
24
37
 
25
38
  private executionCache = new HashedValuesCache();
@@ -35,8 +48,6 @@ export class TXE extends TXETypedOracle {
35
48
  private nextBlockGlobalVariables: GlobalVariables,
36
49
  private txRequestHash: Fr,
37
50
  ) {
38
- super('TXEOraclePrivateUtilityContext');
39
-
40
51
  this.logger = createLogger('txe:oracle');
41
52
  this.logger.debug('Entering Private/Utility context');
42
53
 
@@ -81,13 +92,11 @@ export class TXE extends TXETypedOracle {
81
92
  }
82
93
  }
83
94
 
84
- // TypedOracle
85
-
86
- override utilityGetRandomField() {
95
+ utilityGetRandomField() {
87
96
  return Fr.random();
88
97
  }
89
98
 
90
- override utilityGetUtilityContext() {
99
+ utilityGetUtilityContext() {
91
100
  return Promise.resolve(
92
101
  UtilityContext.from({
93
102
  blockNumber: this.anchorBlockGlobalVariables.blockNumber,
@@ -99,11 +108,11 @@ export class TXE extends TXETypedOracle {
99
108
  );
100
109
  }
101
110
 
102
- override privateStoreInExecutionCache(values: Fr[], hash: Fr) {
111
+ privateStoreInExecutionCache(values: Fr[], hash: Fr) {
103
112
  return this.executionCache.store(values, hash);
104
113
  }
105
114
 
106
- override privateLoadFromExecutionCache(hash: Fr) {
115
+ privateLoadFromExecutionCache(hash: Fr) {
107
116
  const preimage = this.executionCache.getPreimage(hash);
108
117
  if (!preimage) {
109
118
  throw new Error(`Preimage for hash ${hash.toString()} not found in cache`);
@@ -111,49 +120,45 @@ export class TXE extends TXETypedOracle {
111
120
  return Promise.resolve(preimage);
112
121
  }
113
122
 
114
- override utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest> {
123
+ utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest> {
115
124
  return this.pxeOracleInterface.getKeyValidationRequest(pkMHash, this.contractAddress);
116
125
  }
117
126
 
118
- override utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance> {
127
+ utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance> {
119
128
  return this.pxeOracleInterface.getContractInstance(address);
120
129
  }
121
130
 
122
- override utilityGetMembershipWitness(
123
- blockNumber: number,
124
- treeId: MerkleTreeId,
125
- leafValue: Fr,
126
- ): Promise<Fr[] | undefined> {
131
+ utilityGetMembershipWitness(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[] | undefined> {
127
132
  return this.pxeOracleInterface.getMembershipWitness(blockNumber, treeId, leafValue);
128
133
  }
129
134
 
130
- override utilityGetNullifierMembershipWitness(
135
+ utilityGetNullifierMembershipWitness(
131
136
  blockNumber: number,
132
137
  nullifier: Fr,
133
138
  ): Promise<NullifierMembershipWitness | undefined> {
134
139
  return this.pxeOracleInterface.getNullifierMembershipWitness(blockNumber, nullifier);
135
140
  }
136
141
 
137
- override utilityGetPublicDataWitness(blockNumber: number, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
142
+ utilityGetPublicDataWitness(blockNumber: number, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
138
143
  return this.pxeOracleInterface.getPublicDataWitness(blockNumber, leafSlot);
139
144
  }
140
145
 
141
- override utilityGetLowNullifierMembershipWitness(
146
+ utilityGetLowNullifierMembershipWitness(
142
147
  blockNumber: number,
143
148
  nullifier: Fr,
144
149
  ): Promise<NullifierMembershipWitness | undefined> {
145
150
  return this.pxeOracleInterface.getLowNullifierMembershipWitness(blockNumber, nullifier);
146
151
  }
147
152
 
148
- override async utilityGetBlockHeader(blockNumber: number): Promise<BlockHeader | undefined> {
153
+ async utilityGetBlockHeader(blockNumber: number): Promise<BlockHeader | undefined> {
149
154
  return (await this.pxeOracleInterface.getBlock(blockNumber))?.header.toBlockHeader();
150
155
  }
151
156
 
152
- override utilityGetPublicKeysAndPartialAddress(account: AztecAddress) {
157
+ utilityGetPublicKeysAndPartialAddress(account: AztecAddress) {
153
158
  return this.pxeOracleInterface.getCompleteAddress(account);
154
159
  }
155
160
 
156
- override async utilityGetNotes(
161
+ async utilityGetNotes(
157
162
  storageSlot: Fr,
158
163
  numSelects: number,
159
164
  selectByIndexes: number[],
@@ -206,13 +211,7 @@ export class TXE extends TXETypedOracle {
206
211
  return notes;
207
212
  }
208
213
 
209
- override privateNotifyCreatedNote(
210
- storageSlot: Fr,
211
- _noteTypeId: NoteSelector,
212
- noteItems: Fr[],
213
- noteHash: Fr,
214
- counter: number,
215
- ) {
214
+ privateNotifyCreatedNote(storageSlot: Fr, _noteTypeId: NoteSelector, noteItems: Fr[], noteHash: Fr, counter: number) {
216
215
  const note = new Note(noteItems);
217
216
  this.noteCache.addNewNote(
218
217
  {
@@ -227,23 +226,23 @@ export class TXE extends TXETypedOracle {
227
226
  );
228
227
  }
229
228
 
230
- override async privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, _counter: number) {
229
+ async privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, _counter: number) {
231
230
  await this.checkNullifiersNotInTree(this.contractAddress, [innerNullifier]);
232
231
  await this.noteCache.nullifyNote(this.contractAddress, innerNullifier, noteHash);
233
232
  }
234
233
 
235
- override async privateNotifyCreatedNullifier(innerNullifier: Fr): Promise<void> {
234
+ async privateNotifyCreatedNullifier(innerNullifier: Fr): Promise<void> {
236
235
  await this.checkNullifiersNotInTree(this.contractAddress, [innerNullifier]);
237
236
  await this.noteCache.nullifierCreated(this.contractAddress, innerNullifier);
238
237
  }
239
238
 
240
- override async utilityCheckNullifierExists(innerNullifier: Fr): Promise<boolean> {
239
+ async utilityCheckNullifierExists(innerNullifier: Fr): Promise<boolean> {
241
240
  const nullifier = await siloNullifier(this.contractAddress, innerNullifier!);
242
241
  const index = await this.pxeOracleInterface.getNullifierIndex(nullifier);
243
242
  return index !== undefined;
244
243
  }
245
244
 
246
- override async utilityStorageRead(
245
+ async utilityStorageRead(
247
246
  contractAddress: AztecAddress,
248
247
  startStorageSlot: Fr,
249
248
  blockNumber: number,
@@ -258,25 +257,22 @@ export class TXE extends TXETypedOracle {
258
257
  return values;
259
258
  }
260
259
 
261
- override utilityDebugLog(message: string, fields: Fr[]): void {
260
+ utilityDebugLog(message: string, fields: Fr[]): void {
262
261
  this.logger.verbose(`${applyStringFormatting(message, fields)}`, { module: `${this.logger.module}:debug_log` });
263
262
  }
264
263
 
265
- override async privateIncrementAppTaggingSecretIndexAsSender(
266
- sender: AztecAddress,
267
- recipient: AztecAddress,
268
- ): Promise<void> {
264
+ async privateIncrementAppTaggingSecretIndexAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<void> {
269
265
  await this.pxeOracleInterface.incrementAppTaggingSecretIndexAsSender(this.contractAddress, sender, recipient);
270
266
  }
271
267
 
272
- override async utilityGetIndexedTaggingSecretAsSender(
268
+ async utilityGetIndexedTaggingSecretAsSender(
273
269
  sender: AztecAddress,
274
270
  recipient: AztecAddress,
275
271
  ): Promise<IndexedTaggingSecret> {
276
272
  return await this.pxeOracleInterface.getIndexedTaggingSecretAsSender(this.contractAddress, sender, recipient);
277
273
  }
278
274
 
279
- override async utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
275
+ async utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
280
276
  await this.pxeOracleInterface.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot);
281
277
 
282
278
  await this.pxeOracleInterface.removeNullifiedNotes(this.contractAddress);
@@ -284,7 +280,7 @@ export class TXE extends TXETypedOracle {
284
280
  return Promise.resolve();
285
281
  }
286
282
 
287
- public override async utilityValidateEnqueuedNotesAndEvents(
283
+ public async utilityValidateEnqueuedNotesAndEvents(
288
284
  contractAddress: AztecAddress,
289
285
  noteValidationRequestsArrayBaseSlot: Fr,
290
286
  eventValidationRequestsArrayBaseSlot: Fr,
@@ -296,7 +292,7 @@ export class TXE extends TXETypedOracle {
296
292
  );
297
293
  }
298
294
 
299
- override async utilityBulkRetrieveLogs(
295
+ async utilityBulkRetrieveLogs(
300
296
  contractAddress: AztecAddress,
301
297
  logRetrievalRequestsArrayBaseSlot: Fr,
302
298
  logRetrievalResponsesArrayBaseSlot: Fr,
@@ -308,7 +304,7 @@ export class TXE extends TXETypedOracle {
308
304
  );
309
305
  }
310
306
 
311
- override utilityStoreCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void> {
307
+ utilityStoreCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void> {
312
308
  if (!contractAddress.equals(this.contractAddress)) {
313
309
  // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
314
310
  throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
@@ -316,7 +312,7 @@ export class TXE extends TXETypedOracle {
316
312
  return this.pxeOracleInterface.storeCapsule(this.contractAddress, slot, capsule);
317
313
  }
318
314
 
319
- override utilityLoadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
315
+ utilityLoadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
320
316
  if (!contractAddress.equals(this.contractAddress)) {
321
317
  // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
322
318
  throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
@@ -324,7 +320,7 @@ export class TXE extends TXETypedOracle {
324
320
  return this.pxeOracleInterface.loadCapsule(this.contractAddress, slot);
325
321
  }
326
322
 
327
- override utilityDeleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void> {
323
+ utilityDeleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void> {
328
324
  if (!contractAddress.equals(this.contractAddress)) {
329
325
  // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
330
326
  throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
@@ -332,12 +328,7 @@ export class TXE extends TXETypedOracle {
332
328
  return this.pxeOracleInterface.deleteCapsule(this.contractAddress, slot);
333
329
  }
334
330
 
335
- override utilityCopyCapsule(
336
- contractAddress: AztecAddress,
337
- srcSlot: Fr,
338
- dstSlot: Fr,
339
- numEntries: number,
340
- ): Promise<void> {
331
+ utilityCopyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void> {
341
332
  if (!contractAddress.equals(this.contractAddress)) {
342
333
  // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
343
334
  throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
@@ -345,20 +336,20 @@ export class TXE extends TXETypedOracle {
345
336
  return this.pxeOracleInterface.copyCapsule(this.contractAddress, srcSlot, dstSlot, numEntries);
346
337
  }
347
338
 
348
- override utilityAes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer> {
339
+ utilityAes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer> {
349
340
  const aes128 = new Aes128();
350
341
  return aes128.decryptBufferCBC(ciphertext, iv, symKey);
351
342
  }
352
343
 
353
- override utilityGetSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point> {
344
+ utilityGetSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point> {
354
345
  return this.pxeOracleInterface.getSharedSecret(address, ephPk);
355
346
  }
356
347
 
357
- override privateGetSenderForTags(): Promise<AztecAddress | undefined> {
348
+ privateGetSenderForTags(): Promise<AztecAddress | undefined> {
358
349
  return Promise.resolve(this.senderForTags);
359
350
  }
360
351
 
361
- override privateSetSenderForTags(senderForTags: AztecAddress): Promise<void> {
352
+ privateSetSenderForTags(senderForTags: AztecAddress): Promise<void> {
362
353
  this.senderForTags = senderForTags;
363
354
  return Promise.resolve();
364
355
  }
@@ -416,4 +407,56 @@ export class TXE extends TXETypedOracle {
416
407
 
417
408
  return txEffect;
418
409
  }
410
+
411
+ // TODO: this class will soon be replaced with the real UtilityExecutionOracle and PrivateExecutionOracle classes. The
412
+ // functions below are not currently used in Noir tests, and in most cases they're caught beforehand by the RPC
413
+ // translator - we just have a temporary empty implementation until we finalize the migration.
414
+
415
+ utilityAssertCompatibleOracleVersion(_version: number): void {
416
+ throw new Error('Method not implemented.');
417
+ }
418
+ utilityGetAuthWitness(_messageHash: Fr): Promise<Fr[] | undefined> {
419
+ throw new Error('Method not implemented.');
420
+ }
421
+ utilityGetL1ToL2MembershipWitness(
422
+ _contractAddress: AztecAddress,
423
+ _messageHash: Fr,
424
+ _secret: Fr,
425
+ ): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>> {
426
+ throw new Error('Method not implemented.');
427
+ }
428
+ utilityEmitOffchainEffect(_data: Fr[]): Promise<void> {
429
+ throw new Error('Method not implemented.');
430
+ }
431
+ privateNotifyCreatedContractClassLog(_log: ContractClassLog, _counter: number): void {
432
+ throw new Error('Method not implemented.');
433
+ }
434
+ privateCallPrivateFunction(
435
+ _targetContractAddress: AztecAddress,
436
+ _functionSelector: FunctionSelector,
437
+ _argsHash: Fr,
438
+ _sideEffectCounter: number,
439
+ _isStaticCall: boolean,
440
+ ): Promise<{ endSideEffectCounter: Fr; returnsHash: Fr }> {
441
+ throw new Error('Method not implemented.');
442
+ }
443
+ privateNotifyEnqueuedPublicFunctionCall(
444
+ _targetContractAddress: AztecAddress,
445
+ _calldataHash: Fr,
446
+ _sideEffectCounter: number,
447
+ _isStaticCall: boolean,
448
+ ): Promise<void> {
449
+ throw new Error('Method not implemented.');
450
+ }
451
+ privateNotifySetPublicTeardownFunctionCall(
452
+ _targetContractAddress: AztecAddress,
453
+ _calldataHash: Fr,
454
+ _sideEffectCounter: number,
455
+ _isStaticCall: boolean,
456
+ ): Promise<void> {
457
+ throw new Error('Method not implemented.');
458
+ }
459
+ privateNotifySetMinRevertibleSideEffectCounter(_minRevertibleSideEffectCounter: number): Promise<void> {
460
+ throw new Error('Method not implemented.');
461
+ }
419
462
  }
@@ -1,7 +1,7 @@
1
1
  import { Fr } from '@aztec/foundation/fields';
2
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
3
3
  import { PublicDataWrite } from '@aztec/stdlib/avm';
4
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import { Body, L2Block } from '@aztec/stdlib/block';
6
6
  import { computePublicDataTreeLeafSlot, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
7
7
  import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
@@ -15,9 +15,11 @@ import { GlobalVariables, TxEffect, TxHash } from '@aztec/stdlib/tx';
15
15
  import type { UInt32 } from '@aztec/stdlib/types';
16
16
 
17
17
  import { insertTxEffectIntoWorldTrees, makeTXEBlockHeader } from '../utils/block_creation.js';
18
- import { TXETypedOracle } from './txe_typed_oracle.js';
18
+ import type { IAvmExecutionOracle } from './interfaces.js';
19
+
20
+ export class TXEOraclePublicContext implements IAvmExecutionOracle {
21
+ isAvm = true as const;
19
22
 
20
- export class TXEOraclePublicContext extends TXETypedOracle {
21
23
  private logger: Logger;
22
24
  private transientUniqueNoteHashes: Fr[] = [];
23
25
  private transientSiloedNullifiers: Fr[] = [];
@@ -29,7 +31,6 @@ export class TXEOraclePublicContext extends TXETypedOracle {
29
31
  private txRequestHash: Fr,
30
32
  private globalVariables: GlobalVariables,
31
33
  ) {
32
- super('TXEOraclePublicContext');
33
34
  this.logger = createLogger('txe:public_context');
34
35
 
35
36
  this.logger.debug('Entering Public Context', {
@@ -39,42 +40,46 @@ export class TXEOraclePublicContext extends TXETypedOracle {
39
40
  });
40
41
  }
41
42
 
42
- override avmOpcodeAddress(): Promise<AztecAddress> {
43
+ avmOpcodeAddress(): Promise<AztecAddress> {
43
44
  return Promise.resolve(this.contractAddress);
44
45
  }
45
46
 
46
- override avmOpcodeBlockNumber(): Promise<UInt32> {
47
+ avmOpcodeSender(): Promise<AztecAddress> {
48
+ return Promise.resolve(AztecAddress.ZERO); // todo: change?
49
+ }
50
+
51
+ avmOpcodeBlockNumber(): Promise<UInt32> {
47
52
  return Promise.resolve(this.globalVariables.blockNumber);
48
53
  }
49
54
 
50
- override avmOpcodeTimestamp(): Promise<bigint> {
55
+ avmOpcodeTimestamp(): Promise<bigint> {
51
56
  return Promise.resolve(this.globalVariables.timestamp);
52
57
  }
53
58
 
54
- override avmOpcodeIsStaticCall(): Promise<boolean> {
59
+ avmOpcodeIsStaticCall(): Promise<boolean> {
55
60
  return Promise.resolve(false);
56
61
  }
57
62
 
58
- override avmOpcodeChainId(): Promise<Fr> {
63
+ avmOpcodeChainId(): Promise<Fr> {
59
64
  return Promise.resolve(this.globalVariables.chainId);
60
65
  }
61
66
 
62
- override avmOpcodeVersion(): Promise<Fr> {
67
+ avmOpcodeVersion(): Promise<Fr> {
63
68
  return Promise.resolve(this.globalVariables.version);
64
69
  }
65
70
 
66
- override async avmOpcodeEmitNullifier(nullifier: Fr) {
71
+ async avmOpcodeEmitNullifier(nullifier: Fr) {
67
72
  const siloedNullifier = await siloNullifier(this.contractAddress, nullifier);
68
73
  this.transientSiloedNullifiers.push(siloedNullifier);
69
74
  }
70
75
 
71
- override async avmOpcodeEmitNoteHash(noteHash: Fr) {
76
+ async avmOpcodeEmitNoteHash(noteHash: Fr) {
72
77
  const siloedNoteHash = await siloNoteHash(this.contractAddress, noteHash);
73
78
  // TODO: make the note hash unique - they are only siloed right now
74
79
  this.transientUniqueNoteHashes.push(siloedNoteHash);
75
80
  }
76
81
 
77
- override async avmOpcodeNullifierExists(innerNullifier: Fr, targetAddress: AztecAddress): Promise<boolean> {
82
+ async avmOpcodeNullifierExists(innerNullifier: Fr, targetAddress: AztecAddress): Promise<boolean> {
78
83
  const nullifier = await siloNullifier(targetAddress, innerNullifier!);
79
84
 
80
85
  const treeIndex = (
@@ -85,7 +90,7 @@ export class TXEOraclePublicContext extends TXETypedOracle {
85
90
  return treeIndex !== undefined || transientIndex !== undefined;
86
91
  }
87
92
 
88
- override async avmOpcodeStorageWrite(slot: Fr, value: Fr) {
93
+ async avmOpcodeStorageWrite(slot: Fr, value: Fr) {
89
94
  this.logger.debug('AVM storage write', { slot, value });
90
95
 
91
96
  const dataWrite = new PublicDataWrite(await computePublicDataTreeLeafSlot(this.contractAddress, slot), value);
@@ -97,7 +102,7 @@ export class TXEOraclePublicContext extends TXETypedOracle {
97
102
  ]);
98
103
  }
99
104
 
100
- override async avmOpcodeStorageRead(slot: Fr): Promise<Fr> {
105
+ async avmOpcodeStorageRead(slot: Fr): Promise<Fr> {
101
106
  const leafSlot = await computePublicDataTreeLeafSlot(this.contractAddress, slot);
102
107
 
103
108
  const lowLeafResult = await this.forkedWorldTrees.getPreviousValueIndex(