@aztec/pxe 2.1.0-rc.9 → 3.0.0-devnet.2

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/README.md +5 -5
  2. package/dest/bin/check_oracle_version.js +18 -8
  3. package/dest/config/index.d.ts +8 -8
  4. package/dest/config/index.d.ts.map +1 -1
  5. package/dest/config/index.js +3 -3
  6. package/dest/config/package_info.js +1 -1
  7. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  8. package/dest/contract_function_simulator/contract_function_simulator.js +82 -26
  9. package/dest/contract_function_simulator/execution_data_provider.d.ts +27 -38
  10. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
  11. package/dest/contract_function_simulator/execution_note_cache.d.ts +2 -2
  12. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/execution_note_cache.js +7 -4
  14. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  15. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  16. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  17. package/dest/contract_function_simulator/index.d.ts +3 -1
  18. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/index.js +2 -1
  20. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +7 -3
  22. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -0
  23. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  25. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
  26. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  27. package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
  28. package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
  29. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
  30. package/dest/contract_function_simulator/oracle/index.js +1 -1
  31. package/dest/contract_function_simulator/oracle/interfaces.d.ts +97 -0
  32. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  34. package/dest/contract_function_simulator/oracle/oracle.d.ts +12 -11
  35. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/oracle/oracle.js +79 -76
  37. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -2
  38. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/oracle/private_execution.js +6 -15
  40. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +26 -10
  41. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +69 -18
  43. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +10 -22
  44. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  45. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +33 -38
  46. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +19 -55
  47. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
  48. package/dest/contract_function_simulator/pxe_oracle_interface.js +174 -187
  49. package/dest/entrypoints/client/bundle/index.d.ts +3 -1
  50. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  51. package/dest/entrypoints/client/bundle/index.js +2 -1
  52. package/dest/entrypoints/client/bundle/utils.d.ts +8 -8
  53. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  54. package/dest/entrypoints/client/bundle/utils.js +8 -8
  55. package/dest/entrypoints/client/lazy/index.d.ts +3 -1
  56. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  57. package/dest/entrypoints/client/lazy/index.js +2 -1
  58. package/dest/entrypoints/client/lazy/utils.d.ts +7 -7
  59. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  60. package/dest/entrypoints/client/lazy/utils.js +7 -7
  61. package/dest/entrypoints/server/index.d.ts +3 -1
  62. package/dest/entrypoints/server/index.d.ts.map +1 -1
  63. package/dest/entrypoints/server/index.js +2 -1
  64. package/dest/entrypoints/server/utils.d.ts +4 -23
  65. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  66. package/dest/entrypoints/server/utils.js +4 -25
  67. package/dest/{pxe_service/error_enriching.d.ts → error_enriching.d.ts} +1 -1
  68. package/dest/error_enriching.d.ts.map +1 -0
  69. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +3 -0
  70. package/dest/oracle_version.d.ts +2 -2
  71. package/dest/oracle_version.js +2 -2
  72. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
  73. package/dest/private_kernel/private_kernel_execution_prover.d.ts +7 -0
  74. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  75. package/dest/private_kernel/private_kernel_execution_prover.js +23 -18
  76. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +2 -2
  77. package/dest/pxe.d.ts +233 -0
  78. package/dest/pxe.d.ts.map +1 -0
  79. package/dest/{pxe_service/pxe_service.js → pxe.js} +215 -217
  80. package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -3
  81. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
  82. package/dest/storage/address_data_provider/address_data_provider.js +0 -3
  83. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +1 -3
  84. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  85. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -4
  86. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +3 -4
  87. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  88. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -3
  89. package/dest/storage/index.d.ts +0 -1
  90. package/dest/storage/index.d.ts.map +1 -1
  91. package/dest/storage/index.js +0 -1
  92. package/dest/storage/note_data_provider/note_dao.d.ts +1 -1
  93. package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
  94. package/dest/storage/note_data_provider/note_data_provider.d.ts +70 -7
  95. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  96. package/dest/storage/note_data_provider/note_data_provider.js +120 -72
  97. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +1 -3
  98. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
  99. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -3
  100. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +1 -3
  101. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
  102. package/dest/storage/sync_data_provider/sync_data_provider.js +0 -3
  103. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +28 -6
  104. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
  105. package/dest/storage/tagging_data_provider/tagging_data_provider.js +46 -39
  106. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  107. package/dest/synchronizer/synchronizer.js +2 -3
  108. package/dest/tagging/constants.d.ts +2 -0
  109. package/dest/tagging/constants.d.ts.map +1 -0
  110. package/dest/tagging/constants.js +2 -0
  111. package/dest/tagging/index.d.ts +7 -0
  112. package/dest/tagging/index.d.ts.map +1 -0
  113. package/dest/tagging/index.js +5 -0
  114. package/dest/tagging/siloed_tag.d.ts +14 -0
  115. package/dest/tagging/siloed_tag.d.ts.map +1 -0
  116. package/dest/tagging/siloed_tag.js +20 -0
  117. package/dest/tagging/tag.d.ts +12 -0
  118. package/dest/tagging/tag.d.ts.map +1 -0
  119. package/dest/tagging/tag.js +17 -0
  120. package/dest/tagging/utils.d.ts +18 -0
  121. package/dest/tagging/utils.d.ts.map +1 -0
  122. package/dest/tagging/utils.js +24 -0
  123. package/package.json +18 -21
  124. package/src/bin/check_oracle_version.ts +23 -9
  125. package/src/config/index.ts +11 -10
  126. package/src/config/package_info.ts +1 -1
  127. package/src/contract_function_simulator/contract_function_simulator.ts +128 -44
  128. package/src/contract_function_simulator/execution_data_provider.ts +29 -47
  129. package/src/contract_function_simulator/execution_note_cache.ts +11 -6
  130. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  131. package/src/contract_function_simulator/index.ts +3 -1
  132. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +8 -3
  133. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  134. package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
  135. package/src/contract_function_simulator/oracle/index.ts +1 -1
  136. package/src/contract_function_simulator/oracle/interfaces.ts +160 -0
  137. package/src/contract_function_simulator/oracle/oracle.ts +102 -77
  138. package/src/contract_function_simulator/oracle/private_execution.ts +7 -15
  139. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +106 -45
  140. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +51 -76
  141. package/src/contract_function_simulator/pxe_oracle_interface.ts +199 -218
  142. package/src/entrypoints/client/bundle/index.ts +3 -1
  143. package/src/entrypoints/client/bundle/utils.ts +11 -19
  144. package/src/entrypoints/client/lazy/index.ts +3 -1
  145. package/src/entrypoints/client/lazy/utils.ts +10 -18
  146. package/src/entrypoints/server/index.ts +3 -1
  147. package/src/entrypoints/server/utils.ts +9 -39
  148. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +5 -1
  149. package/src/oracle_version.ts +2 -2
  150. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
  151. package/src/private_kernel/private_kernel_execution_prover.ts +35 -23
  152. package/src/{pxe_service/pxe_service.ts → pxe.ts} +230 -261
  153. package/src/storage/address_data_provider/address_data_provider.ts +1 -7
  154. package/src/storage/capsule_data_provider/capsule_data_provider.ts +1 -11
  155. package/src/storage/contract_data_provider/contract_data_provider.ts +3 -9
  156. package/src/storage/index.ts +0 -1
  157. package/src/storage/note_data_provider/note_dao.ts +1 -1
  158. package/src/storage/note_data_provider/note_data_provider.ts +142 -99
  159. package/src/storage/private_event_data_provider/private_event_data_provider.ts +1 -7
  160. package/src/storage/sync_data_provider/sync_data_provider.ts +1 -7
  161. package/src/storage/tagging_data_provider/tagging_data_provider.ts +52 -55
  162. package/src/synchronizer/synchronizer.ts +2 -3
  163. package/src/tagging/constants.ts +2 -0
  164. package/src/tagging/index.ts +6 -0
  165. package/src/tagging/siloed_tag.ts +22 -0
  166. package/src/tagging/tag.ts +16 -0
  167. package/src/tagging/utils.ts +31 -0
  168. package/dest/bin/index.d.ts +0 -3
  169. package/dest/bin/index.d.ts.map +0 -1
  170. package/dest/bin/index.js +0 -48
  171. package/dest/contract_function_simulator/oracle/typed_oracle.d.ts +0 -87
  172. package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +0 -1
  173. package/dest/contract_function_simulator/oracle/typed_oracle.js +0 -146
  174. package/dest/contract_function_simulator/tagging_utils.d.ts +0 -17
  175. package/dest/contract_function_simulator/tagging_utils.d.ts.map +0 -1
  176. package/dest/contract_function_simulator/tagging_utils.js +0 -23
  177. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  178. package/dest/pxe_service/index.d.ts +0 -3
  179. package/dest/pxe_service/index.d.ts.map +0 -1
  180. package/dest/pxe_service/index.js +0 -2
  181. package/dest/pxe_service/pxe_service.d.ts +0 -101
  182. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  183. package/dest/storage/data_provider.d.ts +0 -4
  184. package/dest/storage/data_provider.d.ts.map +0 -1
  185. package/dest/storage/data_provider.js +0 -1
  186. package/dest/test/pxe_test_suite.d.ts +0 -3
  187. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  188. package/dest/test/pxe_test_suite.js +0 -97
  189. package/src/bin/index.ts +0 -62
  190. package/src/contract_function_simulator/oracle/typed_oracle.ts +0 -289
  191. package/src/contract_function_simulator/tagging_utils.ts +0 -32
  192. package/src/pxe_service/index.ts +0 -2
  193. package/src/storage/data_provider.ts +0 -3
  194. package/src/test/pxe_test_suite.ts +0 -113
@@ -1,93 +1,90 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
1
  import { toArray } from '@aztec/foundation/iterable';
3
2
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
4
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import type { IndexedTaggingSecret } from '@aztec/stdlib/logs';
4
+ import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
6
5
 
7
6
  export class TaggingDataProvider {
8
7
  #store: AztecAsyncKVStore;
9
8
  #addressBook: AztecAsyncMap<string, true>;
10
9
 
11
- // Stores the last index used for each tagging secret, taking direction into account
12
- // This is necessary to avoid reusing the same index for the same secret, which happens if
13
- // sender and recipient are the same
14
- #taggingSecretIndexesForSenders: AztecAsyncMap<string, number>;
15
- #taggingSecretIndexesForRecipients: AztecAsyncMap<string, number>;
10
+ // Stores the last used index for each directional app tagging secret. Taking into account whether we are
11
+ // requesting the index as a sender or as a recipient because the sender and recipient can be in the same PXE.
12
+ #lastUsedIndexesAsSenders: AztecAsyncMap<string, number>;
13
+ #lastUsedIndexesAsRecipients: AztecAsyncMap<string, number>;
16
14
 
17
15
  constructor(store: AztecAsyncKVStore) {
18
16
  this.#store = store;
19
17
 
20
18
  this.#addressBook = this.#store.openMap('address_book');
21
19
 
22
- this.#taggingSecretIndexesForSenders = this.#store.openMap('tagging_secret_indexes_for_senders');
23
- this.#taggingSecretIndexesForRecipients = this.#store.openMap('tagging_secret_indexes_for_recipients');
20
+ this.#lastUsedIndexesAsSenders = this.#store.openMap('last_used_indexes_as_senders');
21
+ this.#lastUsedIndexesAsRecipients = this.#store.openMap('last_used_indexes_as_recipients');
24
22
  }
25
23
 
26
- setTaggingSecretsIndexesAsSender(indexedSecrets: IndexedTaggingSecret[], sender: AztecAddress) {
27
- return this.#setTaggingSecretsIndexes(indexedSecrets, this.#taggingSecretIndexesForSenders, sender);
28
- }
24
+ /**
25
+ * Sets the last used indexes when sending a log.
26
+ * @param preTags - The pre tags containing the directional app tagging secrets and the indexes that are to be
27
+ * updated in the db.
28
+ * @throws If any two pre tags contain the same directional app tagging secret
29
+ */
30
+ setLastUsedIndexesAsSender(preTags: PreTag[]) {
31
+ this.#assertUniqueSecrets(preTags, 'sender');
29
32
 
30
- setTaggingSecretsIndexesAsRecipient(indexedSecrets: IndexedTaggingSecret[], recipient: AztecAddress) {
31
- return this.#setTaggingSecretsIndexes(indexedSecrets, this.#taggingSecretIndexesForRecipients, recipient);
33
+ return Promise.all(
34
+ preTags.map(({ secret, index }) => this.#lastUsedIndexesAsSenders.set(secret.toString(), index)),
35
+ );
32
36
  }
33
37
 
34
38
  /**
35
- * Sets the indexes of the tagging secrets for the given app tagging secrets in the direction of the given address.
36
- * @dev We need to specify the direction because app tagging secrets are direction-less due to the way they are generated
37
- * but we need to guarantee that the index is stored under a uni-directional key because the tags are themselves
38
- * uni-directional.
39
- * @param indexedSecrets - The app tagging secrets and indexes to set.
40
- * @param storageMap - The storage map to set the indexes in.
41
- * @param inDirectionOf - The address that the secrets are in the direction of.
39
+ * Sets the last used indexes when looking for logs.
40
+ * @param preTags - The pre tags containing the directional app tagging secrets and the indexes that are to be
41
+ * updated in the db.
42
+ * @throws If any two pre tags contain the same directional app tagging secret
42
43
  */
43
- #setTaggingSecretsIndexes(
44
- indexedSecrets: IndexedTaggingSecret[],
45
- storageMap: AztecAsyncMap<string, number>,
46
- inDirectionOf: AztecAddress,
47
- ) {
44
+ setLastUsedIndexesAsRecipient(preTags: PreTag[]) {
45
+ this.#assertUniqueSecrets(preTags, 'recipient');
46
+
48
47
  return Promise.all(
49
- indexedSecrets.map(indexedSecret =>
50
- storageMap.set(`${indexedSecret.appTaggingSecret.toString()}_${inDirectionOf.toString()}`, indexedSecret.index),
51
- ),
48
+ preTags.map(({ secret, index }) => this.#lastUsedIndexesAsRecipients.set(secret.toString(), index)),
52
49
  );
53
50
  }
54
51
 
55
- getTaggingSecretsIndexesAsRecipient(appTaggingSecrets: Fr[], recipient: AztecAddress) {
56
- return this.#getTaggingSecretsIndexes(appTaggingSecrets, this.#taggingSecretIndexesForRecipients, recipient);
52
+ // It should never happen that we would receive any two pre tags on the input containing the same directional app
53
+ // tagging secret as everywhere we always just apply the largest index. Hence this check is a good way to catch
54
+ // bugs.
55
+ #assertUniqueSecrets(preTags: PreTag[], role: 'sender' | 'recipient'): void {
56
+ const secretStrings = preTags.map(({ secret }) => secret.toString());
57
+ const uniqueSecrets = new Set(secretStrings);
58
+ if (uniqueSecrets.size !== secretStrings.length) {
59
+ throw new Error(`Duplicate secrets found when setting last used indexes as ${role}`);
60
+ }
57
61
  }
58
62
 
59
- getTaggingSecretsIndexesAsSender(appTaggingSecrets: Fr[], sender: AztecAddress) {
60
- return this.#getTaggingSecretsIndexes(appTaggingSecrets, this.#taggingSecretIndexesForSenders, sender);
63
+ /**
64
+ * Returns the last used index when sending a log with a given secret.
65
+ * @param secret - The directional app tagging secret.
66
+ * @returns The last used index for the given directional app tagging secret, or undefined if not found.
67
+ */
68
+ async getLastUsedIndexesAsSender(secret: DirectionalAppTaggingSecret): Promise<number | undefined> {
69
+ return await this.#lastUsedIndexesAsSenders.getAsync(secret.toString());
61
70
  }
62
71
 
63
72
  /**
64
- * Returns the indexes of the tagging secrets for the given app tagging secrets in the direction of the given address.
65
- * @dev We need to specify the direction because app tagging secrets are direction-less due to the way they are generated
66
- * but we need to guarantee that the index is stored under a uni-directional key because the tags are themselves
67
- * uni-directional.
68
- * @param appTaggingSecrets - The app tagging secrets to get the indexes for.
69
- * @param storageMap - The storage map to get the indexes from.
70
- * @param inDirectionOf - The address that the secrets are in the direction of.
71
- * @returns The indexes of the tagging secrets.
73
+ * Returns the last used indexes when looking for logs as a recipient.
74
+ * @param secrets - The directional app tagging secrets to obtain the indexes for.
75
+ * @returns The last used indexes for the given directional app tagging secrets, or undefined if have never yet found
76
+ * a log for a given secret.
72
77
  */
73
- #getTaggingSecretsIndexes(
74
- appTaggingSecrets: Fr[],
75
- storageMap: AztecAsyncMap<string, number>,
76
- inDirectionOf: AztecAddress,
77
- ): Promise<number[]> {
78
- return Promise.all(
79
- appTaggingSecrets.map(
80
- async secret => (await storageMap.getAsync(`${secret.toString()}_${inDirectionOf.toString()}`)) ?? 0,
81
- ),
82
- );
78
+ getLastUsedIndexesAsRecipient(secrets: DirectionalAppTaggingSecret[]): Promise<(number | undefined)[]> {
79
+ return Promise.all(secrets.map(secret => this.#lastUsedIndexesAsRecipients.getAsync(secret.toString())));
83
80
  }
84
81
 
85
82
  resetNoteSyncData(): Promise<void> {
86
83
  return this.#store.transactionAsync(async () => {
87
- const recipients = await toArray(this.#taggingSecretIndexesForRecipients.keysAsync());
88
- await Promise.all(recipients.map(recipient => this.#taggingSecretIndexesForRecipients.delete(recipient)));
89
- const senders = await toArray(this.#taggingSecretIndexesForSenders.keysAsync());
90
- await Promise.all(senders.map(sender => this.#taggingSecretIndexesForSenders.delete(sender)));
84
+ const keysForSenders = await toArray(this.#lastUsedIndexesAsSenders.keysAsync());
85
+ await Promise.all(keysForSenders.map(secret => this.#lastUsedIndexesAsSenders.delete(secret)));
86
+ const keysForRecipients = await toArray(this.#lastUsedIndexesAsRecipients.keysAsync());
87
+ await Promise.all(keysForRecipients.map(secret => this.#lastUsedIndexesAsRecipients.delete(secret)));
91
88
  });
92
89
  }
93
90
 
@@ -55,15 +55,14 @@ export class Synchronizer implements L2BlockStreamEventHandler {
55
55
  archive: lastBlock.archive.root.toString(),
56
56
  header: lastBlock.header.toInspect(),
57
57
  });
58
- await this.syncDataProvider.setHeader(lastBlock.header);
58
+ await this.syncDataProvider.setHeader(lastBlock.getBlockHeader());
59
59
  break;
60
60
  }
61
61
  case 'chain-pruned': {
62
62
  this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
63
63
  // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
64
64
  const lastSynchedBlockNumber = await this.syncDataProvider.getBlockNumber();
65
- await this.noteDataProvider.unnullifyNotesAfter(event.block.number, lastSynchedBlockNumber);
66
- await this.noteDataProvider.removeNotesAfter(event.block.number);
65
+ await this.noteDataProvider.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
67
66
  // Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
68
67
  // block number in which each index is used it's all we can do.
69
68
  await this.taggingDataProvider.resetNoteSyncData();
@@ -0,0 +1,2 @@
1
+ // Half the size of the window we slide over the tagging indexes.
2
+ export const WINDOW_HALF_SIZE = 10;
@@ -0,0 +1,6 @@
1
+ export * from './tag.js';
2
+ export * from './constants.js';
3
+ export * from './siloed_tag.js';
4
+ export * from './utils.js';
5
+ export { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
6
+ export { type PreTag } from '@aztec/stdlib/logs';
@@ -0,0 +1,22 @@
1
+ import { poseidon2Hash } from '@aztec/foundation/crypto';
2
+ import type { Fr } from '@aztec/foundation/fields';
3
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+
5
+ import type { Tag } from './tag.js';
6
+
7
+ /**
8
+ * Represents a tag used in private log as it "appears on the chain" - that is the tag is siloed with a contract
9
+ * address that emitted the log.
10
+ */
11
+ export class SiloedTag {
12
+ private constructor(public readonly value: Fr) {}
13
+
14
+ static async compute(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
15
+ const siloedTag = await poseidon2Hash([app, tag.value]);
16
+ return new SiloedTag(siloedTag);
17
+ }
18
+
19
+ toString(): string {
20
+ return this.value.toString();
21
+ }
22
+ }
@@ -0,0 +1,16 @@
1
+ import { poseidon2Hash } from '@aztec/foundation/crypto';
2
+ import type { Fr } from '@aztec/foundation/fields';
3
+ import type { PreTag } from '@aztec/stdlib/logs';
4
+
5
+ /**
6
+ * Represents a tag of a private log. This is not the tag that "appears" on the chain as this tag is first siloed
7
+ * with a contract address by kernels before being included in the final log.
8
+ */
9
+ export class Tag {
10
+ private constructor(public readonly value: Fr) {}
11
+
12
+ static async compute(preTag: PreTag): Promise<Tag> {
13
+ const tag = await poseidon2Hash([preTag.secret.value, preTag.index]);
14
+ return new Tag(tag);
15
+ }
16
+ }
@@ -0,0 +1,31 @@
1
+ import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
2
+
3
+ // TODO(benesjan): Make this return tags instead - this will moves some complexity from syncTaggedLogs
4
+ export function getPreTagsForTheWindow(
5
+ secretsAndWindows: { secret: DirectionalAppTaggingSecret; leftMostIndex: number; rightMostIndex: number }[],
6
+ ): PreTag[] {
7
+ const secrets = [];
8
+ for (const secretAndWindow of secretsAndWindows) {
9
+ for (let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++) {
10
+ secrets.push({ secret: secretAndWindow.secret, index: i });
11
+ }
12
+ }
13
+ return secrets;
14
+ }
15
+
16
+ /**
17
+ * Creates a map from directional app tagging secret to initial index.
18
+ * @param preTags - The pre tags to get the initial indexes map from.
19
+ * @returns The map from directional app tagging secret to initial index.
20
+ */
21
+ export function getInitialIndexesMap(preTags: { secret: DirectionalAppTaggingSecret; index: number | undefined }[]): {
22
+ [k: string]: number;
23
+ } {
24
+ const initialIndexes: { [k: string]: number } = {};
25
+
26
+ for (const preTag of preTags) {
27
+ initialIndexes[preTag.secret.toString()] = preTag.index ?? 0;
28
+ }
29
+
30
+ return initialIndexes;
31
+ }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env -S node --no-warnings
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}
package/dest/bin/index.js DELETED
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env -S node --no-warnings
2
- import { createNamespacedSafeJsonRpcServer } from '@aztec/foundation/json-rpc/server';
3
- import { createLogger } from '@aztec/foundation/log';
4
- import { PXESchema, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
5
- import http from 'http';
6
- import { getPXEServiceConfig } from '../config/index.js';
7
- import { createPXEService } from '../entrypoints/server/utils.js';
8
- const { PXE_PORT = 8080, AZTEC_NODE_URL = 'http://localhost:8079' } = process.env;
9
- const logger = createLogger('pxe:service');
10
- /**
11
- * Creates an http server that forwards calls to the PXE and starts it on the given port.
12
- * @param pxeService - PXE that answers queries to the created HTTP server.
13
- * @param port - Port to listen in.
14
- * @param maxBatchSize - Maximum allowed batch size for JSON RPC batch requests.
15
- * @returns A running http server.
16
- */ function startPXEHttpServer(pxeService, port, opts = {}) {
17
- const rpcServer = createNamespacedSafeJsonRpcServer({
18
- pxe: [
19
- pxeService,
20
- PXESchema
21
- ]
22
- }, opts);
23
- const app = rpcServer.getApp();
24
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
25
- const httpServer = http.createServer(app.callback());
26
- httpServer.listen(port);
27
- return httpServer;
28
- }
29
- /**
30
- * Create and start a new PXE HTTP Server
31
- */ async function main() {
32
- logger.info(`Setting up PXE...`);
33
- const pxeConfig = getPXEServiceConfig();
34
- const nodeRpcClient = createAztecNodeClient(AZTEC_NODE_URL, {});
35
- const pxeService = await createPXEService(nodeRpcClient, pxeConfig);
36
- const shutdown = ()=>{
37
- logger.info('Shutting down...');
38
- process.exit(0);
39
- };
40
- process.once('SIGINT', shutdown);
41
- process.once('SIGTERM', shutdown);
42
- startPXEHttpServer(pxeService, PXE_PORT);
43
- logger.info(`PXE listening on port ${PXE_PORT}`);
44
- }
45
- main().catch((err)=>{
46
- logger.error(err);
47
- process.exit(1);
48
- });
@@ -1,87 +0,0 @@
1
- import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
2
- import { Fr, Point } from '@aztec/foundation/fields';
3
- import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
4
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
6
- import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
7
- import type { ContractClassLog, IndexedTaggingSecret } from '@aztec/stdlib/logs';
8
- import type { Note, NoteStatus } from '@aztec/stdlib/note';
9
- import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
10
- import type { BlockHeader } from '@aztec/stdlib/tx';
11
- import type { UInt64 } from '@aztec/stdlib/types';
12
- import type { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
13
- /**
14
- * Information about a note needed during execution.
15
- */
16
- export interface NoteData {
17
- /** The actual note content (the fields of the Noir #[note] struct). */
18
- note: Note;
19
- /** The address of the contract that owns the note. */
20
- contractAddress: AztecAddress;
21
- /** The storage slot of the note. */
22
- storageSlot: Fr;
23
- /** The nonce injected into the note hash preimage by kernels. */
24
- noteNonce: Fr;
25
- /** A hash of the note as it gets stored in the note hash tree. */
26
- noteHash: Fr;
27
- /** The corresponding nullifier of the note. Undefined for pending notes. */
28
- siloedNullifier?: Fr;
29
- /** The note's leaf index in the note hash tree. Undefined for pending notes. */
30
- index?: bigint;
31
- }
32
- /**
33
- * Oracle with typed parameters and typed return values.
34
- * Methods that require read and/or write will have to be implemented based on the context (public, private, or view)
35
- * and are unavailable by default.
36
- */
37
- export declare abstract class TypedOracle {
38
- utilityAssertCompatibleOracleVersion(_version: number): void;
39
- utilityGetRandomField(): Fr;
40
- privateStoreInExecutionCache(_values: Fr[], _hash: Fr): void;
41
- privateLoadFromExecutionCache(_hash: Fr): Promise<Fr[]>;
42
- utilityGetBlockNumber(): Promise<number>;
43
- utilityGetTimestamp(): Promise<UInt64>;
44
- utilityGetContractAddress(): Promise<AztecAddress>;
45
- utilityGetChainId(): Promise<Fr>;
46
- utilityGetVersion(): Promise<Fr>;
47
- utilityGetKeyValidationRequest(_pkMHash: Fr): Promise<KeyValidationRequest>;
48
- utilityGetContractInstance(_address: AztecAddress): Promise<ContractInstance>;
49
- utilityGetMembershipWitness(_blockNumber: number, _treeId: MerkleTreeId, _leafValue: Fr): Promise<Fr[] | undefined>;
50
- utilityGetNullifierMembershipWitness(_blockNumber: number, _nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
51
- utilityGetPublicDataWitness(_blockNumber: number, _leafSlot: Fr): Promise<PublicDataWitness | undefined>;
52
- utilityGetLowNullifierMembershipWitness(_blockNumber: number, _nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
53
- utilityGetBlockHeader(_blockNumber: number): Promise<BlockHeader | undefined>;
54
- utilityGetCompleteAddress(_account: AztecAddress): Promise<CompleteAddress>;
55
- utilityGetAuthWitness(_messageHash: Fr): Promise<Fr[] | undefined>;
56
- utilityGetNotes(_storageSlot: Fr, _numSelects: number, _selectByIndexes: number[], _selectByOffsets: number[], _selectByLengths: number[], _selectValues: Fr[], _selectComparators: number[], _sortByIndexes: number[], _sortByOffsets: number[], _sortByLengths: number[], _sortOrder: number[], _limit: number, _offset: number, _status: NoteStatus): Promise<NoteData[]>;
57
- privateNotifyCreatedNote(_storageSlot: Fr, _noteTypeId: NoteSelector, _note: Fr[], _noteHash: Fr, _counter: number): void;
58
- privateNotifyNullifiedNote(_innerNullifier: Fr, _noteHash: Fr, _counter: number): Promise<void>;
59
- privateNotifyCreatedNullifier(_innerNullifier: Fr): Promise<void>;
60
- utilityCheckNullifierExists(_innerNullifier: Fr): Promise<boolean>;
61
- utilityGetL1ToL2MembershipWitness(_contractAddress: AztecAddress, _messageHash: Fr, _secret: Fr): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
62
- utilityStorageRead(_contractAddress: AztecAddress, _startStorageSlot: Fr, _blockNumber: number, _numberOfElements: number): Promise<Fr[]>;
63
- privateNotifyCreatedContractClassLog(_log: ContractClassLog, _counter: number): void;
64
- privateCallPrivateFunction(_targetContractAddress: AztecAddress, _functionSelector: FunctionSelector, _argsHash: Fr, _sideEffectCounter: number, _isStaticCall: boolean): Promise<{
65
- endSideEffectCounter: Fr;
66
- returnsHash: Fr;
67
- }>;
68
- privateNotifyEnqueuedPublicFunctionCall(_targetContractAddress: AztecAddress, _calldataHash: Fr, _sideEffectCounter: number, _isStaticCall: boolean): Promise<void>;
69
- privateNotifySetPublicTeardownFunctionCall(_targetContractAddress: AztecAddress, _calldataHash: Fr, _sideEffectCounter: number, _isStaticCall: boolean): Promise<void>;
70
- privateNotifySetMinRevertibleSideEffectCounter(_minRevertibleSideEffectCounter: number): Promise<void>;
71
- utilityDebugLog(_message: string, _fields: Fr[]): void;
72
- utilityGetIndexedTaggingSecretAsSender(_sender: AztecAddress, _recipient: AztecAddress): Promise<IndexedTaggingSecret>;
73
- privateIncrementAppTaggingSecretIndexAsSender(_sender: AztecAddress, _recipient: AztecAddress): Promise<void>;
74
- utilityFetchTaggedLogs(_pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
75
- utilityValidateEnqueuedNotesAndEvents(_contractAddress: AztecAddress, _noteValidationRequestsArrayBaseSlot: Fr, _eventValidationRequestsArrayBaseSlot: Fr): Promise<void>;
76
- utilityBulkRetrieveLogs(_contractAddress: AztecAddress, _logRetrievalRequestsArrayBaseSlot: Fr, _logRetrievalResponsesArrayBaseSlot: Fr): Promise<void>;
77
- utilityStoreCapsule(_contractAddress: AztecAddress, _key: Fr, _capsule: Fr[]): Promise<void>;
78
- utilityLoadCapsule(_contractAddress: AztecAddress, _key: Fr): Promise<Fr[] | null>;
79
- utilityDeleteCapsule(_contractAddress: AztecAddress, _key: Fr): Promise<void>;
80
- utilityCopyCapsule(_contractAddress: AztecAddress, _srcKey: Fr, _dstKey: Fr, _numEntries: number): Promise<void>;
81
- utilityAes128Decrypt(_ciphertext: Buffer, _iv: Buffer, _symKey: Buffer): Promise<Buffer>;
82
- utilityGetSharedSecret(_address: AztecAddress, _ephPk: Point): Promise<Point>;
83
- utilityEmitOffchainEffect(_data: Fr[]): Promise<void>;
84
- privateGetSenderForTags(): Promise<AztecAddress | undefined>;
85
- privateSetSenderForTags(_senderForTags: AztecAddress): Promise<void>;
86
- }
87
- //# sourceMappingURL=typed_oracle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed_oracle.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/typed_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,uEAAuE;IACvE,IAAI,EAAE,IAAI,CAAC;IACX,sDAAsD;IACtD,eAAe,EAAE,YAAY,CAAC;IAC9B,oCAAoC;IACpC,WAAW,EAAE,EAAE,CAAC;IAChB,iEAAiE;IACjE,SAAS,EAAE,EAAE,CAAC;IACd,kEAAkE;IAClE,QAAQ,EAAE,EAAE,CAAC;IACb,4EAA4E;IAC5E,eAAe,CAAC,EAAE,EAAE,CAAC;IACrB,g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CAAC,IAAI,CAAC;IAIhB,uBAAuB,CACrB,gBAAgB,EAAE,YAAY,EAC9B,kCAAkC,EAAE,EAAE,EACtC,mCAAmC,EAAE,EAAE,GACtC,OAAO,CAAC,IAAI,CAAC;IAIhB,mBAAmB,CAAC,gBAAgB,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5F,kBAAkB,CAAC,gBAAgB,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;IAIlF,oBAAoB,CAAC,gBAAgB,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7E,kBAAkB,CAAC,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhH,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxF,sBAAsB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAI7E,yBAAyB,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,uBAAuB,IAAI,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAI5D,uBAAuB,CAAC,cAAc,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
@@ -1,146 +0,0 @@
1
- class OracleMethodNotAvailableError extends Error {
2
- constructor(methodName){
3
- super(`Oracle method ${methodName} is not available.`);
4
- }
5
- }
6
- /**
7
- * Oracle with typed parameters and typed return values.
8
- * Methods that require read and/or write will have to be implemented based on the context (public, private, or view)
9
- * and are unavailable by default.
10
- */ export class TypedOracle {
11
- utilityAssertCompatibleOracleVersion(_version) {
12
- throw new OracleMethodNotAvailableError('utilityAssertCompatibleOracleVersion');
13
- }
14
- utilityGetRandomField() {
15
- throw new OracleMethodNotAvailableError('utilityGetRandomField');
16
- }
17
- privateStoreInExecutionCache(_values, _hash) {
18
- throw new OracleMethodNotAvailableError('privateStoreInExecutionCache');
19
- }
20
- privateLoadFromExecutionCache(_hash) {
21
- return Promise.reject(new OracleMethodNotAvailableError('privateLoadFromExecutionCache'));
22
- }
23
- utilityGetBlockNumber() {
24
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetBlockNumber'));
25
- }
26
- utilityGetTimestamp() {
27
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetTimestamp'));
28
- }
29
- utilityGetContractAddress() {
30
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetContractAddress'));
31
- }
32
- utilityGetChainId() {
33
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetChainId'));
34
- }
35
- utilityGetVersion() {
36
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetVersion'));
37
- }
38
- utilityGetKeyValidationRequest(_pkMHash) {
39
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetKeyValidationRequest'));
40
- }
41
- utilityGetContractInstance(_address) {
42
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetContractInstance'));
43
- }
44
- utilityGetMembershipWitness(_blockNumber, _treeId, _leafValue) {
45
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetMembershipWitness'));
46
- }
47
- utilityGetNullifierMembershipWitness(_blockNumber, _nullifier) {
48
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetNullifierMembershipWitness'));
49
- }
50
- utilityGetPublicDataWitness(_blockNumber, _leafSlot) {
51
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetPublicDataWitness'));
52
- }
53
- utilityGetLowNullifierMembershipWitness(_blockNumber, _nullifier) {
54
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetLowNullifierMembershipWitness'));
55
- }
56
- utilityGetBlockHeader(_blockNumber) {
57
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetBlockHeader'));
58
- }
59
- utilityGetCompleteAddress(_account) {
60
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetCompleteAddress'));
61
- }
62
- utilityGetAuthWitness(_messageHash) {
63
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetAuthWitness'));
64
- }
65
- utilityGetNotes(_storageSlot, _numSelects, _selectByIndexes, _selectByOffsets, _selectByLengths, _selectValues, _selectComparators, _sortByIndexes, _sortByOffsets, _sortByLengths, _sortOrder, _limit, _offset, _status) {
66
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetNotes'));
67
- }
68
- privateNotifyCreatedNote(_storageSlot, _noteTypeId, _note, _noteHash, _counter) {
69
- throw new OracleMethodNotAvailableError('privateNotifyCreatedNote');
70
- }
71
- privateNotifyNullifiedNote(_innerNullifier, _noteHash, _counter) {
72
- return Promise.reject(new OracleMethodNotAvailableError('privateNotifyNullifiedNote'));
73
- }
74
- privateNotifyCreatedNullifier(_innerNullifier) {
75
- return Promise.reject(new OracleMethodNotAvailableError('privateNotifyCreatedNullifier'));
76
- }
77
- utilityCheckNullifierExists(_innerNullifier) {
78
- return Promise.reject(new OracleMethodNotAvailableError('utilityCheckNullifierExists'));
79
- }
80
- utilityGetL1ToL2MembershipWitness(_contractAddress, _messageHash, _secret) {
81
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetL1ToL2MembershipWitness'));
82
- }
83
- utilityStorageRead(_contractAddress, _startStorageSlot, _blockNumber, _numberOfElements) {
84
- return Promise.reject(new OracleMethodNotAvailableError('utilityStorageRead'));
85
- }
86
- privateNotifyCreatedContractClassLog(_log, _counter) {
87
- throw new OracleMethodNotAvailableError('privateNotifyCreatedContractClassLog');
88
- }
89
- privateCallPrivateFunction(_targetContractAddress, _functionSelector, _argsHash, _sideEffectCounter, _isStaticCall) {
90
- return Promise.reject(new OracleMethodNotAvailableError('privateCallPrivateFunction'));
91
- }
92
- privateNotifyEnqueuedPublicFunctionCall(_targetContractAddress, _calldataHash, _sideEffectCounter, _isStaticCall) {
93
- return Promise.reject(new OracleMethodNotAvailableError('privateNotifyEnqueuedPublicFunctionCall'));
94
- }
95
- privateNotifySetPublicTeardownFunctionCall(_targetContractAddress, _calldataHash, _sideEffectCounter, _isStaticCall) {
96
- return Promise.reject(new OracleMethodNotAvailableError('privateNotifySetPublicTeardownFunctionCall'));
97
- }
98
- privateNotifySetMinRevertibleSideEffectCounter(_minRevertibleSideEffectCounter) {
99
- throw new OracleMethodNotAvailableError('privateNotifySetMinRevertibleSideEffectCounter');
100
- }
101
- utilityDebugLog(_message, _fields) {
102
- throw new OracleMethodNotAvailableError('utilityDebugLog');
103
- }
104
- utilityGetIndexedTaggingSecretAsSender(_sender, _recipient) {
105
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetIndexedTaggingSecretAsSender'));
106
- }
107
- privateIncrementAppTaggingSecretIndexAsSender(_sender, _recipient) {
108
- return Promise.reject(new OracleMethodNotAvailableError('privateIncrementAppTaggingSecretIndexAsSender'));
109
- }
110
- utilityFetchTaggedLogs(_pendingTaggedLogArrayBaseSlot) {
111
- return Promise.reject(new OracleMethodNotAvailableError('utilityFetchTaggedLogs'));
112
- }
113
- utilityValidateEnqueuedNotesAndEvents(_contractAddress, _noteValidationRequestsArrayBaseSlot, _eventValidationRequestsArrayBaseSlot) {
114
- return Promise.reject(new OracleMethodNotAvailableError('utilityValidateEnqueuedNotesAndEvents'));
115
- }
116
- utilityBulkRetrieveLogs(_contractAddress, _logRetrievalRequestsArrayBaseSlot, _logRetrievalResponsesArrayBaseSlot) {
117
- throw new OracleMethodNotAvailableError('utilityBulkRetrieveLogs');
118
- }
119
- utilityStoreCapsule(_contractAddress, _key, _capsule) {
120
- return Promise.reject(new OracleMethodNotAvailableError('utilityStoreCapsule'));
121
- }
122
- utilityLoadCapsule(_contractAddress, _key) {
123
- return Promise.reject(new OracleMethodNotAvailableError('utilityLoadCapsule'));
124
- }
125
- utilityDeleteCapsule(_contractAddress, _key) {
126
- return Promise.reject(new OracleMethodNotAvailableError('utilityDeleteCapsule'));
127
- }
128
- utilityCopyCapsule(_contractAddress, _srcKey, _dstKey, _numEntries) {
129
- return Promise.reject(new OracleMethodNotAvailableError('utilityCopyCapsule'));
130
- }
131
- utilityAes128Decrypt(_ciphertext, _iv, _symKey) {
132
- return Promise.reject(new OracleMethodNotAvailableError('utilityAes128Decrypt'));
133
- }
134
- utilityGetSharedSecret(_address, _ephPk) {
135
- return Promise.reject(new OracleMethodNotAvailableError('utilityGetSharedSecret'));
136
- }
137
- utilityEmitOffchainEffect(_data) {
138
- return Promise.reject(new OracleMethodNotAvailableError('utilityEmitOffchainEffect'));
139
- }
140
- privateGetSenderForTags() {
141
- return Promise.reject(new OracleMethodNotAvailableError('privateGetSenderForTags'));
142
- }
143
- privateSetSenderForTags(_senderForTags) {
144
- return Promise.reject(new OracleMethodNotAvailableError('privateSetSenderForTags'));
145
- }
146
- }
@@ -1,17 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
3
- export declare const WINDOW_HALF_SIZE = 10;
4
- export declare function getIndexedTaggingSecretsForTheWindow(secretsAndWindows: {
5
- appTaggingSecret: Fr;
6
- leftMostIndex: number;
7
- rightMostIndex: number;
8
- }[]): IndexedTaggingSecret[];
9
- /**
10
- * Creates a map from app tagging secret to initial index.
11
- * @param indexedTaggingSecrets - The indexed tagging secrets to get the initial indexes from.
12
- * @returns The map from app tagging secret to initial index.
13
- */
14
- export declare function getInitialIndexesMap(indexedTaggingSecrets: IndexedTaggingSecret[]): {
15
- [k: string]: number;
16
- };
17
- //# sourceMappingURL=tagging_utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tagging_utils.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/tagging_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG1D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wBAAgB,oCAAoC,CAClD,iBAAiB,EAAE;IAAE,gBAAgB,EAAE,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC3F,oBAAoB,EAAE,CAQxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAQ3G"}
@@ -1,23 +0,0 @@
1
- import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
2
- // Half the size of the window we slide over the tagging secret indexes.
3
- export const WINDOW_HALF_SIZE = 10;
4
- export function getIndexedTaggingSecretsForTheWindow(secretsAndWindows) {
5
- const secrets = [];
6
- for (const secretAndWindow of secretsAndWindows){
7
- for(let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++){
8
- secrets.push(new IndexedTaggingSecret(secretAndWindow.appTaggingSecret, i));
9
- }
10
- }
11
- return secrets;
12
- }
13
- /**
14
- * Creates a map from app tagging secret to initial index.
15
- * @param indexedTaggingSecrets - The indexed tagging secrets to get the initial indexes from.
16
- * @returns The map from app tagging secret to initial index.
17
- */ export function getInitialIndexesMap(indexedTaggingSecrets) {
18
- const initialIndexes = {};
19
- for (const indexedTaggingSecret of indexedTaggingSecrets){
20
- initialIndexes[indexedTaggingSecret.appTaggingSecret.toString()] = indexedTaggingSecret.index;
21
- }
22
- return initialIndexes;
23
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"error_enriching.d.ts","sourceRoot":"","sources":["../../src/pxe_service/error_enriching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIpD,OAAO,EAAE,KAAK,eAAe,EAA6B,MAAM,sBAAsB,CAAC;AAEvF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AAExG;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,eAAe,EACpB,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,MAAM,iBAoDf;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,eAAe,EACpB,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,MAAM,iBAqCf"}
@@ -1,3 +0,0 @@
1
- export * from './pxe_service.js';
2
- export { enrichPublicSimulationError } from './error_enriching.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pxe_service/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './pxe_service.js';
2
- export { enrichPublicSimulationError } from './error_enriching.js';