@aztec/pxe 0.0.1-commit.3469e52 → 0.0.1-commit.35158ae7e

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 (247) hide show
  1. package/dest/access_scopes.d.ts +9 -0
  2. package/dest/access_scopes.d.ts.map +1 -0
  3. package/dest/access_scopes.js +6 -0
  4. package/dest/bin/check_oracle_version.js +1 -1
  5. package/dest/block_synchronizer/block_synchronizer.d.ts +9 -5
  6. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  7. package/dest/block_synchronizer/block_synchronizer.js +62 -16
  8. package/dest/config/index.d.ts +4 -2
  9. package/dest/config/index.d.ts.map +1 -1
  10. package/dest/config/index.js +18 -1
  11. package/dest/config/package_info.js +1 -1
  12. package/dest/contract_function_simulator/contract_function_simulator.d.ts +61 -31
  13. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/contract_function_simulator.js +201 -78
  15. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -7
  16. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -11
  18. package/dest/contract_function_simulator/index.d.ts +2 -1
  19. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/index.js +1 -0
  21. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -4
  22. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +6 -5
  24. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
  25. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
  27. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +16 -0
  28. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +1 -0
  29. package/dest/contract_function_simulator/noir-structs/message_tx_context.js +57 -0
  30. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -5
  31. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +4 -6
  33. package/dest/contract_function_simulator/oracle/interfaces.d.ts +54 -46
  34. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
  36. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
  37. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +42 -0
  38. package/dest/contract_function_simulator/oracle/oracle.d.ts +45 -42
  39. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/oracle/oracle.js +201 -110
  41. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -22
  42. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  43. package/dest/contract_function_simulator/oracle/private_execution.js +5 -40
  44. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +60 -77
  45. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +110 -86
  47. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +104 -54
  48. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  49. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +216 -119
  50. package/dest/contract_logging.d.ts +22 -0
  51. package/dest/contract_logging.d.ts.map +1 -0
  52. package/dest/contract_logging.js +23 -0
  53. package/dest/contract_sync/contract_sync_service.d.ts +45 -0
  54. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  55. package/dest/contract_sync/contract_sync_service.js +114 -0
  56. package/dest/contract_sync/helpers.d.ts +29 -0
  57. package/dest/contract_sync/helpers.d.ts.map +1 -0
  58. package/dest/contract_sync/helpers.js +55 -0
  59. package/dest/debug/pxe_debug_utils.d.ts +24 -10
  60. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  61. package/dest/debug/pxe_debug_utils.js +28 -17
  62. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  63. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  64. package/dest/entrypoints/client/bundle/index.js +3 -0
  65. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  66. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  67. package/dest/entrypoints/client/bundle/utils.js +21 -7
  68. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  69. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  70. package/dest/entrypoints/client/lazy/index.js +3 -0
  71. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  72. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  73. package/dest/entrypoints/client/lazy/utils.js +22 -8
  74. package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
  75. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  76. package/dest/entrypoints/server/index.d.ts +4 -1
  77. package/dest/entrypoints/server/index.d.ts.map +1 -1
  78. package/dest/entrypoints/server/index.js +3 -0
  79. package/dest/entrypoints/server/utils.d.ts +1 -1
  80. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  81. package/dest/entrypoints/server/utils.js +28 -9
  82. package/dest/events/event_service.d.ts +5 -6
  83. package/dest/events/event_service.d.ts.map +1 -1
  84. package/dest/events/event_service.js +6 -7
  85. package/dest/job_coordinator/job_coordinator.d.ts +3 -2
  86. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
  87. package/dest/job_coordinator/job_coordinator.js +3 -2
  88. package/dest/logs/log_service.d.ts +7 -5
  89. package/dest/logs/log_service.d.ts.map +1 -1
  90. package/dest/logs/log_service.js +28 -32
  91. package/dest/messages/message_context_service.d.ts +17 -0
  92. package/dest/messages/message_context_service.d.ts.map +1 -0
  93. package/dest/messages/message_context_service.js +36 -0
  94. package/dest/notes/note_service.d.ts +9 -8
  95. package/dest/notes/note_service.d.ts.map +1 -1
  96. package/dest/notes/note_service.js +17 -16
  97. package/dest/notes_filter.d.ts +25 -0
  98. package/dest/notes_filter.d.ts.map +1 -0
  99. package/dest/notes_filter.js +4 -0
  100. package/dest/oracle_version.d.ts +3 -3
  101. package/dest/oracle_version.d.ts.map +1 -1
  102. package/dest/oracle_version.js +5 -4
  103. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  104. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  105. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  106. package/dest/private_kernel/hints/index.d.ts +1 -1
  107. package/dest/private_kernel/hints/index.js +1 -1
  108. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
  109. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  110. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
  111. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  112. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  113. package/dest/private_kernel/hints/test_utils.js +203 -0
  114. package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
  115. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  116. package/dest/private_kernel/private_kernel_execution_prover.js +21 -13
  117. package/dest/private_kernel/private_kernel_oracle.d.ts +8 -4
  118. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  119. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  120. package/dest/pxe.d.ts +74 -24
  121. package/dest/pxe.d.ts.map +1 -1
  122. package/dest/pxe.js +134 -80
  123. package/dest/storage/address_store/address_store.d.ts +1 -1
  124. package/dest/storage/address_store/address_store.d.ts.map +1 -1
  125. package/dest/storage/address_store/address_store.js +12 -11
  126. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
  127. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  128. package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
  129. package/dest/storage/capsule_store/capsule_store.js +6 -8
  130. package/dest/storage/contract_store/contract_store.d.ts +42 -16
  131. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  132. package/dest/storage/contract_store/contract_store.js +157 -84
  133. package/dest/storage/metadata.d.ts +1 -1
  134. package/dest/storage/metadata.js +1 -1
  135. package/dest/storage/note_store/note_store.d.ts +47 -49
  136. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  137. package/dest/storage/note_store/note_store.js +278 -252
  138. package/dest/storage/note_store/stored_note.d.ts +16 -0
  139. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  140. package/dest/storage/note_store/stored_note.js +43 -0
  141. package/dest/storage/private_event_store/private_event_store.d.ts +17 -4
  142. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  143. package/dest/storage/private_event_store/private_event_store.js +198 -147
  144. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  145. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  146. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  147. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  148. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  149. package/dest/storage/tagging_store/recipient_tagging_store.js +31 -19
  150. package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
  151. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
  152. package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
  153. package/dest/storage/tagging_store/sender_tagging_store.d.ts +29 -28
  154. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  155. package/dest/storage/tagging_store/sender_tagging_store.js +233 -137
  156. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  157. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  158. package/dest/tagging/get_all_logs_by_tags.js +60 -0
  159. package/dest/tagging/index.d.ts +4 -3
  160. package/dest/tagging/index.d.ts.map +1 -1
  161. package/dest/tagging/index.js +2 -1
  162. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +5 -5
  163. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  164. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
  165. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  166. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +7 -7
  167. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  168. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +16 -12
  169. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +5 -8
  170. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  171. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +13 -7
  172. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
  173. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  174. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +23 -16
  175. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +6 -7
  176. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  177. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +42 -27
  178. package/package.json +25 -16
  179. package/src/access_scopes.ts +9 -0
  180. package/src/bin/check_oracle_version.ts +1 -0
  181. package/src/block_synchronizer/block_synchronizer.ts +76 -33
  182. package/src/config/index.ts +15 -1
  183. package/src/config/package_info.ts +1 -1
  184. package/src/contract_function_simulator/contract_function_simulator.ts +361 -142
  185. package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -14
  186. package/src/contract_function_simulator/index.ts +1 -0
  187. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +9 -6
  188. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
  189. package/src/contract_function_simulator/noir-structs/message_tx_context.ts +55 -0
  190. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +4 -7
  191. package/src/contract_function_simulator/oracle/interfaces.ts +67 -58
  192. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +135 -0
  193. package/src/contract_function_simulator/oracle/oracle.ts +217 -149
  194. package/src/contract_function_simulator/oracle/private_execution.ts +5 -64
  195. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +150 -182
  196. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +330 -134
  197. package/src/contract_logging.ts +39 -0
  198. package/src/contract_sync/contract_sync_service.ts +181 -0
  199. package/src/contract_sync/helpers.ts +98 -0
  200. package/src/debug/pxe_debug_utils.ts +63 -18
  201. package/src/entrypoints/client/bundle/index.ts +3 -0
  202. package/src/entrypoints/client/bundle/utils.ts +16 -15
  203. package/src/entrypoints/client/lazy/index.ts +3 -0
  204. package/src/entrypoints/client/lazy/utils.ts +17 -15
  205. package/src/entrypoints/pxe_creation_options.ts +2 -1
  206. package/src/entrypoints/server/index.ts +3 -0
  207. package/src/entrypoints/server/utils.ts +22 -26
  208. package/src/events/event_service.ts +5 -7
  209. package/src/job_coordinator/job_coordinator.ts +4 -3
  210. package/src/logs/log_service.ts +48 -39
  211. package/src/messages/message_context_service.ts +45 -0
  212. package/src/notes/note_service.ts +24 -22
  213. package/src/notes_filter.ts +26 -0
  214. package/src/oracle_version.ts +5 -4
  215. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  216. package/src/private_kernel/hints/index.ts +1 -1
  217. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
  218. package/src/private_kernel/hints/test_utils.ts +325 -0
  219. package/src/private_kernel/private_kernel_execution_prover.ts +25 -15
  220. package/src/private_kernel/private_kernel_oracle.ts +9 -9
  221. package/src/pxe.ts +261 -126
  222. package/src/storage/address_store/address_store.ts +15 -15
  223. package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
  224. package/src/storage/capsule_store/capsule_store.ts +8 -8
  225. package/src/storage/contract_store/contract_store.ts +186 -96
  226. package/src/storage/metadata.ts +1 -1
  227. package/src/storage/note_store/note_store.ts +321 -318
  228. package/src/storage/note_store/stored_note.ts +48 -0
  229. package/src/storage/private_event_store/private_event_store.ts +250 -190
  230. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  231. package/src/storage/tagging_store/recipient_tagging_store.ts +38 -24
  232. package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
  233. package/src/storage/tagging_store/sender_tagging_store.ts +287 -156
  234. package/src/tagging/get_all_logs_by_tags.ts +92 -0
  235. package/src/tagging/index.ts +3 -2
  236. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +17 -10
  237. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  238. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +17 -16
  239. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +25 -10
  240. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +29 -26
  241. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +39 -29
  242. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  243. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
  244. package/dest/tree_membership/tree_membership_service.d.ts +0 -50
  245. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  246. package/dest/tree_membership/tree_membership_service.js +0 -75
  247. package/src/tree_membership/tree_membership_service.ts +0 -97
@@ -12,11 +12,11 @@ import {
12
12
  } from '@aztec/simulator/client';
13
13
  import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
14
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
15
- import { L2BlockHash } from '@aztec/stdlib/block';
15
+ import { BlockHash } from '@aztec/stdlib/block';
16
16
  import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
17
- import { MerkleTreeId } from '@aztec/stdlib/trees';
18
17
 
19
18
  import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
19
+ import { buildLegacyOracleCallbacks } from './legacy_oracle_mappings.js';
20
20
  import { packAsHintedNote } from './note_packing_utils.js';
21
21
 
22
22
  export class UnavailableOracleError extends Error {
@@ -70,12 +70,12 @@ export class Oracle {
70
70
  name => !excludedProps.includes(name as (typeof excludedProps)[number]),
71
71
  );
72
72
 
73
- // Validate oracle names - these must be prefixed with either "private" or "utility" to indicate their scope
73
+ // Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
74
74
  // and must correspond to a function on the Oracle class.
75
75
  oracleNames.forEach(name => {
76
- if (!name.startsWith('private') && !name.startsWith('utility')) {
76
+ if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
77
77
  throw new Error(
78
- `Oracle function "${name}" must be prefixed with either "private" or "utility" to indicate its scope`,
78
+ `Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`,
79
79
  );
80
80
  }
81
81
 
@@ -86,48 +86,55 @@ export class Oracle {
86
86
  });
87
87
 
88
88
  // Build callback object and return it
89
- return oracleNames.reduce((acc, name) => {
89
+ const callback = oracleNames.reduce((acc, name) => {
90
90
  const method = this[name as keyof Omit<Oracle, (typeof excludedProps)[number]>];
91
91
  acc[name] = method.bind(this);
92
92
  return acc;
93
93
  }, {} as ACIRCallback);
94
+
95
+ return { ...callback, ...buildLegacyOracleCallbacks(this) };
94
96
  }
95
97
 
96
- utilityAssertCompatibleOracleVersion([version]: ACVMField[]) {
97
- this.handlerAsMisc().utilityAssertCompatibleOracleVersion(Fr.fromString(version).toNumber());
98
+ // eslint-disable-next-line camelcase
99
+ aztec_utl_assertCompatibleOracleVersion([version]: ACVMField[]) {
100
+ this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
98
101
  return Promise.resolve([]);
99
102
  }
100
103
 
101
- utilityGetRandomField(): Promise<ACVMField[]> {
102
- const val = this.handlerAsMisc().utilityGetRandomField();
104
+ // eslint-disable-next-line camelcase
105
+ aztec_utl_getRandomField(): Promise<ACVMField[]> {
106
+ const val = this.handlerAsMisc().getRandomField();
103
107
  return Promise.resolve([toACVMField(val)]);
104
108
  }
105
109
 
106
- privateStoreInExecutionCache(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
107
- this.handlerAsPrivate().privateStoreInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
110
+ // eslint-disable-next-line camelcase
111
+ aztec_prv_storeInExecutionCache(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
112
+ this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
108
113
  return Promise.resolve([]);
109
114
  }
110
115
 
111
- async privateLoadFromExecutionCache([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
112
- const values = await this.handlerAsPrivate().privateLoadFromExecutionCache(Fr.fromString(returnsHash));
116
+ // eslint-disable-next-line camelcase
117
+ async aztec_prv_loadFromExecutionCache([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
118
+ const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
113
119
  return [values.map(toACVMField)];
114
120
  }
115
121
 
116
- utilityGetUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
117
- const context = this.handlerAsUtility().utilityGetUtilityContext();
122
+ // eslint-disable-next-line camelcase
123
+ aztec_utl_getUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
124
+ const context = this.handlerAsUtility().getUtilityContext();
118
125
  return Promise.resolve(context.toNoirRepresentation());
119
126
  }
120
127
 
121
- async utilityGetKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
122
- const keyValidationRequest = await this.handlerAsUtility().utilityGetKeyValidationRequest(Fr.fromString(pkMHash));
128
+ // eslint-disable-next-line camelcase
129
+ async aztec_utl_getKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
130
+ const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
123
131
 
124
132
  return keyValidationRequest.toFields().map(toACVMField);
125
133
  }
126
134
 
127
- async utilityGetContractInstance([address]: ACVMField[]): Promise<ACVMField[]> {
128
- const instance = await this.handlerAsUtility().utilityGetContractInstance(
129
- AztecAddress.fromField(Fr.fromString(address)),
130
- );
135
+ // eslint-disable-next-line camelcase
136
+ async aztec_utl_getContractInstance([address]: ACVMField[]): Promise<ACVMField[]> {
137
+ const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
131
138
 
132
139
  return [
133
140
  instance.salt,
@@ -138,39 +145,49 @@ export class Oracle {
138
145
  ].map(toACVMField);
139
146
  }
140
147
 
141
- async utilityGetMembershipWitness(
148
+ // eslint-disable-next-line camelcase
149
+ async aztec_utl_getNoteHashMembershipWitness(
150
+ [anchorBlockHash]: ACVMField[],
151
+ [noteHash]: ACVMField[],
152
+ ): Promise<(ACVMField | ACVMField[])[]> {
153
+ const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
154
+ const parsedNoteHash = Fr.fromString(noteHash);
155
+
156
+ const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
157
+ if (!witness) {
158
+ throw new Error(
159
+ `Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`,
160
+ );
161
+ }
162
+ return witness.toNoirRepresentation();
163
+ }
164
+
165
+ // eslint-disable-next-line camelcase
166
+ async aztec_utl_getBlockHashMembershipWitness(
167
+ [anchorBlockHash]: ACVMField[],
142
168
  [blockHash]: ACVMField[],
143
- [treeId]: ACVMField[],
144
- [leafValue]: ACVMField[],
145
169
  ): Promise<(ACVMField | ACVMField[])[]> {
146
- const parsedBlockHash = L2BlockHash.fromString(blockHash);
147
- const parsedTreeId = Fr.fromString(treeId).toNumber();
148
- const parsedLeafValue = Fr.fromString(leafValue);
149
-
150
- const witness = await this.handlerAsUtility().utilityGetMembershipWitness(
151
- parsedBlockHash,
152
- parsedTreeId,
153
- parsedLeafValue,
154
- );
170
+ const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
171
+ const parsedBlockHash = BlockHash.fromString(blockHash);
172
+
173
+ const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
155
174
  if (!witness) {
156
175
  throw new Error(
157
- `Leaf ${leafValue} not found in the tree ${MerkleTreeId[parsedTreeId]} at block hash ${parsedBlockHash.toString()}.`,
176
+ `Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`,
158
177
  );
159
178
  }
160
- return [toACVMField(witness[0]), witness.slice(1).map(toACVMField)];
179
+ return witness.toNoirRepresentation();
161
180
  }
162
181
 
163
- async utilityGetNullifierMembershipWitness(
182
+ // eslint-disable-next-line camelcase
183
+ async aztec_utl_getNullifierMembershipWitness(
164
184
  [blockHash]: ACVMField[],
165
185
  [nullifier]: ACVMField[], // nullifier, we try to find the witness for (to prove inclusion)
166
186
  ): Promise<(ACVMField | ACVMField[])[]> {
167
- const parsedBlockHash = L2BlockHash.fromString(blockHash);
187
+ const parsedBlockHash = BlockHash.fromString(blockHash);
168
188
  const parsedNullifier = Fr.fromString(nullifier);
169
189
 
170
- const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(
171
- parsedBlockHash,
172
- parsedNullifier,
173
- );
190
+ const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
174
191
  if (!witness) {
175
192
  throw new Error(
176
193
  `Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
@@ -179,17 +196,15 @@ export class Oracle {
179
196
  return witness.toNoirRepresentation();
180
197
  }
181
198
 
182
- async utilityGetLowNullifierMembershipWitness(
199
+ // eslint-disable-next-line camelcase
200
+ async aztec_utl_getLowNullifierMembershipWitness(
183
201
  [blockHash]: ACVMField[],
184
202
  [nullifier]: ACVMField[], // nullifier, we try to find the low nullifier witness for (to prove non-inclusion)
185
203
  ): Promise<(ACVMField | ACVMField[])[]> {
186
- const parsedBlockHash = L2BlockHash.fromString(blockHash);
204
+ const parsedBlockHash = BlockHash.fromString(blockHash);
187
205
  const parsedNullifier = Fr.fromString(nullifier);
188
206
 
189
- const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(
190
- parsedBlockHash,
191
- parsedNullifier,
192
- );
207
+ const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
193
208
  if (!witness) {
194
209
  throw new Error(
195
210
  `Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
@@ -198,14 +213,15 @@ export class Oracle {
198
213
  return witness.toNoirRepresentation();
199
214
  }
200
215
 
201
- async utilityGetPublicDataWitness(
216
+ // eslint-disable-next-line camelcase
217
+ async aztec_utl_getPublicDataWitness(
202
218
  [blockHash]: ACVMField[],
203
219
  [leafSlot]: ACVMField[],
204
220
  ): Promise<(ACVMField | ACVMField[])[]> {
205
- const parsedBlockHash = L2BlockHash.fromString(blockHash);
221
+ const parsedBlockHash = BlockHash.fromString(blockHash);
206
222
  const parsedLeafSlot = Fr.fromString(leafSlot);
207
223
 
208
- const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(parsedBlockHash, parsedLeafSlot);
224
+ const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
209
225
  if (!witness) {
210
226
  throw new Error(
211
227
  `Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`,
@@ -214,34 +230,45 @@ export class Oracle {
214
230
  return witness.toNoirRepresentation();
215
231
  }
216
232
 
217
- async utilityGetBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
233
+ // eslint-disable-next-line camelcase
234
+ async aztec_utl_getBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
218
235
  const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
219
236
 
220
- const header = await this.handlerAsUtility().utilityGetBlockHeader(BlockNumber(parsedBlockNumber));
237
+ const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
221
238
  if (!header) {
222
239
  throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
223
240
  }
224
241
  return header.toFields().map(toACVMField);
225
242
  }
226
243
 
227
- async utilityGetAuthWitness([messageHash]: ACVMField[]): Promise<ACVMField[][]> {
244
+ // eslint-disable-next-line camelcase
245
+ async aztec_utl_getAuthWitness([messageHash]: ACVMField[]): Promise<ACVMField[][]> {
228
246
  const messageHashField = Fr.fromString(messageHash);
229
- const witness = await this.handlerAsUtility().utilityGetAuthWitness(messageHashField);
247
+ const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
230
248
  if (!witness) {
231
249
  throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
232
250
  }
233
251
  return [witness.map(toACVMField)];
234
252
  }
235
253
 
236
- async utilityGetPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<ACVMField[][]> {
254
+ // eslint-disable-next-line camelcase
255
+ async aztec_utl_tryGetPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
237
256
  const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
238
- const { publicKeys, partialAddress } =
239
- await this.handlerAsUtility().utilityGetPublicKeysAndPartialAddress(parsedAddress);
257
+ const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
240
258
 
241
- return [[...publicKeys.toFields(), partialAddress].map(toACVMField)];
259
+ // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
260
+ // with two fields: `some` (a boolean) and `value` (a field array in this case).
261
+ if (result === undefined) {
262
+ // No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
263
+ return [toACVMField(0), Array(13).fill(toACVMField(0))];
264
+ } else {
265
+ // Data was found so we set `some` to 1 and return it along with `value`.
266
+ return [toACVMField(1), [...result.publicKeys.toFields(), result.partialAddress].map(toACVMField)];
267
+ }
242
268
  }
243
269
 
244
- async utilityGetNotes(
270
+ // eslint-disable-next-line camelcase
271
+ async aztec_utl_getNotes(
245
272
  [ownerSome]: ACVMField[],
246
273
  [ownerValue]: ACVMField[],
247
274
  [storageSlot]: ACVMField[],
@@ -263,7 +290,7 @@ export class Oracle {
263
290
  ): Promise<(ACVMField | ACVMField[])[]> {
264
291
  // Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
265
292
  const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
266
- const noteDatas = await this.handlerAsUtility().utilityGetNotes(
293
+ const noteDatas = await this.handlerAsUtility().getNotes(
267
294
  owner,
268
295
  Fr.fromString(storageSlot),
269
296
  +numSelects,
@@ -302,7 +329,8 @@ export class Oracle {
302
329
  return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
303
330
  }
304
331
 
305
- privateNotifyCreatedNote(
332
+ // eslint-disable-next-line camelcase
333
+ aztec_prv_notifyCreatedNote(
306
334
  [owner]: ACVMField[],
307
335
  [storageSlot]: ACVMField[],
308
336
  [randomness]: ACVMField[],
@@ -311,7 +339,7 @@ export class Oracle {
311
339
  [noteHash]: ACVMField[],
312
340
  [counter]: ACVMField[],
313
341
  ): Promise<ACVMField[]> {
314
- this.handlerAsPrivate().privateNotifyCreatedNote(
342
+ this.handlerAsPrivate().notifyCreatedNote(
315
343
  AztecAddress.fromString(owner),
316
344
  Fr.fromString(storageSlot),
317
345
  Fr.fromString(randomness),
@@ -323,35 +351,47 @@ export class Oracle {
323
351
  return Promise.resolve([]);
324
352
  }
325
353
 
326
- async privateNotifyNullifiedNote(
354
+ // eslint-disable-next-line camelcase
355
+ async aztec_prv_notifyNullifiedNote(
327
356
  [innerNullifier]: ACVMField[],
328
357
  [noteHash]: ACVMField[],
329
358
  [counter]: ACVMField[],
330
359
  ): Promise<ACVMField[]> {
331
- await this.handlerAsPrivate().privateNotifyNullifiedNote(
332
- Fr.fromString(innerNullifier),
333
- Fr.fromString(noteHash),
334
- +counter,
335
- );
360
+ await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
336
361
  return [];
337
362
  }
338
363
 
339
- async privateNotifyCreatedNullifier([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
340
- await this.handlerAsPrivate().privateNotifyCreatedNullifier(Fr.fromString(innerNullifier));
364
+ // eslint-disable-next-line camelcase
365
+ async aztec_prv_notifyCreatedNullifier([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
366
+ await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
341
367
  return [];
342
368
  }
343
369
 
344
- async utilityCheckNullifierExists([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
345
- const exists = await this.handlerAsUtility().utilityCheckNullifierExists(Fr.fromString(innerNullifier));
370
+ // eslint-disable-next-line camelcase
371
+ async aztec_prv_isNullifierPending(
372
+ [innerNullifier]: ACVMField[],
373
+ [contractAddress]: ACVMField[],
374
+ ): Promise<ACVMField[]> {
375
+ const isPending = await this.handlerAsPrivate().isNullifierPending(
376
+ Fr.fromString(innerNullifier),
377
+ AztecAddress.fromString(contractAddress),
378
+ );
379
+ return [toACVMField(isPending)];
380
+ }
381
+
382
+ // eslint-disable-next-line camelcase
383
+ async aztec_utl_checkNullifierExists([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
384
+ const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
346
385
  return [toACVMField(exists)];
347
386
  }
348
387
 
349
- async utilityGetL1ToL2MembershipWitness(
388
+ // eslint-disable-next-line camelcase
389
+ async aztec_utl_getL1ToL2MembershipWitness(
350
390
  [contractAddress]: ACVMField[],
351
391
  [messageHash]: ACVMField[],
352
392
  [secret]: ACVMField[],
353
393
  ): Promise<(ACVMField | ACVMField[])[]> {
354
- const message = await this.handlerAsUtility().utilityGetL1ToL2MembershipWitness(
394
+ const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(
355
395
  AztecAddress.fromString(contractAddress),
356
396
  Fr.fromString(messageHash),
357
397
  Fr.fromString(secret),
@@ -359,14 +399,15 @@ export class Oracle {
359
399
  return message.toNoirRepresentation();
360
400
  }
361
401
 
362
- async utilityStorageRead(
402
+ // eslint-disable-next-line camelcase
403
+ async aztec_utl_storageRead(
363
404
  [blockHash]: ACVMField[],
364
405
  [contractAddress]: ACVMField[],
365
406
  [startStorageSlot]: ACVMField[],
366
407
  [numberOfElements]: ACVMField[],
367
408
  ): Promise<ACVMField[][]> {
368
- const values = await this.handlerAsUtility().utilityStorageRead(
369
- L2BlockHash.fromString(blockHash),
409
+ const values = await this.handlerAsUtility().storageRead(
410
+ BlockHash.fromString(blockHash),
370
411
  new AztecAddress(Fr.fromString(contractAddress)),
371
412
  Fr.fromString(startStorageSlot),
372
413
  +numberOfElements,
@@ -374,7 +415,8 @@ export class Oracle {
374
415
  return [values.map(toACVMField)];
375
416
  }
376
417
 
377
- privateNotifyCreatedContractClassLog(
418
+ // eslint-disable-next-line camelcase
419
+ aztec_prv_notifyCreatedContractClassLog(
378
420
  [contractAddress]: ACVMField[],
379
421
  message: ACVMField[],
380
422
  [length]: ACVMField[],
@@ -383,11 +425,12 @@ export class Oracle {
383
425
  const logFields = new ContractClassLogFields(message.map(Fr.fromString));
384
426
  const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
385
427
 
386
- this.handlerAsPrivate().privateNotifyCreatedContractClassLog(log, +counter);
428
+ this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
387
429
  return Promise.resolve([]);
388
430
  }
389
431
 
390
- utilityDebugLog(
432
+ // eslint-disable-next-line camelcase
433
+ async aztec_utl_log(
391
434
  level: ACVMField[],
392
435
  message: ACVMField[],
393
436
  _ignoredFieldsSize: ACVMField[],
@@ -396,20 +439,21 @@ export class Oracle {
396
439
  const levelFr = Fr.fromString(level[0]);
397
440
  const messageStr = message.map(acvmField => String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
398
441
  const fieldsFr = fields.map(Fr.fromString);
399
- this.handlerAsMisc().utilityDebugLog(levelFr.toNumber(), messageStr, fieldsFr);
400
- return Promise.resolve([]);
442
+ await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
443
+ return [];
401
444
  }
402
445
 
403
446
  // This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
404
447
  // change the name here.
405
- async privateCallPrivateFunction(
448
+ // eslint-disable-next-line camelcase
449
+ async aztec_prv_callPrivateFunction(
406
450
  [contractAddress]: ACVMField[],
407
451
  [functionSelector]: ACVMField[],
408
452
  [argsHash]: ACVMField[],
409
453
  [sideEffectCounter]: ACVMField[],
410
454
  [isStaticCall]: ACVMField[],
411
455
  ): Promise<ACVMField[][]> {
412
- const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().privateCallPrivateFunction(
456
+ const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(
413
457
  AztecAddress.fromField(Fr.fromString(contractAddress)),
414
458
  FunctionSelector.fromField(Fr.fromString(functionSelector)),
415
459
  Fr.fromString(argsHash),
@@ -419,85 +463,65 @@ export class Oracle {
419
463
  return [[endSideEffectCounter, returnsHash].map(toACVMField)];
420
464
  }
421
465
 
422
- async privateNotifyEnqueuedPublicFunctionCall(
423
- [contractAddress]: ACVMField[],
424
- [calldataHash]: ACVMField[],
425
- [sideEffectCounter]: ACVMField[],
426
- [isStaticCall]: ACVMField[],
427
- ): Promise<ACVMField[]> {
428
- await this.handlerAsPrivate().privateNotifyEnqueuedPublicFunctionCall(
429
- AztecAddress.fromString(contractAddress),
430
- Fr.fromString(calldataHash),
431
- Fr.fromString(sideEffectCounter).toNumber(),
432
- Fr.fromString(isStaticCall).toBool(),
433
- );
434
- return [];
435
- }
436
-
437
- async privateNotifySetPublicTeardownFunctionCall(
438
- [contractAddress]: ACVMField[],
439
- [calldataHash]: ACVMField[],
440
- [sideEffectCounter]: ACVMField[],
441
- [isStaticCall]: ACVMField[],
442
- ): Promise<ACVMField[]> {
443
- await this.handlerAsPrivate().privateNotifySetPublicTeardownFunctionCall(
444
- AztecAddress.fromString(contractAddress),
445
- Fr.fromString(calldataHash),
446
- Fr.fromString(sideEffectCounter).toNumber(),
447
- Fr.fromString(isStaticCall).toBool(),
448
- );
466
+ // eslint-disable-next-line camelcase
467
+ async aztec_prv_validatePublicCalldata([calldataHash]: ACVMField[]): Promise<ACVMField[]> {
468
+ await this.handlerAsPrivate().validatePublicCalldata(Fr.fromString(calldataHash));
449
469
  return [];
450
470
  }
451
471
 
452
- async privateNotifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]: ACVMField[]): Promise<
453
- ACVMField[]
454
- > {
455
- await this.handlerAsPrivate().privateNotifySetMinRevertibleSideEffectCounter(
456
- Fr.fromString(minRevertibleSideEffectCounter).toNumber(),
457
- );
472
+ // eslint-disable-next-line camelcase
473
+ async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
474
+ await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
458
475
  return Promise.resolve([]);
459
476
  }
460
477
 
461
- async privateIsSideEffectCounterRevertible([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
462
- const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(
463
- Fr.fromString(sideEffectCounter).toNumber(),
464
- );
478
+ // eslint-disable-next-line camelcase
479
+ async aztec_prv_inRevertiblePhase([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
480
+ const isRevertible = await this.handlerAsPrivate().inRevertiblePhase(Fr.fromString(sideEffectCounter).toNumber());
465
481
  return Promise.resolve([toACVMField(isRevertible)]);
466
482
  }
467
483
 
468
- async privateGetNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
469
- const tag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(
484
+ // eslint-disable-next-line camelcase
485
+ async aztec_prv_getNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
486
+ const tag = await this.handlerAsPrivate().getNextAppTagAsSender(
470
487
  AztecAddress.fromString(sender),
471
488
  AztecAddress.fromString(recipient),
472
489
  );
473
490
  return [toACVMField(tag.value)];
474
491
  }
475
492
 
476
- async utilityFetchTaggedLogs([pendingTaggedLogArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
477
- await this.handlerAsUtility().utilityFetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
493
+ // eslint-disable-next-line camelcase
494
+ async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
495
+ await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
478
496
  return [];
479
497
  }
480
498
 
481
- async utilityValidateEnqueuedNotesAndEvents(
499
+ // eslint-disable-next-line camelcase
500
+ async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
482
501
  [contractAddress]: ACVMField[],
483
502
  [noteValidationRequestsArrayBaseSlot]: ACVMField[],
484
503
  [eventValidationRequestsArrayBaseSlot]: ACVMField[],
504
+ [maxNotePackedLen]: ACVMField[],
505
+ [maxEventSerializedLen]: ACVMField[],
485
506
  ): Promise<ACVMField[]> {
486
- await this.handlerAsUtility().utilityValidateEnqueuedNotesAndEvents(
507
+ await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
487
508
  AztecAddress.fromString(contractAddress),
488
509
  Fr.fromString(noteValidationRequestsArrayBaseSlot),
489
510
  Fr.fromString(eventValidationRequestsArrayBaseSlot),
511
+ Fr.fromString(maxNotePackedLen).toNumber(),
512
+ Fr.fromString(maxEventSerializedLen).toNumber(),
490
513
  );
491
514
 
492
515
  return [];
493
516
  }
494
517
 
495
- async utilityBulkRetrieveLogs(
518
+ // eslint-disable-next-line camelcase
519
+ async aztec_utl_bulkRetrieveLogs(
496
520
  [contractAddress]: ACVMField[],
497
521
  [logRetrievalRequestsArrayBaseSlot]: ACVMField[],
498
522
  [logRetrievalResponsesArrayBaseSlot]: ACVMField[],
499
523
  ): Promise<ACVMField[]> {
500
- await this.handlerAsUtility().utilityBulkRetrieveLogs(
524
+ await this.handlerAsUtility().bulkRetrieveLogs(
501
525
  AztecAddress.fromString(contractAddress),
502
526
  Fr.fromString(logRetrievalRequestsArrayBaseSlot),
503
527
  Fr.fromString(logRetrievalResponsesArrayBaseSlot),
@@ -505,12 +529,27 @@ export class Oracle {
505
529
  return [];
506
530
  }
507
531
 
508
- async utilityStoreCapsule(
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
+
546
+ // eslint-disable-next-line camelcase
547
+ async aztec_utl_storeCapsule(
509
548
  [contractAddress]: ACVMField[],
510
549
  [slot]: ACVMField[],
511
550
  capsule: ACVMField[],
512
551
  ): Promise<ACVMField[]> {
513
- await this.handlerAsUtility().utilityStoreCapsule(
552
+ await this.handlerAsUtility().storeCapsule(
514
553
  AztecAddress.fromField(Fr.fromString(contractAddress)),
515
554
  Fr.fromString(slot),
516
555
  capsule.map(Fr.fromString),
@@ -518,12 +557,13 @@ export class Oracle {
518
557
  return [];
519
558
  }
520
559
 
521
- async utilityLoadCapsule(
560
+ // eslint-disable-next-line camelcase
561
+ async aztec_utl_loadCapsule(
522
562
  [contractAddress]: ACVMField[],
523
563
  [slot]: ACVMField[],
524
564
  [tSize]: ACVMField[],
525
565
  ): Promise<(ACVMField | ACVMField[])[]> {
526
- const values = await this.handlerAsUtility().utilityLoadCapsule(
566
+ const values = await this.handlerAsUtility().loadCapsule(
527
567
  AztecAddress.fromField(Fr.fromString(contractAddress)),
528
568
  Fr.fromString(slot),
529
569
  );
@@ -539,21 +579,23 @@ export class Oracle {
539
579
  }
540
580
  }
541
581
 
542
- async utilityDeleteCapsule([contractAddress]: ACVMField[], [slot]: ACVMField[]): Promise<ACVMField[]> {
543
- await this.handlerAsUtility().utilityDeleteCapsule(
582
+ // eslint-disable-next-line camelcase
583
+ async aztec_utl_deleteCapsule([contractAddress]: ACVMField[], [slot]: ACVMField[]): Promise<ACVMField[]> {
584
+ await this.handlerAsUtility().deleteCapsule(
544
585
  AztecAddress.fromField(Fr.fromString(contractAddress)),
545
586
  Fr.fromString(slot),
546
587
  );
547
588
  return [];
548
589
  }
549
590
 
550
- async utilityCopyCapsule(
591
+ // eslint-disable-next-line camelcase
592
+ async aztec_utl_copyCapsule(
551
593
  [contractAddress]: ACVMField[],
552
594
  [srcSlot]: ACVMField[],
553
595
  [dstSlot]: ACVMField[],
554
596
  [numEntries]: ACVMField[],
555
597
  ): Promise<ACVMField[]> {
556
- await this.handlerAsUtility().utilityCopyCapsule(
598
+ await this.handlerAsUtility().copyCapsule(
557
599
  AztecAddress.fromField(Fr.fromString(contractAddress)),
558
600
  Fr.fromString(srcSlot),
559
601
  Fr.fromString(dstSlot),
@@ -562,7 +604,8 @@ export class Oracle {
562
604
  return [];
563
605
  }
564
606
 
565
- async utilityAes128Decrypt(
607
+ // eslint-disable-next-line camelcase
608
+ async aztec_utl_tryAes128Decrypt(
566
609
  ciphertextBVecStorage: ACVMField[],
567
610
  [ciphertextLength]: ACVMField[],
568
611
  iv: ACVMField[],
@@ -572,36 +615,61 @@ export class Oracle {
572
615
  const ivBuffer = fromUintArray(iv, 8);
573
616
  const symKeyBuffer = fromUintArray(symKey, 8);
574
617
 
575
- const plaintext = await this.handlerAsUtility().utilityAes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
576
- 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
+ }
577
627
  }
578
628
 
579
- async utilityGetSharedSecret(
629
+ // eslint-disable-next-line camelcase
630
+ async aztec_utl_getSharedSecret(
580
631
  [address]: ACVMField[],
581
632
  [ephPKField0]: ACVMField[],
582
633
  [ephPKField1]: ACVMField[],
583
634
  [ephPKField2]: ACVMField[],
584
635
  ): Promise<ACVMField[]> {
585
- const secret = await this.handlerAsUtility().utilityGetSharedSecret(
636
+ const secret = await this.handlerAsUtility().getSharedSecret(
586
637
  AztecAddress.fromField(Fr.fromString(address)),
587
638
  Point.fromFields([ephPKField0, ephPKField1, ephPKField2].map(Fr.fromString)),
588
639
  );
589
640
  return secret.toFields().map(toACVMField);
590
641
  }
591
642
 
592
- async utilityEmitOffchainEffect(data: ACVMField[]) {
593
- await this.handlerAsPrivate().utilityEmitOffchainEffect(data.map(Fr.fromString));
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
+
657
+ // eslint-disable-next-line camelcase
658
+ async aztec_utl_emitOffchainEffect(data: ACVMField[]) {
659
+ await this.handlerAsUtility().emitOffchainEffect(data.map(Fr.fromString));
594
660
  return [];
595
661
  }
596
662
 
597
- async privateGetSenderForTags(): Promise<ACVMField[]> {
598
- const sender = await this.handlerAsPrivate().privateGetSenderForTags();
663
+ // eslint-disable-next-line camelcase
664
+ async aztec_prv_getSenderForTags(): Promise<ACVMField[]> {
665
+ const sender = await this.handlerAsPrivate().getSenderForTags();
599
666
  // Return [1, address] for Some(address), [0, 0] for None
600
667
  return sender ? [toACVMField(1n), toACVMField(sender)] : [toACVMField(0n), toACVMField(0n)];
601
668
  }
602
669
 
603
- async privateSetSenderForTags([senderForTags]: ACVMField[]): Promise<ACVMField[]> {
604
- await this.handlerAsPrivate().privateSetSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
670
+ // eslint-disable-next-line camelcase
671
+ async aztec_prv_setSenderForTags([senderForTags]: ACVMField[]): Promise<ACVMField[]> {
672
+ await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
605
673
  return [];
606
674
  }
607
675
  }