@aztec/pxe 0.0.1-commit.8227e42 → 0.0.1-commit.85d7d01

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 (49) hide show
  1. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
  2. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  3. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
  4. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  5. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
  6. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  7. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -1
  8. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  9. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +8 -8
  10. package/dest/logs/log_service.d.ts +1 -1
  11. package/dest/logs/log_service.d.ts.map +1 -1
  12. package/dest/logs/log_service.js +4 -4
  13. package/dest/pxe.d.ts +1 -1
  14. package/dest/pxe.d.ts.map +1 -1
  15. package/dest/pxe.js +2 -1
  16. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  17. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  18. package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
  19. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  20. package/dest/storage/tagging_store/sender_tagging_store.js +4 -4
  21. package/dest/tagging/index.d.ts +2 -2
  22. package/dest/tagging/index.d.ts.map +1 -1
  23. package/dest/tagging/index.js +1 -1
  24. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
  25. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  26. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +3 -3
  27. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
  28. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  29. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
  30. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
  31. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  32. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
  33. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
  34. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  35. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +14 -15
  36. package/package.json +16 -16
  37. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
  38. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  39. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  40. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +12 -9
  41. package/src/logs/log_service.ts +10 -5
  42. package/src/pxe.ts +2 -1
  43. package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
  44. package/src/storage/tagging_store/sender_tagging_store.ts +8 -8
  45. package/src/tagging/index.ts +1 -1
  46. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +3 -6
  47. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
  48. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
  49. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
@@ -1,8 +1,7 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
1
  import type { BlockHash } from '@aztec/stdlib/block';
3
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
4
- import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
5
- import { SiloedTag, Tag } from '@aztec/stdlib/logs';
3
+ import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
+ import { SiloedTag } from '@aztec/stdlib/logs';
6
5
  import { TxHash } from '@aztec/stdlib/tx';
7
6
 
8
7
  import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
@@ -12,9 +11,7 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
12
11
  * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
13
12
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
14
13
  * place is when a tx is being sent from this PXE.
15
- * @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
16
- * @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
17
- * kernel circuit behavior.
14
+ * @param extendedSecret - The extended directional app tagging secret that's unique for (sender, recipient, app) tuple.
18
15
  * @param start - The starting index (inclusive) of the window to process.
19
16
  * @param end - The ending index (exclusive) of the window to process.
20
17
  * @param aztecNode - The Aztec node instance to query for logs.
@@ -23,8 +20,7 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
23
20
  * preserving way.
24
21
  */
25
22
  export async function loadAndStoreNewTaggingIndexes(
26
- secret: DirectionalAppTaggingSecret,
27
- app: AztecAddress,
23
+ extendedSecret: ExtendedDirectionalAppTaggingSecret,
28
24
  start: number,
29
25
  end: number,
30
26
  aztecNode: AztecNode,
@@ -33,20 +29,17 @@ export async function loadAndStoreNewTaggingIndexes(
33
29
  jobId: string,
34
30
  ) {
35
31
  // We compute the tags for the current window of indexes
36
- const preTagsForWindow: PreTag[] = Array(end - start)
37
- .fill(0)
38
- .map((_, i) => ({ secret, index: start + i }));
39
32
  const siloedTagsForWindow = await Promise.all(
40
- preTagsForWindow.map(async preTag => SiloedTag.compute(await Tag.compute(preTag), app)),
33
+ Array.from({ length: end - start }, (_, i) => SiloedTag.compute({ extendedSecret, index: start + i })),
41
34
  );
42
35
 
43
36
  const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
44
- const highestIndexMap = getTxHighestIndexMap(txsForTags, preTagsForWindow);
37
+ const highestIndexMap = getTxHighestIndexMap(txsForTags, start, siloedTagsForWindow.length);
45
38
 
46
39
  // Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
47
40
  for (const [txHashStr, highestIndex] of highestIndexMap.entries()) {
48
41
  const txHash = TxHash.fromString(txHashStr);
49
- await taggingStore.storePendingIndexes([{ secret, index: highestIndex }], txHash, jobId);
42
+ await taggingStore.storePendingIndexes([{ extendedSecret, index: highestIndex }], txHash, jobId);
50
43
  }
51
44
  }
52
45
 
@@ -64,16 +57,14 @@ async function getTxsContainingTags(
64
57
  }
65
58
 
66
59
  // Returns a map of txHash to the highest index for that txHash.
67
- function getTxHighestIndexMap(txHashesForTags: TxHash[][], preTagsForWindow: PreTag[]): Map<string, number> {
68
- if (txHashesForTags.length !== preTagsForWindow.length) {
69
- throw new Error(
70
- `Number of tx hashes arrays does not match number of pre-tags. ${txHashesForTags.length} !== ${preTagsForWindow.length}`,
71
- );
60
+ function getTxHighestIndexMap(txHashesForTags: TxHash[][], start: number, count: number): Map<string, number> {
61
+ if (txHashesForTags.length !== count) {
62
+ throw new Error(`Number of tx hashes arrays does not match number of tags. ${txHashesForTags.length} !== ${count}`);
72
63
  }
73
64
 
74
65
  const highestIndexMap = new Map<string, number>();
75
66
  for (let i = 0; i < txHashesForTags.length; i++) {
76
- const taggingIndex = preTagsForWindow[i].index;
67
+ const taggingIndex = start + i;
77
68
  const txHashesForTag = txHashesForTags[i];
78
69
  for (const txHash of txHashesForTag) {
79
70
  const key = txHash.toString();