@aztec/pxe 0.0.1-commit.3100065 → 0.0.1-commit.330febf

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 (207) hide show
  1. package/dest/bin/check_oracle_version.js +5 -46
  2. package/dest/bin/index.d.ts +2 -2
  3. package/dest/bin/index.d.ts.map +1 -1
  4. package/dest/bin/index.js +1 -1
  5. package/dest/bin/oracle_version_helpers.d.ts +8 -39
  6. package/dest/bin/oracle_version_helpers.d.ts.map +1 -1
  7. package/dest/bin/oracle_version_helpers.js +10 -239
  8. package/dest/block_synchronizer/block_synchronizer.d.ts +3 -5
  9. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  10. package/dest/block_synchronizer/block_synchronizer.js +5 -18
  11. package/dest/config/package_info.js +1 -1
  12. package/dest/contract/contract_class_service.d.ts +1 -8
  13. package/dest/contract/contract_class_service.d.ts.map +1 -1
  14. package/dest/contract/contract_class_service.js +8 -40
  15. package/dest/contract/helpers.d.ts +1 -1
  16. package/dest/contract/helpers.d.ts.map +1 -1
  17. package/dest/contract/helpers.js +3 -3
  18. package/dest/contract/skip_sync_contracts.d.ts +11 -0
  19. package/dest/contract/skip_sync_contracts.d.ts.map +1 -0
  20. package/dest/contract/skip_sync_contracts.js +18 -0
  21. package/dest/contract_function_simulator/contract_function_simulator.d.ts +1 -8
  22. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/contract_function_simulator.js +5 -20
  24. package/dest/contract_function_simulator/index.d.ts +3 -3
  25. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/index.js +1 -2
  27. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +7 -9
  28. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/resolved_tx.js +3 -44
  30. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +5 -4
  31. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +2 -2
  33. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +4 -3
  34. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/oracle_registry.js +15 -6
  36. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +87 -35
  37. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +297 -287
  39. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -1
  40. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  41. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +11 -8
  42. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +15 -4
  43. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  44. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +168 -53
  45. package/dest/entrypoints/client/bundle/index.d.ts +2 -1
  46. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  47. package/dest/entrypoints/client/bundle/index.js +1 -0
  48. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  49. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  50. package/dest/entrypoints/client/bundle/utils.js +10 -4
  51. package/dest/entrypoints/client/lazy/index.d.ts +2 -1
  52. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  53. package/dest/entrypoints/client/lazy/index.js +1 -0
  54. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  55. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  56. package/dest/entrypoints/client/lazy/utils.js +10 -4
  57. package/dest/entrypoints/client/store.d.ts +14 -0
  58. package/dest/entrypoints/client/store.d.ts.map +1 -0
  59. package/dest/entrypoints/client/store.js +42 -0
  60. package/dest/entrypoints/server/index.d.ts +2 -1
  61. package/dest/entrypoints/server/index.d.ts.map +1 -1
  62. package/dest/entrypoints/server/index.js +1 -0
  63. package/dest/entrypoints/server/store.d.ts +18 -0
  64. package/dest/entrypoints/server/store.d.ts.map +1 -0
  65. package/dest/entrypoints/server/store.js +28 -0
  66. package/dest/entrypoints/server/utils.d.ts +1 -1
  67. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  68. package/dest/entrypoints/server/utils.js +8 -2
  69. package/dest/events/event_service.d.ts +13 -6
  70. package/dest/events/event_service.d.ts.map +1 -1
  71. package/dest/events/event_service.js +13 -13
  72. package/dest/logs/log_service.d.ts +15 -6
  73. package/dest/logs/log_service.d.ts.map +1 -1
  74. package/dest/logs/log_service.js +25 -32
  75. package/dest/messages/tx_resolver_service.d.ts +18 -7
  76. package/dest/messages/tx_resolver_service.d.ts.map +1 -1
  77. package/dest/messages/tx_resolver_service.js +13 -7
  78. package/dest/node/benchmarked_node.d.ts +20 -0
  79. package/dest/node/benchmarked_node.d.ts.map +1 -0
  80. package/dest/node/benchmarked_node.js +94 -0
  81. package/dest/node/caching_aztec_node.d.ts +24 -0
  82. package/dest/node/caching_aztec_node.d.ts.map +1 -0
  83. package/dest/node/caching_aztec_node.js +267 -0
  84. package/dest/notes/note_service.d.ts +13 -7
  85. package/dest/notes/note_service.d.ts.map +1 -1
  86. package/dest/notes/note_service.js +10 -10
  87. package/dest/oracle_version.d.ts +2 -2
  88. package/dest/oracle_version.js +5 -5
  89. package/dest/private_kernel/batch_planner.d.ts +1 -1
  90. package/dest/private_kernel/batch_planner.d.ts.map +1 -1
  91. package/dest/private_kernel/batch_planner.js +1 -1
  92. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  93. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  94. package/dest/private_kernel/private_kernel_execution_prover.js +45 -5
  95. package/dest/pxe.d.ts +1 -1
  96. package/dest/pxe.d.ts.map +1 -1
  97. package/dest/pxe.js +39 -19
  98. package/dest/storage/contract_store/contract_store.d.ts +1 -1
  99. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  100. package/dest/storage/contract_store/contract_store.js +2 -2
  101. package/dest/storage/fact_store/fact_store.d.ts +1 -1
  102. package/dest/storage/fact_store/fact_store.js +1 -1
  103. package/dest/storage/fact_store/index.d.ts +2 -2
  104. package/dest/storage/fact_store/index.d.ts.map +1 -1
  105. package/dest/storage/fact_store/index.js +1 -1
  106. package/dest/storage/fact_store/origin_state.d.ts +4 -2
  107. package/dest/storage/fact_store/origin_state.d.ts.map +1 -1
  108. package/dest/storage/fact_store/origin_state.js +8 -1
  109. package/dest/storage/store_identity.d.ts +35 -0
  110. package/dest/storage/store_identity.d.ts.map +1 -0
  111. package/dest/storage/store_identity.js +44 -0
  112. package/dest/storage/tagging_store/sender_tagging_store.d.ts +41 -10
  113. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  114. package/dest/storage/tagging_store/sender_tagging_store.js +81 -29
  115. package/dest/tagging/constants.d.ts +10 -1
  116. package/dest/tagging/constants.d.ts.map +1 -1
  117. package/dest/tagging/constants.js +19 -0
  118. package/dest/tagging/get_all_logs_by_tags.d.ts +29 -8
  119. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  120. package/dest/tagging/get_all_logs_by_tags.js +29 -10
  121. package/dest/tagging/index.d.ts +3 -3
  122. package/dest/tagging/index.d.ts.map +1 -1
  123. package/dest/tagging/index.js +2 -2
  124. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +10 -5
  125. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -1
  126. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +69 -38
  127. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +6 -3
  128. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  129. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +23 -38
  130. package/dest/tagging/sender_sync/utils/classify_pending_txs.d.ts +22 -0
  131. package/dest/tagging/sender_sync/utils/classify_pending_txs.d.ts.map +1 -0
  132. package/dest/tagging/sender_sync/utils/classify_pending_txs.js +61 -0
  133. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +15 -5
  134. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  135. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +36 -35
  136. package/dest/tagging/sender_sync/utils/resolve_pending_txs.d.ts +29 -0
  137. package/dest/tagging/sender_sync/utils/resolve_pending_txs.d.ts.map +1 -0
  138. package/dest/tagging/sender_sync/utils/resolve_pending_txs.js +41 -0
  139. package/dest/tagging/sender_sync/utils/test_utils.d.ts +16 -0
  140. package/dest/tagging/sender_sync/utils/test_utils.d.ts.map +1 -0
  141. package/dest/tagging/sender_sync/utils/test_utils.js +24 -0
  142. package/dest/tagging/testing/tag_query_test_utils.d.ts +6 -0
  143. package/dest/tagging/testing/tag_query_test_utils.d.ts.map +1 -0
  144. package/dest/tagging/testing/tag_query_test_utils.js +10 -0
  145. package/package.json +17 -17
  146. package/src/bin/check_oracle_version.ts +5 -56
  147. package/src/bin/index.ts +1 -5
  148. package/src/bin/oracle_version_helpers.ts +11 -292
  149. package/src/block_synchronizer/block_synchronizer.ts +6 -23
  150. package/src/config/package_info.ts +1 -1
  151. package/src/contract/contract_class_service.ts +8 -46
  152. package/src/contract/helpers.ts +3 -3
  153. package/src/contract/skip_sync_contracts.ts +23 -0
  154. package/src/contract_function_simulator/contract_function_simulator.ts +5 -20
  155. package/src/contract_function_simulator/index.ts +23 -3
  156. package/src/contract_function_simulator/noir-structs/resolved_tx.ts +11 -45
  157. package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +4 -3
  158. package/src/contract_function_simulator/oracle/oracle_registry.ts +12 -8
  159. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +301 -198
  160. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +19 -9
  161. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +184 -56
  162. package/src/entrypoints/client/bundle/index.ts +1 -0
  163. package/src/entrypoints/client/bundle/utils.ts +15 -3
  164. package/src/entrypoints/client/lazy/index.ts +1 -0
  165. package/src/entrypoints/client/lazy/utils.ts +15 -3
  166. package/src/entrypoints/client/store.ts +54 -0
  167. package/src/entrypoints/server/index.ts +1 -0
  168. package/src/entrypoints/server/store.ts +47 -0
  169. package/src/entrypoints/server/utils.ts +21 -7
  170. package/src/events/event_service.ts +24 -14
  171. package/src/logs/log_service.ts +41 -39
  172. package/src/messages/tx_resolver_service.ts +26 -15
  173. package/src/node/benchmarked_node.ts +140 -0
  174. package/src/node/caching_aztec_node.ts +406 -0
  175. package/src/notes/note_service.ts +20 -14
  176. package/src/oracle_version.ts +5 -5
  177. package/src/private_kernel/batch_planner.ts +0 -1
  178. package/src/private_kernel/private_kernel_execution_prover.ts +90 -4
  179. package/src/pxe.ts +40 -21
  180. package/src/storage/contract_store/contract_store.ts +2 -1
  181. package/src/storage/fact_store/fact_store.ts +1 -1
  182. package/src/storage/fact_store/index.ts +1 -0
  183. package/src/storage/fact_store/origin_state.ts +10 -1
  184. package/src/storage/store_identity.ts +72 -0
  185. package/src/storage/tagging_store/sender_tagging_store.ts +113 -41
  186. package/src/tagging/constants.ts +22 -0
  187. package/src/tagging/get_all_logs_by_tags.ts +47 -11
  188. package/src/tagging/index.ts +7 -2
  189. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +116 -62
  190. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +27 -57
  191. package/src/tagging/sender_sync/utils/classify_pending_txs.ts +91 -0
  192. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +46 -40
  193. package/src/tagging/sender_sync/utils/resolve_pending_txs.ts +64 -0
  194. package/src/tagging/sender_sync/utils/test_utils.ts +46 -0
  195. package/src/tagging/testing/tag_query_test_utils.ts +11 -0
  196. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +0 -39
  197. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +0 -1
  198. package/dest/contract_function_simulator/aztec_node_read_cache.js +0 -60
  199. package/dest/contract_function_simulator/benchmarked_node.d.ts +0 -9
  200. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +0 -1
  201. package/dest/contract_function_simulator/benchmarked_node.js +0 -77
  202. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +0 -17
  203. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +0 -1
  204. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +0 -60
  205. package/src/contract_function_simulator/aztec_node_read_cache.ts +0 -89
  206. package/src/contract_function_simulator/benchmarked_node.ts +0 -103
  207. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +0 -66
@@ -0,0 +1,61 @@
1
+ import { TxHash, TxStatus } from '@aztec/stdlib/tx';
2
+ /** Groups a window's pending txs by what its logs say about them. */ export function classifyPendingTxsFromLogs(pendingTxs, txsInLogs, finalizedBlockNumber) {
3
+ const txHashesFinalized = [];
4
+ const txHashesWithExecutionReverted = [];
5
+ const txHashesAbsent = [];
6
+ for (const pendingTx of pendingTxs){
7
+ const txHash = TxHash.fromString(pendingTx.txHash);
8
+ const txInLogs = txsInLogs.get(pendingTx.txHash);
9
+ if (!txInLogs) {
10
+ txHashesAbsent.push(txHash);
11
+ } else if (txInLogs.blockNumber > finalizedBlockNumber) {
12
+ // A tx in the logs is mined in the log's block, so it is finalized exactly when that block is at or below the
13
+ // finalized tip. This one is not, so it belongs to no group until the tip catches up.
14
+ } else if (txInLogs.taggingIndexes.includes(pendingTx.highestIndex)) {
15
+ txHashesFinalized.push(txHash);
16
+ } else {
17
+ // A partially reverted tx: the revert dropped the logs carrying its higher indexes.
18
+ txHashesWithExecutionReverted.push(txHash);
19
+ }
20
+ }
21
+ return {
22
+ txHashesFinalized,
23
+ txHashesWithExecutionReverted,
24
+ txHashesAbsent
25
+ };
26
+ }
27
+ /** Groups pending txs by what their receipts say, for the txs the logs could not resolve. */ export async function classifyPendingTxsFromReceipts(pending, aztecNode) {
28
+ const receipts = await Promise.all(pending.map((pendingTxHash)=>aztecNode.getTxReceipt(pendingTxHash)));
29
+ const txHashesFinalized = [];
30
+ const txHashesDropped = [];
31
+ const txHashesWithExecutionReverted = [];
32
+ for(let i = 0; i < receipts.length; i++){
33
+ const receipt = receipts[i];
34
+ const txHash = pending[i];
35
+ if (receipt.status === TxStatus.FINALIZED) {
36
+ // Tx has been included in a block and the corresponding block is finalized
37
+ if (receipt.hasExecutionSucceeded()) {
38
+ // No part of execution reverted - we just finalize all the indexes.
39
+ txHashesFinalized.push(txHash);
40
+ } else if (receipt.hasExecutionReverted()) {
41
+ // Tx was mined but execution reverted (app logic, teardown, or both). Some logs from the non-revertible
42
+ // phase may still be onchain. We check which tags made it onchain and finalize those; drop the rest.
43
+ txHashesWithExecutionReverted.push(txHash);
44
+ } else {
45
+ // Defensive check - this branch should never be triggered
46
+ throw new Error('Both hasExecutionSucceeded and hasExecutionReverted on the receipt returned false. This should never happen and it implies a bug. Please open an issue.');
47
+ }
48
+ } else if (receipt.isDropped()) {
49
+ // Tx was dropped from the mempool --> we drop the corresponding pending indexes.
50
+ txHashesDropped.push(txHash);
51
+ } else {
52
+ // Tx is still pending, not yet finalized, or was mined successfully but not yet finalized --> we don't do
53
+ // anything.
54
+ }
55
+ }
56
+ return {
57
+ txHashesFinalized,
58
+ txHashesDropped,
59
+ txHashesWithExecutionReverted
60
+ };
61
+ }
@@ -1,9 +1,12 @@
1
- import type { BlockHash } from '@aztec/stdlib/block';
1
+ import type { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
3
  import { type AppTaggingSecret } from '@aztec/stdlib/logs';
4
4
  import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
5
+ import { type LogQueryAnchor } from '../../get_all_logs_by_tags.js';
5
6
  /**
6
- * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
7
+ * Loads tagging indexes from the Aztec node and stores them in the tagging data provider. Returns the txs the
8
+ * window's logs carried, keyed by tx hash string, with the block each was mined in and the window indexes it used,
9
+ * so the caller can classify their finalization status without further node queries.
7
10
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
8
11
  * place is when a tx is being sent from this PXE.
9
12
  * @param extendedSecret - The app tagging secret whose indexes are being synced.
@@ -11,9 +14,16 @@ import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_t
11
14
  * @param end - The ending index (exclusive) of the window to process.
12
15
  * @param aztecNode - The Aztec node instance to query for logs.
13
16
  * @param taggingStore - The data provider to store pending indexes.
14
- * @param anchorBlockHash - Hash of a block to use as reference block when querying node.
17
+ * @param anchor - Block the log query is anchored to.
15
18
  * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
16
19
  * preserving way.
17
20
  */
18
- export declare function loadAndStoreNewTaggingIndexes(extendedSecret: AppTaggingSecret, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: BlockHash, jobId: string): Promise<void>;
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBYSxNQUFNLG9CQUFvQixDQUFDO0FBR3RFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFHakc7Ozs7Ozs7Ozs7OztHQVlHO0FBQ0gsd0JBQXNCLDZCQUE2QixDQUNqRCxjQUFjLEVBQUUsZ0JBQWdCLEVBQ2hDLEtBQUssRUFBRSxNQUFNLEVBQ2IsR0FBRyxFQUFFLE1BQU0sRUFDWCxTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUsa0JBQWtCLEVBQ2hDLGVBQWUsRUFBRSxTQUFTLEVBQzFCLEtBQUssRUFBRSxNQUFNLGlCQWdCZCJ9
21
+ export declare function loadAndStoreNewTaggingIndexes(extendedSecret: AppTaggingSecret, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchor: LogQueryAnchor, jobId: string): Promise<Map<string, TxInLogs>>;
22
+ /** A tx that a sync window's logs carried. */
23
+ export type TxInLogs = {
24
+ /** The block the tx was mined in, which decides whether it is finalized. */
25
+ blockNumber: BlockNumber;
26
+ /** The window's tagging indexes whose siloed tags this tx's logs carried. */
27
+ taggingIndexes: number[];
28
+ };
29
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQ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MAAM,wDAAwD,CAAC;AAGjG;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,iBAgBd"}
1
+ {"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,KAAK,gBAAgB,EAA6B,MAAM,oBAAoB,CAAC;AAGtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AACjG,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,+BAA+B,CAAC;AAE7F;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CA6BhC;AAED,8CAA8C;AAC9C,MAAM,MAAM,QAAQ,GAAG;IACrB,4EAA4E;IAC5E,WAAW,EAAE,WAAW,CAAC;IACzB,6EAA6E;IAC7E,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC"}
@@ -2,7 +2,9 @@ import { SiloedTag } from '@aztec/stdlib/logs';
2
2
  import { TxHash } from '@aztec/stdlib/tx';
3
3
  import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
4
4
  /**
5
- * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
5
+ * Loads tagging indexes from the Aztec node and stores them in the tagging data provider. Returns the txs the
6
+ * window's logs carried, keyed by tx hash string, with the block each was mined in and the window indexes it used,
7
+ * so the caller can classify their finalization status without further node queries.
6
8
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
7
9
  * place is when a tx is being sent from this PXE.
8
10
  * @param extendedSecret - The app tagging secret whose indexes are being synced.
@@ -10,10 +12,10 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
10
12
  * @param end - The ending index (exclusive) of the window to process.
11
13
  * @param aztecNode - The Aztec node instance to query for logs.
12
14
  * @param taggingStore - The data provider to store pending indexes.
13
- * @param anchorBlockHash - Hash of a block to use as reference block when querying node.
15
+ * @param anchor - Block the log query is anchored to.
14
16
  * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
15
17
  * preserving way.
16
- */ export async function loadAndStoreNewTaggingIndexes(extendedSecret, start, end, aztecNode, taggingStore, anchorBlockHash, jobId) {
18
+ */ export async function loadAndStoreNewTaggingIndexes(extendedSecret, start, end, aztecNode, taggingStore, anchor, jobId) {
17
19
  // We compute the tags for the current window of indexes
18
20
  const siloedTagsForWindow = await Promise.all(Array.from({
19
21
  length: end - start
@@ -21,52 +23,51 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
21
23
  extendedSecret,
22
24
  index: start + i
23
25
  })));
24
- const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
25
- const txIndexesMap = getTxIndexesMap(txsForTags, start, siloedTagsForWindow.length);
26
- // Now we iterate over the map, construct the tagging index ranges and store them in the db.
27
- for (const [txHashStr, indexes] of txIndexesMap.entries()){
26
+ const allLogs = await getAllPrivateLogsByTags(aztecNode, siloedTagsForWindow, anchor);
27
+ if (allLogs.length !== siloedTagsForWindow.length) {
28
+ throw new Error(`Number of log arrays does not match number of tags. ${allLogs.length} !== ${siloedTagsForWindow.length}`);
29
+ }
30
+ const txsInLogs = getTxsInLogs(allLogs, start);
31
+ // Now we iterate over the map, construct the tagging index ranges and store them in the db. A tx already tracked
32
+ // in the store is merged rather than range-checked: if this PXE sent the tx and it partially reverted, the chain
33
+ // only shows the surviving sub-range of the prove-time entry (the finalized receipt step of the sync owns
34
+ // resolving that difference), and a tx from another PXE may straddle a sync window boundary, in which case the
35
+ // entry is widened so the next index choice covers the full onchain range.
36
+ for (const [txHashStr, { taggingIndexes }] of txsInLogs.entries()){
28
37
  const txHash = TxHash.fromString(txHashStr);
29
38
  const ranges = [
30
39
  {
31
40
  extendedSecret,
32
- lowestIndex: Math.min(...indexes),
33
- highestIndex: Math.max(...indexes)
41
+ lowestIndex: Math.min(...taggingIndexes),
42
+ highestIndex: Math.max(...taggingIndexes)
34
43
  }
35
44
  ];
36
- await taggingStore.storePendingIndexes(ranges, txHash, jobId);
45
+ await taggingStore.mergePendingIndexes(ranges, txHash, jobId);
37
46
  }
47
+ return txsInLogs;
38
48
  }
39
- // Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
40
- // an array for each tag.
41
- async function getTxsContainingTags(tags, aztecNode, anchorBlockHash) {
42
- // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
43
- // pagination here. Sender sync only needs `txHash` from each log, so we leave `includeEffects` off.
44
- const allLogs = await getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash);
45
- return allLogs.map((logs)=>logs.map((log)=>log.txHash));
46
- }
47
- // Returns a map of txHash to all indexes for that txHash.
48
- function getTxIndexesMap(txHashesForTags, start, count) {
49
- if (txHashesForTags.length !== count) {
50
- throw new Error(`Number of tx hashes arrays does not match number of tags. ${txHashesForTags.length} !== ${count}`);
51
- }
52
- const indexesMap = new Map();
49
+ // Returns a map of txHash to the block it was mined in and all window indexes used by it.
50
+ function getTxsInLogs(logsForTags, start) {
51
+ const txsInLogs = new Map();
53
52
  // Iterate over indexes
54
- for(let i = 0; i < txHashesForTags.length; i++){
53
+ for(let i = 0; i < logsForTags.length; i++){
55
54
  const taggingIndex = start + i;
56
- const txHashesForTag = txHashesForTags[i];
57
- // iterate over tx hashes that used that index (tag)
58
- for (const txHash of txHashesForTag){
59
- const key = txHash.toString();
60
- const existing = indexesMap.get(key);
55
+ // iterate over logs that used that index (tag)
56
+ for (const log of logsForTags[i]){
57
+ const key = log.txHash.toString();
58
+ const existing = txsInLogs.get(key);
61
59
  // Add the index to the tx's indexes
62
60
  if (existing) {
63
- existing.push(taggingIndex);
61
+ existing.taggingIndexes.push(taggingIndex);
64
62
  } else {
65
- indexesMap.set(key, [
66
- taggingIndex
67
- ]);
63
+ txsInLogs.set(key, {
64
+ blockNumber: log.blockNumber,
65
+ taggingIndexes: [
66
+ taggingIndex
67
+ ]
68
+ });
68
69
  }
69
70
  }
70
71
  }
71
- return indexesMap;
72
+ return txsInLogs;
72
73
  }
@@ -0,0 +1,29 @@
1
+ import type { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
+ import { type MinedTxReceipt, type TxHash } from '@aztec/stdlib/tx';
4
+ import type { PendingTx } from '../../../storage/tagging_store/sender_tagging_store.js';
5
+ import type { TxInLogs } from './load_and_store_new_tagging_indexes.js';
6
+ /** What a window's node reads established about each of its pending txs. */
7
+ export type ResolvedPendingTxs = {
8
+ txHashesFinalizedFromLogs: TxHash[];
9
+ txHashesFinalizedFromReceipts: TxHash[];
10
+ txHashesDropped: TxHash[];
11
+ /** Both sources land here: the logs when a surviving tag fell inside the window, a receipt otherwise. */
12
+ receiptsWithExecutionReverted: MinedTxReceipt<{
13
+ includeTxEffect: true;
14
+ }>[];
15
+ };
16
+ /**
17
+ * Resolves a window's pending txs. All of the window's node reads happen here.
18
+ *
19
+ * The logs it is handed settle most txs on their own, as {@link classifyPendingTxsFromLogs} explains. Two groups are
20
+ * left over, and share one further round trip:
21
+ *
22
+ * - txs absent from the logs, whose receipt is what tells whether they are still in the mempool, dropped, or reverted;
23
+ * - txs the logs show as reverted, which only their tx effect resolves.
24
+ *
25
+ * A third round trip is paid only when those receipts reveal a reverted tx, since its effect cannot be requested
26
+ * before its status says it reverted.
27
+ */
28
+ export declare function resolvePendingTxs(pendingTxs: PendingTx[], txsInLogs: Map<string, TxInLogs>, finalizedBlockNumber: BlockNumber, aztecNode: AztecNode): Promise<ResolvedPendingTxs>;
29
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb2x2ZV9wZW5kaW5nX3R4cy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvcmVzb2x2ZV9wZW5kaW5nX3R4cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQUUsS0FBSyxNQUFNLEVBQTRCLE1BQU0sa0JBQWtCLENBQUM7QUFFOUYsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFFeEYsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0seUNBQXlDLENBQUM7QUFFeEUsNEVBQTRFO0FBQzVFLE1BQU0sTUFBTSxrQkFBa0IsR0FBRztJQUMvQix5QkFBeUIsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUNwQyw2QkFBNkIsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUN4QyxlQUFlLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFDMUIseUdBQXlHO0lBQ3pHLDZCQUE2QixFQUFFLGNBQWMsQ0FBQzt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EAChC,oBAAoB,EAAE,WAAW,EACjC,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAmB7B"}
@@ -0,0 +1,41 @@
1
+ import { TxStatus } from '@aztec/stdlib/tx';
2
+ import { classifyPendingTxsFromLogs, classifyPendingTxsFromReceipts } from './classify_pending_txs.js';
3
+ /**
4
+ * Resolves a window's pending txs. All of the window's node reads happen here.
5
+ *
6
+ * The logs it is handed settle most txs on their own, as {@link classifyPendingTxsFromLogs} explains. Two groups are
7
+ * left over, and share one further round trip:
8
+ *
9
+ * - txs absent from the logs, whose receipt is what tells whether they are still in the mempool, dropped, or reverted;
10
+ * - txs the logs show as reverted, which only their tx effect resolves.
11
+ *
12
+ * A third round trip is paid only when those receipts reveal a reverted tx, since its effect cannot be requested
13
+ * before its status says it reverted.
14
+ */ export async function resolvePendingTxs(pendingTxs, txsInLogs, finalizedBlockNumber, aztecNode) {
15
+ const statusFromLogs = classifyPendingTxsFromLogs(pendingTxs, txsInLogs, finalizedBlockNumber);
16
+ const [statusOfAbsent, receiptsOfRevertedInLogs] = await Promise.all([
17
+ classifyPendingTxsFromReceipts(statusFromLogs.txHashesAbsent, aztecNode),
18
+ getReceiptsWithEffect(statusFromLogs.txHashesWithExecutionReverted, aztecNode)
19
+ ]);
20
+ const receiptsOfRevertedAbsent = await getReceiptsWithEffect(statusOfAbsent.txHashesWithExecutionReverted, aztecNode);
21
+ return {
22
+ txHashesFinalizedFromLogs: statusFromLogs.txHashesFinalized,
23
+ txHashesFinalizedFromReceipts: statusOfAbsent.txHashesFinalized,
24
+ txHashesDropped: statusOfAbsent.txHashesDropped,
25
+ // Both groups were judged finalized before this fetch, the first off our own tip and the second off an earlier
26
+ // receipt, so both are confirmed against what the node says now. Finalizing off a reorgeable block would burn
27
+ // the indexes.
28
+ receiptsWithExecutionReverted: [
29
+ ...receiptsOfRevertedInLogs,
30
+ ...receiptsOfRevertedAbsent
31
+ ].filter(isFinalized)
32
+ };
33
+ }
34
+ function getReceiptsWithEffect(txHashes, aztecNode) {
35
+ return Promise.all(txHashes.map((txHash)=>aztecNode.getTxReceipt(txHash, {
36
+ includeTxEffect: true
37
+ })));
38
+ }
39
+ function isFinalized(receipt) {
40
+ return receipt.status === TxStatus.FINALIZED;
41
+ }
@@ -0,0 +1,16 @@
1
+ import type { MinedTxStatus, TxEffect, TxHash } from '@aztec/stdlib/tx';
2
+ import { MinedTxReceipt, TxExecutionResult } from '@aztec/stdlib/tx';
3
+ import type { PendingTx } from '../../../storage/tagging_store/sender_tagging_store.js';
4
+ import type { TxInLogs } from './load_and_store_new_tagging_indexes.js';
5
+ /** A tx the store holds as pending, tracked up to the given index. */
6
+ export declare function pendingTx(txHash: TxHash, highestIndex: number): PendingTx;
7
+ /** One tx as a window's logs show it: the block it was mined in and the tagging indexes its logs carried. */
8
+ export declare function minedIn(blockNumber: number, taggingIndexes: number[]): TxInLogs;
9
+ /** Builds the tx-hash-keyed map a window's logs would produce. */
10
+ export declare function txsInLogs(...entries: [TxHash, TxInLogs][]): Map<string, TxInLogs>;
11
+ /** The receipt of a mined tx, successful and without a tx effect unless stated otherwise. */
12
+ export declare function minedReceipt(txHash: TxHash, status: MinedTxStatus, blockNumber: number, { executionResult, txEffect }?: {
13
+ executionResult?: TxExecutionResult;
14
+ txEffect?: TxEffect;
15
+ }): MinedTxReceipt;
16
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdF91dGlscy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvdGVzdF91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSxhQUFhLEVBQUUsUUFBUSxFQUFFLE1BQU0sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSxjQUFjLEV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EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAExE,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS,CAEzE;AAED,6GAA6G;AAC7G,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,QAAQ,CAE/E;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAEjF;AAED,6FAA6F;AAC7F,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EACnB,EACE,eAA2C,EAC3C,QAAQ,EACT,GAAE;IAAE,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAO,GACnE,cAAc,CAahB"}
@@ -0,0 +1,24 @@
1
+ import { BlockNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
2
+ import { BlockHash } from '@aztec/stdlib/block';
3
+ import { MinedTxReceipt, TxExecutionResult } from '@aztec/stdlib/tx';
4
+ /** A tx the store holds as pending, tracked up to the given index. */ export function pendingTx(txHash, highestIndex) {
5
+ return {
6
+ txHash: txHash.toString(),
7
+ highestIndex
8
+ };
9
+ }
10
+ /** One tx as a window's logs show it: the block it was mined in and the tagging indexes its logs carried. */ export function minedIn(blockNumber, taggingIndexes) {
11
+ return {
12
+ blockNumber: BlockNumber(blockNumber),
13
+ taggingIndexes
14
+ };
15
+ }
16
+ /** Builds the tx-hash-keyed map a window's logs would produce. */ export function txsInLogs(...entries) {
17
+ return new Map(entries.map(([txHash, txInLogs])=>[
18
+ txHash.toString(),
19
+ txInLogs
20
+ ]));
21
+ }
22
+ /** The receipt of a mined tx, successful and without a tx effect unless stated otherwise. */ export function minedReceipt(txHash, status, blockNumber, { executionResult = TxExecutionResult.SUCCESS, txEffect } = {}) {
23
+ return new MinedTxReceipt(txHash, status, executionResult, 1n, BlockHash.random(), BlockNumber(blockNumber), SlotNumber(Number(blockNumber)), 0, EpochNumber(1), txEffect);
24
+ }
@@ -0,0 +1,6 @@
1
+ import { type AppTaggingSecret, type PrivateLogsQuery, SiloedTag } from '@aztec/stdlib/logs';
2
+ /** Computes the siloed tag */
3
+ export declare function computeSiloedTagForIndex(secret: AppTaggingSecret, index: number): Promise<SiloedTag>;
4
+ /** Extracts the bare-tag set from a query */
5
+ export declare function extractTags(query: PrivateLogsQuery): SiloedTag[];
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFnX3F1ZXJ5X3Rlc3RfdXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90YWdnaW5nL3Rlc3RpbmcvdGFnX3F1ZXJ5X3Rlc3RfdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssZ0JBQWdCLEVBQUUsS0FBSyxnQkFBZ0IsRUFBRSxTQUFTLEVBQWlCLE1BQU0sb0JBQW9CLENBQUM7QUFFNUcsOEJBQThCO0FBQzlCLHdCQUFnQix3QkFBd0IsQ0FBQyxNQUFNLEVBQUUsZ0JBQWdCLEVBQUUsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBRXBHO0FBRUQsNkNBQTZDO0FBQzdDLHdCQUFnQixXQUFXLENBQUMsS0FBSyxFQUFFLGdCQUFnQixHQUFHLFNBQVMsRUFBRSxDQUVoRSJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag_query_test_utils.d.ts","sourceRoot":"","sources":["../../../src/tagging/testing/tag_query_test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAiB,MAAM,oBAAoB,CAAC;AAE5G,8BAA8B;AAC9B,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAEpG;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,EAAE,CAEhE"}
@@ -0,0 +1,10 @@
1
+ import { SiloedTag } from '@aztec/stdlib/logs';
2
+ /** Computes the siloed tag */ export function computeSiloedTagForIndex(secret, index) {
3
+ return SiloedTag.compute({
4
+ extendedSecret: secret,
5
+ index
6
+ });
7
+ }
8
+ /** Extracts the bare-tag set from a query */ export function extractTags(query) {
9
+ return query.tags.map((entry)=>entry instanceof SiloedTag ? entry : entry.tag);
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.3100065",
3
+ "version": "0.0.1-commit.330febf",
4
4
  "type": "module",
5
5
  "typedocOptions": {
6
6
  "entryPoints": [
@@ -71,20 +71,20 @@
71
71
  ]
72
72
  },
73
73
  "dependencies": {
74
- "@aztec/bb-prover": "0.0.1-commit.3100065",
75
- "@aztec/bb.js": "0.0.1-commit.3100065",
76
- "@aztec/builder": "0.0.1-commit.3100065",
77
- "@aztec/constants": "0.0.1-commit.3100065",
78
- "@aztec/ethereum": "0.0.1-commit.3100065",
79
- "@aztec/foundation": "0.0.1-commit.3100065",
80
- "@aztec/key-store": "0.0.1-commit.3100065",
81
- "@aztec/kv-store": "0.0.1-commit.3100065",
82
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.3100065",
83
- "@aztec/noir-types": "0.0.1-commit.3100065",
84
- "@aztec/protocol-contracts": "0.0.1-commit.3100065",
85
- "@aztec/simulator": "0.0.1-commit.3100065",
86
- "@aztec/standard-contracts": "0.0.1-commit.3100065",
87
- "@aztec/stdlib": "0.0.1-commit.3100065",
74
+ "@aztec/bb-prover": "0.0.1-commit.330febf",
75
+ "@aztec/bb.js": "6.0.0-nightly.20260807",
76
+ "@aztec/builder": "0.0.1-commit.330febf",
77
+ "@aztec/constants": "0.0.1-commit.330febf",
78
+ "@aztec/ethereum": "0.0.1-commit.330febf",
79
+ "@aztec/foundation": "0.0.1-commit.330febf",
80
+ "@aztec/key-store": "0.0.1-commit.330febf",
81
+ "@aztec/kv-store": "0.0.1-commit.330febf",
82
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.330febf",
83
+ "@aztec/noir-types": "0.0.1-commit.330febf",
84
+ "@aztec/protocol-contracts": "0.0.1-commit.330febf",
85
+ "@aztec/simulator": "0.0.1-commit.330febf",
86
+ "@aztec/standard-contracts": "0.0.1-commit.330febf",
87
+ "@aztec/stdlib": "0.0.1-commit.330febf",
88
88
  "koa": "^2.16.1",
89
89
  "koa-router": "^13.1.1",
90
90
  "lodash.omit": "^4.5.0",
@@ -93,8 +93,8 @@
93
93
  "viem": "npm:@aztec/viem@2.38.2"
94
94
  },
95
95
  "devDependencies": {
96
- "@aztec/noir-test-contracts.js": "0.0.1-commit.3100065",
97
- "@aztec/world-state": "0.0.1-commit.3100065",
96
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.330febf",
97
+ "@aztec/world-state": "0.0.1-commit.330febf",
98
98
  "@jest/globals": "^30.0.0",
99
99
  "@types/jest": "^30.0.0",
100
100
  "@types/lodash.omit": "^4.5.7",
@@ -1,16 +1,14 @@
1
1
  import { keccak256String } from '@aztec/foundation/crypto/keccak';
2
2
 
3
- import { dirname, join } from 'path';
4
- import { fileURLToPath } from 'url';
5
-
6
- import { ORACLE_INTERFACE_HASH, ORACLE_VERSION_MAJOR } from '../oracle_version.js';
7
- import { getOracleRegistrySignature, readNumericGlobal } from './oracle_version_helpers.js';
3
+ import { ORACLE_REGISTRY } from '../contract_function_simulator/index.js';
4
+ import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
5
+ import { getOracleRegistrySignature } from './oracle_version_helpers.js';
8
6
 
9
7
  /**
10
8
  * Verifies that the Oracle interface matches the expected interface hash.
11
9
  *
12
10
  * The Oracle interface needs to be versioned to ensure compatibility between Aztec.nr and PXE. This function computes
13
- * a hash of the `ORACLE_REGISTRY` declaration (where each oracle's parameter names, parameter types, and return type
11
+ * a hash of `ORACLE_REGISTRY` (where each oracle's parameter names, parameter types, and return type
14
12
  * live) and compares it against a known hash. If they don't match, it means the interface has changed and the oracle
15
13
  * version needs to be bumped:
16
14
  * - If the change is backward-breaking (e.g. removing/renaming an oracle, or changing its params/return), bump
@@ -18,16 +16,8 @@ import { getOracleRegistrySignature, readNumericGlobal } from './oracle_version_
18
16
  * - If the change is an oracle addition (non-breaking), bump ORACLE_VERSION_MINOR.
19
17
  */
20
18
  function assertOracleInterfaceMatches(): void {
21
- // The script runs from dest/bin/ after compilation, so we go up to the package root then into src/ to find
22
- // the source file.
23
- const currentDir = dirname(fileURLToPath(import.meta.url));
24
- const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
25
- const registrySourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle_registry.ts');
26
-
27
- const oracleInterfaceSignature = getOracleRegistrySignature(registrySourcePath, 'ORACLE_REGISTRY');
28
-
29
19
  // We use keccak256 here just because we already have it in the dependencies.
30
- const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
20
+ const oracleInterfaceHash = keccak256String(getOracleRegistrySignature(ORACLE_REGISTRY));
31
21
  if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
32
22
  throw new Error(
33
23
  `The Oracle interface has changed. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} in pxe/src/oracle_version.ts and bump the oracle version (ORACLE_VERSION_MAJOR for breaking changes, ORACLE_VERSION_MINOR for oracle additions).`,
@@ -35,45 +25,4 @@ function assertOracleInterfaceMatches(): void {
35
25
  }
36
26
  }
37
27
 
38
- /**
39
- * Verifies that `ORACLE_VERSION_MAJOR` is identical across all of its hand-maintained copies.
40
- *
41
- * The major version is duplicated across the PXE TypeScript constant and two Noir constants (Aztec.nr and the protocol
42
- * contracts' `aztec_sublib`) because those layers can't import each other. This static check fails fast at build time,
43
- * naming each file and its value.
44
- *
45
- * Only the major version is checked: the minor version legitimately diverges under the "environment minor >= contract
46
- * minor" tolerance, so asserting minor equality would false-positive.
47
- */
48
- function assertContractOracleVersionMajorInSync(): void {
49
- const currentDir = dirname(fileURLToPath(import.meta.url));
50
- // Go up from dest/bin/ or src/bin/ to the package root (pxe/), then up two more to the git root.
51
- const packageRoot = dirname(dirname(currentDir));
52
- const gitRoot = join(packageRoot, '..', '..');
53
-
54
- const copies = [
55
- { label: 'pxe/src/oracle_version.ts', value: ORACLE_VERSION_MAJOR },
56
- {
57
- label: 'aztec-nr/aztec/src/oracle/version.nr',
58
- value: readNumericGlobal(
59
- join(gitRoot, 'noir-projects/aztec-nr/aztec/src/oracle/version.nr'),
60
- 'ORACLE_VERSION_MAJOR',
61
- ),
62
- },
63
- {
64
- label: 'aztec_sublib/src/oracle/version.nr',
65
- value: readNumericGlobal(
66
- join(gitRoot, 'noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/oracle/version.nr'),
67
- 'ORACLE_VERSION_MAJOR',
68
- ),
69
- },
70
- ];
71
-
72
- if (new Set(copies.map(copy => copy.value)).size > 1) {
73
- const details = copies.map(copy => `${copy.label}=${copy.value}`).join(', ');
74
- throw new Error(`ORACLE_VERSION_MAJOR is out of sync: ${details}. Bump all copies together.`);
75
- }
76
- }
77
-
78
28
  assertOracleInterfaceMatches();
79
- assertContractOracleVersionMajorInSync();
package/src/bin/index.ts CHANGED
@@ -1,5 +1 @@
1
- export {
2
- getOracleInterfaceSignature,
3
- getOracleRegistrySignature,
4
- readNumericGlobal,
5
- } from './oracle_version_helpers.js';
1
+ export { getOracleRegistrySignature } from './oracle_version_helpers.js';