@aztec/pxe 0.0.1-commit.6d3c34e → 0.0.1-commit.7035c9bd6

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