@aztec/pxe 5.0.0-rc.2 → 5.0.1

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 (229) hide show
  1. package/dest/block_synchronizer/block_synchronizer.d.ts +5 -3
  2. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  3. package/dest/block_synchronizer/block_synchronizer.js +7 -1
  4. package/dest/contract/contract_class_service.d.ts +31 -0
  5. package/dest/contract/contract_class_service.d.ts.map +1 -0
  6. package/dest/contract/contract_class_service.js +68 -0
  7. package/dest/{contract_sync → contract}/contract_sync_service.d.ts +7 -6
  8. package/dest/contract/contract_sync_service.d.ts.map +1 -0
  9. package/dest/{contract_sync → contract}/contract_sync_service.js +10 -30
  10. package/dest/contract/helpers.d.ts +7 -0
  11. package/dest/contract/helpers.d.ts.map +1 -0
  12. package/dest/contract/helpers.js +20 -0
  13. package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
  14. package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
  15. package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
  16. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
  17. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
  18. package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
  19. package/dest/contract_function_simulator/contract_function_simulator.d.ts +9 -3
  20. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/contract_function_simulator.js +31 -14
  22. package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -9
  23. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/execution_note_cache.js +8 -28
  25. package/dest/contract_function_simulator/index.d.ts +4 -2
  26. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/index.js +2 -1
  28. package/dest/contract_function_simulator/noir-structs/fact.d.ts +5 -5
  29. package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -1
  30. package/dest/contract_function_simulator/noir-structs/fact.js +2 -2
  31. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +3 -3
  32. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/noir-structs/fact_collection.js +3 -1
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +7 -1
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
  37. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
  38. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
  39. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +2 -2
  40. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
  41. package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -1
  42. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +8 -1
  43. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -1
  44. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +17 -0
  45. package/dest/contract_function_simulator/oracle/acir_callback.d.ts +7 -2
  46. package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/oracle/acir_callback.js +55 -11
  48. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
  49. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
  50. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
  51. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +11 -7
  52. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  53. package/dest/contract_function_simulator/oracle/oracle_registry.js +50 -10
  54. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +48 -9
  55. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  56. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +51 -30
  57. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +10 -2
  58. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +73 -32
  60. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +23 -16
  61. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +105 -60
  63. package/dest/debug/pxe_debug_utils.d.ts +2 -2
  64. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  65. package/dest/entrypoints/client/bundle/index.d.ts +2 -1
  66. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  67. package/dest/entrypoints/client/bundle/index.js +1 -0
  68. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  69. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  70. package/dest/entrypoints/client/bundle/utils.js +11 -5
  71. package/dest/entrypoints/client/lazy/index.d.ts +2 -1
  72. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  73. package/dest/entrypoints/client/lazy/index.js +1 -0
  74. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  75. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  76. package/dest/entrypoints/client/lazy/utils.js +11 -5
  77. package/dest/entrypoints/client/store.d.ts +14 -0
  78. package/dest/entrypoints/client/store.d.ts.map +1 -0
  79. package/dest/entrypoints/client/store.js +28 -0
  80. package/dest/entrypoints/server/index.d.ts +6 -2
  81. package/dest/entrypoints/server/index.d.ts.map +1 -1
  82. package/dest/entrypoints/server/index.js +4 -1
  83. package/dest/entrypoints/server/store.d.ts +18 -0
  84. package/dest/entrypoints/server/store.d.ts.map +1 -0
  85. package/dest/entrypoints/server/store.js +28 -0
  86. package/dest/entrypoints/server/utils.d.ts +1 -1
  87. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  88. package/dest/entrypoints/server/utils.js +8 -2
  89. package/dest/error_enriching.d.ts +5 -3
  90. package/dest/error_enriching.d.ts.map +1 -1
  91. package/dest/error_enriching.js +12 -10
  92. package/dest/hooks/execution_hooks.d.ts +15 -4
  93. package/dest/hooks/execution_hooks.d.ts.map +1 -1
  94. package/dest/hooks/index.d.ts +3 -2
  95. package/dest/hooks/index.d.ts.map +1 -1
  96. package/dest/hooks/index.js +1 -0
  97. package/dest/hooks/resolve_custom_request.d.ts +23 -0
  98. package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
  99. package/dest/hooks/resolve_custom_request.js +3 -0
  100. package/dest/hooks/resolve_tagging_secret_strategy.d.ts +10 -1
  101. package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -1
  102. package/dest/hooks/resolve_tagging_secret_strategy.js +3 -3
  103. package/dest/logs/log_service.d.ts +5 -3
  104. package/dest/logs/log_service.d.ts.map +1 -1
  105. package/dest/logs/log_service.js +38 -17
  106. package/dest/notes/note_service.d.ts +1 -1
  107. package/dest/notes/note_service.js +1 -1
  108. package/dest/oracle_version.d.ts +2 -2
  109. package/dest/oracle_version.js +2 -2
  110. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
  111. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  112. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +6 -2
  113. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  114. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  115. package/dest/private_kernel/private_kernel_execution_prover.js +17 -36
  116. package/dest/private_kernel/private_kernel_oracle.d.ts +4 -2
  117. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  118. package/dest/private_kernel/private_kernel_oracle.js +17 -5
  119. package/dest/pxe.d.ts +81 -46
  120. package/dest/pxe.d.ts.map +1 -1
  121. package/dest/pxe.js +138 -104
  122. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
  123. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
  124. package/dest/storage/backwards_compatibility_tests/schema_tests.js +31 -7
  125. package/dest/storage/contract_store/contract_store.d.ts +27 -24
  126. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  127. package/dest/storage/contract_store/contract_store.js +63 -74
  128. package/dest/storage/fact_store/fact_service.d.ts +6 -4
  129. package/dest/storage/fact_store/fact_service.d.ts.map +1 -1
  130. package/dest/storage/fact_store/fact_service.js +19 -4
  131. package/dest/storage/fact_store/fact_store.d.ts +1 -1
  132. package/dest/storage/fact_store/fact_store.js +1 -1
  133. package/dest/storage/fact_store/index.d.ts +2 -1
  134. package/dest/storage/fact_store/index.d.ts.map +1 -1
  135. package/dest/storage/fact_store/index.js +1 -0
  136. package/dest/storage/fact_store/origin_state.d.ts +57 -0
  137. package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
  138. package/dest/storage/fact_store/origin_state.js +53 -0
  139. package/dest/storage/metadata.d.ts +2 -2
  140. package/dest/storage/metadata.d.ts.map +1 -1
  141. package/dest/storage/metadata.js +1 -1
  142. package/dest/storage/store_identity.d.ts +35 -0
  143. package/dest/storage/store_identity.d.ts.map +1 -0
  144. package/dest/storage/store_identity.js +44 -0
  145. package/dest/storage/tagging_store/sender_tagging_store.d.ts +19 -3
  146. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  147. package/dest/storage/tagging_store/sender_tagging_store.js +48 -11
  148. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +17 -6
  149. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -1
  150. package/dest/storage/tagging_store/tagging_secret_sources_store.js +24 -11
  151. package/dest/tagging/constants.d.ts +2 -2
  152. package/dest/tagging/constants.d.ts.map +1 -1
  153. package/dest/tagging/constants.js +18 -9
  154. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +1 -1
  155. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +1 -1
  156. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  157. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +6 -2
  158. package/package.json +17 -17
  159. package/src/block_synchronizer/block_synchronizer.ts +9 -1
  160. package/src/contract/contract_class_service.ts +83 -0
  161. package/src/{contract_sync → contract}/contract_sync_service.ts +18 -37
  162. package/src/contract/helpers.ts +35 -0
  163. package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
  164. package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
  165. package/src/contract_function_simulator/contract_function_simulator.ts +56 -14
  166. package/src/contract_function_simulator/execution_note_cache.ts +7 -28
  167. package/src/contract_function_simulator/index.ts +7 -1
  168. package/src/contract_function_simulator/noir-structs/fact.ts +4 -4
  169. package/src/contract_function_simulator/noir-structs/fact_collection.ts +9 -4
  170. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +6 -0
  171. package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
  172. package/src/contract_function_simulator/noir-structs/provided_secret.ts +1 -1
  173. package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +21 -0
  174. package/src/contract_function_simulator/oracle/acir_callback.ts +58 -12
  175. package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
  176. package/src/contract_function_simulator/oracle/oracle_registry.ts +37 -7
  177. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +49 -32
  178. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +92 -41
  179. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +149 -71
  180. package/src/debug/pxe_debug_utils.ts +1 -1
  181. package/src/entrypoints/client/bundle/index.ts +1 -0
  182. package/src/entrypoints/client/bundle/utils.ts +16 -4
  183. package/src/entrypoints/client/lazy/index.ts +1 -0
  184. package/src/entrypoints/client/lazy/utils.ts +16 -4
  185. package/src/entrypoints/client/store.ts +38 -0
  186. package/src/entrypoints/server/index.ts +6 -1
  187. package/src/entrypoints/server/store.ts +47 -0
  188. package/src/entrypoints/server/utils.ts +21 -7
  189. package/src/error_enriching.ts +26 -10
  190. package/src/hooks/execution_hooks.ts +14 -3
  191. package/src/hooks/index.ts +2 -0
  192. package/src/hooks/resolve_custom_request.ts +24 -0
  193. package/src/hooks/resolve_tagging_secret_strategy.ts +14 -0
  194. package/src/logs/log_service.ts +35 -11
  195. package/src/notes/note_service.ts +1 -1
  196. package/src/oracle_version.ts +2 -2
  197. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
  198. package/src/private_kernel/private_kernel_execution_prover.ts +22 -52
  199. package/src/private_kernel/private_kernel_oracle.ts +23 -4
  200. package/src/pxe.ts +212 -143
  201. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
  202. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +1 -1
  203. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
  204. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
  205. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
  206. package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +3 -3
  207. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +1 -1
  208. package/src/storage/backwards_compatibility_tests/schema_tests.ts +38 -4
  209. package/src/storage/contract_store/contract_store.ts +85 -92
  210. package/src/storage/fact_store/fact_service.ts +29 -5
  211. package/src/storage/fact_store/fact_store.ts +1 -1
  212. package/src/storage/fact_store/index.ts +10 -0
  213. package/src/storage/fact_store/origin_state.ts +75 -0
  214. package/src/storage/metadata.ts +1 -1
  215. package/src/storage/store_identity.ts +72 -0
  216. package/src/storage/tagging_store/sender_tagging_store.ts +62 -15
  217. package/src/storage/tagging_store/tagging_secret_sources_store.ts +36 -15
  218. package/src/tagging/constants.ts +19 -9
  219. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +1 -1
  220. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +6 -2
  221. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
  222. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
  223. package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -51
  224. package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
  225. package/dest/contract_sync/helpers.d.ts +0 -28
  226. package/dest/contract_sync/helpers.d.ts.map +0 -1
  227. package/dest/contract_sync/helpers.js +0 -48
  228. package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
  229. package/src/contract_sync/helpers.ts +0 -79
@@ -8,8 +8,8 @@ import { STANDARD_HANDSHAKE_REGISTRY_ADDRESS } from '@aztec/standard-contracts/h
8
8
  import { FunctionSelector } from '@aztec/stdlib/abi';
9
9
  import { siloNullifier } from '@aztec/stdlib/hash';
10
10
  import { computeAddressSecret, hashPublicKey } from '@aztec/stdlib/keys';
11
- import { AppTaggingSecret, FlatPublicLogs, deriveAppSiloedSharedSecret } from '@aztec/stdlib/logs';
12
- import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
11
+ import { AppTaggingSecret, FlatPublicLogs, appSiloEcdhSharedSecret } from '@aztec/stdlib/logs';
12
+ import { getL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
13
13
  import { MerkleTreeId } from '@aztec/stdlib/trees';
14
14
  import { CallContext } from '@aztec/stdlib/tx';
15
15
  import { createContractLogger, logContractMessage, stripAztecnrLogPrefix } from '../../contract_logging.js';
@@ -17,7 +17,9 @@ import { EventService } from '../../events/event_service.js';
17
17
  import { LogService } from '../../logs/log_service.js';
18
18
  import { NoteService } from '../../notes/note_service.js';
19
19
  import { ORACLE_VERSION_MAJOR } from '../../oracle_version.js';
20
- import { FactCollectionKey, FactCollectionTypeKey } from '../../storage/fact_store/index.js';
20
+ import { assertAllowedScope } from '../../storage/allowed_scopes.js';
21
+ import { FactCollectionKey, FactCollectionTypeKey, anchoredTipBlockNumbers } from '../../storage/fact_store/index.js';
22
+ import { AztecNodeReadCache } from '../aztec_node_read_cache.js';
21
23
  import { EphemeralArrayService } from '../ephemeral_array_service.js';
22
24
  import { BoundedVec } from '../noir-structs/bounded_vec.js';
23
25
  import { EphemeralArray } from '../noir-structs/ephemeral_array.js';
@@ -35,13 +37,14 @@ import { buildACIRCallback } from './acir_callback.js';
35
37
  offchainEffects = [];
36
38
  ephemeralArrayService = new EphemeralArrayService();
37
39
  transientArrayService;
40
+ aztecNodeReadCache;
38
41
  // We store oracle version to be able to show a nice error message when an oracle handler is missing.
39
42
  contractOracleVersion;
40
43
  callContext;
41
44
  authWitnesses;
42
45
  capsules;
43
46
  anchorBlockHeader;
44
- contractStore;
47
+ anchoredContractData;
45
48
  noteStore;
46
49
  keyStore;
47
50
  addressStore;
@@ -65,7 +68,7 @@ import { buildACIRCallback } from './acir_callback.js';
65
68
  this.authWitnesses = args.authWitnesses;
66
69
  this.capsules = args.capsules;
67
70
  this.anchorBlockHeader = args.anchorBlockHeader;
68
- this.contractStore = args.contractStore;
71
+ this.anchoredContractData = args.anchoredContractData;
69
72
  this.noteStore = args.noteStore;
70
73
  this.keyStore = args.keyStore;
71
74
  this.addressStore = args.addressStore;
@@ -85,6 +88,7 @@ import { buildACIRCallback } from './acir_callback.js';
85
88
  this.hooks = args.hooks;
86
89
  this.utilityExecutor = args.utilityExecutor;
87
90
  this.transientArrayService = args.transientArrayService;
91
+ this.aztecNodeReadCache = new AztecNodeReadCache(args.aztecNode);
88
92
  }
89
93
  assertCompatibleOracleVersion(major, minor) {
90
94
  if (major !== ORACLE_VERSION_MAJOR) {
@@ -156,9 +160,14 @@ import { buildACIRCallback } from './acir_callback.js';
156
160
  // Note that we validate that the reference block hash is at or before the anchor block - we don't test the block
157
161
  // hash at all. If the block hash did not exist by the reference block hash, then the node will not return the
158
162
  // membership witness as there is none.
159
- const witness = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, ()=>this.aztecNode.getBlockHashMembershipWitness(referenceBlockHash, blockHash));
163
+ const witness = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, ()=>this.aztecNodeReadCache.getBlockHashMembershipWitness(referenceBlockHash, blockHash));
160
164
  return witness ? Option.some(witness) : Option.none();
161
165
  }
166
+ /** Returns whether each block hash is present in the archive tree at the referenced block. */ async areBlockHashesInArchive(referenceBlockHash, blockHashes) {
167
+ const hashes = blockHashes.readAll(this.ephemeralArrayService);
168
+ const memberships = await this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, ()=>Promise.all(hashes.map((blockHash)=>this.aztecNodeReadCache.getBlockHashMembershipWitness(referenceBlockHash, blockHash).then(Boolean))));
169
+ return EphemeralArray.fromValues(this.ephemeralArrayService, memberships);
170
+ }
162
171
  /**
163
172
  * Returns a nullifier membership witness for a given nullifier at a given block.
164
173
  * @param blockHash - The block hash at which to get the index.
@@ -192,7 +201,7 @@ import { buildACIRCallback } from './acir_callback.js';
192
201
  * @param leafSlot - The slot of the public data tree to get the witness for.
193
202
  * @returns - The witness
194
203
  */ async getPublicDataWitness(blockHash, leafSlot) {
195
- const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, ()=>this.aztecNode.getPublicDataWitness(blockHash, leafSlot));
204
+ const witness = await this.#queryWithBlockHashNotAfterAnchor(blockHash, ()=>this.aztecNodeReadCache.getPublicDataWitness(blockHash, leafSlot));
196
205
  if (!witness) {
197
206
  throw new Error(`Public data witness not found for slot ${leafSlot} at block hash ${blockHash.toString()}.`);
198
207
  }
@@ -244,7 +253,7 @@ import { buildACIRCallback } from './acir_callback.js';
244
253
  * @param address - Address.
245
254
  * @returns A contract instance.
246
255
  */ async getContractInstance(address) {
247
- const instance = await this.contractStore.getContractInstance(address);
256
+ const instance = await this.anchoredContractData.getContractInstance(address);
248
257
  if (!instance) {
249
258
  throw new Error(`No contract instance found for address ${address.toString()}`);
250
259
  }
@@ -327,14 +336,13 @@ import { buildACIRCallback } from './acir_callback.js';
327
336
  return leafIndex?.data !== undefined;
328
337
  }
329
338
  /**
330
- * Returns the membership witness of an un-nullified L1 to L2 message.
331
- * @param contractAddress - Address of a contract by which the message was emitted.
339
+ * Returns the membership witness of an L1 to L2 message.
332
340
  * @param messageHash - Hash of the message.
333
- * @param secret - Secret used to compute a nullifier.
334
- * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
341
+ * @param nullifier - When present, the unsiloed nullifier of the message and the address to silo it with. The witness
342
+ * is only returned if the siloed nullifier is absent from the nullifier tree, i.e. the message has not been consumed.
335
343
  * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
336
- */ async getL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
337
- const [messageIndex, siblingPath] = await getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret, await this.anchorBlockHeader.hash());
344
+ */ async getL1ToL2MembershipWitnessV2(messageHash, nullifier) {
345
+ const [messageIndex, siblingPath] = await getL1ToL2MessageWitness(this.aztecNode, messageHash, nullifier.value, await this.anchorBlockHeader.hash());
338
346
  return {
339
347
  index: messageIndex,
340
348
  siblingPath
@@ -348,9 +356,8 @@ import { buildACIRCallback } from './acir_callback.js';
348
356
  * @param numberOfElements - Number of elements to read from the starting storage slot.
349
357
  */ getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements) {
350
358
  return this.#queryWithBlockHashNotAfterAnchor(blockHash, async ()=>{
351
- const slots = Array(numberOfElements).fill(0).map((_, i)=>new Fr(startStorageSlot.value + BigInt(i)));
352
- const values = await Promise.all(slots.map((storageSlot)=>this.aztecNode.getPublicStorageAt(blockHash, contractAddress, storageSlot)));
353
- this.logger.debug(`Oracle storage read: slots=[${slots.map((slot)=>slot.toString()).join(', ')}] address=${contractAddress.toString()} values=[${values.join(', ')}]`);
359
+ const values = await this.aztecNodeReadCache.getPublicStorageRange(blockHash, contractAddress, startStorageSlot, numberOfElements);
360
+ this.logger.debug(`Oracle storage read: start=${startStorageSlot.toString()} count=${numberOfElements} ` + `address=${contractAddress.toString()} values=[${values.join(', ')}]`);
354
361
  return values;
355
362
  });
356
363
  }
@@ -360,7 +367,7 @@ import { buildACIRCallback } from './acir_callback.js';
360
367
  if (!this.contractLogger) {
361
368
  // Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
362
369
  // to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
363
- this.contractLogger = await createContractLogger(this.contractAddress, (addr)=>this.contractStore.getDebugContractName(addr), 'user', {
370
+ this.contractLogger = await createContractLogger(this.contractAddress, (addr)=>this.anchoredContractData.getDebugContractName(addr), 'user', {
364
371
  instanceId: this.jobId
365
372
  });
366
373
  }
@@ -372,7 +379,7 @@ import { buildACIRCallback } from './acir_callback.js';
372
379
  if (!this.aztecnrLogger) {
373
380
  // Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
374
381
  // to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
375
- this.aztecnrLogger = await createContractLogger(this.contractAddress, (addr)=>this.contractStore.getDebugContractName(addr), 'aztecnr', {
382
+ this.aztecnrLogger = await createContractLogger(this.contractAddress, (addr)=>this.anchoredContractData.getDebugContractName(addr), 'aztecnr', {
376
383
  instanceId: this.jobId
377
384
  });
378
385
  }
@@ -386,14 +393,14 @@ import { buildACIRCallback } from './acir_callback.js';
386
393
  const logger = kind == 'aztecnr' ? await this.#getAztecnrLogger() : await this.#getContractLogger();
387
394
  logContractMessage(logger, LogLevels[level], strippedMessage, fields);
388
395
  }
389
- /** Fetches pending tagged logs into a freshly allocated ephemeral array and returns it. */ async getPendingTaggedLogs(scope, providedSecrets) {
396
+ /** Fetches pending tagged logs into a freshly allocated ephemeral array and returns it. */ async getPendingTaggedLogsV2(scope, providedSecrets) {
390
397
  const secrets = providedSecrets.readAll(this.ephemeralArrayService).map((ps)=>new AppTaggingSecret(ps.secret, this.contractAddress, ps.mode));
391
398
  const logService = this.#createLogService();
392
399
  const logs = await logService.fetchTaggedLogs(this.contractAddress, scope, secrets);
393
400
  return EphemeralArray.fromValues(this.ephemeralArrayService, logs);
394
401
  }
395
402
  #createLogService() {
396
- return new LogService(this.aztecNode, this.anchorBlockHeader, this.l2TipsStore, this.keyStore, this.recipientTaggingStore, this.taggingSecretSourcesStore, this.addressStore, this.jobId, this.logger.getBindings());
403
+ return new LogService(this.aztecNode, this.anchorBlockHeader, this.l2TipsStore, this.keyStore, this.recipientTaggingStore, this.taggingSecretSourcesStore, this.addressStore, this.scopes, this.jobId, this.logger.getBindings());
397
404
  }
398
405
  async validateAndStoreEnqueuedNotesAndEvents(noteValidationRequests, eventValidationRequests, scope) {
399
406
  await this.#processValidationRequests(noteValidationRequests.readAll(this.ephemeralArrayService), eventValidationRequests.readAll(this.ephemeralArrayService), scope);
@@ -410,7 +417,7 @@ import { buildACIRCallback } from './acir_callback.js';
410
417
  eventService.validateAndStoreEvents(eventValidationRequests, scope, txEffects)
411
418
  ]);
412
419
  }
413
- async getLogsByTag(requests) {
420
+ async getLogsByTagV2(requests) {
414
421
  const logRetrievalRequests = requests.readAll(this.ephemeralArrayService);
415
422
  const logService = this.#createLogService();
416
423
  const logRetrievalResponses = await logService.fetchLogsByTag(this.contractAddress, logRetrievalRequests);
@@ -431,22 +438,21 @@ import { buildACIRCallback } from './acir_callback.js';
431
438
  if (txHash.hash.isZero()) {
432
439
  throw new Error('Invalid tx hash passed into aztec_utl_getTxEffect oracle handler');
433
440
  }
434
- const receipt = await this.aztecNode.getTxReceipt(txHash, {
435
- includeTxEffect: true
436
- });
437
- if (!receipt.isMined() || !receipt.txEffect || receipt.blockNumber > this.anchorBlockHeader.getBlockNumber()) {
438
- return Option.none();
441
+ return await this.#getTxEffectOption(txHash);
442
+ }
443
+ /** Fetches transaction effects for all hashes, preserving request order. */ async getTxEffects(txHashes) {
444
+ const hashes = txHashes.readAll(this.ephemeralArrayService);
445
+ const invalidHash = hashes.find((txHash)=>txHash.hash.isZero());
446
+ if (invalidHash) {
447
+ throw new Error('Invalid tx hash passed into aztec_utl_getTxEffects oracle handler');
439
448
  }
440
- const txEffect = receipt.txEffect;
441
- return Option.some({
442
- ...txEffect,
443
- publicLogs: FlatPublicLogs.fromLogs(txEffect.publicLogs),
444
- contractClassLogs: txEffect.contractClassLogs.map((log)=>({
445
- contractAddress: log.contractAddress,
446
- fields: log.fields.toFields(),
447
- emittedLength: log.emittedLength
448
- }))
449
- });
449
+ const uniqueTxHashes = uniqueBy(hashes, (h)=>h.toString());
450
+ const options = await Promise.all(uniqueTxHashes.map((txHash)=>this.#getTxEffectOption(txHash)));
451
+ const optionsByHash = new Map(uniqueTxHashes.map((txHash, i)=>[
452
+ txHash.toString(),
453
+ options[i]
454
+ ]));
455
+ return EphemeralArray.fromValues(this.ephemeralArrayService, hashes.map((txHash)=>optionsByHash.get(txHash.toString())));
450
456
  }
451
457
  setCapsule(contractAddress, slot, capsule, scope) {
452
458
  this.#assertOwnContract(contractAddress);
@@ -491,12 +497,14 @@ import { buildACIRCallback } from './acir_callback.js';
491
497
  * Returns a fact collection.
492
498
  */ async getFactCollection(contractAddress, scope, factCollectionTypeId, factCollectionId) {
493
499
  this.#assertOwnContract(contractAddress);
494
- const collection = await this.factService.getFactCollection(new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId), this.jobId);
500
+ const tips = anchoredTipBlockNumbers(await this.l2TipsStore.getL2Tips(), this.anchorBlockHeader.getBlockNumber());
501
+ const collection = await this.factService.getFactCollection(new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId), tips, this.jobId);
495
502
  return collection ? Option.some(toNoirFactCollection(this.ephemeralArrayService, contractAddress, scope, factCollectionTypeId, factCollectionId, collection.facts)) : Option.none(emptyFactCollection(this.ephemeralArrayService));
496
503
  }
497
504
  /** Returns every fact collection of `factCollectionTypeId`. */ async getFactCollectionsByType(contractAddress, scope, factCollectionTypeId) {
498
505
  this.#assertOwnContract(contractAddress);
499
- const collections = await this.factService.getFactCollectionsByType(new FactCollectionTypeKey(contractAddress, scope, factCollectionTypeId), this.jobId);
506
+ const tips = anchoredTipBlockNumbers(await this.l2TipsStore.getL2Tips(), this.anchorBlockHeader.getBlockNumber());
507
+ const collections = await this.factService.getFactCollectionsByType(new FactCollectionTypeKey(contractAddress, scope, factCollectionTypeId), tips, this.jobId);
500
508
  return EphemeralArray.fromValues(this.ephemeralArrayService, collections.map((collection)=>toNoirFactCollection(this.ephemeralArrayService, collection.key.contractAddress, collection.key.scope, collection.key.factCollectionTypeId, collection.key.factCollectionId, collection.facts)));
501
509
  }
502
510
  /**
@@ -531,17 +539,29 @@ import { buildACIRCallback } from './acir_callback.js';
531
539
  * @param address - The recipient address.
532
540
  * @param ephPks - Ephemeral array containing the serialized Points.
533
541
  * @param contractAddress - The contract address for app-siloing (validated against execution context).
534
- * @returns A new ephemeral array containing the computed shared secrets.
542
+ * @returns A new ephemeral array containing the computed shared secrets, or an empty array when the PXE does not
543
+ * hold the keys for `address`.
544
+ * @throws If `address` is not in the execution's allowed scopes.
535
545
  */ async getSharedSecrets(address, ephPks, contractAddress) {
536
546
  if (!contractAddress.equals(this.contractAddress)) {
537
547
  throw new Error(`getSharedSecrets called with contract address ${contractAddress}, expected ${this.contractAddress}`);
538
548
  }
539
- const recipientCompleteAddress = await this.getCompleteAddressOrFail(address);
549
+ assertAllowedScope(address, this.scopes);
550
+ // An address can be in scope without the PXE holding its keys (e.g. syncing a registered but non-owned account),
551
+ // in which case no secrets can be derived and we return an empty array rather than failing.
552
+ const recipientCompleteAddress = await this.addressStore.getCompleteAddress(address);
553
+ if (!recipientCompleteAddress) {
554
+ this.logger.warn(`Computing shared secrets for address ${address} whose keys are not held - returning no secrets`, {
555
+ address,
556
+ contractAddress: this.contractAddress
557
+ });
558
+ return EphemeralArray.fromValues(this.ephemeralArrayService, []);
559
+ }
540
560
  const ivpkMHash = await hashPublicKey(recipientCompleteAddress.publicKeys.ivpkM);
541
561
  const ivskM = await this.keyStore.getMasterSecretKey(ivpkMHash);
542
562
  const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
543
563
  const ephPkPoints = ephPks.readAll(this.ephemeralArrayService);
544
- const secrets = await Promise.all(ephPkPoints.map(({ x, y })=>deriveAppSiloedSharedSecret(addressSecret, new Point(x, y), this.contractAddress)));
564
+ const secrets = await Promise.all(ephPkPoints.map(({ x, y })=>appSiloEcdhSharedSecret(addressSecret, new Point(x, y), this.contractAddress)));
545
565
  return EphemeralArray.fromValues(this.ephemeralArrayService, secrets);
546
566
  }
547
567
  pushEphemeral(slot, elements) {
@@ -594,19 +614,25 @@ import { buildACIRCallback } from './acir_callback.js';
594
614
  return Promise.resolve();
595
615
  }
596
616
  /** Executes another utility function from within this one and returns its serialized return values. */ async callUtilityFunction(targetContractAddress, functionSelector, args) {
597
- const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(targetContractAddress, functionSelector);
617
+ const targetArtifact = await this.anchoredContractData.getFunctionArtifactWithDebugMetadata(targetContractAddress, functionSelector);
618
+ if (!targetArtifact) {
619
+ throw new Error(`Cannot call ${targetContractAddress}:${functionSelector}: the contract is not registered. ` + `Register it via wallet.registerContract(...).`);
620
+ }
598
621
  if (!targetContractAddress.equals(this.contractAddress)) {
599
622
  // Standard handshake registry reads are authorized by default; every other cross-contract call needs the hook.
600
623
  if (!await isStandardHandshakeRegistryUtilityRead(targetContractAddress, functionSelector)) {
601
- const [callerInstance, targetInstance] = await Promise.all([
602
- this.getContractInstance(this.contractAddress),
603
- this.getContractInstance(targetContractAddress)
624
+ const [callerClassId, targetClassId] = await Promise.all([
625
+ this.anchoredContractData.getCurrentClassId(this.contractAddress),
626
+ this.anchoredContractData.getCurrentClassId(targetContractAddress)
604
627
  ]);
628
+ if (!callerClassId || !targetClassId) {
629
+ throw new Error(`Cannot authorize utility call from ${this.contractAddress} to ${targetContractAddress}: ` + `${!callerClassId ? this.contractAddress : targetContractAddress} is not registered.`);
630
+ }
605
631
  const request = {
606
632
  caller: this.contractAddress,
607
- callerClassId: callerInstance.currentContractClassId,
633
+ callerClassId,
608
634
  target: targetContractAddress,
609
- targetClassId: targetInstance.currentContractClassId,
635
+ targetClassId,
610
636
  functionSelector,
611
637
  functionName: targetArtifact.name,
612
638
  args,
@@ -634,7 +660,7 @@ import { buildACIRCallback } from './acir_callback.js';
634
660
  authWitnesses: this.authWitnesses,
635
661
  capsules: this.capsules,
636
662
  anchorBlockHeader: this.anchorBlockHeader,
637
- contractStore: this.contractStore,
663
+ anchoredContractData: this.anchoredContractData,
638
664
  noteStore: this.noteStore,
639
665
  keyStore: this.keyStore,
640
666
  addressStore: this.addressStore,
@@ -676,9 +702,7 @@ import { buildACIRCallback } from './acir_callback.js';
676
702
  * once. Returns a map keyed by `TxHash.toString()`; hashes for which the node has no tx effect are omitted.
677
703
  */ async #fetchTxEffects(txHashes) {
678
704
  const uniqueTxHashes = uniqueBy(txHashes, (h)=>h.toString());
679
- const fetched = await Promise.all(uniqueTxHashes.map((h)=>this.aztecNode.getTxReceipt(h, {
680
- includeTxEffect: true
681
- })));
705
+ const fetched = await Promise.all(uniqueTxHashes.map((h)=>this.aztecNodeReadCache.getTxReceiptWithEffect(h)));
682
706
  return new Map(uniqueTxHashes.map((h, i)=>{
683
707
  const receipt = fetched[i];
684
708
  if (!receipt.isMined() || !receipt.txEffect) {
@@ -699,6 +723,24 @@ import { buildACIRCallback } from './acir_callback.js';
699
723
  ];
700
724
  }).filter((entry)=>entry[1] !== undefined));
701
725
  }
726
+ async #getTxEffectOption(txHash) {
727
+ const receipt = await this.aztecNodeReadCache.getTxReceiptWithEffect(txHash);
728
+ if (!receipt.isMined() || !receipt.txEffect || receipt.blockNumber > this.anchorBlockHeader.getBlockNumber()) {
729
+ return Option.none();
730
+ }
731
+ return Option.some(this.#toTxEffectData(receipt.txEffect));
732
+ }
733
+ #toTxEffectData(txEffect) {
734
+ return {
735
+ ...txEffect,
736
+ publicLogs: FlatPublicLogs.fromLogs(txEffect.publicLogs),
737
+ contractClassLogs: txEffect.contractClassLogs.map((log)=>({
738
+ contractAddress: log.contractAddress,
739
+ fields: log.fields.toFields(),
740
+ emittedLength: log.emittedLength
741
+ }))
742
+ };
743
+ }
702
744
  /** Runs a query concurrently with a validation that the block hash is not ahead of the anchor block. */ async #queryWithBlockHashNotAfterAnchor(blockHash, query) {
703
745
  // Most contracts query state at the "current" block, which is the anchor. Skip the validation when we can.
704
746
  const anchorHash = await this.anchorBlockHeader.hash();
@@ -708,7 +750,7 @@ import { buildACIRCallback } from './acir_callback.js';
708
750
  const [response] = await Promise.all([
709
751
  query(),
710
752
  (async ()=>{
711
- const block = await this.aztecNode.getBlock(blockHash);
753
+ const block = await this.aztecNodeReadCache.getBlock(blockHash);
712
754
  const header = block?.header;
713
755
  if (!header) {
714
756
  throw new Error(`Could not find block header for block hash ${blockHash}`);
@@ -727,8 +769,14 @@ import { buildACIRCallback } from './acir_callback.js';
727
769
  return this.callContext.contractAddress;
728
770
  }
729
771
  }
730
- const STANDARD_HANDSHAKE_REGISTRY_GET_HANDSHAKES_SIGNATURE = 'get_handshakes((Field),u32)';
731
- const STANDARD_HANDSHAKE_REGISTRY_GET_APP_SILOED_SECRET_SIGNATURE = 'get_app_siloed_secret((Field),(Field))';
772
+ // Registry reads that any contract may issue without an `authorizeUtilityCall` hook. The constrained-delivery
773
+ // library calls these implicitly for the app, and they are safe to default-authorize: `get_app_siloed_secrets`
774
+ // siloes every returned secret to `msg_sender`, and `get_non_interactive_handshakes` only exposes ephemeral public
775
+ // keys, from which the shared secret cannot be derived without the recipient's secret keys.
776
+ const STANDARD_HANDSHAKE_REGISTRY_DEFAULT_AUTHORIZED_READ_SIGNATURES = [
777
+ 'get_non_interactive_handshakes((Field),u32)',
778
+ 'get_app_siloed_secrets((Field),(Field))'
779
+ ];
732
780
  async function doesSelectorHaveSignature(functionSelector, signature) {
733
781
  return functionSelector.equals(await FunctionSelector.fromSignature(signature));
734
782
  }
@@ -741,9 +789,6 @@ async function doesSelectorHaveSignature(functionSelector, signature) {
741
789
  if (!targetContractAddress.equals(STANDARD_HANDSHAKE_REGISTRY_ADDRESS)) {
742
790
  return false;
743
791
  }
744
- const [isGetHandshakes, isGetAppSiloedSecret] = await Promise.all([
745
- doesSelectorHaveSignature(functionSelector, STANDARD_HANDSHAKE_REGISTRY_GET_HANDSHAKES_SIGNATURE),
746
- doesSelectorHaveSignature(functionSelector, STANDARD_HANDSHAKE_REGISTRY_GET_APP_SILOED_SECRET_SIGNATURE)
747
- ]);
748
- return isGetHandshakes || isGetAppSiloedSecret;
792
+ const matches = await Promise.all(STANDARD_HANDSHAKE_REGISTRY_DEFAULT_AUTHORIZED_READ_SIGNATURES.map((signature)=>doesSelectorHaveSignature(functionSelector, signature)));
793
+ return matches.some(Boolean);
749
794
  }
@@ -4,8 +4,8 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import type { NoteDao } from '@aztec/stdlib/note';
5
5
  import type { ContractOverrides } from '@aztec/stdlib/tx';
6
6
  import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
7
+ import type { ContractSyncService } from '../contract/contract_sync_service.js';
7
8
  import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
8
- import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
9
9
  import type { NotesFilter } from '../notes_filter.js';
10
10
  import type { AnchorBlockStore } from '../storage/index.js';
11
11
  import type { NoteStore } from '../storage/note_store/note_store.js';
@@ -37,4 +37,4 @@ export declare class PXEDebugUtils {
37
37
  */
38
38
  getNotes(filter: NotesFilter): Promise<NoteDao[]>;
39
39
  }
40
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlX2RlYnVnX3V0aWxzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGVidWcvcHhlX2RlYnVnX3V0aWxzL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AE,CAAC,CAoBvD;CACF"}
@@ -6,4 +6,5 @@ export * from '../../../contract_logging.js';
6
6
  export * from '../../../storage/index.js';
7
7
  export * from './utils.js';
8
8
  export type { PXECreationOptions } from '../../pxe_creation_options.js';
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvYnVuZGxlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYyw4QkFBOEIsQ0FBQztBQUM3QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsWUFBWSxDQUFDO0FBQzNCLFlBQVksRUFBRSxrQkFBa0IsRUFBRSxNQUFNLCtCQUErQixDQUFDIn0=
9
+ export { openBrowserStore } from '../store.js';
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvYnVuZGxlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYyw4QkFBOEIsQ0FBQztBQUM3QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsWUFBWSxDQUFDO0FBQzNCLFlBQVksRUFBRSxrQkFBa0IsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGFBQWEsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
@@ -5,3 +5,4 @@ export * from '../../../error_enriching.js';
5
5
  export * from '../../../contract_logging.js';
6
6
  export * from '../../../storage/index.js';
7
7
  export * from './utils.js';
8
+ export { openBrowserStore } from '../store.js';
@@ -13,4 +13,4 @@ import { type PXECreationOptions } from '../../pxe_creation_options.js';
13
13
  * @returns A Promise that resolves to the started PXE instance.
14
14
  */
15
15
  export declare function createPXE(aztecNode: AztecNode, config: PXEConfig, options?: PXECreationOptions): Promise<PXE>;
16
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvd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U0FBUyxDQUM3QixTQUFTLEVBQUUsU0FBUyxFQUNwQixNQUFNLEVBQUUsU0FBUyxFQUNqQixPQUFPLEdBQUUsa0JBQW9DLGdCQTREOUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,+BAA+B,CAAC;AAE/F;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,gBAgD9C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,+BAA+B,CAAC;AAG/F;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,gBA4D9C"}
@@ -1,6 +1,5 @@
1
1
  import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
- import { createStore } from '@aztec/kv-store/indexeddb';
4
3
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
5
4
  import { WASMSimulator } from '@aztec/simulator/client';
6
5
  import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
@@ -9,6 +8,7 @@ import { getStandardMultiCallEntrypoint } from '@aztec/standard-contracts/multi-
9
8
  import { PXE } from '../../../pxe.js';
10
9
  import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
11
10
  import { isPrivateKernelProver } from '../../pxe_creation_options.js';
11
+ import { openBrowserStore } from '../store.js';
12
12
  /**
13
13
  * Create and start an PXE instance with the given AztecNode.
14
14
  * If no keyStore or database is provided, it will use KeyStore and MemoryDB as default values.
@@ -23,15 +23,21 @@ import { isPrivateKernelProver } from '../../pxe_creation_options.js';
23
23
  }) {
24
24
  const actor = options.loggerActorLabel;
25
25
  const loggers = options.loggers ?? {};
26
- const l1ContractAddresses = await aztecNode.getL1ContractAddresses();
26
+ const { l1ChainId, l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
27
27
  const configWithContracts = {
28
28
  ...config,
29
- ...l1ContractAddresses
29
+ ...l1ContractAddresses,
30
+ l1ChainId,
31
+ rollupVersion
30
32
  };
31
- const storeLogger = loggers.store ?? createLogger('pxe:data:idb', {
33
+ const storeLogger = loggers.store ?? createLogger('pxe:data', {
32
34
  actor
33
35
  });
34
- const store = options.store ?? await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger);
36
+ const store = options.store ?? await openBrowserStore('pxe_data', PXE_DATA_SCHEMA_VERSION, {
37
+ l1ChainId,
38
+ rollupAddress: l1ContractAddresses.rollupAddress,
39
+ dataStoreMapSizeKb: configWithContracts.dataStoreMapSizeKb
40
+ }, storeLogger);
35
41
  const simulator = options.simulator ?? new WASMSimulator();
36
42
  const proverLogger = loggers.prover ?? createLogger('pxe:bb:wasm:bundle', {
37
43
  actor
@@ -6,4 +6,5 @@ export * from '../../../error_enriching.js';
6
6
  export * from '../../../contract_logging.js';
7
7
  export * from './utils.js';
8
8
  export { type PXECreationOptions } from '../../pxe_creation_options.js';
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvbGF6eS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYyw4QkFBOEIsQ0FBQztBQUM3QyxjQUFjLFlBQVksQ0FBQztBQUMzQixPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBRSxNQUFNLCtCQUErQixDQUFDIn0=
9
+ export { openBrowserStore } from '../store.js';
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvbGF6eS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYyw4QkFBOEIsQ0FBQztBQUM3QyxjQUFjLFlBQVksQ0FBQztBQUMzQixPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGFBQWEsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
@@ -5,3 +5,4 @@ export * from '../../../storage/index.js';
5
5
  export * from '../../../error_enriching.js';
6
6
  export * from '../../../contract_logging.js';
7
7
  export * from './utils.js';
8
+ export { openBrowserStore } from '../store.js';
@@ -12,4 +12,4 @@ import { type PXECreationOptions } from '../../pxe_creation_options.js';
12
12
  * @returns A Promise that resolves to the started PXE instance.
13
13
  */
14
14
  export declare function createPXE(aztecNode: AztecNode, config: PXEConfig, options?: PXECreationOptions): Promise<PXE>;
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvbGF6eS91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hc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.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,+BAA+B,CAAC;AAE/F;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,gBAiD9C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,+BAA+B,CAAC;AAG/F;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,gBA6D9C"}
@@ -1,6 +1,5 @@
1
1
  import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
- import { createStore } from '@aztec/kv-store/indexeddb';
4
3
  import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
5
4
  import { WASMSimulator } from '@aztec/simulator/client';
6
5
  import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry/lazy';
@@ -9,6 +8,7 @@ import { getStandardMultiCallEntrypoint } from '@aztec/standard-contracts/multi-
9
8
  import { PXE } from '../../../pxe.js';
10
9
  import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
11
10
  import { isPrivateKernelProver } from '../../pxe_creation_options.js';
11
+ import { openBrowserStore } from '../store.js';
12
12
  /**
13
13
  * Create and start an PXE instance with the given AztecNode.
14
14
  * Returns a Promise that resolves to the started PXE instance.
@@ -21,16 +21,22 @@ import { isPrivateKernelProver } from '../../pxe_creation_options.js';
21
21
  loggers: {}
22
22
  }) {
23
23
  const actor = options.loggerActorLabel;
24
- const l1ContractAddresses = await aztecNode.getL1ContractAddresses();
24
+ const { l1ChainId, l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
25
25
  const configWithContracts = {
26
26
  ...config,
27
- ...l1ContractAddresses
27
+ ...l1ContractAddresses,
28
+ l1ChainId,
29
+ rollupVersion
28
30
  };
29
31
  const loggers = options.loggers ?? {};
30
- const storeLogger = loggers.store ?? createLogger('pxe:data:idb', {
32
+ const storeLogger = loggers.store ?? createLogger('pxe:data', {
31
33
  actor
32
34
  });
33
- const store = options.store ?? await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger);
35
+ const store = options.store ?? await openBrowserStore('pxe_data', PXE_DATA_SCHEMA_VERSION, {
36
+ l1ChainId,
37
+ rollupAddress: l1ContractAddresses.rollupAddress,
38
+ dataStoreMapSizeKb: configWithContracts.dataStoreMapSizeKb
39
+ }, storeLogger);
34
40
  const simulator = options.simulator ?? new WASMSimulator();
35
41
  const proverLogger = loggers.prover ?? createLogger('pxe:bb:wasm:bundle', {
36
42
  actor
@@ -0,0 +1,14 @@
1
+ import type { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { type Logger } from '@aztec/foundation/log';
3
+ import { AztecSQLiteOPFSStore } from '@aztec/kv-store/sqlite-opfs';
4
+ /**
5
+ * Opens the persistent browser (sqlite-opfs) store selected by `name` and identity `(config.l1ChainId,
6
+ * config.rollupAddress, schemaVersion)` triple. A store exists per identity: reopening with the same identity returns
7
+ * the same data, a different identity selects a different (possibly fresh) store.
8
+ */
9
+ export declare function openBrowserStore(name: string, schemaVersion: number, config: {
10
+ l1ChainId: number;
11
+ rollupAddress: EthAddress;
12
+ dataStoreMapSizeKb?: number;
13
+ }, log?: Logger): Promise<AztecSQLiteOPFSStore>;
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBQ2xFLE9BQU8sRUFBRSxvQkFBb0IsRUFBc0IsTUFBTSw2QkFBNkIsQ0FBQztBQUl2Rjs7OztHQUlHO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUNwQyxJQUFJLEVBQUUsTUFBTSxFQUNaLGFBQWEsRUFBRSxNQUFNLEVBQ3JCLE1BQU0sRUFBRTtJQUFFLFNBQVMsRUFBRSxNQUFNLENBQUM7SUFBQyxhQUFhLEVBQUUsVUFBVSxDQUFDO0lBQUMsa0JBQWtCLENBQUMsRUFBRSxNQUFNLENBQUE7Q0FBRSxFQUNyRixHQUFHLEdBQUUsTUFBaUMsR0FDckMsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBcUIvQiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/client/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAsB,MAAM,6BAA6B,CAAC;AAIvF;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,UAAU,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,EACrF,GAAG,GAAE,MAAiC,GACrC,OAAO,CAAC,oBAAoB,CAAC,CAqB/B"}
@@ -0,0 +1,28 @@
1
+ import { createLogger } from '@aztec/foundation/log';
2
+ import { AztecSQLiteOPFSStore, storePoolDirectory } from '@aztec/kv-store/sqlite-opfs';
3
+ import { assertStoreIdentity, effectiveStoreName } from '../../storage/store_identity.js';
4
+ /**
5
+ * Opens the persistent browser (sqlite-opfs) store selected by `name` and identity `(config.l1ChainId,
6
+ * config.rollupAddress, schemaVersion)` triple. A store exists per identity: reopening with the same identity returns
7
+ * the same data, a different identity selects a different (possibly fresh) store.
8
+ */ export async function openBrowserStore(name, schemaVersion, config, log = createLogger('pxe:data')) {
9
+ const identity = {
10
+ l1ChainId: config.l1ChainId,
11
+ rollupAddress: config.rollupAddress,
12
+ schemaVersion
13
+ };
14
+ const storeName = effectiveStoreName(name, identity);
15
+ log.info(`Creating ${storeName} SQLite-OPFS data store`, {
16
+ storeName,
17
+ dataStoreMapSizeKb: config.dataStoreMapSizeKb
18
+ });
19
+ const store = await AztecSQLiteOPFSStore.open(createLogger('kv-store:sqlite-opfs'), storeName, false, storePoolDirectory(storeName));
20
+ try {
21
+ await assertStoreIdentity(store, storeName, identity);
22
+ } catch (err) {
23
+ // The store handle owns a worker and OPFS locks; release them before surfacing the refusal.
24
+ await store.close().catch(()=>{});
25
+ throw err;
26
+ }
27
+ return store;
28
+ }