@aztec/pxe 0.0.1-commit.b2a5d0dd1 → 0.0.1-commit.b3d3157a

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 (277) hide show
  1. package/dest/bin/check_oracle_version.js +40 -96
  2. package/dest/bin/index.d.ts +2 -0
  3. package/dest/bin/index.d.ts.map +1 -0
  4. package/dest/bin/index.js +1 -0
  5. package/dest/bin/oracle_version_helpers.d.ts +26 -0
  6. package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
  7. package/dest/bin/oracle_version_helpers.js +93 -0
  8. package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
  9. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
  10. package/dest/block_synchronizer/block_stream_source.js +62 -0
  11. package/dest/block_synchronizer/block_synchronizer.d.ts +1 -1
  12. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  13. package/dest/block_synchronizer/block_synchronizer.js +11 -9
  14. package/dest/config/index.d.ts +7 -1
  15. package/dest/config/index.d.ts.map +1 -1
  16. package/dest/config/index.js +5 -0
  17. package/dest/config/package_info.js +1 -1
  18. package/dest/contract_function_simulator/contract_function_simulator.d.ts +4 -1
  19. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/contract_function_simulator.js +17 -7
  21. package/dest/contract_function_simulator/execution_note_cache.d.ts +2 -2
  22. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -9
  24. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -7
  26. package/dest/contract_function_simulator/index.d.ts +13 -2
  27. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/index.js +10 -0
  29. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
  30. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
  31. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
  32. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
  33. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
  34. package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
  35. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
  36. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +3 -2
  38. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +12 -2
  39. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +34 -3
  41. package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
  42. package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
  43. package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
  44. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -2
  45. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +3 -2
  47. package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
  48. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
  49. package/dest/contract_function_simulator/noir-structs/option.js +62 -0
  50. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +11 -0
  51. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
  52. package/dest/contract_function_simulator/noir-structs/provided_secret.js +24 -0
  53. package/dest/contract_function_simulator/oracle/interfaces.d.ts +16 -114
  54. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  55. package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
  56. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +2 -2
  57. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  58. package/dest/contract_function_simulator/oracle/note_packing_utils.js +2 -2
  59. package/dest/contract_function_simulator/oracle/oracle.d.ts +55 -57
  60. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  61. package/dest/contract_function_simulator/oracle/oracle.js +343 -344
  62. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +127 -0
  63. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
  64. package/dest/contract_function_simulator/oracle/oracle_registry.js +786 -0
  65. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +139 -0
  66. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
  67. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +560 -0
  68. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +26 -29
  69. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  70. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +49 -46
  71. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +59 -39
  72. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  73. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +244 -149
  74. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
  75. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  76. package/dest/contract_function_simulator/proxied_contract_data_source.js +35 -67
  77. package/dest/contract_sync/contract_sync_service.d.ts +4 -6
  78. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  79. package/dest/contract_sync/contract_sync_service.js +43 -24
  80. package/dest/contract_sync/helpers.d.ts +2 -3
  81. package/dest/contract_sync/helpers.d.ts.map +1 -1
  82. package/dest/contract_sync/helpers.js +12 -19
  83. package/dest/debug/pxe_debug_utils.d.ts +1 -6
  84. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  85. package/dest/debug/pxe_debug_utils.js +0 -6
  86. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  87. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  88. package/dest/entrypoints/client/bundle/utils.js +11 -3
  89. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  90. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  91. package/dest/entrypoints/client/lazy/utils.js +11 -3
  92. package/dest/entrypoints/pxe_creation_options.d.ts +7 -1
  93. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  94. package/dest/entrypoints/server/index.d.ts +2 -1
  95. package/dest/entrypoints/server/index.d.ts.map +1 -1
  96. package/dest/entrypoints/server/index.js +1 -0
  97. package/dest/entrypoints/server/utils.d.ts +3 -2
  98. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  99. package/dest/entrypoints/server/utils.js +11 -3
  100. package/dest/events/event_service.d.ts +13 -5
  101. package/dest/events/event_service.d.ts.map +1 -1
  102. package/dest/events/event_service.js +20 -8
  103. package/dest/hooks/authorize_utility_call.d.ts +41 -0
  104. package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
  105. package/dest/hooks/authorize_utility_call.js +4 -0
  106. package/dest/hooks/execution_hooks.d.ts +42 -0
  107. package/dest/hooks/execution_hooks.d.ts.map +1 -0
  108. package/dest/hooks/execution_hooks.js +9 -0
  109. package/dest/hooks/index.d.ts +4 -0
  110. package/dest/hooks/index.d.ts.map +1 -0
  111. package/dest/hooks/index.js +1 -0
  112. package/dest/logs/log_service.d.ts +6 -5
  113. package/dest/logs/log_service.d.ts.map +1 -1
  114. package/dest/logs/log_service.js +112 -48
  115. package/dest/messages/message_context_service.d.ts +1 -1
  116. package/dest/messages/message_context_service.d.ts.map +1 -1
  117. package/dest/messages/message_context_service.js +28 -9
  118. package/dest/notes/note_service.d.ts +25 -3
  119. package/dest/notes/note_service.d.ts.map +1 -1
  120. package/dest/notes/note_service.js +80 -65
  121. package/dest/oracle_version.d.ts +3 -3
  122. package/dest/oracle_version.js +4 -4
  123. package/dest/private_kernel/batch_planner.d.ts +47 -0
  124. package/dest/private_kernel/batch_planner.d.ts.map +1 -0
  125. package/dest/private_kernel/batch_planner.js +104 -0
  126. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +1 -1
  127. package/dest/private_kernel/hints/test_utils.d.ts +1 -1
  128. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -1
  129. package/dest/private_kernel/hints/test_utils.js +2 -3
  130. package/dest/private_kernel/private_kernel_execution_prover.d.ts +6 -2
  131. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  132. package/dest/private_kernel/private_kernel_execution_prover.js +148 -52
  133. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -6
  134. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  135. package/dest/private_kernel/private_kernel_oracle.js +12 -7
  136. package/dest/pxe.d.ts +52 -6
  137. package/dest/pxe.d.ts.map +1 -1
  138. package/dest/pxe.js +115 -77
  139. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
  140. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
  141. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
  142. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
  143. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
  144. package/dest/storage/backwards_compatibility_tests/schema_tests.js +591 -0
  145. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
  146. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
  147. package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
  148. package/dest/storage/contract_store/contract_store.d.ts +1 -1
  149. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  150. package/dest/storage/contract_store/contract_store.js +5 -24
  151. package/dest/storage/metadata.d.ts +1 -1
  152. package/dest/storage/metadata.js +1 -1
  153. package/dest/storage/open_pxe_stores.d.ts +33 -0
  154. package/dest/storage/open_pxe_stores.d.ts.map +1 -0
  155. package/dest/storage/open_pxe_stores.js +27 -0
  156. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  157. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  158. package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
  159. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  160. package/dest/storage/tagging_store/sender_tagging_store.js +3 -3
  161. package/dest/tagging/get_all_logs_by_tags.d.ts +34 -10
  162. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  163. package/dest/tagging/get_all_logs_by_tags.js +36 -37
  164. package/dest/tagging/index.d.ts +5 -4
  165. package/dest/tagging/index.d.ts.map +1 -1
  166. package/dest/tagging/index.js +4 -3
  167. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
  168. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
  169. package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
  170. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
  171. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
  172. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +163 -0
  173. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
  174. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
  175. package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
  176. package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
  177. package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
  178. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -5
  179. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  180. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +26 -14
  181. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -6
  182. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  183. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +21 -0
  184. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
  185. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  186. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +2 -2
  187. package/package.json +20 -17
  188. package/src/bin/check_oracle_version.ts +46 -119
  189. package/src/bin/index.ts +1 -0
  190. package/src/bin/oracle_version_helpers.ts +121 -0
  191. package/src/block_synchronizer/block_stream_source.ts +81 -0
  192. package/src/block_synchronizer/block_synchronizer.ts +11 -9
  193. package/src/config/index.ts +12 -0
  194. package/src/config/package_info.ts +1 -1
  195. package/src/contract_function_simulator/contract_function_simulator.ts +31 -6
  196. package/src/contract_function_simulator/execution_note_cache.ts +1 -1
  197. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -9
  198. package/src/contract_function_simulator/index.ts +50 -1
  199. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
  200. package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
  201. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +3 -2
  202. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +35 -2
  203. package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
  204. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -2
  205. package/src/contract_function_simulator/noir-structs/option.ts +69 -0
  206. package/src/contract_function_simulator/noir-structs/provided_secret.ts +27 -0
  207. package/src/contract_function_simulator/oracle/interfaces.ts +12 -204
  208. package/src/contract_function_simulator/oracle/note_packing_utils.ts +3 -3
  209. package/src/contract_function_simulator/oracle/oracle.ts +406 -556
  210. package/src/contract_function_simulator/oracle/oracle_registry.ts +585 -0
  211. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +553 -0
  212. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +66 -66
  213. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +350 -304
  214. package/src/contract_function_simulator/proxied_contract_data_source.ts +40 -70
  215. package/src/contract_sync/contract_sync_service.ts +56 -43
  216. package/src/contract_sync/helpers.ts +11 -23
  217. package/src/debug/pxe_debug_utils.ts +0 -8
  218. package/src/entrypoints/client/bundle/utils.ts +8 -2
  219. package/src/entrypoints/client/lazy/utils.ts +8 -2
  220. package/src/entrypoints/pxe_creation_options.ts +7 -0
  221. package/src/entrypoints/server/index.ts +1 -0
  222. package/src/entrypoints/server/utils.ts +13 -3
  223. package/src/events/event_service.ts +41 -18
  224. package/src/hooks/authorize_utility_call.ts +44 -0
  225. package/src/hooks/execution_hooks.ts +48 -0
  226. package/src/hooks/index.ts +7 -0
  227. package/src/logs/log_service.ts +137 -92
  228. package/src/messages/message_context_service.ts +42 -24
  229. package/src/notes/note_service.ts +115 -91
  230. package/src/oracle_version.ts +4 -4
  231. package/src/private_kernel/batch_planner.ts +169 -0
  232. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +1 -1
  233. package/src/private_kernel/hints/test_utils.ts +2 -9
  234. package/src/private_kernel/private_kernel_execution_prover.ts +236 -73
  235. package/src/private_kernel/private_kernel_oracle.ts +21 -11
  236. package/src/pxe.ts +172 -79
  237. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
  238. package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
  239. package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
  240. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
  241. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
  242. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +46 -0
  243. package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
  244. package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
  245. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
  246. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
  247. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
  248. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
  249. package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
  250. package/src/storage/backwards_compatibility_tests/schema_tests.ts +712 -0
  251. package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
  252. package/src/storage/contract_store/contract_store.ts +6 -29
  253. package/src/storage/metadata.ts +1 -1
  254. package/src/storage/open_pxe_stores.ts +49 -0
  255. package/src/storage/tagging_store/recipient_tagging_store.ts +5 -9
  256. package/src/storage/tagging_store/sender_tagging_store.ts +6 -6
  257. package/src/tagging/get_all_logs_by_tags.ts +78 -50
  258. package/src/tagging/index.ts +4 -3
  259. package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
  260. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +240 -0
  261. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  262. package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
  263. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +41 -19
  264. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +23 -8
  265. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +4 -5
  266. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +0 -9
  267. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +0 -1
  268. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +0 -47
  269. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
  270. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
  271. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -85
  272. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
  273. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
  274. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
  275. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +0 -104
  276. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -130
  277. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
package/src/pxe.ts CHANGED
@@ -6,7 +6,6 @@ import { SerialQueue } from '@aztec/foundation/queue';
6
6
  import { Timer } from '@aztec/foundation/timer';
7
7
  import { KeyStore } from '@aztec/key-store';
8
8
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
9
- import { L2TipsKVStore } from '@aztec/kv-store/stores';
10
9
  import { type ProtocolContractsProvider, protocolContractNames } from '@aztec/protocol-contracts';
11
10
  import type { CircuitSimulator } from '@aztec/simulator/client';
12
11
  import {
@@ -18,7 +17,7 @@ import {
18
17
  } from '@aztec/stdlib/abi';
19
18
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
20
19
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
21
- import type { L2TipsProvider } from '@aztec/stdlib/block';
20
+ import { GENESIS_BLOCK_HEADER_HASH, type L2TipsProvider } from '@aztec/stdlib/block';
22
21
  import {
23
22
  CompleteAddress,
24
23
  type ContractInstanceWithAddress,
@@ -67,6 +66,7 @@ import { readCurrentClassId } from './contract_sync/helpers.js';
67
66
  import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
68
67
  import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
69
68
  import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
69
+ import type { ExecutionHooks } from './hooks/index.js';
70
70
  import { JobCoordinator } from './job_coordinator/job_coordinator.js';
71
71
  import { MessageContextService } from './messages/message_context_service.js';
72
72
  import {
@@ -79,16 +79,26 @@ import { AnchorBlockStore } from './storage/anchor_block_store/anchor_block_stor
79
79
  import { CapsuleStore } from './storage/capsule_store/capsule_store.js';
80
80
  import { ContractStore } from './storage/contract_store/contract_store.js';
81
81
  import { NoteStore } from './storage/note_store/note_store.js';
82
+ import { openPxeStores } from './storage/open_pxe_stores.js';
82
83
  import { PrivateEventStore } from './storage/private_event_store/private_event_store.js';
83
84
  import { RecipientTaggingStore } from './storage/tagging_store/recipient_tagging_store.js';
84
85
  import { SenderAddressBookStore } from './storage/tagging_store/sender_address_book_store.js';
85
86
  import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store.js';
87
+ import { persistSenderTaggingIndexRangesForTx } from './tagging/index.js';
86
88
 
87
89
  export type PackedPrivateEvent = InTx & {
88
90
  packedEvent: Fr[];
89
91
  eventSelector: EventSelector;
90
92
  };
91
93
 
94
+ /** Options for PXE.proveTx. */
95
+ export type ProveTxOpts = {
96
+ /** Addresses whose private state and keys are accessible during private execution. */
97
+ scopes: AztecAddress[];
98
+ /** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
99
+ senderForTags?: AztecAddress;
100
+ };
101
+
92
102
  /** Options for PXE.profileTx. */
93
103
  export type ProfileTxOpts = {
94
104
  /** The profiling mode to use. */
@@ -97,6 +107,8 @@ export type ProfileTxOpts = {
97
107
  skipProofGeneration?: boolean;
98
108
  /** Addresses whose private state and keys are accessible during private execution. */
99
109
  scopes: AztecAddress[];
110
+ /** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
111
+ senderForTags?: AztecAddress;
100
112
  };
101
113
 
102
114
  /** Options for PXE.simulateTx. */
@@ -109,10 +121,16 @@ export type SimulateTxOpts = {
109
121
  skipFeeEnforcement?: boolean;
110
122
  /** If true, kernel logic is emulated in TS for simulation */
111
123
  skipKernels?: boolean;
112
- /** State overrides for the simulation, such as contract instances and artifacts. Requires skipKernels: true */
124
+ /**
125
+ * Pre-simulation overrides applied to the ephemeral fork and contract DB. Bundles publicStorage
126
+ * writes (no skipKernels required) and per-address (instance, artifact?) overrides used by both
127
+ * AVM-side public dispatch and PXE-side ACIR private dispatch (requires skipKernels: true).
128
+ */
113
129
  overrides?: SimulationOverrides;
114
130
  /** Addresses whose private state and keys are accessible during private execution */
115
131
  scopes: AztecAddress[];
132
+ /** Sender address used to derive discovery tags for private messages (notes, events, logs) this tx emits. */
133
+ senderForTags?: AztecAddress;
116
134
  };
117
135
 
118
136
  /** Options for PXE.executeUtility. */
@@ -123,6 +141,21 @@ export type ExecuteUtilityOpts = {
123
141
  scopes: AztecAddress[];
124
142
  };
125
143
 
144
+ /**
145
+ * Supplies the set of "nice to have" contracts that every PXE preloads regardless of which wallet
146
+ * drives it. Today this is just the standard multi-call entrypoint: the SDK's self-paid account
147
+ * deploy flow ({@link DeployAccountMethod} with `from = NO_FROM`) routes its payload through it, so a
148
+ * PXE that did not register it would fail contract sync with an opaque "no contract instance" error.
149
+ *
150
+ * Returning a list keeps this extensible: a wallet may supply its own provider that preloads
151
+ * additional contracts. Injected the same way as {@link ProtocolContractsProvider} so the PXE never
152
+ * statically imports the bundled artifacts, keeping the bundle/lazy split intact.
153
+ */
154
+ export type PreloadedContractsProvider = {
155
+ /** Returns the contract instances and artifacts the PXE should preload on startup. */
156
+ getPreloadedContracts: () => Promise<Array<{ instance: ContractInstanceWithAddress; artifact: ContractArtifact }>>;
157
+ };
158
+
126
159
  /** Args for PXE.create. */
127
160
  export type PXECreateArgs = {
128
161
  /** The Aztec node to connect to. */
@@ -135,10 +168,14 @@ export type PXECreateArgs = {
135
168
  simulator: CircuitSimulator;
136
169
  /** Provider for protocol contract artifacts and instances. */
137
170
  protocolContractsProvider: ProtocolContractsProvider;
171
+ /** Provider for the "nice to have" contracts the PXE preloads. */
172
+ preloadedContractsProvider: PreloadedContractsProvider;
138
173
  /** PXE configuration options. */
139
174
  config: PXEConfig;
140
175
  /** Optional logger instance or string suffix for the logger name. */
141
176
  loggerOrSuffix?: string | Logger;
177
+ /** Optional hooks to observe and influence contract execution. */
178
+ hooks?: ExecutionHooks;
142
179
  };
143
180
 
144
181
  /**
@@ -165,12 +202,15 @@ export class PXE {
165
202
  private l2TipsStore: L2TipsProvider,
166
203
  private simulator: CircuitSimulator,
167
204
  private proverEnabled: boolean,
205
+ private autoSync: boolean,
168
206
  private proofCreator: PrivateKernelProver,
169
207
  private protocolContractsProvider: ProtocolContractsProvider,
208
+ private preloadedContractsProvider: PreloadedContractsProvider,
170
209
  private log: Logger,
171
210
  private jobQueue: SerialQueue,
172
211
  private jobCoordinator: JobCoordinator,
173
212
  public debug: PXEDebugUtils,
213
+ private hooks: ExecutionHooks | undefined,
174
214
  ) {}
175
215
 
176
216
  /**
@@ -186,8 +226,10 @@ export class PXE {
186
226
  proofCreator,
187
227
  simulator,
188
228
  protocolContractsProvider,
229
+ preloadedContractsProvider,
189
230
  config,
190
231
  loggerOrSuffix,
232
+ hooks,
191
233
  }: PXECreateArgs) {
192
234
  // Extract bindings from the logger, or use empty bindings if a string suffix is provided.
193
235
  const bindings: LoggerBindings | undefined =
@@ -200,18 +242,28 @@ export class PXE {
200
242
 
201
243
  const info = await node.getNodeInfo();
202
244
 
245
+ // Source the genesis block hash from the node so PXE's L2BlockStream agrees with the node's
246
+ // archiver on the dynamic initial header hash. Without this the tip store would fall back to
247
+ // the static `GENESIS_BLOCK_HEADER_HASH` constant, which only matches deployments with the
248
+ // default empty genesis (timestamp 0, no prefilled public data) and diverges otherwise — the
249
+ // sync at block 0 would then get stuck in `areBlockHashesEqualAt` and abort. If the node does
250
+ // not return a genesis block (older node or test fixture) we fall back to the static constant.
251
+ const initialBlockHash = (await node.getBlock(BlockNumber.ZERO))?.hash ?? GENESIS_BLOCK_HEADER_HASH;
252
+
203
253
  const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
204
- const addressStore = new AddressStore(store);
205
- const privateEventStore = new PrivateEventStore(store);
206
- const contractStore = new ContractStore(store);
207
- const noteStore = new NoteStore(store);
208
- const anchorBlockStore = new AnchorBlockStore(store);
209
- const senderTaggingStore = new SenderTaggingStore(store);
210
- const senderAddressBookStore = new SenderAddressBookStore(store);
211
- const recipientTaggingStore = new RecipientTaggingStore(store);
212
- const capsuleStore = new CapsuleStore(store);
213
- const keyStore = new KeyStore(store);
214
- const tipsStore = new L2TipsKVStore(store, 'pxe');
254
+ const {
255
+ addressStore,
256
+ privateEventStore,
257
+ contractStore,
258
+ noteStore,
259
+ anchorBlockStore,
260
+ senderTaggingStore,
261
+ senderAddressBookStore,
262
+ recipientTaggingStore,
263
+ capsuleStore,
264
+ keyStore,
265
+ l2TipsStore,
266
+ } = openPxeStores(store, initialBlockHash);
215
267
  const contractSyncService = new ContractSyncService(
216
268
  node,
217
269
  contractStore,
@@ -226,7 +278,7 @@ export class PXE {
226
278
  anchorBlockStore,
227
279
  noteStore,
228
280
  privateEventStore,
229
- tipsStore,
281
+ l2TipsStore,
230
282
  contractSyncService,
231
283
  config,
232
284
  bindings,
@@ -262,15 +314,18 @@ export class PXE {
262
314
  privateEventStore,
263
315
  contractSyncService,
264
316
  messageContextService,
265
- tipsStore,
317
+ l2TipsStore,
266
318
  simulator,
267
319
  proverEnabled,
320
+ config.autoSync,
268
321
  proofCreator,
269
322
  protocolContractsProvider,
323
+ preloadedContractsProvider,
270
324
  log,
271
325
  jobQueue,
272
326
  jobCoordinator,
273
327
  debugUtils,
328
+ hooks,
274
329
  );
275
330
 
276
331
  debugUtils.setPXEHelpers(
@@ -281,7 +336,7 @@ export class PXE {
281
336
 
282
337
  pxe.jobQueue.start();
283
338
 
284
- await pxe.#registerProtocolContracts();
339
+ await Promise.all([pxe.#registerProtocolContracts(), pxe.#registerPreloadedContracts()]);
285
340
  log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
286
341
  return pxe;
287
342
  }
@@ -306,6 +361,7 @@ export class PXE {
306
361
  simulator: this.simulator,
307
362
  contractSyncService: this.contractSyncService,
308
363
  messageContextService: this.messageContextService,
364
+ hooks: this.hooks,
309
365
  });
310
366
  }
311
367
 
@@ -356,25 +412,45 @@ export class PXE {
356
412
  }
357
413
 
358
414
  async #registerProtocolContracts() {
359
- const registered: Record<string, string> = {};
360
- for (const name of protocolContractNames) {
361
- const { address, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
362
- await this.contractStore.addContractArtifact(artifact);
363
- await this.contractStore.addContractInstance(instance);
364
- registered[name] = address.toString();
365
- }
415
+ const registered = Object.fromEntries(
416
+ await Promise.all(
417
+ protocolContractNames.map(async name => {
418
+ const { address, instance, artifact } =
419
+ await this.protocolContractsProvider.getProtocolContractArtifact(name);
420
+ await this.contractStore.addContractArtifact(artifact);
421
+ await this.contractStore.addContractInstance(instance);
422
+ return [name, address.toString()] as const;
423
+ }),
424
+ ),
425
+ );
366
426
  this.log.verbose(`Registered protocol contracts in pxe`, registered);
367
427
  }
368
428
 
429
+ async #registerPreloadedContracts() {
430
+ const contracts = await this.preloadedContractsProvider.getPreloadedContracts();
431
+ await Promise.all(contracts.map(({ instance, artifact }) => this.registerContract({ instance, artifact })));
432
+ this.log.verbose(`Registered preloaded contracts in pxe`, {
433
+ contracts: contracts.map(({ instance }) => instance.address.toString()),
434
+ });
435
+ }
436
+
369
437
  // Executes the entrypoint private function, as well as all nested private
370
438
  // functions that might arise.
371
- async #executePrivate(
372
- contractFunctionSimulator: ContractFunctionSimulator,
373
- txRequest: TxExecutionRequest,
374
- anchorBlockHeader: BlockHeader,
375
- scopes: AztecAddress[],
376
- jobId: string,
377
- ): Promise<PrivateExecutionResult> {
439
+ async #executePrivate({
440
+ contractFunctionSimulator,
441
+ txRequest,
442
+ anchorBlockHeader,
443
+ scopes,
444
+ jobId,
445
+ senderForTags,
446
+ }: {
447
+ contractFunctionSimulator: ContractFunctionSimulator;
448
+ txRequest: TxExecutionRequest;
449
+ anchorBlockHeader: BlockHeader;
450
+ scopes: AztecAddress[];
451
+ jobId: string;
452
+ senderForTags?: AztecAddress;
453
+ }): Promise<PrivateExecutionResult> {
378
454
  const { origin: contractAddress, functionSelector } = txRequest;
379
455
 
380
456
  try {
@@ -394,6 +470,7 @@ export class PXE {
394
470
  anchorBlockHeader,
395
471
  scopes,
396
472
  jobId,
473
+ senderForTags,
397
474
  });
398
475
  this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
399
476
  return result;
@@ -446,11 +523,11 @@ export class PXE {
446
523
  * It can also be used for estimating gas in the future.
447
524
  * @param tx - The transaction to be simulated.
448
525
  */
449
- async #simulatePublicCalls(tx: Tx, skipFeeEnforcement: boolean) {
526
+ async #simulatePublicCalls(tx: Tx, skipFeeEnforcement: boolean, overrides?: SimulationOverrides) {
450
527
  // Simulating public calls can throw if the TX fails in a phase that doesn't allow reverts (setup)
451
528
  // Or return as reverted if it fails in a phase that allows reverts (app logic, teardown)
452
529
  try {
453
- const result = await this.node.simulatePublicCalls(tx, skipFeeEnforcement);
530
+ const result = await this.node.simulatePublicCalls(tx, skipFeeEnforcement, overrides);
454
531
  if (result.revertReason) {
455
532
  throw result.revertReason;
456
533
  }
@@ -496,8 +573,28 @@ export class PXE {
496
573
  return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
497
574
  }
498
575
 
576
+ /**
577
+ * Syncs with the node only when `autoSync` is enabled.
578
+ * When `autoSync` is disabled, callers (typically a wallet) are
579
+ * responsible for invoking `pxe.sync()` at the right granularity.
580
+ */
581
+ async #maybeSync(): Promise<void> {
582
+ if (this.autoSync) {
583
+ await this.blockStateSynchronizer.sync();
584
+ }
585
+ }
586
+
499
587
  // Public API
500
588
 
589
+ /**
590
+ * Triggers a sync of PXE state with the node, regardless of the `autoSync` config flag. Use this to
591
+ * batch syncs across composite flows when `autoSync` is disabled (e.g. one sync per simulate+send
592
+ * instead of one per inner PXE call). Serialized through the job queue.
593
+ */
594
+ public sync(): Promise<void> {
595
+ return this.#putInJobQueue(() => this.blockStateSynchronizer.sync());
596
+ }
597
+
501
598
  /**
502
599
  * Returns the block header up to which the PXE has synced.
503
600
  * @returns The synced block header
@@ -539,7 +636,7 @@ export class PXE {
539
636
  public async registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress> {
540
637
  const accounts = await this.keyStore.getAccounts();
541
638
  const accountCompleteAddress = await this.keyStore.addAccount(secretKey, partialAddress);
542
- if (accounts.includes(accountCompleteAddress.address)) {
639
+ if (accounts.some(a => a.equals(accountCompleteAddress.address))) {
543
640
  this.log.info(`Account:\n "${accountCompleteAddress.address.toString()}"\n already registered.`);
544
641
  return accountCompleteAddress;
545
642
  } else {
@@ -569,7 +666,7 @@ export class PXE {
569
666
  }
570
667
 
571
668
  const accounts = await this.keyStore.getAccounts();
572
- if (accounts.includes(sender)) {
669
+ if (accounts.some(a => a.equals(sender))) {
573
670
  this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
574
671
  return sender;
575
672
  }
@@ -664,7 +761,9 @@ export class PXE {
664
761
  const publicFunctionSignatures = artifact.functions
665
762
  .filter(fn => fn.functionType === FunctionType.PUBLIC)
666
763
  .map(fn => decodeFunctionSignature(fn.name, fn.parameters));
667
- await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
764
+ if (publicFunctionSignatures.length > 0) {
765
+ await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
766
+ }
668
767
  } else {
669
768
  // Otherwise, make sure there is an artifact already registered for that class id
670
769
  artifact = await this.contractStore.getContractArtifact(instance.currentContractClassId);
@@ -699,7 +798,7 @@ export class PXE {
699
798
  throw new Error(`Instance not found when updating a contract. Contract address: ${contractAddress}.`);
700
799
  }
701
800
  const contractClass = await getContractClassFromArtifact(artifact);
702
- await this.blockStateSynchronizer.sync();
801
+ await this.#maybeSync();
703
802
 
704
803
  const header = await this.anchorBlockStore.getBlockHeader();
705
804
 
@@ -711,7 +810,9 @@ export class PXE {
711
810
  const publicFunctionSignatures = artifact.functions
712
811
  .filter(fn => fn.functionType === FunctionType.PUBLIC)
713
812
  .map(fn => decodeFunctionSignature(fn.name, fn.parameters));
714
- await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
813
+ if (publicFunctionSignatures.length > 0) {
814
+ await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
815
+ }
715
816
 
716
817
  currentInstance.currentContractClassId = contractClass.id;
717
818
  await Promise.all([
@@ -740,7 +841,7 @@ export class PXE {
740
841
  * @throws If contract code not found, or public simulation reverts.
741
842
  * Also throws if simulatePublic is true and public simulation reverts.
742
843
  */
743
- public proveTx(txRequest: TxExecutionRequest, scopes: AztecAddress[]): Promise<TxProvingResult> {
844
+ public proveTx(txRequest: TxExecutionRequest, { scopes, senderForTags }: ProveTxOpts): Promise<TxProvingResult> {
744
845
  let privateExecutionResult: PrivateExecutionResult;
745
846
  // We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
746
847
  // computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
@@ -748,17 +849,18 @@ export class PXE {
748
849
  const totalTimer = new Timer();
749
850
  try {
750
851
  const syncTimer = new Timer();
751
- await this.blockStateSynchronizer.sync();
852
+ await this.#maybeSync();
752
853
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
753
854
  const syncTime = syncTimer.ms();
754
855
  const contractFunctionSimulator = this.#getSimulatorForTx();
755
- privateExecutionResult = await this.#executePrivate(
856
+ privateExecutionResult = await this.#executePrivate({
756
857
  contractFunctionSimulator,
757
858
  txRequest,
758
859
  anchorBlockHeader,
759
860
  scopes,
760
861
  jobId,
761
- );
862
+ senderForTags,
863
+ });
762
864
 
763
865
  const {
764
866
  publicInputs,
@@ -795,23 +897,20 @@ export class PXE {
795
897
  nodeRPCCalls: contractFunctionSimulator?.getStats().nodeRPCCalls,
796
898
  });
797
899
 
798
- // While not strictly necessary to store tagging cache contents in the DB since we sync tagging indexes from
799
- // chain before sending new logs, the sync can only see logs already included in blocks. If we send another
800
- // transaction before this one is included in a block from this PXE, and that transaction contains a log with
801
- // a tag derived from the same secret, we would reuse the tag and the transactions would be linked. Hence
802
- // storing the tags here prevents linkage of txs sent from the same PXE.
803
- const taggingIndexRangesUsedInTheTx = privateExecutionResult.entrypoint.taggingIndexRanges;
804
- if (taggingIndexRangesUsedInTheTx.length > 0) {
805
- // TODO(benesjan): The following is an expensive operation. Figure out a way to avoid it.
806
- const txHash = (await txProvingResult.toTx()).txHash;
807
-
808
- await this.senderTaggingStore.storePendingIndexes(taggingIndexRangesUsedInTheTx, txHash, jobId);
809
- this.log.debug(`Stored used tagging index ranges as sender for the tx`, {
810
- taggingIndexRangesUsedInTheTx,
811
- });
812
- } else {
813
- this.log.debug(`No tagging index ranges used in the tx`);
814
- }
900
+ // We keep track of which tagging indices we've used in this tx so that we don't repeat them in future txs
901
+ // (which would link them) without having to rely on this tx being mined (and us seeing the indices being used
902
+ // onchain).
903
+ // Note that this must happen _after_ proving as it requires the proof's public inputs, from which the kernels
904
+ // may have removed some logs due to note-nullifier squashing - this may lead to range of tagging indices we've
905
+ // actually used to being reduced.
906
+ await persistSenderTaggingIndexRangesForTx(
907
+ this.senderTaggingStore,
908
+ privateExecutionResult.entrypoint.taggingIndexRanges,
909
+ publicInputs,
910
+ () => txProvingResult.getTxHash(),
911
+ jobId,
912
+ this.log,
913
+ );
815
914
 
816
915
  return txProvingResult;
817
916
  } catch (err: any) {
@@ -828,7 +927,7 @@ export class PXE {
828
927
  */
829
928
  public profileTx(
830
929
  txRequest: TxExecutionRequest,
831
- { profileMode, skipProofGeneration = true, scopes }: ProfileTxOpts,
930
+ { profileMode, skipProofGeneration = true, scopes, senderForTags }: ProfileTxOpts,
832
931
  ): Promise<TxProfileResult> {
833
932
  // We disable concurrent profiles for consistency with simulateTx.
834
933
  return this.#putInJobQueue(async jobId => {
@@ -847,18 +946,19 @@ export class PXE {
847
946
  txInfo,
848
947
  );
849
948
  const syncTimer = new Timer();
850
- await this.blockStateSynchronizer.sync();
949
+ await this.#maybeSync();
851
950
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
852
951
  const syncTime = syncTimer.ms();
853
952
 
854
953
  const contractFunctionSimulator = this.#getSimulatorForTx();
855
- const privateExecutionResult = await this.#executePrivate(
954
+ const privateExecutionResult = await this.#executePrivate({
856
955
  contractFunctionSimulator,
857
956
  txRequest,
858
957
  anchorBlockHeader,
859
958
  scopes,
860
959
  jobId,
861
- );
960
+ senderForTags,
961
+ });
862
962
 
863
963
  const { executionSteps, timings: { proving } = {} } = await this.#prove(
864
964
  txRequest,
@@ -932,6 +1032,7 @@ export class PXE {
932
1032
  skipKernels = true,
933
1033
  overrides,
934
1034
  scopes,
1035
+ senderForTags,
935
1036
  }: SimulateTxOpts,
936
1037
  ): Promise<TxSimulationResult> {
937
1038
  // We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
@@ -953,34 +1054,26 @@ export class PXE {
953
1054
  txInfo,
954
1055
  );
955
1056
  const syncTimer = new Timer();
956
- await this.blockStateSynchronizer.sync();
1057
+ await this.#maybeSync();
957
1058
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
958
1059
  const syncTime = syncTimer.ms();
959
1060
 
960
- const overriddenContracts = overrides?.contracts ? new Set(Object.keys(overrides.contracts)) : undefined;
961
- const hasOverriddenContracts = overriddenContracts !== undefined && overriddenContracts.size > 0;
962
-
963
- if (hasOverriddenContracts && !skipKernels) {
1061
+ if (overrides?.contracts && Object.keys(overrides.contracts).length > 0 && !skipKernels) {
964
1062
  throw new Error(
965
1063
  'Simulating with overridden contracts is not compatible with kernel execution. Please set skipKernels to true when simulating with overridden contracts.',
966
1064
  );
967
1065
  }
968
1066
  const contractFunctionSimulator = this.#getSimulatorForTx(overrides);
969
1067
 
970
- if (hasOverriddenContracts) {
971
- // Overridden contracts don't have a sync function, so calling sync on them would fail.
972
- // We exclude them so the sync service skips them entirely.
973
- this.contractSyncService.setExcludedFromSync(jobId, overriddenContracts);
974
- }
975
-
976
1068
  // Execution of private functions only; no proving, and no kernel logic.
977
- const privateExecutionResult = await this.#executePrivate(
1069
+ const privateExecutionResult = await this.#executePrivate({
978
1070
  contractFunctionSimulator,
979
1071
  txRequest,
980
1072
  anchorBlockHeader,
981
1073
  scopes,
982
1074
  jobId,
983
- );
1075
+ senderForTags,
1076
+ });
984
1077
 
985
1078
  let publicInputs: PrivateKernelTailCircuitPublicInputs | undefined;
986
1079
  let executionSteps: PrivateExecutionStep[] = [];
@@ -1012,7 +1105,7 @@ export class PXE {
1012
1105
  let publicOutput: PublicSimulationOutput | undefined;
1013
1106
  if (simulatePublic && publicInputs.forPublic) {
1014
1107
  const publicSimulationTimer = new Timer();
1015
- publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
1108
+ publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement, overrides);
1016
1109
  publicSimulationTime = publicSimulationTimer.ms();
1017
1110
  if (publicOutput?.debugLogs?.length) {
1018
1111
  await displayDebugLogs(publicOutput.debugLogs, addr => this.contractStore.getDebugContractName(addr));
@@ -1098,7 +1191,7 @@ export class PXE {
1098
1191
  try {
1099
1192
  const totalTimer = new Timer();
1100
1193
  const syncTimer = new Timer();
1101
- await this.blockStateSynchronizer.sync();
1194
+ await this.#maybeSync();
1102
1195
  const syncTime = syncTimer.ms();
1103
1196
  const functionTimer = new Timer();
1104
1197
  const contractFunctionSimulator = this.#getSimulatorForTx();
@@ -1173,7 +1266,7 @@ export class PXE {
1173
1266
  let anchorBlockNumber: BlockNumber;
1174
1267
 
1175
1268
  await this.#putInJobQueue(async jobId => {
1176
- await this.blockStateSynchronizer.sync();
1269
+ await this.#maybeSync();
1177
1270
 
1178
1271
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
1179
1272
  anchorBlockNumber = anchorBlockHeader.getBlockNumber();
@@ -0,0 +1,22 @@
1
+ {
2
+ "complete_addresses": [
3
+ {
4
+ "index": 0,
5
+ "value": "0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea313ad6965d11a533a663d07507319f74ac3305325f6f72423c0b24aa1193268bb19e95c05f09cb86d1a6257572f9082ca15d4a02373c4d8c9cee23dc61a4c2a882f9017d51bca6616102d8a1d4dba89e4ce12881a2414576f01d2fec9492814a22a1b054e998835d166711839b515d434b1fbc207ad4fdb5b2b43d6ac6b400871019f5bb255e87523d43da83ebc9fa95169b653d4abef902e011e9eac620fc45b14a5d4bde495b8c3a9ba4aed0d4870526e46fdff22d341a2f689ac5a50d103560f124f07811eebfaaa6d31316a2cc5bf255fa118f720e8ff1f2fc0d4aa46d4960000000000000000000000000000000000000000000000000000000000000003"
6
+ },
7
+ {
8
+ "index": 1,
9
+ "value": "2cf4c6a79bcb041923c0cf1cfbb6c7407e082824e29588dbcf9cc6c1d6e8b01f17c2df1b7355bb4c4494aa4ec85d15ff8881cea1b34691f0cc558e8aef3f3f4c267e526a2e6e9adf6a026989be005bd50d1aea76d20816b9843bc95557696f9f16c3eb259ba3e3eb27b7fe3abc36e87923990bf5c265cb0d57790eda2a4432f105a5449624125d37f10cd4c68ffd57b0dc0cdaa916cb37840be1db9bf88e3c5f0e81754454e3b12035b13448a9fe3b980bf31a9808cb93e146628fb06fa1b46f14a5d4bde495b8c3a9ba4aed0d4870526e46fdff22d341a2f689ac5a50d103560f124f07811eebfaaa6d31316a2cc5bf255fa118f720e8ff1f2fc0d4aa46d4960000000000000000000000000000000000000000000000000000000000000007"
10
+ }
11
+ ],
12
+ "complete_address_index": [
13
+ {
14
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3",
15
+ "value": "num:0"
16
+ },
17
+ {
18
+ "key": "utf8:0x2cf4c6a79bcb041923c0cf1cfbb6c7407e082824e29588dbcf9cc6c1d6e8b01f",
19
+ "value": "num:1"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "header": "000000000000000000000000000000000000000000000000000000000000000200000003000000000000000000000000000000000000000000000000000000000000000500000007000000000000000000000000000000000000000000000000000000000000000b0000000d00000000000000000000000000000000000000000000000000000000000000110000001300000000000000000000000000000000000000000000000000000000000000170000001d000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000290000002b0000002f0000000000000035000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000003d00000000000000000000000000000043000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000004f"
3
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "capsules": [
3
+ {
4
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003:0x0000000000000000000000000000000000000000000000000000000000000005",
5
+ "value": "0000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000b"
6
+ },
7
+ {
8
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003:0x000000000000000000000000000000000000000000000000000000000000000d",
9
+ "value": "0000000000000000000000000000000000000000000000000000000000000011"
10
+ },
11
+ {
12
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003:0x0000000000000000000000000000000000000000000000000000000000000013",
13
+ "value": ""
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "contract_artifacts": [
3
+ {
4
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002",
5
+ "value": "7b226e616d65223a22536368656d6146697874757265436f6e7472616374222c22617a74656356657273696f6e223a22736368656d612d666978747572652d76657273696f6e222c2266756e6374696f6e73223a5b7b226e616d65223a22707269766174655f666e222c2266756e6374696f6e54797065223a2270726976617465222c2269734f6e6c7953656c66223a66616c73652c226973537461746963223a66616c73652c226973496e697469616c697a6572223a747275652c22706172616d6574657273223a5b7b226e616d65223a226669727374222c2274797065223a7b226b696e64223a226669656c64227d2c227669736962696c697479223a2270726976617465227d2c7b226e616d65223a227365636f6e64222c2274797065223a7b226b696e64223a22696e7465676572222c227369676e223a22756e7369676e6564222c227769647468223a33327d2c227669736962696c697479223a227075626c6963227d5d2c2272657475726e5479706573223a5b7b226b696e64223a22626f6f6c65616e227d5d2c226572726f725479706573223a7b22736368656d615f746573745f6572726f72223a7b226572726f725f6b696e64223a22737472696e67222c22737472696e67223a22666978656420736368656d612d74657374206572726f72227d7d2c2262797465636f6465223a2241674d4642773d3d222c22646562756753796d626f6c73223a22736368656d612d666978747572652d6465627567227d5d2c226e6f6e44697370617463685075626c696346756e6374696f6e73223a5b7b226e616d65223a227075626c69635f666e222c2266756e6374696f6e54797065223a227075626c6963222c2269734f6e6c7953656c66223a747275652c226973537461746963223a747275652c226973496e697469616c697a6572223a66616c73652c22706172616d6574657273223a5b5d2c2272657475726e5479706573223a5b5d2c226572726f725479706573223a7b7d7d5d2c226f757470757473223a7b2273747275637473223a7b226d795f737472756374223a5b7b226b696e64223a226669656c64227d2c7b226b696e64223a22626f6f6c65616e227d5d7d2c22676c6f62616c73223a7b7d7d2c2273746f726167654c61796f7574223a7b226d795f6669656c64223a7b22736c6f74223a22307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303062227d7d2c2266696c654d6170223a7b2231223a7b22736f75726365223a22736368656d61206669787475726520736f75726365222c2270617468223a227372632f736368656d615f666978747572652e6e72222c2266756e6374696f6e5f6c6f636174696f6e73223a5b5d7d7d7d"
6
+ },
7
+ {
8
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000017",
9
+ "value": "7b226e616d65223a22536368656d6146697874757265436f6e7472616374222c22617a74656356657273696f6e223a22736368656d612d666978747572652d76657273696f6e222c2266756e6374696f6e73223a5b7b226e616d65223a22707269766174655f666e222c2266756e6374696f6e54797065223a2270726976617465222c2269734f6e6c7953656c66223a66616c73652c226973537461746963223a66616c73652c226973496e697469616c697a6572223a747275652c22706172616d6574657273223a5b7b226e616d65223a226669727374222c2274797065223a7b226b696e64223a226669656c64227d2c227669736962696c697479223a2270726976617465227d2c7b226e616d65223a227365636f6e64222c2274797065223a7b226b696e64223a22696e7465676572222c227369676e223a22756e7369676e6564222c227769647468223a33327d2c227669736962696c697479223a227075626c6963227d5d2c2272657475726e5479706573223a5b7b226b696e64223a22626f6f6c65616e227d5d2c226572726f725479706573223a7b22736368656d615f746573745f6572726f72223a7b226572726f725f6b696e64223a22737472696e67222c22737472696e67223a22666978656420736368656d612d74657374206572726f72227d7d2c2262797465636f6465223a2241674d4642773d3d222c22646562756753796d626f6c73223a22736368656d612d666978747572652d6465627567227d5d2c226e6f6e44697370617463685075626c696346756e6374696f6e73223a5b7b226e616d65223a227075626c69635f666e222c2266756e6374696f6e54797065223a227075626c6963222c2269734f6e6c7953656c66223a747275652c226973537461746963223a747275652c226973496e697469616c697a6572223a66616c73652c22706172616d6574657273223a5b5d2c2272657475726e5479706573223a5b5d2c226572726f725479706573223a7b7d7d5d2c226f757470757473223a7b2273747275637473223a7b226d795f737472756374223a5b7b226b696e64223a226669656c64227d2c7b226b696e64223a22626f6f6c65616e227d5d7d2c22676c6f62616c73223a7b7d7d2c2273746f726167654c61796f7574223a7b226d795f6669656c64223a7b22736c6f74223a22307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303062227d7d2c2266696c654d6170223a7b2231223a7b22736f75726365223a22736368656d61206669787475726520736f75726365222c2270617468223a227372632f736368656d615f666978747572652e6e72222c2266756e6374696f6e5f6c6f636174696f6e73223a5b5d7d7d7d"
10
+ }
11
+ ],
12
+ "contract_classes": [
13
+ {
14
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002",
15
+ "value": "010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000020000000b000000000000000000000000000000000000000000000000000000000000000d000000110000000000000000000000000000000000000000000000000000000000000013"
16
+ },
17
+ {
18
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000017",
19
+ "value": "010000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000002500000000"
20
+ }
21
+ ],
22
+ "contracts_instances": [
23
+ {
24
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000065",
25
+ "value": "020000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000049"
26
+ }
27
+ ]
28
+ }