@aztec/pxe 0.0.1-commit.c80b6263 → 0.0.1-commit.c949de6bc

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 (194) hide show
  1. package/dest/access_scopes.d.ts +9 -0
  2. package/dest/access_scopes.d.ts.map +1 -0
  3. package/dest/access_scopes.js +6 -0
  4. package/dest/block_synchronizer/block_synchronizer.d.ts +4 -2
  5. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  6. package/dest/block_synchronizer/block_synchronizer.js +7 -1
  7. package/dest/config/package_info.js +1 -1
  8. package/dest/contract_function_simulator/contract_function_simulator.d.ts +54 -30
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  10. package/dest/contract_function_simulator/contract_function_simulator.js +174 -70
  11. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
  12. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
  14. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  15. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  16. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  18. package/dest/contract_function_simulator/oracle/interfaces.d.ts +9 -9
  19. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/oracle/oracle.d.ts +5 -5
  21. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/oracle/oracle.js +32 -20
  23. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +36 -36
  24. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +74 -29
  26. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +48 -24
  27. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +84 -63
  29. package/dest/contract_logging.d.ts +22 -0
  30. package/dest/contract_logging.d.ts.map +1 -0
  31. package/dest/contract_logging.js +23 -0
  32. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  33. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  34. package/dest/contract_sync/contract_sync_service.js +97 -0
  35. package/dest/contract_sync/helpers.d.ts +29 -0
  36. package/dest/contract_sync/helpers.d.ts.map +1 -0
  37. package/dest/contract_sync/{index.js → helpers.js} +13 -12
  38. package/dest/debug/pxe_debug_utils.d.ts +14 -10
  39. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  40. package/dest/debug/pxe_debug_utils.js +16 -15
  41. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  42. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  43. package/dest/entrypoints/client/bundle/index.js +3 -0
  44. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  45. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  46. package/dest/entrypoints/client/bundle/utils.js +11 -2
  47. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  48. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  49. package/dest/entrypoints/client/lazy/index.js +3 -0
  50. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  51. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  52. package/dest/entrypoints/client/lazy/utils.js +11 -2
  53. package/dest/entrypoints/server/index.d.ts +4 -2
  54. package/dest/entrypoints/server/index.d.ts.map +1 -1
  55. package/dest/entrypoints/server/index.js +3 -1
  56. package/dest/entrypoints/server/utils.js +9 -1
  57. package/dest/events/event_service.d.ts +4 -5
  58. package/dest/events/event_service.d.ts.map +1 -1
  59. package/dest/events/event_service.js +5 -6
  60. package/dest/logs/log_service.d.ts +6 -5
  61. package/dest/logs/log_service.d.ts.map +1 -1
  62. package/dest/logs/log_service.js +18 -28
  63. package/dest/notes/note_service.d.ts +7 -7
  64. package/dest/notes/note_service.d.ts.map +1 -1
  65. package/dest/notes/note_service.js +9 -9
  66. package/dest/notes_filter.d.ts +25 -0
  67. package/dest/notes_filter.d.ts.map +1 -0
  68. package/dest/notes_filter.js +4 -0
  69. package/dest/oracle_version.d.ts +3 -3
  70. package/dest/oracle_version.d.ts.map +1 -1
  71. package/dest/oracle_version.js +2 -2
  72. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  73. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  74. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  75. package/dest/private_kernel/hints/index.d.ts +1 -1
  76. package/dest/private_kernel/hints/index.js +1 -1
  77. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
  78. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  79. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
  80. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  81. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  82. package/dest/private_kernel/hints/test_utils.js +203 -0
  83. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  84. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  85. package/dest/private_kernel/private_kernel_execution_prover.js +19 -11
  86. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
  87. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  88. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  89. package/dest/pxe.d.ts +69 -23
  90. package/dest/pxe.d.ts.map +1 -1
  91. package/dest/pxe.js +94 -61
  92. package/dest/storage/address_store/address_store.d.ts +1 -1
  93. package/dest/storage/address_store/address_store.d.ts.map +1 -1
  94. package/dest/storage/address_store/address_store.js +12 -11
  95. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
  96. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  97. package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
  98. package/dest/storage/capsule_store/capsule_store.js +6 -8
  99. package/dest/storage/contract_store/contract_store.d.ts +42 -15
  100. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  101. package/dest/storage/contract_store/contract_store.js +157 -72
  102. package/dest/storage/metadata.d.ts +1 -1
  103. package/dest/storage/metadata.js +1 -1
  104. package/dest/storage/note_store/note_store.d.ts +13 -3
  105. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  106. package/dest/storage/note_store/note_store.js +147 -107
  107. package/dest/storage/private_event_store/private_event_store.d.ts +1 -1
  108. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  109. package/dest/storage/private_event_store/private_event_store.js +84 -61
  110. package/dest/storage/private_event_store/stored_private_event.js +1 -1
  111. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  112. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  113. package/dest/storage/tagging_store/recipient_tagging_store.js +31 -19
  114. package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
  115. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
  116. package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
  117. package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
  118. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  119. package/dest/storage/tagging_store/sender_tagging_store.js +184 -114
  120. package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
  121. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  122. package/dest/tagging/get_all_logs_by_tags.js +17 -3
  123. package/dest/tagging/index.d.ts +2 -2
  124. package/dest/tagging/index.d.ts.map +1 -1
  125. package/dest/tagging/index.js +1 -1
  126. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
  127. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  128. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
  129. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  130. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
  131. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  132. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
  133. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
  134. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  135. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
  136. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
  137. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  138. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +14 -15
  139. package/package.json +25 -16
  140. package/src/access_scopes.ts +9 -0
  141. package/src/block_synchronizer/block_synchronizer.ts +6 -0
  142. package/src/config/package_info.ts +1 -1
  143. package/src/contract_function_simulator/contract_function_simulator.ts +323 -128
  144. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
  145. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  146. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  147. package/src/contract_function_simulator/oracle/interfaces.ts +10 -10
  148. package/src/contract_function_simulator/oracle/oracle.ts +35 -18
  149. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +100 -110
  150. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +131 -64
  151. package/src/contract_logging.ts +39 -0
  152. package/src/contract_sync/contract_sync_service.ts +152 -0
  153. package/src/contract_sync/{index.ts → helpers.ts} +21 -21
  154. package/src/debug/pxe_debug_utils.ts +48 -18
  155. package/src/entrypoints/client/bundle/index.ts +3 -0
  156. package/src/entrypoints/client/bundle/utils.ts +12 -2
  157. package/src/entrypoints/client/lazy/index.ts +3 -0
  158. package/src/entrypoints/client/lazy/utils.ts +12 -2
  159. package/src/entrypoints/server/index.ts +3 -1
  160. package/src/entrypoints/server/utils.ts +7 -7
  161. package/src/events/event_service.ts +4 -6
  162. package/src/logs/log_service.ts +25 -35
  163. package/src/notes/note_service.ts +9 -10
  164. package/src/notes_filter.ts +26 -0
  165. package/src/oracle_version.ts +2 -2
  166. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  167. package/src/private_kernel/hints/index.ts +1 -1
  168. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
  169. package/src/private_kernel/hints/test_utils.ts +325 -0
  170. package/src/private_kernel/private_kernel_execution_prover.ts +19 -12
  171. package/src/private_kernel/private_kernel_oracle.ts +7 -7
  172. package/src/pxe.ts +178 -111
  173. package/src/storage/address_store/address_store.ts +15 -15
  174. package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
  175. package/src/storage/capsule_store/capsule_store.ts +8 -8
  176. package/src/storage/contract_store/contract_store.ts +186 -76
  177. package/src/storage/metadata.ts +1 -1
  178. package/src/storage/note_store/note_store.ts +169 -132
  179. package/src/storage/private_event_store/private_event_store.ts +102 -81
  180. package/src/storage/private_event_store/stored_private_event.ts +1 -1
  181. package/src/storage/tagging_store/recipient_tagging_store.ts +38 -24
  182. package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
  183. package/src/storage/tagging_store/sender_tagging_store.ts +214 -130
  184. package/src/tagging/get_all_logs_by_tags.ts +28 -4
  185. package/src/tagging/index.ts +1 -1
  186. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -10
  187. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  188. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
  189. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
  190. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
  191. package/dest/contract_sync/index.d.ts +0 -23
  192. package/dest/contract_sync/index.d.ts.map +0 -1
  193. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  194. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
package/dest/pxe.js CHANGED
@@ -13,7 +13,9 @@ import { BlockSynchronizer } from './block_synchronizer/index.js';
13
13
  import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
14
14
  import { ContractFunctionSimulator, generateSimulatedProvingResult } from './contract_function_simulator/contract_function_simulator.js';
15
15
  import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
16
- import { ensureContractSynced, readCurrentClassId } from './contract_sync/index.js';
16
+ import { displayDebugLogs } from './contract_logging.js';
17
+ import { ContractSyncService } from './contract_sync/contract_sync_service.js';
18
+ import { readCurrentClassId } from './contract_sync/helpers.js';
17
19
  import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
18
20
  import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
19
21
  import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
@@ -45,6 +47,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
45
47
  recipientTaggingStore;
46
48
  addressStore;
47
49
  privateEventStore;
50
+ contractSyncService;
48
51
  simulator;
49
52
  proverEnabled;
50
53
  proofCreator;
@@ -53,7 +56,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
53
56
  jobQueue;
54
57
  jobCoordinator;
55
58
  debug;
56
- constructor(node, blockStateSynchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debug){
59
+ constructor(node, blockStateSynchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, contractSyncService, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debug){
57
60
  this.node = node;
58
61
  this.blockStateSynchronizer = blockStateSynchronizer;
59
62
  this.keyStore = keyStore;
@@ -66,6 +69,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
66
69
  this.recipientTaggingStore = recipientTaggingStore;
67
70
  this.addressStore = addressStore;
68
71
  this.privateEventStore = privateEventStore;
72
+ this.contractSyncService = contractSyncService;
69
73
  this.simulator = simulator;
70
74
  this.proverEnabled = proverEnabled;
71
75
  this.proofCreator = proofCreator;
@@ -81,11 +85,12 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
81
85
  * can be contacted.
82
86
  *
83
87
  * @returns A promise that resolves PXE is ready to be used.
84
- */ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
88
+ */ static async create({ node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix }) {
85
89
  // Extract bindings from the logger, or use empty bindings if a string suffix is provided.
86
90
  const bindings = loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
87
91
  const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
88
- const proverEnabled = !!config.proverEnabled;
92
+ const info = await node.getNodeInfo();
93
+ const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
89
94
  const addressStore = new AddressStore(store);
90
95
  const privateEventStore = new PrivateEventStore(store);
91
96
  const contractStore = new ContractStore(store);
@@ -97,29 +102,43 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
97
102
  const capsuleStore = new CapsuleStore(store);
98
103
  const keyStore = new KeyStore(store);
99
104
  const tipsStore = new L2TipsKVStore(store, 'pxe');
100
- const synchronizer = new BlockSynchronizer(node, store, anchorBlockStore, noteStore, privateEventStore, tipsStore, config, bindings);
105
+ const contractSyncService = new ContractSyncService(node, contractStore, noteStore, createLogger('pxe:contract_sync', bindings));
106
+ const synchronizer = new BlockSynchronizer(node, store, anchorBlockStore, noteStore, privateEventStore, tipsStore, contractSyncService, config, bindings);
101
107
  const jobCoordinator = new JobCoordinator(store, bindings);
102
108
  jobCoordinator.registerStores([
103
109
  capsuleStore,
104
110
  senderTaggingStore,
105
111
  recipientTaggingStore,
106
112
  privateEventStore,
107
- noteStore
113
+ noteStore,
114
+ contractSyncService
108
115
  ]);
109
- const debugUtils = new PXEDebugUtils(contractStore, noteStore, synchronizer, anchorBlockStore);
116
+ const debugUtils = new PXEDebugUtils(contractSyncService, noteStore, synchronizer, anchorBlockStore);
110
117
  const jobQueue = new SerialQueue();
111
- const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debugUtils);
112
- debugUtils.setPXE(pxe, pxe.#putInJobQueue.bind(pxe));
118
+ const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, contractSyncService, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debugUtils);
119
+ debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#executeUtility.bind(pxe));
113
120
  pxe.jobQueue.start();
114
121
  await pxe.#registerProtocolContracts();
115
- const info = await node.getNodeInfo();
116
122
  log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
117
123
  return pxe;
118
124
  }
119
125
  // Internal methods
120
126
  #getSimulatorForTx(overrides) {
121
127
  const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
122
- return new ContractFunctionSimulator(proxyContractStore, this.noteStore, this.keyStore, this.addressStore, BenchmarkedNodeFactory.create(this.node), this.anchorBlockStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.simulator);
128
+ return new ContractFunctionSimulator({
129
+ contractStore: proxyContractStore,
130
+ noteStore: this.noteStore,
131
+ keyStore: this.keyStore,
132
+ addressStore: this.addressStore,
133
+ aztecNode: BenchmarkedNodeFactory.create(this.node),
134
+ senderTaggingStore: this.senderTaggingStore,
135
+ recipientTaggingStore: this.recipientTaggingStore,
136
+ senderAddressBookStore: this.senderAddressBookStore,
137
+ capsuleStore: this.capsuleStore,
138
+ privateEventStore: this.privateEventStore,
139
+ simulator: this.simulator,
140
+ contractSyncService: this.contractSyncService
141
+ });
123
142
  }
124
143
  #contextualizeError(err, ...context) {
125
144
  let contextStr = '';
@@ -162,8 +181,8 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
162
181
  async #registerProtocolContracts() {
163
182
  const registered = {};
164
183
  for (const name of protocolContractNames){
165
- const { address, contractClass, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
166
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
184
+ const { address, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
185
+ await this.contractStore.addContractArtifact(artifact);
167
186
  await this.contractStore.addContractInstance(instance);
168
187
  registered[name] = address.toString();
169
188
  }
@@ -175,10 +194,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
175
194
  const { origin: contractAddress, functionSelector } = txRequest;
176
195
  try {
177
196
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
178
- await ensureContractSynced(contractAddress, functionSelector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
179
- const result = await contractFunctionSimulator.run(txRequest, contractAddress, functionSelector, undefined, anchorBlockHeader, // The sender for tags is set by contracts, typically by an account
180
- // contract entrypoint
181
- undefined, scopes, jobId);
197
+ await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall, execScopes)=>this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
198
+ const result = await contractFunctionSimulator.run(txRequest, {
199
+ contractAddress,
200
+ selector: functionSelector,
201
+ anchorBlockHeader,
202
+ scopes,
203
+ jobId
204
+ });
182
205
  this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
183
206
  return result;
184
207
  } catch (err) {
@@ -189,15 +212,15 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
189
212
  }
190
213
  }
191
214
  /**
192
- * Simulate a utility function call on the given contract.
215
+ * Execute a utility function call on the given contract.
193
216
  * @param contractFunctionSimulator - The simulator to use for the function call.
194
217
  * @param call - The function call to execute.
195
218
  * @param authWitnesses - Authentication witnesses required for the function call.
196
219
  * @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
197
220
  * accounts if not specified.
198
221
  * @param jobId - The job ID for staged writes.
199
- * @returns The simulation result containing the outputs of the utility function.
200
- */ async #simulateUtility(contractFunctionSimulator, call, authWitnesses, scopes, jobId) {
222
+ * @returns The execution result containing the outputs of the utility function.
223
+ */ async #executeUtility(contractFunctionSimulator, call, authWitnesses, scopes, jobId) {
201
224
  try {
202
225
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
203
226
  return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes, jobId);
@@ -252,7 +275,17 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
252
275
  return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
253
276
  }
254
277
  // Public API
255
- getContractInstance(address) {
278
+ /**
279
+ * Returns the block header up to which the PXE has synced.
280
+ * @returns The synced block header
281
+ */ getSyncedBlockHeader() {
282
+ return this.anchorBlockStore.getBlockHeader();
283
+ }
284
+ /**
285
+ * Returns the contract instance for a given address, if it's registered in the PXE.
286
+ * @param address - The contract address.
287
+ * @returns The contract instance if found, undefined otherwise.
288
+ */ getContractInstance(address) {
256
289
  return this.contractStore.getContractInstance(address);
257
290
  }
258
291
  /**
@@ -339,8 +372,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
339
372
  *
340
373
  * @param artifact - The build artifact for the contract class.
341
374
  */ async registerContractClass(artifact) {
342
- const { id: contractClassId } = await getContractClassFromArtifact(artifact);
343
- await this.contractStore.addContractArtifact(contractClassId, artifact);
375
+ const contractClassId = await this.contractStore.addContractArtifact(artifact);
344
376
  this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
345
377
  }
346
378
  /**
@@ -356,15 +388,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
356
388
  if (artifact) {
357
389
  // If the user provides an artifact, validate it against the expected class id and register it
358
390
  const contractClass = await getContractClassFromArtifact(artifact);
359
- const contractClassId = contractClass.id;
360
- if (!contractClassId.equals(instance.currentContractClassId)) {
361
- throw new Error(`Artifact does not match expected class id (computed ${contractClassId} but instance refers to ${instance.currentContractClassId})`);
391
+ if (!contractClass.id.equals(instance.currentContractClassId)) {
392
+ throw new Error(`Artifact does not match expected class id (computed ${contractClass.id} but instance refers to ${instance.currentContractClassId})`);
362
393
  }
363
394
  const computedAddress = await computeContractAddressFromInstance(instance);
364
395
  if (!computedAddress.equals(instance.address)) {
365
396
  throw new Error('Added a contract in which the address does not match the contract instance.');
366
397
  }
367
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
398
+ await this.contractStore.addContractArtifact(artifact, contractClass);
368
399
  const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
369
400
  await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
370
401
  } else {
@@ -400,11 +431,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
400
431
  if (!contractClass.id.equals(currentClassId)) {
401
432
  throw new Error('Could not update contract to a class different from the current one.');
402
433
  }
403
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
404
434
  const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
405
435
  await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
406
436
  currentInstance.currentContractClassId = contractClass.id;
407
- await this.contractStore.addContractInstance(currentInstance);
437
+ await Promise.all([
438
+ this.contractStore.addContractArtifact(artifact, contractClass),
439
+ this.contractStore.addContractInstance(currentInstance)
440
+ ]);
408
441
  this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
409
442
  });
410
443
  }
@@ -419,10 +452,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
419
452
  * (where validators prove the public portion).
420
453
  *
421
454
  * @param txRequest - An authenticated tx request ready for proving
455
+ * @param scopes - Addresses whose private state and keys are accessible during private execution.
422
456
  * @returns A result containing the proof and public inputs of the tail circuit.
423
457
  * @throws If contract code not found, or public simulation reverts.
424
458
  * Also throws if simulatePublic is true and public simulation reverts.
425
- */ proveTx(txRequest) {
459
+ */ proveTx(txRequest, scopes) {
426
460
  let privateExecutionResult;
427
461
  // We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
428
462
  // computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
@@ -433,7 +467,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
433
467
  await this.blockStateSynchronizer.sync();
434
468
  const syncTime = syncTimer.ms();
435
469
  const contractFunctionSimulator = this.#getSimulatorForTx();
436
- privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
470
+ privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
437
471
  const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
438
472
  simulate: false,
439
473
  skipFeeEnforcement: false,
@@ -483,13 +517,10 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
483
517
  }
484
518
  /**
485
519
  * Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
486
- *
487
- * @param txRequest - An authenticated tx request ready for simulation
488
- * @param msgSender - (Optional) The message sender to use for the simulation.
489
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
520
+ * @param txRequest - An authenticated tx request ready for simulation.
490
521
  * @returns A trace of the program execution with gate counts.
491
522
  * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
492
- */ profileTx(txRequest, profileMode, skipProofGeneration = true) {
523
+ */ profileTx(txRequest, { profileMode, skipProofGeneration = true, scopes }) {
493
524
  // We disable concurrent profiles for consistency with simulateTx.
494
525
  return this.#putInJobQueue(async (jobId)=>{
495
526
  const totalTimer = new Timer();
@@ -507,7 +538,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
507
538
  await this.blockStateSynchronizer.sync();
508
539
  const syncTime = syncTimer.ms();
509
540
  const contractFunctionSimulator = this.#getSimulatorForTx();
510
- const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
541
+ const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
511
542
  const { executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
512
543
  simulate: skipProofGeneration,
513
544
  skipFeeEnforcement: false,
@@ -552,18 +583,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
552
583
  * In that case, the transaction returned is only potentially ready to be sent to the network for execution.
553
584
  *
554
585
  *
555
- * @param txRequest - An authenticated tx request ready for simulation
556
- * @param simulatePublic - Whether to simulate the public part of the transaction.
557
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
558
- * @param skipFeeEnforcement - (Optional) If false, fees are enforced.
559
- * @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
560
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
586
+ * @param txRequest - An authenticated tx request ready for simulation.
561
587
  * @returns A simulated transaction result object that includes public and private return values.
562
588
  * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
563
589
  * Also throws if simulatePublic is true and public simulation reverts.
564
590
  *
565
591
  * TODO(#7456) Prevent msgSender being defined here for the first call
566
- */ simulateTx(txRequest, simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes) {
592
+ */ simulateTx(txRequest, { simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes }) {
567
593
  // We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
568
594
  // to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
569
595
  // delete the same read value, or reading values that another simulation is currently modifying).
@@ -586,13 +612,19 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
586
612
  // Temporary: in case there are overrides, we have to skip the kernels or validations
587
613
  // will fail. Consider handing control to the user/wallet on whether they want to run them
588
614
  // or not.
589
- const skipKernels = overrides?.contracts !== undefined && Object.keys(overrides.contracts ?? {}).length > 0;
615
+ const overriddenContracts = overrides?.contracts ? new Set(Object.keys(overrides.contracts)) : undefined;
616
+ const hasOverriddenContracts = overriddenContracts !== undefined && overriddenContracts.size > 0;
617
+ const skipKernels = hasOverriddenContracts;
618
+ // Set overridden contracts on the sync service so it knows to skip syncing them
619
+ if (hasOverriddenContracts) {
620
+ this.contractSyncService.setOverriddenContracts(jobId, overriddenContracts);
621
+ }
590
622
  // Execution of private functions only; no proving, and no kernel logic.
591
623
  const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
592
624
  let publicInputs;
593
625
  let executionSteps = [];
594
626
  if (skipKernels) {
595
- ({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, this.contractStore));
627
+ ({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel), this.node));
596
628
  } else {
597
629
  // Kernel logic, plus proving of all private functions and kernels.
598
630
  ({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
@@ -609,6 +641,9 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
609
641
  const publicSimulationTimer = new Timer();
610
642
  publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
611
643
  publicSimulationTime = publicSimulationTimer.ms();
644
+ if (publicOutput?.debugLogs?.length) {
645
+ await displayDebugLogs(publicOutput.debugLogs, (addr)=>this.contractStore.getDebugContractName(addr));
646
+ }
612
647
  }
613
648
  let validationTime;
614
649
  if (!skipTxValidation) {
@@ -619,7 +654,8 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
619
654
  });
620
655
  validationTime = validationTimer.ms();
621
656
  if (validationResult.result === 'invalid') {
622
- throw new Error('The simulated transaction is unable to be added to state and is invalid.');
657
+ const reason = validationResult.reason.length > 0 ? ` Reason: ${validationResult.reason.join(', ')}` : '';
658
+ throw new Error(`The simulated transaction is unable to be added to state and is invalid.${reason}`);
623
659
  }
624
660
  }
625
661
  const txHash = simulatedTx.getTxHash();
@@ -652,22 +688,19 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
652
688
  nodeRPCCalls: simulatorStats.nodeRPCCalls
653
689
  });
654
690
  } catch (err) {
655
- throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes?.map((s)=>s.toString()).join(', ') ?? 'undefined'}`);
691
+ throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
656
692
  }
657
693
  });
658
694
  }
659
695
  /**
660
- * Simulate the execution of a contract utility function.
661
- *
696
+ * Executes a contract utility function.
662
697
  * @param call - The function call containing the function details, arguments, and target contract address.
663
- * @param authwits - (Optional) The authentication witnesses required for the function call.
664
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
665
- * default to all.
666
- * @returns The result of the utility function call, structured based on the function ABI.
667
- */ simulateUtility(call, authwits, scopes) {
668
- // We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
698
+ */ executeUtility(call, { authwits, scopes } = {
699
+ scopes: 'ALL_SCOPES'
700
+ }) {
701
+ // We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
669
702
  // to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
670
- // delete the same read value, or reading values that another simulation is currently modifying).
703
+ // delete the same read value, or reading values that another execution is currently modifying).
671
704
  return this.#putInJobQueue(async (jobId)=>{
672
705
  try {
673
706
  const totalTimer = new Timer();
@@ -677,8 +710,8 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
677
710
  const functionTimer = new Timer();
678
711
  const contractFunctionSimulator = this.#getSimulatorForTx();
679
712
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
680
- await ensureContractSynced(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
681
- const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
713
+ await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall, execScopes)=>this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
714
+ const executionResult = await this.#executeUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
682
715
  const functionTime = functionTimer.ms();
683
716
  const totalTime = totalTimer.ms();
684
717
  const perFunction = [
@@ -704,7 +737,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
704
737
  } catch (err) {
705
738
  const { to, name, args } = call;
706
739
  const stringifiedArgs = args.map((arg)=>arg.toString()).join(', ');
707
- throw this.#contextualizeError(err, `simulateUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes?.map((s)=>s.toString()).join(', ') ?? 'undefined'}`);
740
+ throw this.#contextualizeError(err, `executeUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
708
741
  }
709
742
  });
710
743
  }
@@ -727,7 +760,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
727
760
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
728
761
  anchorBlockNumber = anchorBlockHeader.getBlockNumber();
729
762
  const contractFunctionSimulator = this.#getSimulatorForTx();
730
- await ensureContractSynced(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
763
+ await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall, execScopes)=>await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, filter.scopes);
731
764
  });
732
765
  // anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
733
766
  const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
@@ -8,4 +8,4 @@ export declare class AddressStore {
8
8
  getCompleteAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
9
9
  getCompleteAddresses(): Promise<CompleteAddress[]>;
10
10
  }
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzc19zdG9yZS5kLnRzIiwic291c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QXdCLENBQUM7QUFFekQscUJBQWEsWUFBWTs7SUFLdkIsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBS25DO0lBRUQsa0JBQWtCLENBQUMsZUFBZSxFQUFFLGVBQWUsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBMEJyRTtJQUVELGtCQUFrQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLGVBQWUsR0FBRyxTQUFTLENBQUMsQ0FVOUU7SUFFRCxvQkFBb0IsSUFBSSxPQUFPLENBQUMsZUFBZSxFQUFFLENBQUMsQ0FNakQ7Q0FDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"address_store.d.ts","sourceRoot":"","sources":["../../../src/storage/address_store/address_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,YAAY;;IAKvB,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA0BrE;IAYD,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAE9E;IAEK,oBAAoB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAIvD;CACF"}
1
+ {"version":3,"file":"address_store.d.ts","sourceRoot":"","sources":["../../../src/storage/address_store/address_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,YAAY;;IAKvB,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA0BrE;IAED,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAU9E;IAED,oBAAoB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAMjD;CACF"}
@@ -30,18 +30,19 @@ export class AddressStore {
30
30
  }
31
31
  });
32
32
  }
33
- async #getCompleteAddress(address) {
34
- const index = await this.#completeAddressIndex.getAsync(address.toString());
35
- if (index === undefined) {
36
- return undefined;
37
- }
38
- const value = await this.#completeAddresses.atAsync(index);
39
- return value ? await CompleteAddress.fromBuffer(value) : undefined;
40
- }
41
33
  getCompleteAddress(account) {
42
- return this.#getCompleteAddress(account);
34
+ return this.#store.transactionAsync(async ()=>{
35
+ const index = await this.#completeAddressIndex.getAsync(account.toString());
36
+ if (index === undefined) {
37
+ return undefined;
38
+ }
39
+ const value = await this.#completeAddresses.atAsync(index);
40
+ return value ? await CompleteAddress.fromBuffer(value) : undefined;
41
+ });
43
42
  }
44
- async getCompleteAddresses() {
45
- return await Promise.all((await toArray(this.#completeAddresses.valuesAsync())).map((v)=>CompleteAddress.fromBuffer(v)));
43
+ getCompleteAddresses() {
44
+ return this.#store.transactionAsync(async ()=>{
45
+ return await Promise.all((await toArray(this.#completeAddresses.valuesAsync())).map((v)=>CompleteAddress.fromBuffer(v)));
46
+ });
46
47
  }
47
48
  }
@@ -3,7 +3,15 @@ import { BlockHeader } from '@aztec/stdlib/tx';
3
3
  export declare class AnchorBlockStore {
4
4
  #private;
5
5
  constructor(store: AztecAsyncKVStore);
6
+ /**
7
+ * Sets the currently synchronized block
8
+ *
9
+ * Important: this method is only called from BlockSynchronizer, and since we need it to run atomically with other
10
+ * stores in the case of a reorg, it MUST NOT be wrapped in a `transactionAsync` call. Doing so would result in a
11
+ * deadlock when the backend is IndexedDB, because `transactionAsync` is not designed to support reentrancy.
12
+ *
13
+ */
6
14
  setHeader(header: BlockHeader): Promise<void>;
7
15
  getBlockHeader(): Promise<BlockHeader>;
8
16
  }
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5jaG9yX2Jsb2NrX3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9hbmNob3JfYmxvY2tfc3RvcmUvYW5jaG9yX2Jsb2NrX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUF1QixNQUFNLGlCQUFpQixDQUFDO0FBQzlFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUvQyxxQkFBYSxnQkFBZ0I7O0lBSTNCLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUduQztJQUVLLFNBQVMsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFbEQ7SUFFSyxjQUFjLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQU8zQztDQUNGIn0=
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5jaG9yX2Jsb2NrX3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9hbmNob3JfYmxvY2tfc3RvcmUvYW5jaG9yX2Jsb2NrX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUF1QixNQUFNLGlCQUFpQixDQUFDO0FBQzlFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUvQyxxQkFBYSxnQkFBZ0I7O0lBSTNCLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUduQztJQUVEOzs7Ozs7O09BT0c7SUFDRyxTQUFTLENBQUMsTUFBTSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRWxEO0lBRUssY0FBYyxJQUFJLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FPM0M7Q0FDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"anchor_block_store.d.ts","sourceRoot":"","sources":["../../../src/storage/anchor_block_store/anchor_block_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAgB;;IAI3B,YAAY,KAAK,EAAE,iBAAiB,EAGnC;IAEK,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;IAEK,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAO3C;CACF"}
1
+ {"version":3,"file":"anchor_block_store.d.ts","sourceRoot":"","sources":["../../../src/storage/anchor_block_store/anchor_block_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAgB;;IAI3B,YAAY,KAAK,EAAE,iBAAiB,EAGnC;IAED;;;;;;;OAOG;IACG,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;IAEK,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAO3C;CACF"}
@@ -6,7 +6,14 @@ export class AnchorBlockStore {
6
6
  this.#store = store;
7
7
  this.#synchronizedHeader = this.#store.openSingleton('header');
8
8
  }
9
- async setHeader(header) {
9
+ /**
10
+ * Sets the currently synchronized block
11
+ *
12
+ * Important: this method is only called from BlockSynchronizer, and since we need it to run atomically with other
13
+ * stores in the case of a reorg, it MUST NOT be wrapped in a `transactionAsync` call. Doing so would result in a
14
+ * deadlock when the backend is IndexedDB, because `transactionAsync` is not designed to support reentrancy.
15
+ *
16
+ */ async setHeader(header) {
10
17
  await this.#synchronizedHeader.set(header.toBuffer());
11
18
  }
12
19
  async getBlockHeader() {
@@ -40,14 +40,12 @@ export class CapsuleStore {
40
40
  * If it is not there, it reads it from the KV store.
41
41
  */ async #getFromStage(jobId, dbSlotKey) {
42
42
  const jobStagedCapsules = this.#getJobStagedCapsules(jobId);
43
- let staged = jobStagedCapsules.get(dbSlotKey);
44
- // Note that if staged === null, we marked it for deletion, so we don't want to
45
- // re-read it from DB
46
- if (staged === undefined) {
47
- // If we don't have a staged version of this dbSlotKey, first we check if there's one in DB
48
- staged = await this.#loadCapsuleFromDb(dbSlotKey);
49
- }
50
- return staged;
43
+ const staged = jobStagedCapsules.get(dbSlotKey);
44
+ // Always issue DB read to keep IndexedDB transaction alive, even if the value is in the job staged data. This
45
+ // keeps IndexedDB transactions alive (they auto-commit when a new micro-task starts and there are no pending read
46
+ // requests). The staged value still takes precedence if it exists (including null for deletions).
47
+ const dbValue = await this.#loadCapsuleFromDb(dbSlotKey);
48
+ return staged !== undefined ? staged : dbValue;
51
49
  }
52
50
  /**
53
51
  * Writes a capsule to the stage of a job.
@@ -1,10 +1,37 @@
1
1
  import type { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { BufferReader } from '@aztec/foundation/serialize';
3
4
  import type { MembershipWitness } from '@aztec/foundation/trees';
4
5
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
5
6
  import { type ContractArtifact, type FunctionAbi, type FunctionArtifactWithContractName, FunctionCall, type FunctionDebugMetadata, FunctionSelector } from '@aztec/stdlib/abi';
6
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
8
+ import { type ContractClassIdPreimage, type ContractClassWithId, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
9
+ /**
10
+ * All contract class data except the large packedBytecode.
11
+ * The expensive data from the ContractClass is precomputed and stored in this format to avoid redundant hashing.
12
+ * Since we have to store the artifacts anyway, the final ContractClass is reconstructed by combining this data
13
+ * with the packedBytecode obtained from the former. That way we can have quick class lookups without wasted storage.
14
+ */
15
+ export declare class SerializableContractClassData {
16
+ readonly version: 1;
17
+ readonly id: Fr;
18
+ readonly artifactHash: Fr;
19
+ readonly privateFunctionsRoot: Fr;
20
+ readonly publicBytecodeCommitment: Fr;
21
+ readonly privateFunctions: {
22
+ selector: FunctionSelector;
23
+ vkHash: Fr;
24
+ }[];
25
+ constructor(data: ContractClassIdPreimage & {
26
+ id: Fr;
27
+ privateFunctions: {
28
+ selector: FunctionSelector;
29
+ vkHash: Fr;
30
+ }[];
31
+ });
32
+ toBuffer(): Buffer;
33
+ static fromBuffer(bufferOrReader: Buffer | BufferReader): SerializableContractClassData;
34
+ }
8
35
  /**
9
36
  * ContractStore serves as a data manager and retriever for Aztec.nr contracts.
10
37
  * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
@@ -15,19 +42,24 @@ import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/std
15
42
  export declare class ContractStore {
16
43
  #private;
17
44
  constructor(store: AztecAsyncKVStore);
18
- addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
45
+ /**
46
+ * Registers a new contract artifact and its corresponding class data.
47
+ * IMPORTANT: This method does not verify that the provided artifact matches the class data or that the class id matches the artifact.
48
+ * It is the caller's responsibility to ensure the consistency and correctness of the provided data.
49
+ * This is done to avoid redundant, expensive contract class computations
50
+ */
51
+ addContractArtifact(contract: ContractArtifact, contractClassWithIdAndPreimage?: ContractClassWithId & ContractClassIdPreimage): Promise<Fr>;
19
52
  addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
20
53
  getContractsAddresses(): Promise<AztecAddress[]>;
21
- /** Returns a contract instance for a given address. Throws if not found. */
54
+ /** Returns a contract instance for a given address. */
22
55
  getContractInstance(contractAddress: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
56
+ /** Returns the raw contract artifact for a given class id. */
23
57
  getContractArtifact(contractClassId: Fr): Promise<ContractArtifact | undefined>;
24
- /** Returns a contract class for a given class id. Throws if not found. */
25
- getContractClass(contractClassId: Fr): Promise<ContractClass | undefined>;
58
+ /** Returns a contract class for a given class id. */
59
+ getContractClassWithPreimage(contractClassId: Fr): Promise<(ContractClassWithId & ContractClassIdPreimage) | undefined>;
26
60
  getContract(address: AztecAddress): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined>;
27
61
  /**
28
62
  * Retrieves the artifact of a specified function within a given contract.
29
- * The function is identified by its selector, which is a unique code generated from the function's signature.
30
- * Throws an error if the contract address or function selector are invalid or not found.
31
63
  *
32
64
  * @param contractAddress - The AztecAddress representing the contract containing the function.
33
65
  * @param selector - The function selector.
@@ -39,20 +71,15 @@ export declare class ContractStore {
39
71
  getFunctionAbi(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionAbi | undefined>;
40
72
  /**
41
73
  * Retrieves the debug metadata of a specified function within a given contract.
42
- * The function is identified by its selector, which is a unique code generated from the function's signature.
43
- * Returns undefined if the debug metadata for the given function is not found.
44
- * Throws if the contract has not been added to the database.
45
74
  *
46
75
  * @param contractAddress - The AztecAddress representing the contract containing the function.
47
76
  * @param selector - The function selector.
48
- * @returns The corresponding function's artifact as an object.
77
+ * @returns The corresponding function's debug metadata, or undefined.
49
78
  */
50
79
  getFunctionDebugMetadata(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionDebugMetadata | undefined>;
51
80
  getPublicFunctionDebugMetadata(contractAddress: AztecAddress): Promise<FunctionDebugMetadata | undefined>;
52
81
  /**
53
82
  * Retrieve the function membership witness for the given contract class and function selector.
54
- * The function membership witness represents a proof that the function belongs to the specified contract.
55
- * Throws an error if the contract address or function selector is unknown.
56
83
  *
57
84
  * @param contractClassId - The id of the class.
58
85
  * @param selector - The function selector.
@@ -63,4 +90,4 @@ export declare class ContractStore {
63
90
  getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
64
91
  getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall>;
65
92
  }
66
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X3N0b3JlL2NvbnRyYWN0X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDN0QsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RSxPQUFPLEVBQ0wsS0FBSyxnQkFBZ0IsRUFDckIsS0FBSyxXQUFXLEVBRWhCLEtBQUssZ0NBQWdDLEVBQ3JDLFlBQVksRUFDWixLQUFLLHFCQUFxQixFQUMxQixnQkFBZ0IsRUFNakIsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDM0QsT0FBTyxFQUNMLEtBQUssYUFBYSxFQUNsQixLQUFLLDJCQUEyQixFQUdqQyxNQUFNLHdCQUF3QixDQUFDO0FBSWhD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