@aztec/pxe 0.0.1-commit.4ad48494d → 0.0.1-commit.4eabbdb
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.
- package/dest/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +5 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +4 -4
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +3 -2
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +4 -3
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +1 -1
- package/dest/contract_sync/contract_sync_service.d.ts +4 -3
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +10 -10
- package/dest/contract_sync/helpers.d.ts +3 -2
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +3 -3
- package/dest/debug/pxe_debug_utils.d.ts +5 -4
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +4 -4
- package/dest/entrypoints/client/bundle/index.d.ts +3 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -0
- package/dest/entrypoints/client/lazy/index.d.ts +3 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -0
- package/dest/entrypoints/server/index.d.ts +3 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -0
- package/dest/logs/log_service.d.ts +3 -2
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +1 -1
- package/dest/notes/note_service.d.ts +4 -3
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +3 -2
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +4 -4
- package/dest/private_kernel/private_kernel_execution_prover.js +6 -6
- package/dest/pxe.d.ts +12 -11
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +16 -14
- package/dest/storage/note_store/note_store.d.ts +3 -2
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +2 -2
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +17 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +4 -4
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/package.json +16 -16
- package/src/access_scopes.ts +9 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +8 -8
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +4 -3
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +4 -3
- package/src/contract_sync/contract_sync_service.ts +19 -12
- package/src/contract_sync/helpers.ts +7 -2
- package/src/debug/pxe_debug_utils.ts +9 -8
- package/src/entrypoints/client/bundle/index.ts +2 -0
- package/src/entrypoints/client/lazy/index.ts +2 -0
- package/src/entrypoints/server/index.ts +2 -0
- package/src/logs/log_service.ts +3 -6
- package/src/notes/note_service.ts +4 -3
- package/src/notes_filter.ts +26 -0
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +7 -7
- package/src/private_kernel/private_kernel_execution_prover.ts +6 -6
- package/src/pxe.ts +28 -27
- package/src/storage/note_store/note_store.ts +7 -3
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -4
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
|
@@ -2,8 +2,9 @@ import type { Fr } from '@aztec/foundation/schemas';
|
|
|
2
2
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { DataInBlock } from '@aztec/stdlib/block';
|
|
5
|
-
import { NoteDao
|
|
5
|
+
import { NoteDao } from '@aztec/stdlib/note';
|
|
6
6
|
import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
|
|
7
|
+
import type { NotesFilter } from '../../notes_filter.js';
|
|
7
8
|
/**
|
|
8
9
|
* NoteStore manages the storage and retrieval of notes.
|
|
9
10
|
*
|
|
@@ -79,4 +80,4 @@ export declare class NoteStore implements StagedStore {
|
|
|
79
80
|
commit(jobId: string): Promise<void>;
|
|
80
81
|
discardStaged(jobId: string): Promise<void>;
|
|
81
82
|
}
|
|
82
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
83
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2Uvbm90ZV9zdG9yZS9ub3RlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFxQyxNQUFNLGlCQUFpQixDQUFDO0FBQzVGLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxPQUFPLEVBQWMsTUFBTSxvQkFBb0IsQ0FBQztBQUV6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSwwQ0FBMEMsQ0FBQztBQUM1RSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUd6RDs7Ozs7SUFLSTtBQUNKLHFCQUFhLFNBQVUsWUFBVyxXQUFXOztJQUMzQyxRQUFRLENBQUMsU0FBUyxFQUFFLE1BQU0sQ0FBVTtJQStCcEMsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBUW5DO0lBRUQ7Ozs7Ozs7OztPQVNHO0lBQ0ksUUFBUSxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUUsRUFBRSxLQUFLLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksRUFBRSxDQUFDLENBYXJGO0lBY0Q7Ozs7Ozs7Ozs7T0FVRztJQUNILFFBQVEsQ0FBQyxNQUFNLEVBQUUsV0FBVyxFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDLENBZ0cvRDtJQUVEOzs7Ozs7Ozs7Ozs7OztPQWNHO0lBQ0gsZUFBZSxDQUFDLFVBQVUsRUFBRSxXQUFXLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRSxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQXlDaEY7SUFFRDs7Ozs7Ozs7Ozs7T0FXRztJQUNVLFFBQVEsQ0FBQyxXQUFXLEVBQUUsTUFBTSxFQUFFLGtCQUFrQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBTXBGO0lBNkVEOzs7Ozs7Ozs7T0FTRztJQUNHLE1BQU0sQ0FBQyxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FVekM7SUFFRCxhQUFhLENBQUMsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRzFDO0NBa0NGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAc,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;IAKI;AACJ,qBAAa,SAAU,YAAW,WAAW;;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAU;IA+BpC,YAAY,KAAK,EAAE,iBAAiB,EAQnC;IAED;;;;;;;;;OASG;IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAarF;IAcD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAgG/D;IAED;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAyChF;IAED;;;;;;;;;;;OAWG;IACU,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMpF;IA6ED;;;;;;;;;OASG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1C;CAkCF"}
|
|
@@ -75,7 +75,7 @@ import { StoredNote } from './stored_note.js';
|
|
|
75
75
|
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
76
76
|
* returned once if this is the case)
|
|
77
77
|
*/ getNotes(filter, jobId) {
|
|
78
|
-
if (filter.scopes !==
|
|
78
|
+
if (filter.scopes !== 'ALL_SCOPES' && filter.scopes.length === 0) {
|
|
79
79
|
return Promise.resolve([]);
|
|
80
80
|
}
|
|
81
81
|
return this.#store.transactionAsync(async ()=>{
|
|
@@ -135,7 +135,7 @@ import { StoredNote } from './stored_note.js';
|
|
|
135
135
|
if (filter.siloedNullifier && !note.noteDao.siloedNullifier.equals(filter.siloedNullifier)) {
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
|
-
if (filter.scopes && note.scopes.intersection(new Set(filter.scopes.map((s)=>s.toString()))).size === 0) {
|
|
138
|
+
if (filter.scopes !== 'ALL_SCOPES' && note.scopes.intersection(new Set(filter.scopes.map((s)=>s.toString()))).size === 0) {
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
foundNotes.set(note.noteDao.siloedNullifier.toString(), note.noteDao);
|
|
@@ -21,4 +21,4 @@ export declare function getAllPrivateLogsByTags(aztecNode: AztecNode, tags: Silo
|
|
|
21
21
|
* @returns An array of log arrays, one per tag, containing all logs across all pages.
|
|
22
22
|
*/
|
|
23
23
|
export declare function getAllPublicLogsByTagsFromContract(aztecNode: AztecNode, contractAddress: AztecAddress, tags: Tag[], anchorBlockHash: BlockHash): Promise<TxScopedL2Log[][]>;
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2FsbF9sb2dzX2J5X3RhZ3MuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2dldF9hbGxfbG9nc19ieV90YWdzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRXJELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxHQUFHLEVBQUUsYUFBYSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFpRHhFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBZ0IsdUJBQXVCLENBQ3JDLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLElBQUksRUFBRSxTQUFTLEVBQUUsRUFDakIsZUFBZSxFQUFFLFNBQVMsR0FDekIsT0FBTyxDQUFDLGFBQWEsRUFBRSxFQUFFLENBQUMsQ0FJNUI7QUFFRDs7Ozs7Ozs7R0FRRztBQUNILHdCQUFnQixrQ0FBa0MsQ0FDaEQsU0FBUyxFQUFFLFNBQVMsRUFDcEIsZUFBZSxFQUFFLFlBQVksRUFDN0IsSUFBSSxFQUFFLEdBQUcsRUFBRSxFQUNYLGVBQWUsRUFBRSxTQUFTLEdBQ3pCLE9BQU8sQ0FBQyxhQUFhLEVBQUUsRUFBRSxDQUFDLENBTTVCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_all_logs_by_tags.d.ts","sourceRoot":"","sources":["../../src/tagging/get_all_logs_by_tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"get_all_logs_by_tags.d.ts","sourceRoot":"","sources":["../../src/tagging/get_all_logs_by_tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAiDxE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EAAE,EACjB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAI5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAM5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
|
|
1
|
+
import { MAX_LOGS_PER_TAG, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/api-limit';
|
|
2
2
|
/**
|
|
3
3
|
* Generic pagination helper that fetches all pages of results.
|
|
4
4
|
* @param numTags - The number of tags being queried (determines result array size).
|
|
@@ -23,6 +23,20 @@ import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
|
|
|
23
23
|
}
|
|
24
24
|
return allResultsPerTag;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Splits tags into chunks of MAX_RPC_LEN, fetches logs for each chunk using getAllPages, then stitches the results
|
|
28
|
+
* back into a single array preserving the original tag order.
|
|
29
|
+
*/ async function getAllPagesInBatches(tags, fetchAllPagesForBatch) {
|
|
30
|
+
if (tags.length <= MAX_RPC_LEN) {
|
|
31
|
+
return fetchAllPagesForBatch(tags);
|
|
32
|
+
}
|
|
33
|
+
const batches = [];
|
|
34
|
+
for(let i = 0; i < tags.length; i += MAX_RPC_LEN){
|
|
35
|
+
batches.push(tags.slice(i, i + MAX_RPC_LEN));
|
|
36
|
+
}
|
|
37
|
+
const batchResults = await Promise.all(batches.map(fetchAllPagesForBatch));
|
|
38
|
+
return batchResults.flat();
|
|
39
|
+
}
|
|
26
40
|
/**
|
|
27
41
|
* Fetches all private logs for the given tags, automatically paginating through all pages.
|
|
28
42
|
* @param aztecNode - The Aztec node to query.
|
|
@@ -31,7 +45,7 @@ import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
|
|
|
31
45
|
* because of reorgs).
|
|
32
46
|
* @returns An array of log arrays, one per tag, containing all logs across all pages.
|
|
33
47
|
*/ export function getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash) {
|
|
34
|
-
return getAllPages(
|
|
48
|
+
return getAllPagesInBatches(tags, (batch)=>getAllPages(batch.length, (page)=>aztecNode.getPrivateLogsByTags(batch, page, anchorBlockHash)));
|
|
35
49
|
}
|
|
36
50
|
/**
|
|
37
51
|
* Fetches all public logs for the given tags from a contract, automatically paginating through all pages.
|
|
@@ -42,5 +56,5 @@ import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
|
|
|
42
56
|
* because of reorgs).
|
|
43
57
|
* @returns An array of log arrays, one per tag, containing all logs across all pages.
|
|
44
58
|
*/ export function getAllPublicLogsByTagsFromContract(aztecNode, contractAddress, tags, anchorBlockHash) {
|
|
45
|
-
return getAllPages(
|
|
59
|
+
return getAllPagesInBatches(tags, (batch)=>getAllPages(batch.length, (page)=>aztecNode.getPublicLogsByTagsFromContract(contractAddress, batch, page, anchorBlockHash)));
|
|
46
60
|
}
|
|
@@ -13,7 +13,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
13
13
|
// (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
|
|
14
14
|
//
|
|
15
15
|
// highestAgedIndex is the highest index that was used in a tx that is included in a block at least
|
|
16
|
-
// `
|
|
16
|
+
// `MAX_TX_LIFETIME` seconds ago.
|
|
17
17
|
// highestFinalizedIndex is the highest index that was used in a tx that is included in a finalized block.
|
|
18
18
|
//
|
|
19
19
|
// "(" denotes an open end of the range - the index is not included in the range.
|
|
@@ -25,19 +25,19 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
25
25
|
// ever appear.
|
|
26
26
|
//
|
|
27
27
|
// This relies on the "maximum inclusion timestamp" rule enforced by the kernel and rollup circuits:
|
|
28
|
-
// - a transaction's maximum inclusion timestamp is at most `
|
|
28
|
+
// - a transaction's maximum inclusion timestamp is at most `MAX_TX_LIFETIME` seconds after
|
|
29
29
|
// the timestamp of its anchor block; and
|
|
30
30
|
// - a rollup only includes transactions whose inclusion timestamp is >= the L2 block's timestamp.
|
|
31
31
|
//
|
|
32
32
|
// Suppose some device used index `I` in a transaction anchored to block `B_N` at time `N`, and that block is now at
|
|
33
|
-
// least `
|
|
33
|
+
// least `MAX_TX_LIFETIME` seconds in the past. Then there is no possibility of any *other* device
|
|
34
34
|
// trying to use an index <= `I` while anchoring to a *newer* block than `B_N` because if we were anchoring to
|
|
35
35
|
// a newer block than `B_N` then we would already have seen the log with index `I` and hence the device would have
|
|
36
36
|
// chosen a larger index.
|
|
37
37
|
// If that *other* device would anchor to a block older than `B_N` then that tx could never be included in a block
|
|
38
38
|
// because it would already have been expired.
|
|
39
39
|
//
|
|
40
|
-
// Therefore, once we see that index `I` has been used in a block that is at least `
|
|
40
|
+
// Therefore, once we see that index `I` has been used in a block that is at least `MAX_TX_LIFETIME`
|
|
41
41
|
// seconds old, we can safely stop syncing logs for all indexes <= `I` and set highestAgedIndex = `I`.
|
|
42
42
|
//
|
|
43
43
|
// ## Explanation of the upper bound `highestFinalizedIndex + WINDOW_LEN`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_TX_LIFETIME } from '@aztec/constants';
|
|
2
2
|
/**
|
|
3
3
|
* Finds the highest aged and the highest finalized tagging indexes.
|
|
4
4
|
*/ export function findHighestIndexes(privateLogsWithIndexes, currentTimestamp, finalizedBlockNumber) {
|
|
@@ -6,7 +6,7 @@ import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants';
|
|
|
6
6
|
let highestFinalizedIndex = undefined;
|
|
7
7
|
for (const { log, taggingIndex } of privateLogsWithIndexes){
|
|
8
8
|
const ageInSeconds = currentTimestamp - log.blockTimestamp;
|
|
9
|
-
if (ageInSeconds >= BigInt(
|
|
9
|
+
if (ageInSeconds >= BigInt(MAX_TX_LIFETIME) && (highestAgedIndex === undefined || taggingIndex > highestAgedIndex)) {
|
|
10
10
|
highestAgedIndex = taggingIndex;
|
|
11
11
|
}
|
|
12
12
|
if (log.blockNumber <= finalizedBlockNumber && (highestFinalizedIndex === undefined || taggingIndex > highestFinalizedIndex)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.4eabbdb",
|
|
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.
|
|
74
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
75
|
-
"@aztec/builder": "0.0.1-commit.
|
|
76
|
-
"@aztec/constants": "0.0.1-commit.
|
|
77
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
78
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
79
|
-
"@aztec/key-store": "0.0.1-commit.
|
|
80
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
81
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
82
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
83
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
84
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
85
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
73
|
+
"@aztec/bb-prover": "0.0.1-commit.4eabbdb",
|
|
74
|
+
"@aztec/bb.js": "0.0.1-commit.4eabbdb",
|
|
75
|
+
"@aztec/builder": "0.0.1-commit.4eabbdb",
|
|
76
|
+
"@aztec/constants": "0.0.1-commit.4eabbdb",
|
|
77
|
+
"@aztec/ethereum": "0.0.1-commit.4eabbdb",
|
|
78
|
+
"@aztec/foundation": "0.0.1-commit.4eabbdb",
|
|
79
|
+
"@aztec/key-store": "0.0.1-commit.4eabbdb",
|
|
80
|
+
"@aztec/kv-store": "0.0.1-commit.4eabbdb",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.4eabbdb",
|
|
82
|
+
"@aztec/noir-types": "0.0.1-commit.4eabbdb",
|
|
83
|
+
"@aztec/protocol-contracts": "0.0.1-commit.4eabbdb",
|
|
84
|
+
"@aztec/simulator": "0.0.1-commit.4eabbdb",
|
|
85
|
+
"@aztec/stdlib": "0.0.1-commit.4eabbdb",
|
|
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.
|
|
95
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
94
|
+
"@aztec/merkle-tree": "0.0.1-commit.4eabbdb",
|
|
95
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.4eabbdb",
|
|
96
96
|
"@jest/globals": "^30.0.0",
|
|
97
97
|
"@types/jest": "^30.0.0",
|
|
98
98
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Controls which accounts' private state and keys are accessible during execution.
|
|
5
|
+
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
6
|
+
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
7
|
+
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
8
|
+
*/
|
|
9
|
+
export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
|
|
@@ -2,8 +2,7 @@ import {
|
|
|
2
2
|
AVM_EMITNOTEHASH_BASE_L2_GAS,
|
|
3
3
|
AVM_EMITNULLIFIER_BASE_L2_GAS,
|
|
4
4
|
AVM_SENDL2TOL1MSG_BASE_L2_GAS,
|
|
5
|
-
|
|
6
|
-
DA_GAS_PER_BYTE,
|
|
5
|
+
DA_GAS_PER_FIELD,
|
|
7
6
|
FIXED_AVM_STARTUP_L2_GAS,
|
|
8
7
|
FIXED_DA_GAS,
|
|
9
8
|
FIXED_L2_GAS,
|
|
@@ -87,6 +86,7 @@ import {
|
|
|
87
86
|
getFinalMinRevertibleSideEffectCounter,
|
|
88
87
|
} from '@aztec/stdlib/tx';
|
|
89
88
|
|
|
89
|
+
import type { AccessScopes } from '../access_scopes.js';
|
|
90
90
|
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
91
91
|
import type { AddressStore } from '../storage/address_store/address_store.js';
|
|
92
92
|
import type { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
|
|
@@ -117,8 +117,8 @@ export type ContractSimulatorRunOpts = {
|
|
|
117
117
|
anchorBlockHeader: BlockHeader;
|
|
118
118
|
/** The address used as a tagging sender when emitting private logs. */
|
|
119
119
|
senderForTags?: AztecAddress;
|
|
120
|
-
/** The accounts whose notes we can access in this call.
|
|
121
|
-
scopes
|
|
120
|
+
/** The accounts whose notes we can access in this call. */
|
|
121
|
+
scopes: AccessScopes;
|
|
122
122
|
/** The job ID for staged writes. */
|
|
123
123
|
jobId: string;
|
|
124
124
|
};
|
|
@@ -311,7 +311,7 @@ export class ContractFunctionSimulator {
|
|
|
311
311
|
call: FunctionCall,
|
|
312
312
|
authwits: AuthWitness[],
|
|
313
313
|
anchorBlockHeader: BlockHeader,
|
|
314
|
-
scopes:
|
|
314
|
+
scopes: AccessScopes,
|
|
315
315
|
jobId: string,
|
|
316
316
|
): Promise<Fr[]> {
|
|
317
317
|
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
@@ -360,7 +360,7 @@ export class ContractFunctionSimulator {
|
|
|
360
360
|
);
|
|
361
361
|
});
|
|
362
362
|
|
|
363
|
-
this.log.verbose(`Utility
|
|
363
|
+
this.log.verbose(`Utility execution for ${call.to}.${call.selector} completed`);
|
|
364
364
|
return witnessMapToFields(acirExecutionResult.returnWitness);
|
|
365
365
|
} catch (err) {
|
|
366
366
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
@@ -655,7 +655,7 @@ export async function generateSimulatedProvingResult(
|
|
|
655
655
|
constantData,
|
|
656
656
|
/*gasUsed=*/ gasUsed.add(Gas.from({ l2Gas: FIXED_L2_GAS, daGas: FIXED_DA_GAS })),
|
|
657
657
|
/*feePayer=*/ AztecAddress.zero(),
|
|
658
|
-
/*
|
|
658
|
+
/*expirationTimestamp=*/ 0n,
|
|
659
659
|
hasPublicCalls ? inputsForPublic : undefined,
|
|
660
660
|
!hasPublicCalls ? inputsForRollup : undefined,
|
|
661
661
|
);
|
|
@@ -817,7 +817,7 @@ function meterGasUsed(data: PrivateToRollupAccumulatedData | PrivateToPublicAccu
|
|
|
817
817
|
);
|
|
818
818
|
meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
|
|
819
819
|
|
|
820
|
-
const meteredDAGas = meteredDAFields *
|
|
820
|
+
const meteredDAGas = meteredDAFields * DA_GAS_PER_FIELD;
|
|
821
821
|
|
|
822
822
|
if ((data as PrivateToPublicAccumulatedData).publicCallRequests) {
|
|
823
823
|
const dataForPublic = data as PrivateToPublicAccumulatedData;
|
|
@@ -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 =
|
|
8
|
+
const MAX_EVENT_SERIALIZED_LEN = 11;
|
|
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 =
|
|
7
|
+
export const MAX_NOTE_PACKED_LEN = 9;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Intermediate struct used to perform batch note validation by PXE. The `utilityValidateAndStoreEnqueuedNotesAndEvents` oracle
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type TxContext,
|
|
26
26
|
} from '@aztec/stdlib/tx';
|
|
27
27
|
|
|
28
|
+
import type { AccessScopes } from '../../access_scopes.js';
|
|
28
29
|
import type { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
|
|
29
30
|
import { NoteService } from '../../notes/note_service.js';
|
|
30
31
|
import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
|
|
@@ -43,7 +44,7 @@ export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contr
|
|
|
43
44
|
txContext: TxContext;
|
|
44
45
|
callContext: CallContext;
|
|
45
46
|
/** Needed to trigger contract synchronization before nested calls */
|
|
46
|
-
utilityExecutor: (call: FunctionCall, scopes:
|
|
47
|
+
utilityExecutor: (call: FunctionCall, scopes: AccessScopes) => Promise<void>;
|
|
47
48
|
executionCache: HashedValuesCache;
|
|
48
49
|
noteCache: ExecutionNoteCache;
|
|
49
50
|
taggingIndexCache: ExecutionTaggingIndexCache;
|
|
@@ -78,7 +79,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
78
79
|
private readonly argsHash: Fr;
|
|
79
80
|
private readonly txContext: TxContext;
|
|
80
81
|
private readonly callContext: CallContext;
|
|
81
|
-
private readonly utilityExecutor: (call: FunctionCall, scopes:
|
|
82
|
+
private readonly utilityExecutor: (call: FunctionCall, scopes: AccessScopes) => Promise<void>;
|
|
82
83
|
private readonly executionCache: HashedValuesCache;
|
|
83
84
|
private readonly noteCache: ExecutionNoteCache;
|
|
84
85
|
private readonly taggingIndexCache: ExecutionTaggingIndexCache;
|
|
@@ -531,7 +532,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
531
532
|
// We only expand for registered accounts because the log service needs the recipient's keys to derive
|
|
532
533
|
// tagging secrets, which are only available for registered accounts.
|
|
533
534
|
const expandedScopes =
|
|
534
|
-
this.scopes && (await this.keyStore.hasAccount(targetContractAddress))
|
|
535
|
+
this.scopes !== 'ALL_SCOPES' && (await this.keyStore.hasAccount(targetContractAddress))
|
|
535
536
|
? [...this.scopes, targetContractAddress]
|
|
536
537
|
: this.scopes;
|
|
537
538
|
|
|
@@ -20,6 +20,7 @@ import type { NoteStatus } from '@aztec/stdlib/note';
|
|
|
20
20
|
import { MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
21
21
|
import type { BlockHeader, Capsule } from '@aztec/stdlib/tx';
|
|
22
22
|
|
|
23
|
+
import type { AccessScopes } from '../../access_scopes.js';
|
|
23
24
|
import { EventService } from '../../events/event_service.js';
|
|
24
25
|
import { LogService } from '../../logs/log_service.js';
|
|
25
26
|
import { NoteService } from '../../notes/note_service.js';
|
|
@@ -58,7 +59,7 @@ export type UtilityExecutionOracleArgs = {
|
|
|
58
59
|
privateEventStore: PrivateEventStore;
|
|
59
60
|
jobId: string;
|
|
60
61
|
log?: ReturnType<typeof createLogger>;
|
|
61
|
-
scopes
|
|
62
|
+
scopes: AccessScopes;
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -85,7 +86,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
85
86
|
protected readonly privateEventStore: PrivateEventStore;
|
|
86
87
|
protected readonly jobId: string;
|
|
87
88
|
protected log: ReturnType<typeof createLogger>;
|
|
88
|
-
protected readonly scopes
|
|
89
|
+
protected readonly scopes: AccessScopes;
|
|
89
90
|
|
|
90
91
|
constructor(args: UtilityExecutionOracleArgs) {
|
|
91
92
|
this.contractAddress = args.contractAddress;
|
|
@@ -129,7 +130,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
129
130
|
*/
|
|
130
131
|
public async utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest> {
|
|
131
132
|
// If scopes are defined, check that the key belongs to an account in the scopes.
|
|
132
|
-
if (this.scopes && this.scopes.length > 0) {
|
|
133
|
+
if (this.scopes !== 'ALL_SCOPES' && this.scopes.length > 0) {
|
|
133
134
|
let hasAccess = false;
|
|
134
135
|
for (let i = 0; i < this.scopes.length && !hasAccess; i++) {
|
|
135
136
|
if (await this.keyStore.accountHasKey(this.scopes[i], pkMHash)) {
|
|
@@ -4,6 +4,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
4
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
7
|
+
import type { AccessScopes } from '../access_scopes.js';
|
|
7
8
|
import type { StagedStore } from '../job_coordinator/job_coordinator.js';
|
|
8
9
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
9
10
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
@@ -45,15 +46,15 @@ export class ContractSyncService implements StagedStore {
|
|
|
45
46
|
* @param functionToInvokeAfterSync - The function selector that will be called after sync (used to validate it's
|
|
46
47
|
* not sync_state itself).
|
|
47
48
|
* @param utilityExecutor - Executor function for running the sync_state utility function.
|
|
48
|
-
* @param scopes -
|
|
49
|
+
* @param scopes - Access scopes to pass through to the utility executor (affects whose account's private state is discovered).
|
|
49
50
|
*/
|
|
50
51
|
async ensureContractSynced(
|
|
51
52
|
contractAddress: AztecAddress,
|
|
52
53
|
functionToInvokeAfterSync: FunctionSelector | null,
|
|
53
|
-
utilityExecutor: (call: FunctionCall, scopes:
|
|
54
|
+
utilityExecutor: (call: FunctionCall, scopes: AccessScopes) => Promise<any>,
|
|
54
55
|
anchorBlockHeader: BlockHeader,
|
|
55
56
|
jobId: string,
|
|
56
|
-
scopes:
|
|
57
|
+
scopes: AccessScopes,
|
|
57
58
|
): Promise<void> {
|
|
58
59
|
// Skip sync if this contract has an override for this job (overrides are keyed by contract address only)
|
|
59
60
|
const overrides = this.overriddenContracts.get(jobId);
|
|
@@ -62,13 +63,16 @@ export class ContractSyncService implements StagedStore {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
// Skip sync if we already synced for "all scopes", or if we have an empty list of scopes
|
|
65
|
-
const allScopesKey = toKey(contractAddress,
|
|
66
|
+
const allScopesKey = toKey(contractAddress, 'ALL_SCOPES');
|
|
66
67
|
const allScopesExisting = this.syncedContracts.get(allScopesKey);
|
|
67
|
-
if (allScopesExisting || (scopes && scopes.length == 0)) {
|
|
68
|
+
if (allScopesExisting || (scopes !== 'ALL_SCOPES' && scopes.length == 0)) {
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
const unsyncedScopes =
|
|
72
|
+
const unsyncedScopes =
|
|
73
|
+
scopes === 'ALL_SCOPES'
|
|
74
|
+
? scopes
|
|
75
|
+
: scopes.filter(scope => !this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
72
76
|
const unsyncedScopesKeys = toKeys(contractAddress, unsyncedScopes);
|
|
73
77
|
|
|
74
78
|
if (unsyncedScopesKeys.length > 0) {
|
|
@@ -76,9 +80,10 @@ export class ContractSyncService implements StagedStore {
|
|
|
76
80
|
const promise = this.#doSync(
|
|
77
81
|
contractAddress,
|
|
78
82
|
functionToInvokeAfterSync,
|
|
79
|
-
|
|
83
|
+
utilityExecutor,
|
|
80
84
|
anchorBlockHeader,
|
|
81
85
|
jobId,
|
|
86
|
+
unsyncedScopes,
|
|
82
87
|
).catch(err => {
|
|
83
88
|
// There was an error syncing the contract, so we remove it from the cache so that it can be retried.
|
|
84
89
|
unsyncedScopesKeys.forEach(key => this.syncedContracts.delete(key));
|
|
@@ -94,9 +99,10 @@ export class ContractSyncService implements StagedStore {
|
|
|
94
99
|
async #doSync(
|
|
95
100
|
contractAddress: AztecAddress,
|
|
96
101
|
functionToInvokeAfterSync: FunctionSelector | null,
|
|
97
|
-
utilityExecutor: (call: FunctionCall) => Promise<any>,
|
|
102
|
+
utilityExecutor: (call: FunctionCall, scopes: AccessScopes) => Promise<any>,
|
|
98
103
|
anchorBlockHeader: BlockHeader,
|
|
99
104
|
jobId: string,
|
|
105
|
+
scopes: AccessScopes,
|
|
100
106
|
): Promise<void> {
|
|
101
107
|
this.log.debug(`Syncing contract ${contractAddress}`);
|
|
102
108
|
await Promise.all([
|
|
@@ -109,6 +115,7 @@ export class ContractSyncService implements StagedStore {
|
|
|
109
115
|
this.aztecNode,
|
|
110
116
|
anchorBlockHeader,
|
|
111
117
|
jobId,
|
|
118
|
+
scopes,
|
|
112
119
|
),
|
|
113
120
|
verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader),
|
|
114
121
|
]);
|
|
@@ -136,10 +143,10 @@ export class ContractSyncService implements StagedStore {
|
|
|
136
143
|
}
|
|
137
144
|
}
|
|
138
145
|
|
|
139
|
-
function toKeys(contract: AztecAddress, scopes:
|
|
140
|
-
return scopes ===
|
|
146
|
+
function toKeys(contract: AztecAddress, scopes: AccessScopes) {
|
|
147
|
+
return scopes === 'ALL_SCOPES' ? [toKey(contract, scopes)] : scopes.map(scope => toKey(contract, scope));
|
|
141
148
|
}
|
|
142
149
|
|
|
143
|
-
function toKey(contract: AztecAddress, scope: AztecAddress |
|
|
144
|
-
return scope ===
|
|
150
|
+
function toKey(contract: AztecAddress, scope: AztecAddress | 'ALL_SCOPES') {
|
|
151
|
+
return scope === 'ALL_SCOPES' ? `${contract.toString()}:*` : `${contract.toString()}:${scope.toString()}`;
|
|
145
152
|
}
|
|
@@ -6,6 +6,7 @@ import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '
|
|
|
6
6
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
7
7
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
8
8
|
|
|
9
|
+
import type { AccessScopes } from '../access_scopes.js';
|
|
9
10
|
import { NoteService } from '../notes/note_service.js';
|
|
10
11
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
11
12
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
@@ -42,11 +43,12 @@ export async function syncState(
|
|
|
42
43
|
contractAddress: AztecAddress,
|
|
43
44
|
contractStore: ContractStore,
|
|
44
45
|
functionToInvokeAfterSync: FunctionSelector | null,
|
|
45
|
-
utilityExecutor: (privateSyncCall: FunctionCall) => Promise<any>,
|
|
46
|
+
utilityExecutor: (privateSyncCall: FunctionCall, scopes: AccessScopes) => Promise<any>,
|
|
46
47
|
noteStore: NoteStore,
|
|
47
48
|
aztecNode: AztecNode,
|
|
48
49
|
anchorBlockHeader: BlockHeader,
|
|
49
50
|
jobId: string,
|
|
51
|
+
scopes: AccessScopes,
|
|
50
52
|
) {
|
|
51
53
|
// Protocol contracts don't have private state to sync
|
|
52
54
|
if (!isProtocolContract(contractAddress)) {
|
|
@@ -61,7 +63,10 @@ export async function syncState(
|
|
|
61
63
|
|
|
62
64
|
// Both sync_state and syncNoteNullifiers interact with the note store, but running them in parallel is safe
|
|
63
65
|
// because note store is designed to handle concurrent operations.
|
|
64
|
-
await Promise.all([
|
|
66
|
+
await Promise.all([
|
|
67
|
+
utilityExecutor(syncStateFunctionCall, scopes),
|
|
68
|
+
noteService.syncNoteNullifiers(contractAddress, scopes),
|
|
69
|
+
]);
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
72
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
2
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
|
-
import type {
|
|
4
|
-
import type { NoteDao, NotesFilter } from '@aztec/stdlib/note';
|
|
3
|
+
import type { NoteDao } from '@aztec/stdlib/note';
|
|
5
4
|
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
6
5
|
|
|
6
|
+
import type { AccessScopes } from '../access_scopes.js';
|
|
7
7
|
import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
|
|
8
8
|
import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
|
|
9
9
|
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
10
|
+
import type { NotesFilter } from '../notes_filter.js';
|
|
10
11
|
import type { AnchorBlockStore } from '../storage/index.js';
|
|
11
12
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
12
13
|
|
|
@@ -17,11 +18,11 @@ import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
|
17
18
|
export class PXEDebugUtils {
|
|
18
19
|
#putJobInQueue!: <T>(job: (jobId: string) => Promise<T>) => Promise<T>;
|
|
19
20
|
#getSimulatorForTx!: (overrides?: { contracts?: ContractOverrides }) => ContractFunctionSimulator;
|
|
20
|
-
#
|
|
21
|
+
#executeUtility!: (
|
|
21
22
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
22
23
|
call: FunctionCall,
|
|
23
24
|
authWitnesses: AuthWitness[] | undefined,
|
|
24
|
-
scopes:
|
|
25
|
+
scopes: AccessScopes,
|
|
25
26
|
jobId: string,
|
|
26
27
|
) => Promise<any>;
|
|
27
28
|
|
|
@@ -36,17 +37,17 @@ export class PXEDebugUtils {
|
|
|
36
37
|
public setPXEHelpers(
|
|
37
38
|
putJobInQueue: <T>(job: (jobId: string) => Promise<T>) => Promise<T>,
|
|
38
39
|
getSimulatorForTx: (overrides?: { contracts?: ContractOverrides }) => ContractFunctionSimulator,
|
|
39
|
-
|
|
40
|
+
executeUtility: (
|
|
40
41
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
41
42
|
call: FunctionCall,
|
|
42
43
|
authWitnesses: AuthWitness[] | undefined,
|
|
43
|
-
scopes:
|
|
44
|
+
scopes: AccessScopes,
|
|
44
45
|
jobId: string,
|
|
45
46
|
) => Promise<any>,
|
|
46
47
|
) {
|
|
47
48
|
this.#putJobInQueue = putJobInQueue;
|
|
48
49
|
this.#getSimulatorForTx = getSimulatorForTx;
|
|
49
|
-
this.#
|
|
50
|
+
this.#executeUtility = executeUtility;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/**
|
|
@@ -72,7 +73,7 @@ export class PXEDebugUtils {
|
|
|
72
73
|
filter.contractAddress,
|
|
73
74
|
null,
|
|
74
75
|
async (privateSyncCall, execScopes) =>
|
|
75
|
-
await this.#
|
|
76
|
+
await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
76
77
|
anchorBlockHeader,
|
|
77
78
|
jobId,
|
|
78
79
|
filter.scopes,
|
package/src/logs/log_service.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
|
6
6
|
import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
7
7
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
8
8
|
|
|
9
|
+
import type { AccessScopes } from '../access_scopes.js';
|
|
9
10
|
import type { LogRetrievalRequest } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
|
|
10
11
|
import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
|
|
11
12
|
import { AddressStore } from '../storage/address_store/address_store.js';
|
|
@@ -107,11 +108,7 @@ export class LogService {
|
|
|
107
108
|
);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
public async fetchTaggedLogs(
|
|
111
|
-
contractAddress: AztecAddress,
|
|
112
|
-
pendingTaggedLogArrayBaseSlot: Fr,
|
|
113
|
-
scopes?: AztecAddress[],
|
|
114
|
-
) {
|
|
111
|
+
public async fetchTaggedLogs(contractAddress: AztecAddress, pendingTaggedLogArrayBaseSlot: Fr, scopes: AccessScopes) {
|
|
115
112
|
this.log.verbose(`Fetching tagged logs for ${contractAddress.toString()}`);
|
|
116
113
|
|
|
117
114
|
// We only load logs from block up to and including the anchor block number
|
|
@@ -119,7 +116,7 @@ export class LogService {
|
|
|
119
116
|
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
120
117
|
|
|
121
118
|
// Determine recipients: use scopes if provided, otherwise get all accounts
|
|
122
|
-
const recipients = scopes && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
|
|
119
|
+
const recipients = scopes !== 'ALL_SCOPES' && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
|
|
123
120
|
|
|
124
121
|
// For each recipient, fetch secrets, load logs, and store them.
|
|
125
122
|
// We run these per-recipient tasks in parallel so that logs are loaded for all recipients concurrently.
|