@aztec/pxe 0.0.1-commit.cf93bcc56 → 0.0.1-commit.d117d021b

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 (118) hide show
  1. package/dest/config/index.d.ts +2 -2
  2. package/dest/config/index.d.ts.map +1 -1
  3. package/dest/config/index.js +1 -1
  4. package/dest/config/package_info.js +1 -1
  5. package/dest/contract_function_simulator/contract_function_simulator.d.ts +1 -1
  6. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  7. package/dest/contract_function_simulator/contract_function_simulator.js +11 -11
  8. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
  9. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  10. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
  11. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -3
  12. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -4
  14. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
  15. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
  17. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -4
  18. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +3 -5
  20. package/dest/contract_function_simulator/oracle/interfaces.d.ts +48 -45
  21. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/oracle/oracle.d.ts +43 -44
  23. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/oracle/oracle.js +129 -91
  25. package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
  26. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +20 -34
  27. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +37 -64
  29. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +36 -34
  30. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +48 -50
  32. package/dest/contract_logging.d.ts +22 -0
  33. package/dest/contract_logging.d.ts.map +1 -0
  34. package/dest/contract_logging.js +23 -0
  35. package/dest/debug/pxe_debug_utils.d.ts +2 -2
  36. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  37. package/dest/debug/pxe_debug_utils.js +4 -4
  38. package/dest/entrypoints/client/bundle/index.d.ts +2 -1
  39. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  40. package/dest/entrypoints/client/bundle/index.js +1 -0
  41. package/dest/entrypoints/client/lazy/index.d.ts +2 -1
  42. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  43. package/dest/entrypoints/client/lazy/index.js +1 -0
  44. package/dest/logs/log_service.d.ts +1 -1
  45. package/dest/logs/log_service.d.ts.map +1 -1
  46. package/dest/logs/log_service.js +4 -4
  47. package/dest/oracle_version.d.ts +2 -2
  48. package/dest/oracle_version.js +3 -3
  49. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
  50. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  51. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +125 -64
  52. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  53. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  54. package/dest/private_kernel/hints/test_utils.js +203 -0
  55. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  56. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  57. package/dest/private_kernel/private_kernel_execution_prover.js +13 -5
  58. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
  59. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  60. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  61. package/dest/pxe.d.ts +8 -7
  62. package/dest/pxe.d.ts.map +1 -1
  63. package/dest/pxe.js +37 -29
  64. package/dest/storage/contract_store/contract_store.d.ts +42 -15
  65. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  66. package/dest/storage/contract_store/contract_store.js +140 -64
  67. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  68. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  69. package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
  70. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  71. package/dest/storage/tagging_store/sender_tagging_store.js +4 -4
  72. package/dest/tagging/index.d.ts +2 -2
  73. package/dest/tagging/index.d.ts.map +1 -1
  74. package/dest/tagging/index.js +1 -1
  75. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
  76. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  77. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +3 -3
  78. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
  79. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  80. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
  81. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
  82. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  83. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
  84. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
  85. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  86. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +14 -15
  87. package/package.json +16 -16
  88. package/src/config/index.ts +1 -1
  89. package/src/config/package_info.ts +1 -1
  90. package/src/contract_function_simulator/contract_function_simulator.ts +18 -20
  91. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
  92. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -5
  93. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
  94. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -6
  95. package/src/contract_function_simulator/oracle/interfaces.ts +48 -54
  96. package/src/contract_function_simulator/oracle/oracle.ts +136 -136
  97. package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
  98. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +42 -80
  99. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +55 -59
  100. package/src/contract_logging.ts +39 -0
  101. package/src/debug/pxe_debug_utils.ts +4 -4
  102. package/src/entrypoints/client/bundle/index.ts +1 -0
  103. package/src/entrypoints/client/lazy/index.ts +1 -0
  104. package/src/logs/log_service.ts +10 -5
  105. package/src/oracle_version.ts +3 -3
  106. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +157 -110
  107. package/src/private_kernel/hints/test_utils.ts +325 -0
  108. package/src/private_kernel/private_kernel_execution_prover.ts +13 -6
  109. package/src/private_kernel/private_kernel_oracle.ts +7 -7
  110. package/src/pxe.ts +41 -34
  111. package/src/storage/contract_store/contract_store.ts +170 -71
  112. package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
  113. package/src/storage/tagging_store/sender_tagging_store.ts +8 -8
  114. package/src/tagging/index.ts +1 -1
  115. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +3 -6
  116. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
  117. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
  118. 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.cf93bcc56",
3
+ "version": "0.0.1-commit.d117d021b",
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.cf93bcc56",
74
- "@aztec/bb.js": "0.0.1-commit.cf93bcc56",
75
- "@aztec/builder": "0.0.1-commit.cf93bcc56",
76
- "@aztec/constants": "0.0.1-commit.cf93bcc56",
77
- "@aztec/ethereum": "0.0.1-commit.cf93bcc56",
78
- "@aztec/foundation": "0.0.1-commit.cf93bcc56",
79
- "@aztec/key-store": "0.0.1-commit.cf93bcc56",
80
- "@aztec/kv-store": "0.0.1-commit.cf93bcc56",
81
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.cf93bcc56",
82
- "@aztec/noir-types": "0.0.1-commit.cf93bcc56",
83
- "@aztec/protocol-contracts": "0.0.1-commit.cf93bcc56",
84
- "@aztec/simulator": "0.0.1-commit.cf93bcc56",
85
- "@aztec/stdlib": "0.0.1-commit.cf93bcc56",
73
+ "@aztec/bb-prover": "0.0.1-commit.d117d021b",
74
+ "@aztec/bb.js": "0.0.1-commit.d117d021b",
75
+ "@aztec/builder": "0.0.1-commit.d117d021b",
76
+ "@aztec/constants": "0.0.1-commit.d117d021b",
77
+ "@aztec/ethereum": "0.0.1-commit.d117d021b",
78
+ "@aztec/foundation": "0.0.1-commit.d117d021b",
79
+ "@aztec/key-store": "0.0.1-commit.d117d021b",
80
+ "@aztec/kv-store": "0.0.1-commit.d117d021b",
81
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.d117d021b",
82
+ "@aztec/noir-types": "0.0.1-commit.d117d021b",
83
+ "@aztec/protocol-contracts": "0.0.1-commit.d117d021b",
84
+ "@aztec/simulator": "0.0.1-commit.d117d021b",
85
+ "@aztec/stdlib": "0.0.1-commit.d117d021b",
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.cf93bcc56",
95
- "@aztec/noir-test-contracts.js": "0.0.1-commit.cf93bcc56",
94
+ "@aztec/merkle-tree": "0.0.1-commit.d117d021b",
95
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.d117d021b",
96
96
  "@jest/globals": "^30.0.0",
97
97
  "@types/jest": "^30.0.0",
98
98
  "@types/lodash.omit": "^4.5.7",
@@ -5,8 +5,8 @@ import {
5
5
  numberConfigHelper,
6
6
  parseBooleanEnv,
7
7
  } from '@aztec/foundation/config';
8
- import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
9
8
  import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
9
+ import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
10
10
 
11
11
  export { getPackageInfo } from './package_info.js';
12
12
 
@@ -1,3 +1,3 @@
1
1
  export function getPackageInfo() {
2
- return { version: '4.0.0', name: '@aztec/pxe' };
2
+ return { version: '5.0.0', name: '@aztec/pxe' };
3
3
  }
@@ -2,11 +2,8 @@ import {
2
2
  AVM_EMITNOTEHASH_BASE_L2_GAS,
3
3
  AVM_EMITNULLIFIER_BASE_L2_GAS,
4
4
  AVM_SENDL2TOL1MSG_BASE_L2_GAS,
5
- DA_BYTES_PER_FIELD,
6
- DA_GAS_PER_BYTE,
5
+ DA_GAS_PER_FIELD,
7
6
  FIXED_AVM_STARTUP_L2_GAS,
8
- FIXED_DA_GAS,
9
- FIXED_L2_GAS,
10
7
  L2_GAS_PER_CONTRACT_CLASS_LOG,
11
8
  L2_GAS_PER_L2_TO_L1_MSG,
12
9
  L2_GAS_PER_NOTE_HASH,
@@ -20,6 +17,9 @@ import {
20
17
  MAX_NULLIFIERS_PER_TX,
21
18
  MAX_NULLIFIER_READ_REQUESTS_PER_TX,
22
19
  MAX_PRIVATE_LOGS_PER_TX,
20
+ PRIVATE_TX_L2_GAS_OVERHEAD,
21
+ PUBLIC_TX_L2_GAS_OVERHEAD,
22
+ TX_DA_GAS_OVERHEAD,
23
23
  } from '@aztec/constants';
24
24
  import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
25
25
  import { Fr } from '@aztec/foundation/curves/bn254';
@@ -277,7 +277,7 @@ export class ContractFunctionSimulator {
277
277
  );
278
278
  const publicFunctionsCalldata = await Promise.all(
279
279
  publicCallRequests.map(async r => {
280
- const calldata = await privateExecutionOracle.privateLoadFromExecutionCache(r.calldataHash);
280
+ const calldata = await privateExecutionOracle.loadFromExecutionCache(r.calldataHash);
281
281
  return new HashedValues(calldata, r.calldataHash);
282
282
  }),
283
283
  );
@@ -361,7 +361,7 @@ export class ContractFunctionSimulator {
361
361
  );
362
362
  });
363
363
 
364
- this.log.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
364
+ this.log.verbose(`Utility execution for ${call.to}.${call.selector} completed`);
365
365
  return witnessMapToFields(acirExecutionResult.returnWitness);
366
366
  } catch (err) {
367
367
  throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
@@ -654,7 +654,12 @@ export async function generateSimulatedProvingResult(
654
654
 
655
655
  const publicInputs = new PrivateKernelTailCircuitPublicInputs(
656
656
  constantData,
657
- /*gasUsed=*/ gasUsed.add(Gas.from({ l2Gas: FIXED_L2_GAS, daGas: FIXED_DA_GAS })),
657
+ /*gasUsed=*/ gasUsed.add(
658
+ Gas.from({
659
+ l2Gas: isPrivateOnlyTx ? PRIVATE_TX_L2_GAS_OVERHEAD : PUBLIC_TX_L2_GAS_OVERHEAD,
660
+ daGas: TX_DA_GAS_OVERHEAD,
661
+ }),
662
+ ),
658
663
  /*feePayer=*/ AztecAddress.zero(),
659
664
  /*expirationTimestamp=*/ 0n,
660
665
  hasPublicCalls ? inputsForPublic : undefined,
@@ -684,6 +689,7 @@ function squashTransientSideEffects(
684
689
  scopedNullifiersCLA,
685
690
  /*futureNoteHashReads=*/ [],
686
691
  /*futureNullifierReads=*/ [],
692
+ /*futureLogs=*/ [],
687
693
  noteHashNullifierCounterMap,
688
694
  minRevertibleSideEffectCounter,
689
695
  );
@@ -726,16 +732,8 @@ async function verifyReadRequests(
726
732
  nullifierReadRequests.length,
727
733
  );
728
734
 
729
- const noteHashResetActions = getNoteHashReadRequestResetActions(
730
- noteHashReadRequestsCLA,
731
- scopedNoteHashesCLA,
732
- /*futureNoteHashes=*/ [],
733
- );
734
- const nullifierResetActions = getNullifierReadRequestResetActions(
735
- nullifierReadRequestsCLA,
736
- scopedNullifiersCLA,
737
- /*futureNullifiers=*/ [],
738
- );
735
+ const noteHashResetActions = getNoteHashReadRequestResetActions(noteHashReadRequestsCLA, scopedNoteHashesCLA);
736
+ const nullifierResetActions = getNullifierReadRequestResetActions(nullifierReadRequestsCLA, scopedNullifiersCLA);
739
737
 
740
738
  const settledNoteHashReads: { index: number; value: Fr }[] = [];
741
739
  for (let i = 0; i < noteHashResetActions.actions.length; i++) {
@@ -811,14 +809,14 @@ function meterGasUsed(data: PrivateToRollupAccumulatedData | PrivateToPublicAccu
811
809
  meteredL2Gas += numPrivatelogs * L2_GAS_PER_PRIVATE_LOG;
812
810
 
813
811
  const numContractClassLogs = arrayNonEmptyLength(data.contractClassLogsHashes, log => log.isEmpty());
814
- // Every contract class log emits its length and contract address as additional fields
812
+ // Every contract class log emits its contract address as an additional field
815
813
  meteredDAFields += data.contractClassLogsHashes.reduce(
816
- (acc, log) => (!log.isEmpty() ? acc + log.logHash.length + 2 : acc),
814
+ (acc, log) => (!log.isEmpty() ? acc + log.logHash.length + 1 : acc),
817
815
  0,
818
816
  );
819
817
  meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
820
818
 
821
- const meteredDAGas = meteredDAFields * DA_BYTES_PER_FIELD * DA_GAS_PER_BYTE;
819
+ const meteredDAGas = meteredDAFields * DA_GAS_PER_FIELD;
822
820
 
823
821
  if ((data as PrivateToPublicAccumulatedData).publicCallRequests) {
824
822
  const dataForPublic = data as PrivateToPublicAccumulatedData;
@@ -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
  }
@@ -4,9 +4,6 @@ import { EventSelector } from '@aztec/stdlib/abi';
4
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import { TxHash } from '@aztec/stdlib/tx';
6
6
 
7
- // TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
8
- const MAX_EVENT_SERIALIZED_LEN = 11;
9
-
10
7
  /**
11
8
  * Intermediate struct used to perform batch event validation by PXE. The `utilityValidateAndStoreEnqueuedNotesAndEvents` oracle
12
9
  * expects for values of this type to be stored in a `CapsuleArray`.
@@ -22,7 +19,7 @@ export class EventValidationRequest {
22
19
  public recipient: AztecAddress,
23
20
  ) {}
24
21
 
25
- static fromFields(fields: Fr[] | FieldReader): EventValidationRequest {
22
+ static fromFields(fields: Fr[], maxEventSerializedLen: number): EventValidationRequest {
26
23
  const reader = FieldReader.asReader(fields);
27
24
 
28
25
  const contractAddress = AztecAddress.fromField(reader.readField());
@@ -30,7 +27,7 @@ export class EventValidationRequest {
30
27
 
31
28
  const randomness = reader.readField();
32
29
 
33
- const eventStorage = reader.readFieldArray(MAX_EVENT_SERIALIZED_LEN);
30
+ const eventStorage = reader.readFieldArray(maxEventSerializedLen);
34
31
  const eventLen = reader.readField().toNumber();
35
32
  const serializedEvent = eventStorage.slice(0, eventLen);
36
33
 
@@ -38,6 +35,12 @@ export class EventValidationRequest {
38
35
  const txHash = TxHash.fromField(reader.readField());
39
36
  const recipient = AztecAddress.fromField(reader.readField());
40
37
 
38
+ if (reader.remainingFields() !== 0) {
39
+ throw new Error(
40
+ `Error converting array of fields to EventValidationRequest: expected ${reader.cursor} fields but received ${fields.length} (maxEventSerializedLen=${maxEventSerializedLen}).`,
41
+ );
42
+ }
43
+
41
44
  return new EventValidationRequest(
42
45
  contractAddress,
43
46
  eventTypeId,
@@ -3,10 +3,7 @@ import { range } from '@aztec/foundation/array';
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import type { TxHash } from '@aztec/stdlib/tx';
5
5
 
6
- import { MAX_NOTE_PACKED_LEN } from './note_validation_request.js';
7
-
8
- const MAX_PUBLIC_LOG_LEN_FOR_NOTE_COMPLETION = MAX_NOTE_PACKED_LEN;
9
- const MAX_LOG_CONTENT_LEN = Math.max(MAX_PUBLIC_LOG_LEN_FOR_NOTE_COMPLETION, PRIVATE_LOG_CIPHERTEXT_LEN);
6
+ const MAX_LOG_CONTENT_LEN = PRIVATE_LOG_CIPHERTEXT_LEN;
10
7
 
11
8
  /**
12
9
  * Intermediate struct used to perform batch log retrieval by PXE. The `utilityBulkRetrieveLogs` oracle stores values of this
@@ -3,9 +3,6 @@ import { FieldReader } from '@aztec/foundation/serialize';
3
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { TxHash } from '@aztec/stdlib/tx';
5
5
 
6
- // TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
7
- export const MAX_NOTE_PACKED_LEN = 9;
8
-
9
6
  /**
10
7
  * Intermediate struct used to perform batch note validation by PXE. The `utilityValidateAndStoreEnqueuedNotesAndEvents` oracle
11
8
  * expects for values of this type to be stored in a `CapsuleArray`.
@@ -24,7 +21,7 @@ export class NoteValidationRequest {
24
21
  public recipient: AztecAddress,
25
22
  ) {}
26
23
 
27
- static fromFields(fields: Fr[] | FieldReader): NoteValidationRequest {
24
+ static fromFields(fields: Fr[], maxNotePackedLen: number): NoteValidationRequest {
28
25
  const reader = FieldReader.asReader(fields);
29
26
 
30
27
  const contractAddress = AztecAddress.fromField(reader.readField());
@@ -33,7 +30,7 @@ export class NoteValidationRequest {
33
30
  const randomness = reader.readField();
34
31
  const noteNonce = reader.readField();
35
32
 
36
- const contentStorage = reader.readFieldArray(MAX_NOTE_PACKED_LEN);
33
+ const contentStorage = reader.readFieldArray(maxNotePackedLen);
37
34
  const contentLen = reader.readField().toNumber();
38
35
  const content = contentStorage.slice(0, contentLen);
39
36
 
@@ -44,7 +41,7 @@ export class NoteValidationRequest {
44
41
 
45
42
  if (reader.remainingFields() !== 0) {
46
43
  throw new Error(
47
- `Error converting array of fields to NoteValidationRequest. Hint: check that MAX_NOTE_PACKED_LEN is consistent with private_notes::MAX_NOTE_PACKED_LEN in Aztec-nr.`,
44
+ `Error converting array of fields to NoteValidationRequest: expected ${reader.cursor} fields but received ${fields.length} (maxNotePackedLen=${maxNotePackedLen}).`,
48
45
  );
49
46
  }
50
47
 
@@ -6,8 +6,9 @@ import { MembershipWitness } from '@aztec/foundation/trees';
6
6
  import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
7
7
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
8
  import { BlockHash } from '@aztec/stdlib/block';
9
- import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
9
+ import type { ContractInstance, PartialAddress } from '@aztec/stdlib/contract';
10
10
  import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
11
+ import type { PublicKeys } from '@aztec/stdlib/keys';
11
12
  import type { ContractClassLog, Tag } from '@aztec/stdlib/logs';
12
13
  import type { Note, NoteStatus } from '@aztec/stdlib/note';
13
14
  import { type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
@@ -52,9 +53,9 @@ export interface NoteData {
52
53
  export interface IMiscOracle {
53
54
  isMisc: true;
54
55
 
55
- utilityGetRandomField(): Fr;
56
- utilityAssertCompatibleOracleVersion(version: number): void;
57
- utilityLog(level: number, message: string, fields: Fr[]): Promise<void>;
56
+ getRandomField(): Fr;
57
+ assertCompatibleOracleVersion(version: number): void;
58
+ log(level: number, message: string, fields: Fr[]): Promise<void>;
58
59
  }
59
60
 
60
61
  /**
@@ -64,30 +65,32 @@ export interface IMiscOracle {
64
65
  export interface IUtilityExecutionOracle {
65
66
  isUtility: true;
66
67
 
67
- utilityGetUtilityContext(): UtilityContext;
68
- utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
69
- utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance>;
70
- utilityGetNoteHashMembershipWitness(
68
+ getUtilityContext(): UtilityContext;
69
+ getKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
70
+ getContractInstance(address: AztecAddress): Promise<ContractInstance>;
71
+ getNoteHashMembershipWitness(
71
72
  anchorBlockHash: BlockHash,
72
73
  noteHash: Fr,
73
74
  ): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
74
- utilityGetBlockHashMembershipWitness(
75
+ getBlockHashMembershipWitness(
75
76
  anchorBlockHash: BlockHash,
76
77
  blockHash: BlockHash,
77
78
  ): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
78
- utilityGetNullifierMembershipWitness(
79
+ getNullifierMembershipWitness(
79
80
  anchorBlockHash: BlockHash,
80
81
  nullifier: Fr,
81
82
  ): Promise<NullifierMembershipWitness | undefined>;
82
- utilityGetPublicDataWitness(anchorBlockHash: BlockHash, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
83
- utilityGetLowNullifierMembershipWitness(
83
+ getPublicDataWitness(anchorBlockHash: BlockHash, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
84
+ getLowNullifierMembershipWitness(
84
85
  anchorBlockHash: BlockHash,
85
86
  nullifier: Fr,
86
87
  ): Promise<NullifierMembershipWitness | undefined>;
87
- utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined>;
88
- utilityTryGetPublicKeysAndPartialAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
89
- utilityGetAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
90
- utilityGetNotes(
88
+ getBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined>;
89
+ tryGetPublicKeysAndPartialAddress(
90
+ account: AztecAddress,
91
+ ): Promise<{ publicKeys: PublicKeys; partialAddress: PartialAddress } | undefined>;
92
+ getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
93
+ getNotes(
91
94
  owner: AztecAddress | undefined,
92
95
  storageSlot: Fr,
93
96
  numSelects: number,
@@ -104,35 +107,37 @@ export interface IUtilityExecutionOracle {
104
107
  offset: number,
105
108
  status: NoteStatus,
106
109
  ): Promise<NoteData[]>;
107
- utilityCheckNullifierExists(innerNullifier: Fr): Promise<boolean>;
108
- utilityGetL1ToL2MembershipWitness(
110
+ checkNullifierExists(innerNullifier: Fr): Promise<boolean>;
111
+ getL1ToL2MembershipWitness(
109
112
  contractAddress: AztecAddress,
110
113
  messageHash: Fr,
111
114
  secret: Fr,
112
115
  ): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
113
- utilityStorageRead(
116
+ storageRead(
114
117
  anchorBlockHash: BlockHash,
115
118
  contractAddress: AztecAddress,
116
119
  startStorageSlot: Fr,
117
120
  numberOfElements: number,
118
121
  ): Promise<Fr[]>;
119
- utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
120
- utilityValidateAndStoreEnqueuedNotesAndEvents(
122
+ fetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
123
+ validateAndStoreEnqueuedNotesAndEvents(
121
124
  contractAddress: AztecAddress,
122
125
  noteValidationRequestsArrayBaseSlot: Fr,
123
126
  eventValidationRequestsArrayBaseSlot: Fr,
127
+ maxNotePackedLen: number,
128
+ maxEventSerializedLen: number,
124
129
  ): Promise<void>;
125
- utilityBulkRetrieveLogs(
130
+ bulkRetrieveLogs(
126
131
  contractAddress: AztecAddress,
127
132
  logRetrievalRequestsArrayBaseSlot: Fr,
128
133
  logRetrievalResponsesArrayBaseSlot: Fr,
129
134
  ): Promise<void>;
130
- utilityStoreCapsule(contractAddress: AztecAddress, key: Fr, capsule: Fr[]): Promise<void>;
131
- utilityLoadCapsule(contractAddress: AztecAddress, key: Fr): Promise<Fr[] | null>;
132
- utilityDeleteCapsule(contractAddress: AztecAddress, key: Fr): Promise<void>;
133
- utilityCopyCapsule(contractAddress: AztecAddress, srcKey: Fr, dstKey: Fr, numEntries: number): Promise<void>;
134
- utilityAes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer>;
135
- utilityGetSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
135
+ storeCapsule(contractAddress: AztecAddress, key: Fr, capsule: Fr[]): Promise<void>;
136
+ loadCapsule(contractAddress: AztecAddress, key: Fr): Promise<Fr[] | null>;
137
+ deleteCapsule(contractAddress: AztecAddress, key: Fr): Promise<void>;
138
+ copyCapsule(contractAddress: AztecAddress, srcKey: Fr, dstKey: Fr, numEntries: number): Promise<void>;
139
+ aes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer>;
140
+ getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
136
141
  }
137
142
 
138
143
  /**
@@ -142,9 +147,9 @@ export interface IUtilityExecutionOracle {
142
147
  export interface IPrivateExecutionOracle {
143
148
  isPrivate: true;
144
149
 
145
- privateStoreInExecutionCache(values: Fr[], hash: Fr): void;
146
- privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]>;
147
- privateNotifyCreatedNote(
150
+ storeInExecutionCache(values: Fr[], hash: Fr): void;
151
+ loadFromExecutionCache(hash: Fr): Promise<Fr[]>;
152
+ notifyCreatedNote(
148
153
  owner: AztecAddress,
149
154
  storageSlot: Fr,
150
155
  randomness: Fr,
@@ -153,33 +158,22 @@ export interface IPrivateExecutionOracle {
153
158
  noteHash: Fr,
154
159
  counter: number,
155
160
  ): void;
156
- privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number): Promise<void>;
157
- privateNotifyCreatedNullifier(innerNullifier: Fr): Promise<void>;
158
- privateIsNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean>;
159
- privateNotifyCreatedContractClassLog(log: ContractClassLog, counter: number): void;
160
- privateCallPrivateFunction(
161
+ notifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number): Promise<void>;
162
+ notifyCreatedNullifier(innerNullifier: Fr): Promise<void>;
163
+ isNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean>;
164
+ notifyCreatedContractClassLog(log: ContractClassLog, counter: number): void;
165
+ callPrivateFunction(
161
166
  targetContractAddress: AztecAddress,
162
167
  functionSelector: FunctionSelector,
163
168
  argsHash: Fr,
164
169
  sideEffectCounter: number,
165
170
  isStaticCall: boolean,
166
171
  ): Promise<{ endSideEffectCounter: Fr; returnsHash: Fr }>;
167
- privateNotifyEnqueuedPublicFunctionCall(
168
- targetContractAddress: AztecAddress,
169
- calldataHash: Fr,
170
- sideEffectCounter: number,
171
- isStaticCall: boolean,
172
- ): Promise<void>;
173
- privateNotifySetPublicTeardownFunctionCall(
174
- targetContractAddress: AztecAddress,
175
- calldataHash: Fr,
176
- sideEffectCounter: number,
177
- isStaticCall: boolean,
178
- ): Promise<void>;
179
- privateNotifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
180
- privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean>;
181
- privateGetSenderForTags(): Promise<AztecAddress | undefined>;
182
- privateSetSenderForTags(senderForTags: AztecAddress): Promise<void>;
183
- privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
184
- utilityEmitOffchainEffect(data: Fr[]): Promise<void>;
172
+ validatePublicCalldata(calldataHash: Fr): Promise<void>;
173
+ notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void>;
174
+ inRevertiblePhase(sideEffectCounter: number): Promise<boolean>;
175
+ getSenderForTags(): Promise<AztecAddress | undefined>;
176
+ setSenderForTags(senderForTags: AztecAddress): Promise<void>;
177
+ getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
178
+ emitOffchainEffect(data: Fr[]): Promise<void>;
185
179
  }