@aztec/pxe 0.0.1-commit.fcb71a6 → 0.0.1-commit.ff7989d6c

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 (266) 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 +13 -5
  6. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  7. package/dest/block_synchronizer/block_synchronizer.js +74 -20
  8. package/dest/config/index.d.ts +3 -1
  9. package/dest/config/index.d.ts.map +1 -1
  10. package/dest/config/index.js +17 -0
  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 +57 -34
  16. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/contract_function_simulator.js +197 -82
  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/index.d.ts +2 -2
  22. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/index.js +1 -1
  24. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
  25. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -4
  27. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -3
  28. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
  30. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  31. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  33. package/dest/contract_function_simulator/oracle/interfaces.d.ts +17 -13
  34. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  36. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
  38. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
  40. package/dest/contract_function_simulator/oracle/oracle.d.ts +12 -10
  41. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/oracle/oracle.js +67 -44
  43. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
  44. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  45. package/dest/contract_function_simulator/oracle/private_execution.js +1 -37
  46. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +44 -50
  47. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  48. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +83 -54
  49. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +67 -33
  50. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  51. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +131 -110
  52. package/dest/contract_logging.d.ts +22 -0
  53. package/dest/contract_logging.d.ts.map +1 -0
  54. package/dest/contract_logging.js +23 -0
  55. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  56. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  57. package/dest/contract_sync/contract_sync_service.js +97 -0
  58. package/dest/contract_sync/helpers.d.ts +29 -0
  59. package/dest/contract_sync/helpers.d.ts.map +1 -0
  60. package/dest/contract_sync/helpers.js +55 -0
  61. package/dest/debug/pxe_debug_utils.d.ts +24 -10
  62. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  63. package/dest/debug/pxe_debug_utils.js +28 -17
  64. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  65. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  66. package/dest/entrypoints/client/bundle/index.js +3 -0
  67. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  68. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  69. package/dest/entrypoints/client/bundle/utils.js +31 -8
  70. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  71. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  72. package/dest/entrypoints/client/lazy/index.js +3 -0
  73. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  74. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  75. package/dest/entrypoints/client/lazy/utils.js +32 -9
  76. package/dest/entrypoints/pxe_creation_options.d.ts +5 -3
  77. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  78. package/dest/entrypoints/server/index.d.ts +5 -1
  79. package/dest/entrypoints/server/index.d.ts.map +1 -1
  80. package/dest/entrypoints/server/index.js +4 -0
  81. package/dest/entrypoints/server/utils.d.ts +1 -1
  82. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  83. package/dest/entrypoints/server/utils.js +39 -16
  84. package/dest/events/event_service.d.ts +6 -6
  85. package/dest/events/event_service.d.ts.map +1 -1
  86. package/dest/events/event_service.js +19 -22
  87. package/dest/events/private_event_filter_validator.d.ts +5 -5
  88. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  89. package/dest/events/private_event_filter_validator.js +5 -6
  90. package/dest/job_coordinator/job_coordinator.d.ts +75 -0
  91. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  92. package/dest/job_coordinator/job_coordinator.js +94 -0
  93. package/dest/logs/log_service.d.ts +8 -5
  94. package/dest/logs/log_service.d.ts.map +1 -1
  95. package/dest/logs/log_service.js +28 -30
  96. package/dest/notes/note_service.d.ts +10 -9
  97. package/dest/notes/note_service.d.ts.map +1 -1
  98. package/dest/notes/note_service.js +34 -38
  99. package/dest/notes_filter.d.ts +25 -0
  100. package/dest/notes_filter.d.ts.map +1 -0
  101. package/dest/notes_filter.js +4 -0
  102. package/dest/oracle_version.d.ts +3 -3
  103. package/dest/oracle_version.d.ts.map +1 -1
  104. package/dest/oracle_version.js +4 -3
  105. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  106. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  107. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  108. package/dest/private_kernel/hints/index.d.ts +3 -3
  109. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  110. package/dest/private_kernel/hints/index.js +2 -2
  111. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  112. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  113. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +16 -10
  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 +12 -13
  117. package/dest/private_kernel/private_kernel_oracle.d.ts +24 -24
  118. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  119. package/dest/private_kernel/private_kernel_oracle.js +94 -2
  120. package/dest/pxe.d.ts +76 -58
  121. package/dest/pxe.d.ts.map +1 -1
  122. package/dest/pxe.js +149 -138
  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.d.ts +24 -9
  130. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  131. package/dest/storage/capsule_store/capsule_store.js +130 -23
  132. package/dest/storage/contract_store/contract_store.d.ts +42 -16
  133. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  134. package/dest/storage/contract_store/contract_store.js +157 -84
  135. package/dest/storage/metadata.d.ts +1 -1
  136. package/dest/storage/metadata.js +1 -1
  137. package/dest/storage/note_store/note_store.d.ts +50 -51
  138. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  139. package/dest/storage/note_store/note_store.js +284 -263
  140. package/dest/storage/note_store/stored_note.d.ts +16 -0
  141. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  142. package/dest/storage/note_store/stored_note.js +43 -0
  143. package/dest/storage/private_event_store/private_event_store.d.ts +47 -7
  144. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  145. package/dest/storage/private_event_store/private_event_store.js +231 -73
  146. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  147. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  148. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  149. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +15 -8
  150. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  151. package/dest/storage/tagging_store/recipient_tagging_store.js +88 -19
  152. package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
  153. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
  154. package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
  155. package/dest/storage/tagging_store/sender_tagging_store.d.ts +19 -9
  156. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  157. package/dest/storage/tagging_store/sender_tagging_store.js +253 -101
  158. package/dest/tagging/constants.d.ts +2 -0
  159. package/dest/tagging/constants.d.ts.map +1 -0
  160. package/dest/tagging/constants.js +10 -0
  161. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  162. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  163. package/dest/tagging/get_all_logs_by_tags.js +60 -0
  164. package/dest/tagging/index.d.ts +3 -2
  165. package/dest/tagging/index.d.ts.map +1 -1
  166. package/dest/tagging/index.js +2 -10
  167. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -2
  168. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  169. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +12 -12
  170. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  171. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
  172. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  173. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +5 -2
  174. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +3 -2
  175. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  176. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +8 -8
  177. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
  178. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  179. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +5 -8
  180. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -2
  181. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  182. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +10 -5
  183. package/package.json +27 -18
  184. package/src/access_scopes.ts +9 -0
  185. package/src/bin/check_oracle_version.ts +1 -0
  186. package/src/block_synchronizer/block_synchronizer.ts +93 -32
  187. package/src/config/index.ts +14 -0
  188. package/src/config/package_info.ts +1 -1
  189. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  190. package/src/contract_function_simulator/contract_function_simulator.ts +350 -143
  191. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  192. package/src/contract_function_simulator/index.ts +1 -1
  193. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +6 -2
  194. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
  195. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  196. package/src/contract_function_simulator/oracle/interfaces.ts +22 -12
  197. package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
  198. package/src/contract_function_simulator/oracle/oracle.ts +79 -47
  199. package/src/contract_function_simulator/oracle/private_execution.ts +1 -69
  200. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +119 -137
  201. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +198 -115
  202. package/src/contract_logging.ts +39 -0
  203. package/src/contract_sync/contract_sync_service.ts +152 -0
  204. package/src/contract_sync/helpers.ts +98 -0
  205. package/src/debug/pxe_debug_utils.ts +63 -18
  206. package/src/entrypoints/client/bundle/index.ts +3 -0
  207. package/src/entrypoints/client/bundle/utils.ts +23 -16
  208. package/src/entrypoints/client/lazy/index.ts +3 -0
  209. package/src/entrypoints/client/lazy/utils.ts +24 -17
  210. package/src/entrypoints/pxe_creation_options.ts +4 -2
  211. package/src/entrypoints/server/index.ts +4 -0
  212. package/src/entrypoints/server/utils.ts +33 -41
  213. package/src/events/event_service.ts +19 -25
  214. package/src/events/private_event_filter_validator.ts +3 -5
  215. package/src/job_coordinator/job_coordinator.ts +150 -0
  216. package/src/logs/log_service.ts +40 -34
  217. package/src/notes/note_service.ts +41 -45
  218. package/src/notes_filter.ts +26 -0
  219. package/src/oracle_version.ts +4 -3
  220. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  221. package/src/private_kernel/hints/index.ts +2 -2
  222. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +39 -28
  223. package/src/private_kernel/private_kernel_execution_prover.ts +15 -14
  224. package/src/private_kernel/private_kernel_oracle.ts +116 -36
  225. package/src/pxe.ts +280 -209
  226. package/src/storage/address_store/address_store.ts +15 -15
  227. package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
  228. package/src/storage/capsule_store/capsule_store.ts +159 -23
  229. package/src/storage/contract_store/contract_store.ts +186 -96
  230. package/src/storage/metadata.ts +1 -1
  231. package/src/storage/note_store/note_store.ts +326 -320
  232. package/src/storage/note_store/stored_note.ts +48 -0
  233. package/src/storage/private_event_store/private_event_store.ts +301 -79
  234. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  235. package/src/storage/tagging_store/recipient_tagging_store.ts +106 -20
  236. package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
  237. package/src/storage/tagging_store/sender_tagging_store.ts +294 -109
  238. package/src/tagging/constants.ts +10 -0
  239. package/src/tagging/get_all_logs_by_tags.ts +92 -0
  240. package/src/tagging/index.ts +2 -11
  241. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +25 -11
  242. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  243. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
  244. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +10 -7
  245. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +5 -13
  246. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +16 -4
  247. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  248. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  249. package/dest/contract_function_simulator/proxied_node.js +0 -27
  250. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  251. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  252. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  253. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
  254. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  255. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  256. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  257. package/dest/public_storage/public_storage_service.d.ts +0 -24
  258. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  259. package/dest/public_storage/public_storage_service.js +0 -26
  260. package/dest/tree_membership/tree_membership_service.d.ts +0 -52
  261. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  262. package/dest/tree_membership/tree_membership_service.js +0 -84
  263. package/src/contract_function_simulator/proxied_node.ts +0 -33
  264. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
  265. package/src/public_storage/public_storage_service.ts +0 -33
  266. package/src/tree_membership/tree_membership_service.ts +0 -112
@@ -1 +1 @@
1
- {"version":3,"file":"anchor_block_store.d.ts","sourceRoot":"","sources":["../../../src/storage/anchor_block_store/anchor_block_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAgB;;IAI3B,YAAY,KAAK,EAAE,iBAAiB,EAGnC;IAEK,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;IAEK,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAO3C;CACF"}
1
+ {"version":3,"file":"anchor_block_store.d.ts","sourceRoot":"","sources":["../../../src/storage/anchor_block_store/anchor_block_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAgB;;IAI3B,YAAY,KAAK,EAAE,iBAAiB,EAGnC;IAED;;;;;;;OAOG;IACG,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;IAEK,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAO3C;CACF"}
@@ -6,7 +6,14 @@ export class AnchorBlockStore {
6
6
  this.#store = store;
7
7
  this.#synchronizedHeader = this.#store.openSingleton('header');
8
8
  }
9
- async setHeader(header) {
9
+ /**
10
+ * Sets the currently synchronized block
11
+ *
12
+ * Important: this method is only called from BlockSynchronizer, and since we need it to run atomically with other
13
+ * stores in the case of a reorg, it MUST NOT be wrapped in a `transactionAsync` call. Doing so would result in a
14
+ * deadlock when the backend is IndexedDB, because `transactionAsync` is not designed to support reentrancy.
15
+ *
16
+ */ async setHeader(header) {
10
17
  await this.#synchronizedHeader.set(header.toBuffer());
11
18
  }
12
19
  async getBlockHeader() {
@@ -2,34 +2,49 @@ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { type Logger } from '@aztec/foundation/log';
3
3
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
4
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- export declare class CapsuleStore {
5
+ import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
6
+ export declare class CapsuleStore implements StagedStore {
6
7
  #private;
8
+ readonly storeName = "capsule";
7
9
  logger: Logger;
8
10
  constructor(store: AztecAsyncKVStore);
11
+ /**
12
+ * Commits staged data to main storage.
13
+ * Called by JobCoordinator when a job completes successfully.
14
+ * Note: JobCoordinator wraps all commits in a single transaction, so we don't
15
+ * need our own transactionAsync here (and using one would deadlock on IndexedDB).
16
+ * @param jobId - The jobId identifying which staged data to commit
17
+ */
18
+ commit(jobId: string): Promise<void>;
19
+ /**
20
+ * Discards staged data without committing.
21
+ */
22
+ discardStaged(jobId: string): Promise<void>;
9
23
  /**
10
24
  * Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
11
25
  * * If data was already stored at this slot, it is overwritten.
12
26
  * @param contractAddress - The contract address to scope the data under.
13
27
  * @param slot - The slot in the database in which to store the value. Slots need not be contiguous.
14
28
  * @param capsule - An array of field elements representing the capsule.
29
+ * @param jobId - The context in which this store will be visible until PXE decides to persist it to underlying KV store
15
30
  * @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
16
31
  * to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
17
32
  * network state it's backed by local PXE db.
18
33
  */
19
- storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
34
+ storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], jobId: string): void;
20
35
  /**
21
36
  * Returns data previously stored via `storeCapsule` in the per-contract non-volatile database.
22
37
  * @param contractAddress - The contract address under which the data is scoped.
23
38
  * @param slot - The slot in the database to read.
24
39
  * @returns The stored data or `null` if no data is stored under the slot.
25
40
  */
26
- loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
41
+ loadCapsule(contractAddress: AztecAddress, slot: Fr, jobId: string): Promise<Fr[] | null>;
27
42
  /**
28
43
  * Deletes data in the per-contract non-volatile database. Does nothing if no data was present.
29
44
  * @param contractAddress - The contract address under which the data is scoped.
30
45
  * @param slot - The slot in the database to delete.
31
46
  */
32
- deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void>;
47
+ deleteCapsule(contractAddress: AztecAddress, slot: Fr, jobId: string): void;
33
48
  /**
34
49
  * Copies a number of contiguous entries in the per-contract non-volatile database. This allows for efficient data
35
50
  * structures by avoiding repeated calls to `loadCapsule` and `storeCapsule`.
@@ -41,7 +56,7 @@ export declare class CapsuleStore {
41
56
  * @param dstSlot - The first slot to copy to.
42
57
  * @param numEntries - The number of entries to copy.
43
58
  */
44
- copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
59
+ copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number, jobId: string): Promise<void>;
45
60
  /**
46
61
  * Appends multiple capsules to a capsule array stored at the base slot.
47
62
  * The array length is stored at the base slot, and elements are stored in consecutive slots after it.
@@ -50,8 +65,8 @@ export declare class CapsuleStore {
50
65
  * @param baseSlot - The slot where the array length is stored
51
66
  * @param content - Array of capsule data to append
52
67
  */
53
- appendToCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void>;
54
- readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr): Promise<Fr[][]>;
55
- setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void>;
68
+ appendToCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][], jobId: string): Promise<void>;
69
+ readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, jobId: string): Promise<Fr[][]>;
70
+ setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][], jobId: string): Promise<void>;
56
71
  }
57
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Fwc3VsZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvY2Fwc3VsZV9zdG9yZS9jYXBzdWxlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxLQUFLLE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AAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAW9F;IAED;;;;OAIG;IACH,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,QAGnE;IAED;;;;;;;;;;OAUG;IACH,WAAW,CACT,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,EAAE,EACX,OAAO,EAAE,EAAE,EACX,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CA2Bf;IAED;;;;;;;OAOG;IACH,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB/G;IAED,gBAAgB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CA2B5F;IAED,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,iBA2B1F;CACF"}
@@ -1,34 +1,118 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
3
  export class CapsuleStore {
4
+ storeName = 'capsule';
4
5
  #store;
5
6
  // Arbitrary data stored by contracts. Key is computed as `${contractAddress}:${key}`
6
7
  #capsules;
8
+ // jobId => `${contractAddress}:${key}` => capsule data
9
+ // when `#stagedCapsules.get('some-job-id').get('${some-contract-address:some-key') === null`,
10
+ // it signals that the capsule was deleted during the job, so it needs to be deleted on commit
11
+ #stagedCapsules;
7
12
  logger;
8
13
  constructor(store){
9
14
  this.#store = store;
10
15
  this.#capsules = this.#store.openMap('capsules');
16
+ this.#stagedCapsules = new Map();
11
17
  this.logger = createLogger('pxe:capsule-data-provider');
12
18
  }
13
19
  /**
20
+ * Given a job denoted by `jobId`, it returns the
21
+ * capsules that said job has interacted with.
22
+ *
23
+ * Capsules that haven't been committed to persistence KV storage
24
+ * are kept in-memory in `#stagedCapsules`, this method provides a convenient
25
+ * way to access that in-memory collection of data.
26
+ *
27
+ * @param jobId
28
+ * @returns
29
+ */ #getJobStagedCapsules(jobId) {
30
+ let jobStagedCapsules = this.#stagedCapsules.get(jobId);
31
+ if (!jobStagedCapsules) {
32
+ jobStagedCapsules = new Map();
33
+ this.#stagedCapsules.set(jobId, jobStagedCapsules);
34
+ }
35
+ return jobStagedCapsules;
36
+ }
37
+ /**
38
+ * Reads a capsule's slot from the staged version of the data associated to the given jobId.
39
+ *
40
+ * If it is not there, it reads it from the KV store.
41
+ */ async #getFromStage(jobId, dbSlotKey) {
42
+ const jobStagedCapsules = this.#getJobStagedCapsules(jobId);
43
+ const staged = jobStagedCapsules.get(dbSlotKey);
44
+ // Always issue DB read to keep IndexedDB transaction alive, even if the value is in the job staged data. This
45
+ // keeps IndexedDB transactions alive (they auto-commit when a new micro-task starts and there are no pending read
46
+ // requests). The staged value still takes precedence if it exists (including null for deletions).
47
+ const dbValue = await this.#loadCapsuleFromDb(dbSlotKey);
48
+ return staged !== undefined ? staged : dbValue;
49
+ }
50
+ /**
51
+ * Writes a capsule to the stage of a job.
52
+ */ #setOnStage(jobId, dbSlotKey, capsuleData) {
53
+ this.#getJobStagedCapsules(jobId).set(dbSlotKey, capsuleData);
54
+ }
55
+ /**
56
+ * Deletes a capsule on the stage of a job. Note the capsule will still
57
+ * exist in storage until the job is committed.
58
+ */ #deleteOnStage(jobId, dbSlotKey) {
59
+ this.#getJobStagedCapsules(jobId).set(dbSlotKey, null);
60
+ }
61
+ async #loadCapsuleFromDb(dbSlotKey) {
62
+ const dataBuffer = await this.#capsules.getAsync(dbSlotKey);
63
+ if (!dataBuffer) {
64
+ return null;
65
+ }
66
+ return dataBuffer;
67
+ }
68
+ /**
69
+ * Commits staged data to main storage.
70
+ * Called by JobCoordinator when a job completes successfully.
71
+ * Note: JobCoordinator wraps all commits in a single transaction, so we don't
72
+ * need our own transactionAsync here (and using one would deadlock on IndexedDB).
73
+ * @param jobId - The jobId identifying which staged data to commit
74
+ */ async commit(jobId) {
75
+ const jobStagedCapsules = this.#getJobStagedCapsules(jobId);
76
+ for (const [key, value] of jobStagedCapsules){
77
+ // In the write stage, we represent deleted capsules with null
78
+ // (as opposed to undefined, which denotes there was never a capsule there to begin with).
79
+ // So we delete from actual KV store here.
80
+ if (value === null) {
81
+ await this.#capsules.delete(key);
82
+ } else {
83
+ await this.#capsules.set(key, value);
84
+ }
85
+ }
86
+ this.#stagedCapsules.delete(jobId);
87
+ }
88
+ /**
89
+ * Discards staged data without committing.
90
+ */ discardStaged(jobId) {
91
+ this.#stagedCapsules.delete(jobId);
92
+ return Promise.resolve();
93
+ }
94
+ /**
14
95
  * Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
15
96
  * * If data was already stored at this slot, it is overwritten.
16
97
  * @param contractAddress - The contract address to scope the data under.
17
98
  * @param slot - The slot in the database in which to store the value. Slots need not be contiguous.
18
99
  * @param capsule - An array of field elements representing the capsule.
100
+ * @param jobId - The context in which this store will be visible until PXE decides to persist it to underlying KV store
19
101
  * @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
20
102
  * to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
21
103
  * network state it's backed by local PXE db.
22
- */ async storeCapsule(contractAddress, slot, capsule) {
23
- await this.#capsules.set(dbSlotToKey(contractAddress, slot), Buffer.concat(capsule.map((value)=>value.toBuffer())));
104
+ */ storeCapsule(contractAddress, slot, capsule, jobId) {
105
+ const dbSlotKey = dbSlotToKey(contractAddress, slot);
106
+ // A store overrides any pre-existing data on the slot
107
+ this.#setOnStage(jobId, dbSlotKey, Buffer.concat(capsule.map((value)=>value.toBuffer())));
24
108
  }
25
109
  /**
26
110
  * Returns data previously stored via `storeCapsule` in the per-contract non-volatile database.
27
111
  * @param contractAddress - The contract address under which the data is scoped.
28
112
  * @param slot - The slot in the database to read.
29
113
  * @returns The stored data or `null` if no data is stored under the slot.
30
- */ async loadCapsule(contractAddress, slot) {
31
- const dataBuffer = await this.#capsules.getAsync(dbSlotToKey(contractAddress, slot));
114
+ */ async loadCapsule(contractAddress, slot, jobId) {
115
+ const dataBuffer = await this.#getFromStage(jobId, dbSlotToKey(contractAddress, slot));
32
116
  if (!dataBuffer) {
33
117
  this.logger.trace(`Data not found for contract ${contractAddress.toString()} and slot ${slot.toString()}`);
34
118
  return null;
@@ -43,8 +127,9 @@ export class CapsuleStore {
43
127
  * Deletes data in the per-contract non-volatile database. Does nothing if no data was present.
44
128
  * @param contractAddress - The contract address under which the data is scoped.
45
129
  * @param slot - The slot in the database to delete.
46
- */ async deleteCapsule(contractAddress, slot) {
47
- await this.#capsules.delete(dbSlotToKey(contractAddress, slot));
130
+ */ deleteCapsule(contractAddress, slot, jobId) {
131
+ // When we commit this, we will interpret null as a deletion, so we'll propagate the delete to the KV store
132
+ this.#deleteOnStage(jobId, dbSlotToKey(contractAddress, slot));
48
133
  }
49
134
  /**
50
135
  * Copies a number of contiguous entries in the per-contract non-volatile database. This allows for efficient data
@@ -56,7 +141,11 @@ export class CapsuleStore {
56
141
  * @param srcSlot - The first slot to copy from.
57
142
  * @param dstSlot - The first slot to copy to.
58
143
  * @param numEntries - The number of entries to copy.
59
- */ copyCapsule(contractAddress, srcSlot, dstSlot, numEntries) {
144
+ */ copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, jobId) {
145
+ // This transactional context gives us "copy atomicity":
146
+ // there shouldn't be concurrent writes to what's being copied here.
147
+ // Equally important: this in practice is expected to perform thousands of DB operations
148
+ // and not using a transaction here would heavily impact performance.
60
149
  return this.#store.transactionAsync(async ()=>{
61
150
  // In order to support overlapping source and destination regions, we need to check the relative positions of source
62
151
  // and destination. If destination is ahead of source, then by the time we overwrite source elements using forward
@@ -69,11 +158,11 @@ export class CapsuleStore {
69
158
  for (const i of indexes){
70
159
  const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
71
160
  const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
72
- const toCopy = await this.#capsules.getAsync(currentSrcSlot);
161
+ const toCopy = await this.#getFromStage(jobId, currentSrcSlot);
73
162
  if (!toCopy) {
74
163
  throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
75
164
  }
76
- await this.#capsules.set(currentDstSlot, toCopy);
165
+ this.#setOnStage(jobId, currentDstSlot, toCopy);
77
166
  }
78
167
  });
79
168
  }
@@ -84,32 +173,42 @@ export class CapsuleStore {
84
173
  * @param contractAddress - The contract address that owns the capsule array
85
174
  * @param baseSlot - The slot where the array length is stored
86
175
  * @param content - Array of capsule data to append
87
- */ appendToCapsuleArray(contractAddress, baseSlot, content) {
176
+ */ appendToCapsuleArray(contractAddress, baseSlot, content, jobId) {
177
+ // We wrap this in a transaction to serialize concurrent calls from Promise.all.
178
+ // Without this, concurrent appends to the same array could race: both read length=0,
179
+ // both write at the same slots, one overwrites the other.
180
+ // Equally important: this in practice is expected to perform thousands of DB operations
181
+ // and not using a transaction here would heavily impact performance.
88
182
  return this.#store.transactionAsync(async ()=>{
89
183
  // Load current length, defaulting to 0 if not found
90
- const lengthData = await this.loadCapsule(contractAddress, baseSlot);
184
+ const lengthData = await this.loadCapsule(contractAddress, baseSlot, jobId);
91
185
  const currentLength = lengthData ? lengthData[0].toNumber() : 0;
92
186
  // Store each capsule at consecutive slots after baseSlot + 1 + currentLength
93
187
  for(let i = 0; i < content.length; i++){
94
188
  const nextSlot = arraySlot(baseSlot, currentLength + i);
95
- await this.storeCapsule(contractAddress, nextSlot, content[i]);
189
+ this.storeCapsule(contractAddress, nextSlot, content[i], jobId);
96
190
  }
97
191
  // Update length to include all new capsules
98
192
  const newLength = currentLength + content.length;
99
- await this.storeCapsule(contractAddress, baseSlot, [
193
+ this.storeCapsule(contractAddress, baseSlot, [
100
194
  new Fr(newLength)
101
- ]);
195
+ ], jobId);
102
196
  });
103
197
  }
104
- readCapsuleArray(contractAddress, baseSlot) {
198
+ readCapsuleArray(contractAddress, baseSlot, jobId) {
199
+ // I'm leaving this transactional context here though because I'm assuming this
200
+ // gives us "read array atomicity": there shouldn't be concurrent writes to what's being copied
201
+ // here.
202
+ // This is one point we should revisit in the future if we want to relax the concurrency
203
+ // of jobs: different calls running concurrently on the same contract may cause trouble.
105
204
  return this.#store.transactionAsync(async ()=>{
106
205
  // Load length, defaulting to 0 if not found
107
- const maybeLength = await this.loadCapsule(contractAddress, baseSlot);
206
+ const maybeLength = await this.loadCapsule(contractAddress, baseSlot, jobId);
108
207
  const length = maybeLength ? maybeLength[0].toBigInt() : 0n;
109
208
  const values = [];
110
209
  // Read each capsule at consecutive slots after baseSlot
111
210
  for(let i = 0; i < length; i++){
112
- const currentValue = await this.loadCapsule(contractAddress, arraySlot(baseSlot, i));
211
+ const currentValue = await this.loadCapsule(contractAddress, arraySlot(baseSlot, i), jobId);
113
212
  if (currentValue == undefined) {
114
213
  throw new Error(`Expected non-empty value at capsule array in base slot ${baseSlot} at index ${i} for contract ${contractAddress}`);
115
214
  }
@@ -118,22 +217,30 @@ export class CapsuleStore {
118
217
  return values;
119
218
  });
120
219
  }
121
- setCapsuleArray(contractAddress, baseSlot, content) {
220
+ setCapsuleArray(contractAddress, baseSlot, content, jobId) {
221
+ // This transactional context in theory isn't so critical now because we aren't
222
+ // writing to DB so if there's exceptions midway and it blows up, no visible impact
223
+ // to persistent storage will happen.
224
+ // I'm leaving this transactional context here though because I'm assuming this
225
+ // gives us "write array atomicity": there shouldn't be concurrent writes to what's being copied
226
+ // here.
227
+ // This is one point we should revisit in the future if we want to relax the concurrency
228
+ // of jobs: different calls running concurrently on the same contract may cause trouble.
122
229
  return this.#store.transactionAsync(async ()=>{
123
230
  // Load current length, defaulting to 0 if not found
124
- const maybeLength = await this.loadCapsule(contractAddress, baseSlot);
231
+ const maybeLength = await this.loadCapsule(contractAddress, baseSlot, jobId);
125
232
  const originalLength = maybeLength ? maybeLength[0].toNumber() : 0;
126
233
  // Set the new length
127
- await this.storeCapsule(contractAddress, baseSlot, [
234
+ this.storeCapsule(contractAddress, baseSlot, [
128
235
  new Fr(content.length)
129
- ]);
236
+ ], jobId);
130
237
  // Store the new content, possibly overwriting existing values
131
238
  for(let i = 0; i < content.length; i++){
132
- await this.storeCapsule(contractAddress, arraySlot(baseSlot, i), content[i]);
239
+ this.storeCapsule(contractAddress, arraySlot(baseSlot, i), content[i], jobId);
133
240
  }
134
241
  // Clear any stragglers
135
242
  for(let i = content.length; i < originalLength; i++){
136
- await this.deleteCapsule(contractAddress, arraySlot(baseSlot, i));
243
+ this.deleteCapsule(contractAddress, arraySlot(baseSlot, i), jobId);
137
244
  }
138
245
  });
139
246
  }
@@ -1,10 +1,37 @@
1
1
  import type { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { BufferReader } from '@aztec/foundation/serialize';
3
4
  import type { MembershipWitness } from '@aztec/foundation/trees';
4
5
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
5
6
  import { type ContractArtifact, type FunctionAbi, type FunctionArtifactWithContractName, FunctionCall, type FunctionDebugMetadata, FunctionSelector } from '@aztec/stdlib/abi';
6
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
8
+ import { type ContractClassIdPreimage, type ContractClassWithId, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
9
+ /**
10
+ * All contract class data except the large packedBytecode.
11
+ * The expensive data from the ContractClass is precomputed and stored in this format to avoid redundant hashing.
12
+ * Since we have to store the artifacts anyway, the final ContractClass is reconstructed by combining this data
13
+ * with the packedBytecode obtained from the former. That way we can have quick class lookups without wasted storage.
14
+ */
15
+ export declare class SerializableContractClassData {
16
+ readonly version: 1;
17
+ readonly id: Fr;
18
+ readonly artifactHash: Fr;
19
+ readonly privateFunctionsRoot: Fr;
20
+ readonly publicBytecodeCommitment: Fr;
21
+ readonly privateFunctions: {
22
+ selector: FunctionSelector;
23
+ vkHash: Fr;
24
+ }[];
25
+ constructor(data: ContractClassIdPreimage & {
26
+ id: Fr;
27
+ privateFunctions: {
28
+ selector: FunctionSelector;
29
+ vkHash: Fr;
30
+ }[];
31
+ });
32
+ toBuffer(): Buffer;
33
+ static fromBuffer(bufferOrReader: Buffer | BufferReader): SerializableContractClassData;
34
+ }
8
35
  /**
9
36
  * ContractStore serves as a data manager and retriever for Aztec.nr contracts.
10
37
  * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
@@ -15,19 +42,24 @@ import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/std
15
42
  export declare class ContractStore {
16
43
  #private;
17
44
  constructor(store: AztecAsyncKVStore);
18
- addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
45
+ /**
46
+ * Registers a new contract artifact and its corresponding class data.
47
+ * IMPORTANT: This method does not verify that the provided artifact matches the class data or that the class id matches the artifact.
48
+ * It is the caller's responsibility to ensure the consistency and correctness of the provided data.
49
+ * This is done to avoid redundant, expensive contract class computations
50
+ */
51
+ addContractArtifact(contract: ContractArtifact, contractClassWithIdAndPreimage?: ContractClassWithId & ContractClassIdPreimage): Promise<Fr>;
19
52
  addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
20
53
  getContractsAddresses(): Promise<AztecAddress[]>;
21
- /** Returns a contract instance for a given address. Throws if not found. */
54
+ /** Returns a contract instance for a given address. */
22
55
  getContractInstance(contractAddress: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
56
+ /** Returns the raw contract artifact for a given class id. */
23
57
  getContractArtifact(contractClassId: Fr): Promise<ContractArtifact | undefined>;
24
- /** Returns a contract class for a given class id. Throws if not found. */
25
- getContractClass(contractClassId: Fr): Promise<ContractClass | undefined>;
58
+ /** Returns a contract class for a given class id. */
59
+ getContractClassWithPreimage(contractClassId: Fr): Promise<(ContractClassWithId & ContractClassIdPreimage) | undefined>;
26
60
  getContract(address: AztecAddress): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined>;
27
61
  /**
28
62
  * Retrieves the artifact of a specified function within a given contract.
29
- * The function is identified by its selector, which is a unique code generated from the function's signature.
30
- * Throws an error if the contract address or function selector are invalid or not found.
31
63
  *
32
64
  * @param contractAddress - The AztecAddress representing the contract containing the function.
33
65
  * @param selector - The function selector.
@@ -39,20 +71,15 @@ export declare class ContractStore {
39
71
  getFunctionAbi(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionAbi | undefined>;
40
72
  /**
41
73
  * Retrieves the debug metadata of a specified function within a given contract.
42
- * The function is identified by its selector, which is a unique code generated from the function's signature.
43
- * Returns undefined if the debug metadata for the given function is not found.
44
- * Throws if the contract has not been added to the database.
45
74
  *
46
75
  * @param contractAddress - The AztecAddress representing the contract containing the function.
47
76
  * @param selector - The function selector.
48
- * @returns The corresponding function's artifact as an object.
77
+ * @returns The corresponding function's debug metadata, or undefined.
49
78
  */
50
79
  getFunctionDebugMetadata(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionDebugMetadata | undefined>;
51
80
  getPublicFunctionDebugMetadata(contractAddress: AztecAddress): Promise<FunctionDebugMetadata | undefined>;
52
81
  /**
53
82
  * Retrieve the function membership witness for the given contract class and function selector.
54
- * The function membership witness represents a proof that the function belongs to the specified contract.
55
- * Throws an error if the contract address or function selector is unknown.
56
83
  *
57
84
  * @param contractClassId - The id of the class.
58
85
  * @param selector - The function selector.
@@ -62,6 +89,5 @@ export declare class ContractStore {
62
89
  getDebugContractName(contractAddress: AztecAddress): Promise<string | undefined>;
63
90
  getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
64
91
  getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall>;
65
- syncPrivateState(contractAddress: AztecAddress, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall) => Promise<any>): Promise<any>;
66
92
  }
67
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X3N0b3JlL2NvbnRyYWN0X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDN0QsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUV4RSxPQUFPLEVBQ0wsS0FBSyxnQkFBZ0IsRUFDckIsS0FBSyxXQUFXLEVBRWhCLEtBQUssZ0NBQWdDLEVBQ3JDLFlBQVksRUFDWixLQUFLLHFCQUFxQixFQUMxQixnQkFBZ0IsRUFNakIsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDM0QsT0FBTyxFQUNMLEtBQUssYUFBYSxFQUNsQixLQUFLLDJCQUEyQixFQUdqQyxNQUFNLHdCQUF3QixDQUFDO0FBSWhDOzs7Ozs7R0FNRztBQUNILHFCQUFhLGFBQWE7O0lBV3hCLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUduQztJQUlZLG1CQUFtQixDQUFDLEVBQUUsRUFBRSxFQUFFLEVBQUU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