@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,21 +1,17 @@
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 } from '@aztec/stdlib/logs';
3
+ import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
5
4
  import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
6
5
  /**
7
6
  * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
8
7
  *
9
- * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
8
+ * @param secret - The secret that's unique for (sender, recipient, app) tuple while the direction of
10
9
  * sender -> recipient matters.
11
- * @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
12
- * second round of siloing in this function which is necessary because kernels do it as well (they silo first field
13
- * of the private log which corresponds to the tag).
14
10
  * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
15
11
  * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
16
12
  * is simply the highest pending index plus one (or finalized if pending is undefined).
17
13
  * @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
18
14
  * updates its status accordingly.
19
15
  */
20
- export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: BlockHash, jobId: string): Promise<void>;
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19zZW5kZXJfdGFnZ2luZ19pbmRleGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9zZW5kZXJfc3luYy9zeW5jX3NlbmRlcl90YWdnaW5nX2luZGV4ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDckQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUV0RSxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBSzlGOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixFQUNoQyxlQUFlLEVBQUUsU0FBUyxFQUMxQixLQUFLLEVBQUUsTUFBTSxHQUNaLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FtRWYifQ==
16
+ export declare function syncSenderTaggingIndexes(secret: ExtendedDirectionalAppTaggingSecret, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: BlockHash, jobId: string): Promise<void>;
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19zZW5kZXJfdGFnZ2luZ19pbmRleGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9zZW5kZXJfc3luYy9zeW5jX3NlbmRlcl90YWdnaW5nX2luZGV4ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDckQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsbUNBQW1DLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU5RSxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBSzlGOzs7Ozs7Ozs7O0dBVUc7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE1BQU0sRUFBRSxtQ0FBbUMsRUFDM0MsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixFQUNoQyxlQUFlLEVBQUUsU0FBUyxFQUMxQixLQUFLLEVBQUUsTUFBTSxHQUNaLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FtRWYifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"sync_sender_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../src/tagging/sender_sync/sync_sender_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AAK9F;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAmEf"}
1
+ {"version":3,"file":"sync_sender_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../src/tagging/sender_sync/sync_sender_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AAK9F;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,mCAAmC,EAC3C,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAmEf"}
@@ -4,17 +4,14 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
4
4
  /**
5
5
  * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
6
6
  *
7
- * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
7
+ * @param secret - The secret that's unique for (sender, recipient, app) tuple while the direction of
8
8
  * sender -> recipient matters.
9
- * @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
10
- * second round of siloing in this function which is necessary because kernels do it as well (they silo first field
11
- * of the private log which corresponds to the tag).
12
9
  * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
13
10
  * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
14
11
  * is simply the highest pending index plus one (or finalized if pending is undefined).
15
12
  * @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
16
13
  * updates its status accordingly.
17
- */ export async function syncSenderTaggingIndexes(secret, app, aztecNode, taggingStore, anchorBlockHash, jobId) {
14
+ */ export async function syncSenderTaggingIndexes(secret, aztecNode, taggingStore, anchorBlockHash, jobId) {
18
15
  // # Explanation of how syncing works
19
16
  //
20
17
  // When choosing an index, we select: highest pending index + 1 (or highest finalized index + 1 if no pending).
@@ -40,7 +37,7 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
40
37
  while(true){
41
38
  // Load and store indexes for the current window. These indexes may already exist in the database if txs using
42
39
  // them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
43
- await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, anchorBlockHash, jobId);
40
+ await loadAndStoreNewTaggingIndexes(secret, start, end, aztecNode, taggingStore, anchorBlockHash, jobId);
44
41
  // Retrieve all indexes within the current window from storage and update their status accordingly.
45
42
  const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
46
43
  if (pendingTxHashes.length === 0) {
@@ -1,15 +1,12 @@
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 } from '@aztec/stdlib/logs';
3
+ import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
5
4
  import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
6
5
  /**
7
6
  * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
8
7
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
9
8
  * place is when a tx is being sent from this PXE.
10
- * @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
11
- * @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
12
- * kernel circuit behavior.
9
+ * @param extendedSecret - The extended directional app tagging secret that's unique for (sender, recipient, app) tuple.
13
10
  * @param start - The starting index (inclusive) of the window to process.
14
11
  * @param end - The ending index (exclusive) of the window to process.
15
12
  * @param aztecNode - The Aztec node instance to query for logs.
@@ -17,5 +14,5 @@ import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_t
17
14
  * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
18
15
  * preserving way.
19
16
  */
20
- export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: BlockHash, jobId: string): Promise<void>;
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBVSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFHakc7Ozs7Ozs7Ozs7Ozs7R0FhRztBQUNILHdCQUFzQiw2QkFBNkIsQ0FDakQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixLQUFLLEVBQUUsTUFBTSxFQUNiLEdBQUcsRUFBRSxNQUFNLEVBQ1gsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixFQUNoQyxlQUFlLEVBQUUsU0FBUyxFQUMxQixLQUFLLEVBQUUsTUFBTSxpQkFrQmQifQ==
17
+ export declare function loadAndStoreNewTaggingIndexes(extendedSecret: ExtendedDirectionalAppTaggingSecret, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: BlockHash, jobId: string): Promise<void>;
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxtQ0FBbUMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFHakc7Ozs7Ozs7Ozs7O0dBV0c7QUFDSCx3QkFBc0IsNkJBQTZCLENBQ2pELGNBQWMsRUFBRSxtQ0FBbUMsRUFDbkQsS0FBSyxFQUFFLE1BQU0sRUFDYixHQUFHLEVBQUUsTUFBTSxFQUNYLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxrQkFBa0IsRUFDaEMsZUFBZSxFQUFFLFNBQVMsRUFDMUIsS0FBSyxFQUFFLE1BQU0saUJBZWQifQ==
@@ -1 +1 @@
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,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAGjG;;;;;;;;;;;;;GAaG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,iBAkBd"}
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,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAGjG;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,mCAAmC,EACnD,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,iBAed"}
@@ -1,34 +1,33 @@
1
- import { SiloedTag, Tag } from '@aztec/stdlib/logs';
1
+ 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
5
  * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
6
6
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
7
7
  * place is when a tx is being sent from this PXE.
8
- * @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
9
- * @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
10
- * kernel circuit behavior.
8
+ * @param extendedSecret - The extended directional app tagging secret that's unique for (sender, recipient, app) tuple.
11
9
  * @param start - The starting index (inclusive) of the window to process.
12
10
  * @param end - The ending index (exclusive) of the window to process.
13
11
  * @param aztecNode - The Aztec node instance to query for logs.
14
12
  * @param taggingStore - The data provider to store pending indexes.
15
13
  * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
16
14
  * preserving way.
17
- */ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, anchorBlockHash, jobId) {
15
+ */ export async function loadAndStoreNewTaggingIndexes(extendedSecret, start, end, aztecNode, taggingStore, anchorBlockHash, jobId) {
18
16
  // We compute the tags for the current window of indexes
19
- const preTagsForWindow = Array(end - start).fill(0).map((_, i)=>({
20
- secret,
17
+ const siloedTagsForWindow = await Promise.all(Array.from({
18
+ length: end - start
19
+ }, (_, i)=>SiloedTag.compute({
20
+ extendedSecret,
21
21
  index: start + i
22
- }));
23
- const siloedTagsForWindow = await Promise.all(preTagsForWindow.map(async (preTag)=>SiloedTag.compute(await Tag.compute(preTag), app)));
22
+ })));
24
23
  const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
25
- const highestIndexMap = getTxHighestIndexMap(txsForTags, preTagsForWindow);
24
+ const highestIndexMap = getTxHighestIndexMap(txsForTags, start, siloedTagsForWindow.length);
26
25
  // Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
27
26
  for (const [txHashStr, highestIndex] of highestIndexMap.entries()){
28
27
  const txHash = TxHash.fromString(txHashStr);
29
28
  await taggingStore.storePendingIndexes([
30
29
  {
31
- secret,
30
+ extendedSecret,
32
31
  index: highestIndex
33
32
  }
34
33
  ], txHash, jobId);
@@ -43,13 +42,13 @@ async function getTxsContainingTags(tags, aztecNode, anchorBlockHash) {
43
42
  return allLogs.map((logs)=>logs.map((log)=>log.txHash));
44
43
  }
45
44
  // Returns a map of txHash to the highest index for that txHash.
46
- function getTxHighestIndexMap(txHashesForTags, preTagsForWindow) {
47
- if (txHashesForTags.length !== preTagsForWindow.length) {
48
- throw new Error(`Number of tx hashes arrays does not match number of pre-tags. ${txHashesForTags.length} !== ${preTagsForWindow.length}`);
45
+ function getTxHighestIndexMap(txHashesForTags, start, count) {
46
+ if (txHashesForTags.length !== count) {
47
+ throw new Error(`Number of tx hashes arrays does not match number of tags. ${txHashesForTags.length} !== ${count}`);
49
48
  }
50
49
  const highestIndexMap = new Map();
51
50
  for(let i = 0; i < txHashesForTags.length; i++){
52
- const taggingIndex = preTagsForWindow[i].index;
51
+ const taggingIndex = start + i;
53
52
  const txHashesForTag = txHashesForTags[i];
54
53
  for (const txHash of txHashesForTag){
55
54
  const key = txHash.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.8227e42",
3
+ "version": "0.0.1-commit.85d7d01",
4
4
  "type": "module",
5
5
  "typedocOptions": {
6
6
  "entryPoints": [
@@ -70,19 +70,19 @@
70
70
  ]
71
71
  },
72
72
  "dependencies": {
73
- "@aztec/bb-prover": "0.0.1-commit.8227e42",
74
- "@aztec/bb.js": "0.0.1-commit.8227e42",
75
- "@aztec/builder": "0.0.1-commit.8227e42",
76
- "@aztec/constants": "0.0.1-commit.8227e42",
77
- "@aztec/ethereum": "0.0.1-commit.8227e42",
78
- "@aztec/foundation": "0.0.1-commit.8227e42",
79
- "@aztec/key-store": "0.0.1-commit.8227e42",
80
- "@aztec/kv-store": "0.0.1-commit.8227e42",
81
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.8227e42",
82
- "@aztec/noir-types": "0.0.1-commit.8227e42",
83
- "@aztec/protocol-contracts": "0.0.1-commit.8227e42",
84
- "@aztec/simulator": "0.0.1-commit.8227e42",
85
- "@aztec/stdlib": "0.0.1-commit.8227e42",
73
+ "@aztec/bb-prover": "0.0.1-commit.85d7d01",
74
+ "@aztec/bb.js": "0.0.1-commit.85d7d01",
75
+ "@aztec/builder": "0.0.1-commit.85d7d01",
76
+ "@aztec/constants": "0.0.1-commit.85d7d01",
77
+ "@aztec/ethereum": "0.0.1-commit.85d7d01",
78
+ "@aztec/foundation": "0.0.1-commit.85d7d01",
79
+ "@aztec/key-store": "0.0.1-commit.85d7d01",
80
+ "@aztec/kv-store": "0.0.1-commit.85d7d01",
81
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.85d7d01",
82
+ "@aztec/noir-types": "0.0.1-commit.85d7d01",
83
+ "@aztec/protocol-contracts": "0.0.1-commit.85d7d01",
84
+ "@aztec/simulator": "0.0.1-commit.85d7d01",
85
+ "@aztec/stdlib": "0.0.1-commit.85d7d01",
86
86
  "koa": "^2.16.1",
87
87
  "koa-router": "^13.1.1",
88
88
  "lodash.omit": "^4.5.0",
@@ -91,8 +91,8 @@
91
91
  "viem": "npm:@aztec/viem@2.38.2"
92
92
  },
93
93
  "devDependencies": {
94
- "@aztec/merkle-tree": "0.0.1-commit.8227e42",
95
- "@aztec/noir-test-contracts.js": "0.0.1-commit.8227e42",
94
+ "@aztec/merkle-tree": "0.0.1-commit.85d7d01",
95
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.85d7d01",
96
96
  "@jest/globals": "^30.0.0",
97
97
  "@types/jest": "^30.0.0",
98
98
  "@types/lodash.omit": "^4.5.7",
@@ -1,18 +1,18 @@
1
- import { DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
1
+ import { ExtendedDirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
2
2
 
3
3
  /**
4
- * A map that stores the tagging index for a given directional app tagging secret.
4
+ * A map that stores the tagging index for a given extended directional app tagging secret.
5
5
  * Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
6
6
  * of sender -> recipient matters.
7
7
  */
8
8
  export class ExecutionTaggingIndexCache {
9
9
  private taggingIndexMap: Map<string, number> = new Map();
10
10
 
11
- public getLastUsedIndex(secret: DirectionalAppTaggingSecret): number | undefined {
11
+ public getLastUsedIndex(secret: ExtendedDirectionalAppTaggingSecret): number | undefined {
12
12
  return this.taggingIndexMap.get(secret.toString());
13
13
  }
14
14
 
15
- public setLastUsedIndex(secret: DirectionalAppTaggingSecret, index: number) {
15
+ public setLastUsedIndex(secret: ExtendedDirectionalAppTaggingSecret, index: number) {
16
16
  const currentValue = this.taggingIndexMap.get(secret.toString());
17
17
  if (currentValue !== undefined && currentValue !== index - 1) {
18
18
  throw new Error(`Invalid tagging index update. Current value: ${currentValue}, new value: ${index}`);
@@ -25,7 +25,7 @@ export class ExecutionTaggingIndexCache {
25
25
  */
26
26
  public getUsedPreTags(): PreTag[] {
27
27
  return Array.from(this.taggingIndexMap.entries()).map(([secret, index]) => ({
28
- secret: DirectionalAppTaggingSecret.fromString(secret),
28
+ extendedSecret: ExtendedDirectionalAppTaggingSecret.fromString(secret),
29
29
  index,
30
30
  }));
31
31
  }
@@ -5,7 +5,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import { TxHash } from '@aztec/stdlib/tx';
6
6
 
7
7
  // TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
8
- const MAX_EVENT_SERIALIZED_LEN = 11;
8
+ const MAX_EVENT_SERIALIZED_LEN = 10;
9
9
 
10
10
  /**
11
11
  * Intermediate struct used to perform batch event validation by PXE. The `utilityValidateAndStoreEnqueuedNotesAndEvents` oracle
@@ -4,7 +4,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { TxHash } from '@aztec/stdlib/tx';
5
5
 
6
6
  // TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
7
- export const MAX_NOTE_PACKED_LEN = 9;
7
+ export const MAX_NOTE_PACKED_LEN = 8;
8
8
 
9
9
  /**
10
10
  * Intermediate struct used to perform batch note validation by PXE. The `utilityValidateAndStoreEnqueuedNotesAndEvents` oracle
@@ -14,7 +14,7 @@ import {
14
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
15
15
  import { siloNullifier } from '@aztec/stdlib/hash';
16
16
  import { PrivateContextInputs } from '@aztec/stdlib/kernel';
17
- import { type ContractClassLog, DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
17
+ import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
18
18
  import { Tag } from '@aztec/stdlib/logs';
19
19
  import { Note, type NoteStatus } from '@aztec/stdlib/note';
20
20
  import {
@@ -216,25 +216,29 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
216
216
  * @returns An app tag to be used in a log.
217
217
  */
218
218
  public async privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag> {
219
- const secret = await this.#calculateDirectionalAppTaggingSecret(this.contractAddress, sender, recipient);
219
+ const extendedSecret = await this.#calculateExtendedDirectionalAppTaggingSecret(
220
+ this.contractAddress,
221
+ sender,
222
+ recipient,
223
+ );
220
224
 
221
- const index = await this.#getIndexToUseForSecret(secret);
225
+ const index = await this.#getIndexToUseForSecret(extendedSecret);
222
226
  this.log.debug(
223
227
  `Incrementing tagging index for sender: ${sender}, recipient: ${recipient}, contract: ${this.contractAddress} to ${index}`,
224
228
  );
225
- this.taggingIndexCache.setLastUsedIndex(secret, index);
229
+ this.taggingIndexCache.setLastUsedIndex(extendedSecret, index);
226
230
 
227
- return Tag.compute({ secret, index });
231
+ return Tag.compute({ extendedSecret, index });
228
232
  }
229
233
 
230
- async #calculateDirectionalAppTaggingSecret(
234
+ async #calculateExtendedDirectionalAppTaggingSecret(
231
235
  contractAddress: AztecAddress,
232
236
  sender: AztecAddress,
233
237
  recipient: AztecAddress,
234
238
  ) {
235
239
  const senderCompleteAddress = await this.getCompleteAddressOrFail(sender);
236
240
  const senderIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(sender);
237
- return DirectionalAppTaggingSecret.compute(
241
+ return ExtendedDirectionalAppTaggingSecret.compute(
238
242
  senderCompleteAddress,
239
243
  senderIvsk,
240
244
  recipient,
@@ -243,7 +247,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
243
247
  );
244
248
  }
245
249
 
246
- async #getIndexToUseForSecret(secret: DirectionalAppTaggingSecret): Promise<number> {
250
+ async #getIndexToUseForSecret(secret: ExtendedDirectionalAppTaggingSecret): Promise<number> {
247
251
  // If we have the tagging index in the cache, we use it. If not we obtain it from the execution data provider.
248
252
  const lastUsedIndexInTx = this.taggingIndexCache.getLastUsedIndex(secret);
249
253
 
@@ -255,7 +259,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
255
259
  // that'd be wasteful as most tagging secrets are not used in each tx.
256
260
  await syncSenderTaggingIndexes(
257
261
  secret,
258
- this.contractAddress,
259
262
  this.aztecNode,
260
263
  this.senderTaggingStore,
261
264
  await this.anchorBlockHeader.hash(),
@@ -3,7 +3,13 @@ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundatio
3
3
  import type { KeyStore } from '@aztec/key-store';
4
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
6
- import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
6
+ import {
7
+ ExtendedDirectionalAppTaggingSecret,
8
+ PendingTaggedLog,
9
+ SiloedTag,
10
+ Tag,
11
+ TxScopedL2Log,
12
+ } from '@aztec/stdlib/logs';
7
13
  import type { BlockHeader } from '@aztec/stdlib/tx';
8
14
 
9
15
  import type { AccessScopes } from '../access_scopes.js';
@@ -41,7 +47,7 @@ export class LogService {
41
47
  logRetrievalRequests.map(async request => {
42
48
  const [publicLog, privateLog] = await Promise.all([
43
49
  this.#getPublicLogByTag(request.tag, request.contractAddress),
44
- this.#getPrivateLogByTag(await SiloedTag.compute(request.tag, request.contractAddress)),
50
+ this.#getPrivateLogByTag(await SiloedTag.computeFromTagAndApp(request.tag, request.contractAddress)),
45
51
  ]);
46
52
 
47
53
  if (publicLog !== null && privateLog !== null) {
@@ -130,7 +136,6 @@ export class LogService {
130
136
  secrets.map(secret =>
131
137
  loadPrivateLogsForSenderRecipientPair(
132
138
  secret,
133
- contractAddress,
134
139
  this.aztecNode,
135
140
  this.recipientTaggingStore,
136
141
  anchorBlockNumber,
@@ -154,7 +159,7 @@ export class LogService {
154
159
  async #getSecretsForSenders(
155
160
  contractAddress: AztecAddress,
156
161
  recipient: AztecAddress,
157
- ): Promise<DirectionalAppTaggingSecret[]> {
162
+ ): Promise<ExtendedDirectionalAppTaggingSecret[]> {
158
163
  const recipientCompleteAddress = await this.addressStore.getCompleteAddress(recipient);
159
164
  if (!recipientCompleteAddress) {
160
165
  return [];
@@ -172,7 +177,7 @@ export class LogService {
172
177
 
173
178
  return Promise.all(
174
179
  deduplicatedSenders.map(sender => {
175
- return DirectionalAppTaggingSecret.compute(
180
+ return ExtendedDirectionalAppTaggingSecret.compute(
176
181
  recipientCompleteAddress,
177
182
  recipientIvsk,
178
183
  sender,
package/src/pxe.ts CHANGED
@@ -958,7 +958,8 @@ export class PXE {
958
958
  const validationResult = await this.node.isValidTx(simulatedTx, { isSimulation: true, skipFeeEnforcement });
959
959
  validationTime = validationTimer.ms();
960
960
  if (validationResult.result === 'invalid') {
961
- throw new Error('The simulated transaction is unable to be added to state and is invalid.');
961
+ const reason = validationResult.reason.length > 0 ? ` Reason: ${validationResult.reason.join(', ')}` : '';
962
+ throw new Error(`The simulated transaction is unable to be added to state and is invalid.${reason}`);
962
963
  }
963
964
  }
964
965
 
@@ -1,5 +1,5 @@
1
1
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
2
- import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
2
+ import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
3
3
 
4
4
  import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
5
5
 
@@ -106,11 +106,11 @@ export class RecipientTaggingStore implements StagedStore {
106
106
  return Promise.resolve();
107
107
  }
108
108
 
109
- getHighestAgedIndex(secret: DirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
109
+ getHighestAgedIndex(secret: ExtendedDirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
110
110
  return this.#store.transactionAsync(() => this.#readHighestAgedIndex(jobId, secret.toString()));
111
111
  }
112
112
 
113
- updateHighestAgedIndex(secret: DirectionalAppTaggingSecret, index: number, jobId: string): Promise<void> {
113
+ updateHighestAgedIndex(secret: ExtendedDirectionalAppTaggingSecret, index: number, jobId: string): Promise<void> {
114
114
  return this.#store.transactionAsync(async () => {
115
115
  const currentIndex = await this.#readHighestAgedIndex(jobId, secret.toString());
116
116
  if (currentIndex !== undefined && index <= currentIndex) {
@@ -121,11 +121,15 @@ export class RecipientTaggingStore implements StagedStore {
121
121
  });
122
122
  }
123
123
 
124
- getHighestFinalizedIndex(secret: DirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
124
+ getHighestFinalizedIndex(secret: ExtendedDirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
125
125
  return this.#store.transactionAsync(() => this.#readHighestFinalizedIndex(jobId, secret.toString()));
126
126
  }
127
127
 
128
- updateHighestFinalizedIndex(secret: DirectionalAppTaggingSecret, index: number, jobId: string): Promise<void> {
128
+ updateHighestFinalizedIndex(
129
+ secret: ExtendedDirectionalAppTaggingSecret,
130
+ index: number,
131
+ jobId: string,
132
+ ): Promise<void> {
129
133
  return this.#store.transactionAsync(async () => {
130
134
  const currentIndex = await this.#readHighestFinalizedIndex(jobId, secret.toString());
131
135
  if (currentIndex !== undefined && index < currentIndex) {
@@ -1,5 +1,5 @@
1
1
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
2
- import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
2
+ import type { ExtendedDirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
3
3
  import { TxHash } from '@aztec/stdlib/tx';
4
4
 
5
5
  import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
@@ -154,7 +154,7 @@ export class SenderTaggingStore implements StagedStore {
154
154
 
155
155
  // The secrets in pre-tags should be unique because we always store just the highest index per given secret-txHash
156
156
  // pair. Below we check that this is the case.
157
- const secretsSet = new Set(preTags.map(preTag => preTag.secret.toString()));
157
+ const secretsSet = new Set(preTags.map(preTag => preTag.extendedSecret.toString()));
158
158
  if (secretsSet.size !== preTags.length) {
159
159
  return Promise.reject(new Error(`Duplicate secrets found when storing pending indexes`));
160
160
  }
@@ -163,10 +163,10 @@ export class SenderTaggingStore implements StagedStore {
163
163
 
164
164
  return this.#store.transactionAsync(async () => {
165
165
  // Prefetch all data, start reads during iteration to keep IndexedDB transaction alive
166
- const preTagReadPromises = preTags.map(({ secret, index }) => {
167
- const secretStr = secret.toString();
166
+ const preTagReadPromises = preTags.map(({ extendedSecret, index }) => {
167
+ const secretStr = extendedSecret.toString();
168
168
  return {
169
- secret,
169
+ extendedSecret,
170
170
  secretStr,
171
171
  index,
172
172
  pending: this.#readPendingIndexes(jobId, secretStr),
@@ -233,7 +233,7 @@ export class SenderTaggingStore implements StagedStore {
233
233
  * [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
234
234
  */
235
235
  getTxHashesOfPendingIndexes(
236
- secret: DirectionalAppTaggingSecret,
236
+ secret: ExtendedDirectionalAppTaggingSecret,
237
237
  startIndex: number,
238
238
  endIndex: number,
239
239
  jobId: string,
@@ -252,7 +252,7 @@ export class SenderTaggingStore implements StagedStore {
252
252
  * @param secret - The secret to get the last finalized index for.
253
253
  * @returns The last (highest) finalized index for the given secret.
254
254
  */
255
- getLastFinalizedIndex(secret: DirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
255
+ getLastFinalizedIndex(secret: ExtendedDirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
256
256
  return this.#store.transactionAsync(() => this.#readLastFinalizedIndex(jobId, secret.toString()));
257
257
  }
258
258
 
@@ -262,7 +262,7 @@ export class SenderTaggingStore implements StagedStore {
262
262
  * @param secret - The directional app tagging secret to query the last used index for.
263
263
  * @returns The last used index.
264
264
  */
265
- getLastUsedIndex(secret: DirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
265
+ getLastUsedIndex(secret: ExtendedDirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
266
266
  const secretStr = secret.toString();
267
267
 
268
268
  return this.#store.transactionAsync(async () => {
@@ -15,5 +15,5 @@ export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
15
15
  export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
16
16
 
17
17
  // Re-export tagging-related types from stdlib
18
- export { DirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
18
+ export { ExtendedDirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
19
19
  export { type PreTag } from '@aztec/stdlib/logs';
@@ -1,8 +1,7 @@
1
1
  import type { BlockNumber } from '@aztec/foundation/branded-types';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
2
  import type { BlockHash } from '@aztec/stdlib/block';
4
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
- import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
4
+ import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
6
5
 
7
6
  import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
8
7
  import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
@@ -10,15 +9,14 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
10
9
  import { loadLogsForRange } from './utils/load_logs_for_range.js';
11
10
 
12
11
  /**
13
- * Loads private logs for `app` and sender-recipient pair defined by `secret` and updates the highest aged and
12
+ * Loads private logs for the app-sender-recipient triplet defined by `secret` and updates the highest aged and
14
13
  * finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
15
14
  *
16
15
  * @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
17
16
  * in the tagging data provider is indexed by the secret and hence completely disjoint.
18
17
  */
19
18
  export async function loadPrivateLogsForSenderRecipientPair(
20
- secret: DirectionalAppTaggingSecret,
21
- app: AztecAddress,
19
+ secret: ExtendedDirectionalAppTaggingSecret,
22
20
  aztecNode: AztecNode,
23
21
  taggingStore: RecipientTaggingStore,
24
22
  anchorBlockNumber: BlockNumber,
@@ -96,7 +94,6 @@ export async function loadPrivateLogsForSenderRecipientPair(
96
94
  // Get private logs with their block timestamps and corresponding tagging indexes
97
95
  const privateLogsWithIndexes = await loadLogsForRange(
98
96
  secret,
99
- app,
100
97
  aztecNode,
101
98
  start,
102
99
  end,
@@ -1,32 +1,27 @@
1
1
  import type { BlockNumber } from '@aztec/foundation/branded-types';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
2
  import type { BlockHash } from '@aztec/stdlib/block';
4
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
- import type { DirectionalAppTaggingSecret, PreTag, TxScopedL2Log } from '@aztec/stdlib/logs';
6
- import { SiloedTag, Tag } from '@aztec/stdlib/logs';
4
+ import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
5
+ import { SiloedTag } from '@aztec/stdlib/logs';
7
6
 
8
7
  import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
9
8
 
10
9
  /**
11
- * Gets private logs with their corresponding block timestamps and tagging indexes for the given index range, `app` and
12
- * `secret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and `end` is
13
- * exclusive.
10
+ * Gets private logs with their corresponding block timestamps and tagging indexes for the given index range and
11
+ * `extendedSecret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and
12
+ * `end` is exclusive.
14
13
  */
15
14
  export async function loadLogsForRange(
16
- secret: DirectionalAppTaggingSecret,
17
- app: AztecAddress,
15
+ extendedSecret: ExtendedDirectionalAppTaggingSecret,
18
16
  aztecNode: AztecNode,
19
17
  start: number,
20
18
  end: number,
21
19
  anchorBlockNumber: BlockNumber,
22
20
  anchorBlockHash: BlockHash,
23
21
  ): Promise<Array<{ log: TxScopedL2Log; taggingIndex: number }>> {
24
- // Derive tags for the window
25
- const preTags: PreTag[] = Array(end - start)
26
- .fill(0)
27
- .map((_, i) => ({ secret, index: start + i }));
28
- const siloedTags = await Promise.all(preTags.map(preTag => Tag.compute(preTag))).then(tags =>
29
- Promise.all(tags.map(tag => SiloedTag.compute(tag, app))),
22
+ // Derive siloed tags for the window
23
+ const siloedTags = await Promise.all(
24
+ Array.from({ length: end - start }, (_, i) => SiloedTag.compute({ extendedSecret, index: start + i })),
30
25
  );
31
26
 
32
27
  // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
@@ -37,7 +32,7 @@ export async function loadLogsForRange(
37
32
  const logsWithIndexes: Array<{ log: TxScopedL2Log; taggingIndex: number }> = [];
38
33
  for (let i = 0; i < logs.length; i++) {
39
34
  const logsForTag = logs[i];
40
- const taggingIndex = preTags[i].index;
35
+ const taggingIndex = start + i;
41
36
  for (const log of logsForTag) {
42
37
  if (log.blockNumber <= anchorBlockNumber) {
43
38
  logsWithIndexes.push({ log, taggingIndex });
@@ -1,7 +1,6 @@
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 } from '@aztec/stdlib/logs';
3
+ import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
5
4
 
6
5
  import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
7
6
  import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
@@ -11,11 +10,8 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
11
10
  /**
12
11
  * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
13
12
  *
14
- * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
13
+ * @param secret - The secret that's unique for (sender, recipient, app) tuple while the direction of
15
14
  * sender -> recipient matters.
16
- * @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
17
- * second round of siloing in this function which is necessary because kernels do it as well (they silo first field
18
- * of the private log which corresponds to the tag).
19
15
  * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
20
16
  * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
21
17
  * is simply the highest pending index plus one (or finalized if pending is undefined).
@@ -23,8 +19,7 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
23
19
  * updates its status accordingly.
24
20
  */
25
21
  export async function syncSenderTaggingIndexes(
26
- secret: DirectionalAppTaggingSecret,
27
- app: AztecAddress,
22
+ secret: ExtendedDirectionalAppTaggingSecret,
28
23
  aztecNode: AztecNode,
29
24
  taggingStore: SenderTaggingStore,
30
25
  anchorBlockHash: BlockHash,
@@ -59,7 +54,7 @@ export async function syncSenderTaggingIndexes(
59
54
  while (true) {
60
55
  // Load and store indexes for the current window. These indexes may already exist in the database if txs using
61
56
  // them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
62
- await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, anchorBlockHash, jobId);
57
+ await loadAndStoreNewTaggingIndexes(secret, start, end, aztecNode, taggingStore, anchorBlockHash, jobId);
63
58
 
64
59
  // Retrieve all indexes within the current window from storage and update their status accordingly.
65
60
  const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);