@aztec/pxe 0.0.1-commit.cb6bed7c2 → 0.0.1-commit.cbf2c2d5d

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.
Files changed (87) hide show
  1. package/dest/contract_function_simulator/contract_function_simulator.d.ts +9 -3
  2. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  3. package/dest/contract_function_simulator/contract_function_simulator.js +25 -3
  4. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
  5. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  6. package/dest/contract_function_simulator/execution_tagging_index_cache.js +17 -9
  7. package/dest/contract_function_simulator/index.d.ts +2 -1
  8. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  9. package/dest/contract_function_simulator/index.js +1 -0
  10. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -3
  11. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  12. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -4
  13. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
  14. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  15. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
  16. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +16 -0
  17. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +1 -0
  18. package/dest/contract_function_simulator/noir-structs/message_tx_context.js +57 -0
  19. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -4
  20. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +3 -5
  22. package/dest/contract_function_simulator/oracle/interfaces.d.ts +8 -7
  23. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
  25. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
  26. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +42 -0
  27. package/dest/contract_function_simulator/oracle/oracle.d.ts +8 -7
  28. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/oracle/oracle.js +44 -18
  30. package/dest/contract_function_simulator/oracle/private_execution.js +4 -2
  31. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +8 -33
  32. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +7 -39
  34. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +19 -3
  35. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +60 -3
  37. package/dest/contract_sync/contract_sync_service.d.ts +5 -3
  38. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  39. package/dest/contract_sync/contract_sync_service.js +47 -30
  40. package/dest/messages/message_context_service.d.ts +17 -0
  41. package/dest/messages/message_context_service.d.ts.map +1 -0
  42. package/dest/messages/message_context_service.js +36 -0
  43. package/dest/oracle_version.d.ts +2 -2
  44. package/dest/oracle_version.js +2 -2
  45. package/dest/pxe.d.ts +6 -3
  46. package/dest/pxe.d.ts.map +1 -1
  47. package/dest/pxe.js +33 -19
  48. package/dest/storage/metadata.d.ts +1 -1
  49. package/dest/storage/metadata.js +1 -1
  50. package/dest/storage/tagging_store/sender_tagging_store.d.ts +26 -25
  51. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  52. package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
  53. package/dest/tagging/index.d.ts +2 -2
  54. package/dest/tagging/index.d.ts.map +1 -1
  55. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +1 -1
  56. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  57. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +10 -1
  58. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
  59. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  60. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +20 -10
  61. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +2 -1
  62. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  63. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +24 -11
  64. package/package.json +16 -16
  65. package/src/contract_function_simulator/contract_function_simulator.ts +36 -4
  66. package/src/contract_function_simulator/execution_tagging_index_cache.ts +16 -11
  67. package/src/contract_function_simulator/index.ts +1 -0
  68. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -5
  69. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
  70. package/src/contract_function_simulator/noir-structs/message_tx_context.ts +55 -0
  71. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -6
  72. package/src/contract_function_simulator/oracle/interfaces.ts +12 -15
  73. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +135 -0
  74. package/src/contract_function_simulator/oracle/oracle.ts +53 -43
  75. package/src/contract_function_simulator/oracle/private_execution.ts +3 -3
  76. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +9 -57
  77. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +93 -3
  78. package/src/contract_sync/contract_sync_service.ts +67 -38
  79. package/src/messages/message_context_service.ts +45 -0
  80. package/src/oracle_version.ts +2 -2
  81. package/src/pxe.ts +51 -18
  82. package/src/storage/metadata.ts +1 -1
  83. package/src/storage/tagging_store/sender_tagging_store.ts +182 -135
  84. package/src/tagging/index.ts +1 -1
  85. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +19 -1
  86. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +26 -11
  87. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +19 -9
@@ -124,18 +124,27 @@ export interface IUtilityExecutionOracle {
124
124
  contractAddress: AztecAddress,
125
125
  noteValidationRequestsArrayBaseSlot: Fr,
126
126
  eventValidationRequestsArrayBaseSlot: Fr,
127
+ maxNotePackedLen: number,
128
+ maxEventSerializedLen: number,
127
129
  ): Promise<void>;
128
130
  bulkRetrieveLogs(
129
131
  contractAddress: AztecAddress,
130
132
  logRetrievalRequestsArrayBaseSlot: Fr,
131
133
  logRetrievalResponsesArrayBaseSlot: Fr,
132
134
  ): Promise<void>;
135
+ utilityResolveMessageContexts(
136
+ contractAddress: AztecAddress,
137
+ messageContextRequestsArrayBaseSlot: Fr,
138
+ messageContextResponsesArrayBaseSlot: Fr,
139
+ ): Promise<void>;
133
140
  storeCapsule(contractAddress: AztecAddress, key: Fr, capsule: Fr[]): Promise<void>;
134
141
  loadCapsule(contractAddress: AztecAddress, key: Fr): Promise<Fr[] | null>;
135
142
  deleteCapsule(contractAddress: AztecAddress, key: Fr): Promise<void>;
136
143
  copyCapsule(contractAddress: AztecAddress, srcKey: Fr, dstKey: Fr, numEntries: number): Promise<void>;
137
144
  aes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer>;
138
145
  getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
146
+ invalidateContractSyncCache(contractAddress: AztecAddress, scopes: AztecAddress[]): void;
147
+ emitOffchainEffect(data: Fr[]): Promise<void>;
139
148
  }
140
149
 
141
150
  /**
@@ -167,22 +176,10 @@ export interface IPrivateExecutionOracle {
167
176
  sideEffectCounter: number,
168
177
  isStaticCall: boolean,
169
178
  ): Promise<{ endSideEffectCounter: Fr; returnsHash: Fr }>;
170
- notifyEnqueuedPublicFunctionCall(
171
- targetContractAddress: AztecAddress,
172
- calldataHash: Fr,
173
- sideEffectCounter: number,
174
- isStaticCall: boolean,
175
- ): Promise<void>;
176
- notifySetPublicTeardownFunctionCall(
177
- targetContractAddress: AztecAddress,
178
- calldataHash: Fr,
179
- sideEffectCounter: number,
180
- isStaticCall: boolean,
181
- ): Promise<void>;
182
- notifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
183
- isSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean>;
179
+ validatePublicCalldata(calldataHash: Fr): Promise<void>;
180
+ notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void>;
181
+ inRevertiblePhase(sideEffectCounter: number): Promise<boolean>;
184
182
  getSenderForTags(): Promise<AztecAddress | undefined>;
185
183
  setSenderForTags(senderForTags: AztecAddress): Promise<void>;
186
184
  getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
187
- emitOffchainEffect(data: Fr[]): Promise<void>;
188
185
  }
@@ -0,0 +1,135 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { ACIRCallback, ACVMField } from '@aztec/simulator/client';
3
+
4
+ import type { Oracle } from './oracle.js';
5
+
6
+ /**
7
+ * Builds legacy oracle name callbacks for pinned protocol contracts whose artifacts are committed and cannot be
8
+ * changed.
9
+ * TODO(F-416): Remove these aliases on v5 when protocol contracts are redeployed.
10
+ */
11
+ export function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback {
12
+ return {
13
+ // Simple prefix renames (privateXxx/utilityXxx → aztec_prv_/aztec_utl_)
14
+ utilityLog: (
15
+ level: ACVMField[],
16
+ message: ACVMField[],
17
+ _ignoredFieldsSize: ACVMField[],
18
+ fields: ACVMField[],
19
+ ): Promise<ACVMField[]> => oracle.aztec_utl_log(level, message, _ignoredFieldsSize, fields),
20
+ utilityAssertCompatibleOracleVersion: (version: ACVMField[]): Promise<ACVMField[]> =>
21
+ oracle.aztec_utl_assertCompatibleOracleVersion(version),
22
+ utilityLoadCapsule: (
23
+ contractAddress: ACVMField[],
24
+ slot: ACVMField[],
25
+ tSize: ACVMField[],
26
+ ): Promise<(ACVMField | ACVMField[])[]> => oracle.aztec_utl_loadCapsule(contractAddress, slot, tSize),
27
+ privateStoreInExecutionCache: (values: ACVMField[], hash: ACVMField[]): Promise<ACVMField[]> =>
28
+ oracle.aztec_prv_storeInExecutionCache(values, hash),
29
+ privateLoadFromExecutionCache: (returnsHash: ACVMField[]): Promise<ACVMField[][]> =>
30
+ oracle.aztec_prv_loadFromExecutionCache(returnsHash),
31
+ privateCallPrivateFunction: (
32
+ contractAddress: ACVMField[],
33
+ functionSelector: ACVMField[],
34
+ argsHash: ACVMField[],
35
+ sideEffectCounter: ACVMField[],
36
+ isStaticCall: ACVMField[],
37
+ ): Promise<ACVMField[][]> =>
38
+ oracle.aztec_prv_callPrivateFunction(
39
+ contractAddress,
40
+ functionSelector,
41
+ argsHash,
42
+ sideEffectCounter,
43
+ isStaticCall,
44
+ ),
45
+ privateIsNullifierPending: (innerNullifier: ACVMField[], contractAddress: ACVMField[]): Promise<ACVMField[]> =>
46
+ oracle.aztec_prv_isNullifierPending(innerNullifier, contractAddress),
47
+ privateNotifyCreatedNullifier: (innerNullifier: ACVMField[]): Promise<ACVMField[]> =>
48
+ oracle.aztec_prv_notifyCreatedNullifier(innerNullifier),
49
+ privateNotifyCreatedContractClassLog: (
50
+ contractAddress: ACVMField[],
51
+ message: ACVMField[],
52
+ length: ACVMField[],
53
+ counter: ACVMField[],
54
+ ): Promise<ACVMField[]> =>
55
+ oracle.aztec_prv_notifyCreatedContractClassLog(contractAddress, message, length, counter),
56
+ utilityGetUtilityContext: (): Promise<(ACVMField | ACVMField[])[]> => oracle.aztec_utl_getUtilityContext(),
57
+ utilityStorageRead: (
58
+ blockHash: ACVMField[],
59
+ contractAddress: ACVMField[],
60
+ startStorageSlot: ACVMField[],
61
+ numberOfElements: ACVMField[],
62
+ ): Promise<ACVMField[][]> =>
63
+ oracle.aztec_utl_storageRead(blockHash, contractAddress, startStorageSlot, numberOfElements),
64
+ utilityStoreCapsule: (
65
+ contractAddress: ACVMField[],
66
+ slot: ACVMField[],
67
+ capsule: ACVMField[],
68
+ ): Promise<ACVMField[]> => oracle.aztec_utl_storeCapsule(contractAddress, slot, capsule),
69
+ utilityCopyCapsule: (
70
+ contractAddress: ACVMField[],
71
+ srcSlot: ACVMField[],
72
+ dstSlot: ACVMField[],
73
+ numEntries: ACVMField[],
74
+ ): Promise<ACVMField[]> => oracle.aztec_utl_copyCapsule(contractAddress, srcSlot, dstSlot, numEntries),
75
+ utilityDeleteCapsule: (contractAddress: ACVMField[], slot: ACVMField[]): Promise<ACVMField[]> =>
76
+ oracle.aztec_utl_deleteCapsule(contractAddress, slot),
77
+ utilityGetSharedSecret: (
78
+ address: ACVMField[],
79
+ ephPKField0: ACVMField[],
80
+ ephPKField1: ACVMField[],
81
+ ephPKField2: ACVMField[],
82
+ ): Promise<ACVMField[]> => oracle.aztec_utl_getSharedSecret(address, ephPKField0, ephPKField1, ephPKField2),
83
+ utilityFetchTaggedLogs: (pendingTaggedLogArrayBaseSlot: ACVMField[]): Promise<ACVMField[]> =>
84
+ oracle.aztec_utl_fetchTaggedLogs(pendingTaggedLogArrayBaseSlot),
85
+ utilityBulkRetrieveLogs: (
86
+ contractAddress: ACVMField[],
87
+ logRetrievalRequestsArrayBaseSlot: ACVMField[],
88
+ logRetrievalResponsesArrayBaseSlot: ACVMField[],
89
+ ): Promise<ACVMField[]> =>
90
+ oracle.aztec_utl_bulkRetrieveLogs(
91
+ contractAddress,
92
+ logRetrievalRequestsArrayBaseSlot,
93
+ logRetrievalResponsesArrayBaseSlot,
94
+ ),
95
+ utilityGetL1ToL2MembershipWitness: (
96
+ contractAddress: ACVMField[],
97
+ messageHash: ACVMField[],
98
+ secret: ACVMField[],
99
+ ): Promise<(ACVMField | ACVMField[])[]> =>
100
+ oracle.aztec_utl_getL1ToL2MembershipWitness(contractAddress, messageHash, secret),
101
+ utilityEmitOffchainEffect: (data: ACVMField[]): Promise<ACVMField[]> => oracle.aztec_utl_emitOffchainEffect(data),
102
+ // Adapter: old 3-param signature → new 5-param with injected constants.
103
+ // Values derived from: MAX_MESSAGE_CONTENT_LEN(11) - RESERVED_FIELDS (3 for notes, 1 for events).
104
+ utilityValidateAndStoreEnqueuedNotesAndEvents: (
105
+ contractAddress: ACVMField[],
106
+ noteValidationRequestsArrayBaseSlot: ACVMField[],
107
+ eventValidationRequestsArrayBaseSlot: ACVMField[],
108
+ ): Promise<ACVMField[]> =>
109
+ oracle.aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
110
+ contractAddress,
111
+ noteValidationRequestsArrayBaseSlot,
112
+ eventValidationRequestsArrayBaseSlot,
113
+ [new Fr(8).toString()],
114
+ [new Fr(10).toString()],
115
+ ),
116
+ // Renames (same signature, different oracle name)
117
+ privateNotifySetMinRevertibleSideEffectCounter: (counter: ACVMField[]): Promise<ACVMField[]> =>
118
+ oracle.aztec_prv_notifyRevertiblePhaseStart(counter),
119
+ privateIsSideEffectCounterRevertible: (sideEffectCounter: ACVMField[]): Promise<ACVMField[]> =>
120
+ oracle.aztec_prv_inRevertiblePhase(sideEffectCounter),
121
+ // Signature changes: old 4-param oracles → new 1-param validatePublicCalldata
122
+ privateNotifyEnqueuedPublicFunctionCall: (
123
+ _contractAddress: ACVMField[],
124
+ calldataHash: ACVMField[],
125
+ _sideEffectCounter: ACVMField[],
126
+ _isStaticCall: ACVMField[],
127
+ ): Promise<ACVMField[]> => oracle.aztec_prv_validatePublicCalldata(calldataHash),
128
+ privateNotifySetPublicTeardownFunctionCall: (
129
+ _contractAddress: ACVMField[],
130
+ calldataHash: ACVMField[],
131
+ _sideEffectCounter: ACVMField[],
132
+ _isStaticCall: ACVMField[],
133
+ ): Promise<ACVMField[]> => oracle.aztec_prv_validatePublicCalldata(calldataHash),
134
+ };
135
+ }
@@ -16,6 +16,7 @@ import { BlockHash } from '@aztec/stdlib/block';
16
16
  import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
17
17
 
18
18
  import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
19
+ import { buildLegacyOracleCallbacks } from './legacy_oracle_mappings.js';
19
20
  import { packAsHintedNote } from './note_packing_utils.js';
20
21
 
21
22
  export class UnavailableOracleError extends Error {
@@ -85,11 +86,13 @@ export class Oracle {
85
86
  });
86
87
 
87
88
  // Build callback object and return it
88
- return oracleNames.reduce((acc, name) => {
89
+ const callback = oracleNames.reduce((acc, name) => {
89
90
  const method = this[name as keyof Omit<Oracle, (typeof excludedProps)[number]>];
90
91
  acc[name] = method.bind(this);
91
92
  return acc;
92
93
  }, {} as ACIRCallback);
94
+
95
+ return { ...callback, ...buildLegacyOracleCallbacks(this) };
93
96
  }
94
97
 
95
98
  // eslint-disable-next-line camelcase
@@ -461,52 +464,20 @@ export class Oracle {
461
464
  }
462
465
 
463
466
  // eslint-disable-next-line camelcase
464
- async aztec_prv_notifyEnqueuedPublicFunctionCall(
465
- [contractAddress]: ACVMField[],
466
- [calldataHash]: ACVMField[],
467
- [sideEffectCounter]: ACVMField[],
468
- [isStaticCall]: ACVMField[],
469
- ): Promise<ACVMField[]> {
470
- await this.handlerAsPrivate().notifyEnqueuedPublicFunctionCall(
471
- AztecAddress.fromString(contractAddress),
472
- Fr.fromString(calldataHash),
473
- Fr.fromString(sideEffectCounter).toNumber(),
474
- Fr.fromString(isStaticCall).toBool(),
475
- );
476
- return [];
477
- }
478
-
479
- // eslint-disable-next-line camelcase
480
- async aztec_prv_notifySetPublicTeardownFunctionCall(
481
- [contractAddress]: ACVMField[],
482
- [calldataHash]: ACVMField[],
483
- [sideEffectCounter]: ACVMField[],
484
- [isStaticCall]: ACVMField[],
485
- ): Promise<ACVMField[]> {
486
- await this.handlerAsPrivate().notifySetPublicTeardownFunctionCall(
487
- AztecAddress.fromString(contractAddress),
488
- Fr.fromString(calldataHash),
489
- Fr.fromString(sideEffectCounter).toNumber(),
490
- Fr.fromString(isStaticCall).toBool(),
491
- );
467
+ async aztec_prv_validatePublicCalldata([calldataHash]: ACVMField[]): Promise<ACVMField[]> {
468
+ await this.handlerAsPrivate().validatePublicCalldata(Fr.fromString(calldataHash));
492
469
  return [];
493
470
  }
494
471
 
495
472
  // eslint-disable-next-line camelcase
496
- async aztec_prv_notifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]: ACVMField[]): Promise<
497
- ACVMField[]
498
- > {
499
- await this.handlerAsPrivate().notifySetMinRevertibleSideEffectCounter(
500
- Fr.fromString(minRevertibleSideEffectCounter).toNumber(),
501
- );
473
+ async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
474
+ await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
502
475
  return Promise.resolve([]);
503
476
  }
504
477
 
505
478
  // eslint-disable-next-line camelcase
506
- async aztec_prv_isSideEffectCounterRevertible([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
507
- const isRevertible = await this.handlerAsPrivate().isSideEffectCounterRevertible(
508
- Fr.fromString(sideEffectCounter).toNumber(),
509
- );
479
+ async aztec_prv_inRevertiblePhase([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
480
+ const isRevertible = await this.handlerAsPrivate().inRevertiblePhase(Fr.fromString(sideEffectCounter).toNumber());
510
481
  return Promise.resolve([toACVMField(isRevertible)]);
511
482
  }
512
483
 
@@ -530,11 +501,15 @@ export class Oracle {
530
501
  [contractAddress]: ACVMField[],
531
502
  [noteValidationRequestsArrayBaseSlot]: ACVMField[],
532
503
  [eventValidationRequestsArrayBaseSlot]: ACVMField[],
504
+ [maxNotePackedLen]: ACVMField[],
505
+ [maxEventSerializedLen]: ACVMField[],
533
506
  ): Promise<ACVMField[]> {
534
507
  await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
535
508
  AztecAddress.fromString(contractAddress),
536
509
  Fr.fromString(noteValidationRequestsArrayBaseSlot),
537
510
  Fr.fromString(eventValidationRequestsArrayBaseSlot),
511
+ Fr.fromString(maxNotePackedLen).toNumber(),
512
+ Fr.fromString(maxEventSerializedLen).toNumber(),
538
513
  );
539
514
 
540
515
  return [];
@@ -554,6 +529,20 @@ export class Oracle {
554
529
  return [];
555
530
  }
556
531
 
532
+ // eslint-disable-next-line camelcase
533
+ async aztec_utl_utilityResolveMessageContexts(
534
+ [contractAddress]: ACVMField[],
535
+ [messageContextRequestsArrayBaseSlot]: ACVMField[],
536
+ [messageContextResponsesArrayBaseSlot]: ACVMField[],
537
+ ): Promise<ACVMField[]> {
538
+ await this.handlerAsUtility().utilityResolveMessageContexts(
539
+ AztecAddress.fromString(contractAddress),
540
+ Fr.fromString(messageContextRequestsArrayBaseSlot),
541
+ Fr.fromString(messageContextResponsesArrayBaseSlot),
542
+ );
543
+ return [];
544
+ }
545
+
557
546
  // eslint-disable-next-line camelcase
558
547
  async aztec_utl_storeCapsule(
559
548
  [contractAddress]: ACVMField[],
@@ -616,7 +605,7 @@ export class Oracle {
616
605
  }
617
606
 
618
607
  // eslint-disable-next-line camelcase
619
- async aztec_utl_aes128Decrypt(
608
+ async aztec_utl_tryAes128Decrypt(
620
609
  ciphertextBVecStorage: ACVMField[],
621
610
  [ciphertextLength]: ACVMField[],
622
611
  iv: ACVMField[],
@@ -626,8 +615,15 @@ export class Oracle {
626
615
  const ivBuffer = fromUintArray(iv, 8);
627
616
  const symKeyBuffer = fromUintArray(symKey, 8);
628
617
 
629
- const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
630
- return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
618
+ // Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
619
+ try {
620
+ const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
621
+ const [storage, length] = bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
622
+ return [toACVMField(1), storage, length];
623
+ } catch {
624
+ const zeroStorage = Array(ciphertextBVecStorage.length).fill(toACVMField(0));
625
+ return [toACVMField(0), zeroStorage, toACVMField(0)];
626
+ }
631
627
  }
632
628
 
633
629
  // eslint-disable-next-line camelcase
@@ -644,9 +640,23 @@ export class Oracle {
644
640
  return secret.toFields().map(toACVMField);
645
641
  }
646
642
 
643
+ // eslint-disable-next-line camelcase
644
+ aztec_utl_invalidateContractSyncCache(
645
+ [contractAddress]: ACVMField[],
646
+ scopes: ACVMField[],
647
+ [scopeCount]: ACVMField[],
648
+ ): Promise<ACVMField[]> {
649
+ const scopeAddresses = scopes.slice(0, +scopeCount).map(s => AztecAddress.fromField(Fr.fromString(s)));
650
+ this.handlerAsUtility().invalidateContractSyncCache(
651
+ AztecAddress.fromField(Fr.fromString(contractAddress)),
652
+ scopeAddresses,
653
+ );
654
+ return Promise.resolve([]);
655
+ }
656
+
647
657
  // eslint-disable-next-line camelcase
648
658
  async aztec_utl_emitOffchainEffect(data: ACVMField[]) {
649
- await this.handlerAsPrivate().emitOffchainEffect(data.map(Fr.fromString));
659
+ await this.handlerAsUtility().emitOffchainEffect(data.map(Fr.fromString));
650
660
  return [];
651
661
  }
652
662
 
@@ -81,7 +81,7 @@ export async function executePrivateFunction(
81
81
  const newNotes = privateExecutionOracle.getNewNotes();
82
82
  const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
83
83
  const offchainEffects = privateExecutionOracle.getOffchainEffects();
84
- const preTags = privateExecutionOracle.getUsedPreTags();
84
+ const taggingIndexRanges = privateExecutionOracle.getUsedTaggingIndexRanges();
85
85
  const nestedExecutionResults = privateExecutionOracle.getNestedExecutionResults();
86
86
 
87
87
  let timerSubtractionList = nestedExecutionResults;
@@ -103,8 +103,8 @@ export async function executePrivateFunction(
103
103
  newNotes,
104
104
  noteHashNullifierCounterMap,
105
105
  rawReturnValues,
106
- offchainEffects,
107
- preTags,
106
+ offchainEffects.map(e => ({ data: e.data })),
107
+ taggingIndexRanges,
108
108
  nestedExecutionResults,
109
109
  contractClassLogs,
110
110
  {
@@ -14,7 +14,7 @@ import {
14
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
15
15
  import { siloNullifier } from '@aztec/stdlib/hash';
16
16
  import { PrivateContextInputs } from '@aztec/stdlib/kernel';
17
- import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
17
+ import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type TaggingIndexRange } from '@aztec/stdlib/logs';
18
18
  import { Tag } from '@aztec/stdlib/logs';
19
19
  import { Note, type NoteStatus } from '@aztec/stdlib/note';
20
20
  import {
@@ -26,7 +26,6 @@ import {
26
26
  } from '@aztec/stdlib/tx';
27
27
 
28
28
  import type { AccessScopes } from '../../access_scopes.js';
29
- import type { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
30
29
  import { NoteService } from '../../notes/note_service.js';
31
30
  import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
32
31
  import { syncSenderTaggingIndexes } from '../../tagging/index.js';
@@ -49,7 +48,6 @@ export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contr
49
48
  noteCache: ExecutionNoteCache;
50
49
  taggingIndexCache: ExecutionTaggingIndexCache;
51
50
  senderTaggingStore: SenderTaggingStore;
52
- contractSyncService: ContractSyncService;
53
51
  totalPublicCalldataCount?: number;
54
52
  sideEffectCounter?: number;
55
53
  senderForTags?: AztecAddress;
@@ -73,7 +71,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
73
71
  private newNotes: NoteAndSlot[] = [];
74
72
  private noteHashNullifierCounterMap: Map<number, number> = new Map();
75
73
  private contractClassLogs: CountedContractClassLog[] = [];
76
- private offchainEffects: { data: Fr[] }[] = [];
77
74
  private nestedExecutionResults: PrivateCallExecutionResult[] = [];
78
75
 
79
76
  private readonly argsHash: Fr;
@@ -84,7 +81,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
84
81
  private readonly noteCache: ExecutionNoteCache;
85
82
  private readonly taggingIndexCache: ExecutionTaggingIndexCache;
86
83
  private readonly senderTaggingStore: SenderTaggingStore;
87
- private readonly contractSyncService: ContractSyncService;
88
84
  private totalPublicCalldataCount: number;
89
85
  protected sideEffectCounter: number;
90
86
  private senderForTags?: AztecAddress;
@@ -104,7 +100,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
104
100
  this.noteCache = args.noteCache;
105
101
  this.taggingIndexCache = args.taggingIndexCache;
106
102
  this.senderTaggingStore = args.senderTaggingStore;
107
- this.contractSyncService = args.contractSyncService;
108
103
  this.totalPublicCalldataCount = args.totalPublicCalldataCount ?? 0;
109
104
  this.sideEffectCounter = args.sideEffectCounter ?? 0;
110
105
  this.senderForTags = args.senderForTags;
@@ -159,17 +154,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
159
154
  }
160
155
 
161
156
  /**
162
- * Return the offchain effects emitted during this execution.
157
+ * Returns the tagging index ranges that were used in this execution (and that need to be stored in the db).
163
158
  */
164
- public getOffchainEffects() {
165
- return this.offchainEffects;
166
- }
167
-
168
- /**
169
- * Returns the pre-tags that were used in this execution (and that need to be stored in the db).
170
- */
171
- public getUsedPreTags(): PreTag[] {
172
- return this.taggingIndexCache.getUsedPreTags();
159
+ public getUsedTaggingIndexRanges(): TaggingIndexRange[] {
160
+ return this.taggingIndexCache.getUsedTaggingIndexRanges();
173
161
  }
174
162
 
175
163
  /**
@@ -569,6 +557,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
569
557
  senderAddressBookStore: this.senderAddressBookStore,
570
558
  capsuleStore: this.capsuleStore,
571
559
  privateEventStore: this.privateEventStore,
560
+ messageContextService: this.messageContextService,
572
561
  contractSyncService: this.contractSyncService,
573
562
  jobId: this.jobId,
574
563
  totalPublicCalldataCount: this.totalPublicCalldataCount,
@@ -608,7 +597,8 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
608
597
  };
609
598
  }
610
599
 
611
- #onNewPublicFunctionCall(calldataHash: Fr) {
600
+ /** Validates the calldata preimage exists in the cache and checks cumulative calldata size is within limits. */
601
+ public validatePublicCalldata(calldataHash: Fr) {
612
602
  const calldata = this.executionCache.getPreimage(calldataHash);
613
603
  if (!calldata) {
614
604
  throw new Error('Calldata for public call not found in cache');
@@ -618,47 +608,14 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
618
608
  if (this.totalPublicCalldataCount > MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS) {
619
609
  throw new Error(`Too many total args to all enqueued public calls! (> ${MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS})`);
620
610
  }
621
- }
622
-
623
- /**
624
- * Verify relevant information when a public function is enqueued.
625
- * @param targetContractAddress - The address of the contract to call.
626
- * @param calldataHash - The hash of the function selector and arguments.
627
- * @param sideEffectCounter - The side effect counter at the start of the call.
628
- * @param isStaticCall - Whether the call is a static call.
629
- */
630
- public notifyEnqueuedPublicFunctionCall(
631
- _targetContractAddress: AztecAddress,
632
- calldataHash: Fr,
633
- _sideEffectCounter: number,
634
- _isStaticCall: boolean,
635
- ) {
636
- this.#onNewPublicFunctionCall(calldataHash);
637
611
  return Promise.resolve();
638
612
  }
639
613
 
640
- /**
641
- * Verify relevant information when a public teardown function is set.
642
- * @param targetContractAddress - The address of the contract to call.
643
- * @param argsHash - The arguments hash to pass to the function.
644
- * @param sideEffectCounter - The side effect counter at the start of the call.
645
- * @param isStaticCall - Whether the call is a static call.
646
- */
647
- public notifySetPublicTeardownFunctionCall(
648
- _targetContractAddress: AztecAddress,
649
- calldataHash: Fr,
650
- _sideEffectCounter: number,
651
- _isStaticCall: boolean,
652
- ) {
653
- this.#onNewPublicFunctionCall(calldataHash);
654
- return Promise.resolve();
655
- }
656
-
657
- public notifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void> {
614
+ public notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void> {
658
615
  return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
659
616
  }
660
617
 
661
- public isSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean> {
618
+ public inRevertiblePhase(sideEffectCounter: number): Promise<boolean> {
662
619
  return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
663
620
  }
664
621
 
@@ -685,9 +642,4 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
685
642
  public getDebugFunctionName() {
686
643
  return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
687
644
  }
688
-
689
- public emitOffchainEffect(data: Fr[]): Promise<void> {
690
- this.offchainEffects.push({ data });
691
- return Promise.resolve();
692
- }
693
645
  }