@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.1142ef1
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/block_synchronizer/block_synchronizer.d.ts +8 -8
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +15 -20
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +25 -22
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +34 -28
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -2
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +4 -4
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +4 -5
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +17 -26
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +14 -39
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +20 -19
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +47 -45
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +5 -5
- package/dest/debug/pxe_debug_utils.d.ts +6 -6
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +7 -7
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +10 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +10 -1
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +11 -7
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- package/dest/events/event_service.d.ts +7 -7
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +8 -8
- package/dest/events/private_event_filter_validator.d.ts +6 -6
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +4 -4
- package/dest/job_coordinator/job_coordinator.d.ts +74 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +93 -0
- package/dest/logs/log_service.d.ts +14 -31
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +61 -180
- package/dest/notes/note_service.d.ts +7 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -14
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +2 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +3 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +5 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +9 -10
- package/dest/public_storage/public_storage_service.d.ts +4 -4
- package/dest/public_storage/public_storage_service.d.ts.map +1 -1
- package/dest/public_storage/public_storage_service.js +4 -4
- package/dest/pxe.d.ts +11 -9
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +113 -87
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +1 -1
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.d.ts → capsule_store/capsule_store.d.ts} +2 -2
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +1 -1
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +4 -3
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +14 -2
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/{note_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +7 -7
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +6 -6
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/{private_event_data_provider/private_event_data_provider.js → private_event_store/private_event_store.js} +59 -16
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/{tagging/recipient_sync/new_recipient_tagging_data_provider.js → storage/tagging_store/recipient_tagging_store.js} +3 -3
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +3 -3
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.js → tagging_store/sender_tagging_store.js} +3 -3
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -3
- package/dest/tagging/index.d.ts +14 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +13 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.d.ts +3 -4
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +8 -23
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +2 -2
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +3 -3
- package/dest/tree_membership/tree_membership_service.d.ts +4 -4
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -1
- package/dest/tree_membership/tree_membership_service.js +5 -5
- package/package.json +16 -16
- package/src/block_synchronizer/block_synchronizer.ts +14 -19
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +57 -48
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +4 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -6
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +52 -80
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +53 -49
- package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -7
- package/src/debug/pxe_debug_utils.ts +6 -6
- package/src/entrypoints/client/bundle/utils.ts +7 -1
- package/src/entrypoints/client/lazy/utils.ts +7 -2
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/utils.ts +11 -15
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +8 -6
- package/src/events/private_event_filter_validator.ts +5 -5
- package/src/job_coordinator/job_coordinator.ts +149 -0
- package/src/logs/log_service.ts +92 -254
- package/src/notes/note_service.ts +13 -13
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +1 -2
- package/src/private_kernel/private_kernel_execution_prover.ts +2 -4
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +8 -14
- package/src/public_storage/public_storage_service.ts +3 -3
- package/src/pxe.ts +154 -106
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +1 -1
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +1 -1
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +22 -2
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/index.ts +7 -7
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +7 -7
- package/src/storage/{private_event_data_provider/private_event_data_provider.ts → private_event_store/private_event_store.ts} +72 -18
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/{tagging/recipient_sync/new_recipient_tagging_data_provider.ts → storage/tagging_store/recipient_tagging_store.ts} +3 -3
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/{tagging_data_provider/sender_tagging_data_provider.ts → tagging_store/sender_tagging_store.ts} +3 -3
- package/src/tagging/constants.ts +10 -3
- package/src/tagging/index.ts +16 -2
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +11 -8
- package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +9 -25
- package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +6 -2
- package/src/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.ts +4 -4
- package/src/tree_membership/tree_membership_service.ts +4 -4
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
- package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -3
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -2
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
- package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -25
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/anchor_block_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
- package/src/tagging/utils.ts +0 -32
- /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
- /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
package/dest/logs/log_service.js
CHANGED
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag } from '@aztec/stdlib/logs';
|
|
2
4
|
import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
|
|
3
|
-
import {
|
|
4
|
-
import { getInitialIndexesMap, getPreTagsForTheWindow } from '../tagging/utils.js';
|
|
5
|
+
import { loadPrivateLogsForSenderRecipientPair } from '../tagging/index.js';
|
|
5
6
|
export class LogService {
|
|
6
7
|
aztecNode;
|
|
7
|
-
|
|
8
|
+
anchorBlockStore;
|
|
8
9
|
keyStore;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
capsuleStore;
|
|
11
|
+
recipientTaggingStore;
|
|
12
|
+
senderAddressBookStore;
|
|
13
|
+
addressStore;
|
|
14
|
+
log;
|
|
15
|
+
constructor(aztecNode, anchorBlockStore, keyStore, capsuleStore, recipientTaggingStore, senderAddressBookStore, addressStore){
|
|
13
16
|
this.aztecNode = aztecNode;
|
|
14
|
-
this.
|
|
17
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
15
18
|
this.keyStore = keyStore;
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
+
this.capsuleStore = capsuleStore;
|
|
20
|
+
this.recipientTaggingStore = recipientTaggingStore;
|
|
21
|
+
this.senderAddressBookStore = senderAddressBookStore;
|
|
22
|
+
this.addressStore = addressStore;
|
|
23
|
+
this.log = createLogger('log_service');
|
|
19
24
|
}
|
|
20
25
|
async bulkRetrieveLogs(logRetrievalRequests) {
|
|
21
26
|
return await Promise.all(logRetrievalRequests.map(async (request)=>{
|
|
22
|
-
// TODO(F-231): remove these internal functions and have node endpoints that do this instead
|
|
23
27
|
const [publicLog, privateLog] = await Promise.all([
|
|
24
|
-
this
|
|
25
|
-
this
|
|
28
|
+
this.#getPublicLogByTag(request.tag, request.contractAddress),
|
|
29
|
+
this.#getPrivateLogByTag(await SiloedTag.compute(request.tag, request.contractAddress))
|
|
26
30
|
]);
|
|
27
|
-
if (publicLog !== null) {
|
|
28
|
-
|
|
29
|
-
throw new Error(`Found both a public and private log when searching for tag ${request.tag} from contract ${request.contractAddress}`);
|
|
30
|
-
}
|
|
31
|
-
return new LogRetrievalResponse(publicLog.logPayload, publicLog.txHash, publicLog.uniqueNoteHashesInTx, publicLog.firstNullifierInTx);
|
|
32
|
-
} else if (privateLog !== null) {
|
|
33
|
-
return new LogRetrievalResponse(privateLog.logPayload, privateLog.txHash, privateLog.uniqueNoteHashesInTx, privateLog.firstNullifierInTx);
|
|
34
|
-
} else {
|
|
35
|
-
return null;
|
|
31
|
+
if (publicLog !== null && privateLog !== null) {
|
|
32
|
+
throw new Error(`Found both a public and private log when searching for tag ${request.tag} from contract ${request.contractAddress}`);
|
|
36
33
|
}
|
|
34
|
+
return publicLog ?? privateLog;
|
|
37
35
|
}));
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
async getPublicLogByTag(tag, contractAddress) {
|
|
37
|
+
async #getPublicLogByTag(tag, contractAddress) {
|
|
41
38
|
const logs = await this.aztecNode.getPublicLogsByTagsFromContract(contractAddress, [
|
|
42
39
|
tag
|
|
43
40
|
]);
|
|
@@ -49,17 +46,9 @@ export class LogService {
|
|
|
49
46
|
throw new Error(`Got ${logsForTag.length} logs for tag ${tag} and contract ${contractAddress.toString()}. getPublicLogByTag currently only supports a single log per tag`);
|
|
50
47
|
}
|
|
51
48
|
const scopedLog = logsForTag[0];
|
|
52
|
-
|
|
53
|
-
// we need to make a second call to the node for `getTxEffect`.
|
|
54
|
-
// TODO(#9789): bundle this information in the `getLogsByTag` call.
|
|
55
|
-
const txEffect = await this.aztecNode.getTxEffect(scopedLog.txHash);
|
|
56
|
-
if (txEffect == undefined) {
|
|
57
|
-
throw new Error(`Unexpected: failed to retrieve tx effects for tx ${scopedLog.txHash} which is known to exist`);
|
|
58
|
-
}
|
|
59
|
-
return new PublicLogWithTxData(scopedLog.log.getEmittedFieldsWithoutTag(), scopedLog.txHash, txEffect.data.noteHashes, txEffect.data.nullifiers[0]);
|
|
49
|
+
return new LogRetrievalResponse(scopedLog.logData.slice(1), scopedLog.txHash, scopedLog.noteHashes, scopedLog.firstNullifier);
|
|
60
50
|
}
|
|
61
|
-
|
|
62
|
-
async getPrivateLogByTag(siloedTag) {
|
|
51
|
+
async #getPrivateLogByTag(siloedTag) {
|
|
63
52
|
const logs = await this.aztecNode.getPrivateLogsByTags([
|
|
64
53
|
siloedTag
|
|
65
54
|
]);
|
|
@@ -71,165 +60,57 @@ export class LogService {
|
|
|
71
60
|
throw new Error(`Got ${logsForTag.length} logs for tag ${siloedTag}. getPrivateLogByTag currently only supports a single log per tag`);
|
|
72
61
|
}
|
|
73
62
|
const scopedLog = logsForTag[0];
|
|
74
|
-
|
|
75
|
-
// we need to make a second call to the node for `getTxEffect`.
|
|
76
|
-
// TODO(#9789): bundle this information in the `getLogsByTag` call.
|
|
77
|
-
const txEffect = await this.aztecNode.getTxEffect(scopedLog.txHash);
|
|
78
|
-
if (txEffect == undefined) {
|
|
79
|
-
throw new Error(`Unexpected: failed to retrieve tx effects for tx ${scopedLog.txHash} which is known to exist`);
|
|
80
|
-
}
|
|
81
|
-
return new PrivateLogWithTxData(scopedLog.log.getEmittedFieldsWithoutTag(), scopedLog.txHash, txEffect.data.noteHashes, txEffect.data.nullifiers[0]);
|
|
63
|
+
return new LogRetrievalResponse(scopedLog.logData.slice(1), scopedLog.txHash, scopedLog.noteHashes, scopedLog.firstNullifier);
|
|
82
64
|
}
|
|
83
|
-
// TODO(#17775): Replace this implementation of this function with one implementing an approach similar
|
|
84
|
-
// to syncSenderTaggingIndexes. Not done yet due to re-prioritization to devex and this doesn't directly affect
|
|
85
|
-
// devex.
|
|
86
65
|
async syncTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, scopes) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
const recipients = scopes ? scopes : await this.keyStore.getAccounts();
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (indexedSecret.index === undefined) {
|
|
107
|
-
return {
|
|
108
|
-
secret: indexedSecret.secret,
|
|
109
|
-
leftMostIndex: 0,
|
|
110
|
-
rightMostIndex: WINDOW_HALF_SIZE
|
|
111
|
-
};
|
|
112
|
-
} else {
|
|
113
|
-
return {
|
|
114
|
-
secret: indexedSecret.secret,
|
|
115
|
-
leftMostIndex: Math.max(0, indexedSecret.index - WINDOW_HALF_SIZE),
|
|
116
|
-
rightMostIndex: indexedSecret.index + WINDOW_HALF_SIZE
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
// As we iterate we store the largest index we have seen for a given secret to later on store it in the db.
|
|
121
|
-
const newLargestIndexMapToStore = {};
|
|
122
|
-
// The initial/unmodified indexes of the secrets stored in a key-value map where key is the directional app
|
|
123
|
-
// tagging secret.
|
|
124
|
-
const initialIndexesMap = getInitialIndexesMap(indexedSecrets);
|
|
125
|
-
while(secretsAndWindows.length > 0){
|
|
126
|
-
const preTagsForTheWholeWindow = getPreTagsForTheWindow(secretsAndWindows);
|
|
127
|
-
const tagsForTheWholeWindow = await Promise.all(preTagsForTheWholeWindow.map(async (preTag)=>{
|
|
128
|
-
return SiloedTag.compute(await Tag.compute(preTag), contractAddress);
|
|
129
|
-
}));
|
|
130
|
-
// We store the new largest indexes we find in the iteration in the following map to later on construct
|
|
131
|
-
// a new set of secrets and windows to fetch logs for.
|
|
132
|
-
const newLargestIndexMapForIteration = {};
|
|
133
|
-
// Fetch the private logs for the tags and iterate over them
|
|
134
|
-
const logsByTags = await this.aztecNode.getPrivateLogsByTags(tagsForTheWholeWindow);
|
|
135
|
-
for(let logIndex = 0; logIndex < logsByTags.length; logIndex++){
|
|
136
|
-
const logsByTag = logsByTags[logIndex];
|
|
137
|
-
if (logsByTag.length > 0) {
|
|
138
|
-
// We filter out the logs that are newer than the anchor block number of the tx currently being constructed
|
|
139
|
-
const filteredLogsByBlockNumber = logsByTag.filter((l)=>l.blockNumber <= maxBlockNumber);
|
|
140
|
-
// We store the logs in capsules (to later be obtained in Noir)
|
|
141
|
-
await this.#storePendingTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, recipient, filteredLogsByBlockNumber);
|
|
142
|
-
// We retrieve the pre-tag corresponding to the log as I need that to evaluate whether
|
|
143
|
-
// a new largest index have been found.
|
|
144
|
-
const preTagCorrespondingToLog = preTagsForTheWholeWindow[logIndex];
|
|
145
|
-
const initialIndex = initialIndexesMap[preTagCorrespondingToLog.secret.toString()];
|
|
146
|
-
if (preTagCorrespondingToLog.index >= initialIndex && (newLargestIndexMapForIteration[preTagCorrespondingToLog.secret.toString()] === undefined || preTagCorrespondingToLog.index >= newLargestIndexMapForIteration[preTagCorrespondingToLog.secret.toString()])) {
|
|
147
|
-
// We have found a new largest index so we store it for later processing (storing it in the db + fetching
|
|
148
|
-
// the difference of the window sets of current and the next iteration)
|
|
149
|
-
newLargestIndexMapForIteration[preTagCorrespondingToLog.secret.toString()] = preTagCorrespondingToLog.index + 1;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
// Now based on the new largest indexes we found, we will construct a new secrets and windows set to fetch logs
|
|
154
|
-
// for. Note that it's very unlikely that a new log from the current window would appear between the iterations
|
|
155
|
-
// so we fetch the logs only for the difference of the window sets.
|
|
156
|
-
const newSecretsAndWindows = [];
|
|
157
|
-
for (const [directionalAppTaggingSecret, newIndex] of Object.entries(newLargestIndexMapForIteration)){
|
|
158
|
-
const maybeIndexedSecret = indexedSecrets.find((indexedSecret)=>indexedSecret.secret.toString() === directionalAppTaggingSecret);
|
|
159
|
-
if (maybeIndexedSecret) {
|
|
160
|
-
newSecretsAndWindows.push({
|
|
161
|
-
secret: maybeIndexedSecret.secret,
|
|
162
|
-
// We set the left most index to the new index to avoid fetching the same logs again
|
|
163
|
-
leftMostIndex: newIndex,
|
|
164
|
-
rightMostIndex: newIndex + WINDOW_HALF_SIZE
|
|
165
|
-
});
|
|
166
|
-
// We store the new largest index in the map to later store it in the db.
|
|
167
|
-
newLargestIndexMapToStore[directionalAppTaggingSecret] = newIndex;
|
|
168
|
-
} else {
|
|
169
|
-
throw new Error(`Secret not found for directionalAppTaggingSecret ${directionalAppTaggingSecret}. This is a bug as it should never happen!`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
// Now we set the new secrets and windows and proceed to the next iteration.
|
|
173
|
-
secretsAndWindows = newSecretsAndWindows;
|
|
66
|
+
this.log.verbose('Searching for tagged logs', {
|
|
67
|
+
contract: contractAddress
|
|
68
|
+
});
|
|
69
|
+
// We only load logs from block up to and including the anchor block number
|
|
70
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
71
|
+
// Determine recipients: use scopes if provided, otherwise get all accounts
|
|
72
|
+
const recipients = scopes && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
|
|
73
|
+
// For each recipient, fetch secrets, load logs, and store them.
|
|
74
|
+
// We run these per-recipient tasks in parallel so that logs are loaded for all recipients concurrently.
|
|
75
|
+
await Promise.all(recipients.map(async (recipient)=>{
|
|
76
|
+
// Get all secrets for this recipient (one per sender)
|
|
77
|
+
const secrets = await this.#getSecretsForSenders(contractAddress, recipient);
|
|
78
|
+
// Load logs for all sender-recipient pairs in parallel
|
|
79
|
+
const logArrays = await Promise.all(secrets.map((secret)=>loadPrivateLogsForSenderRecipientPair(secret, contractAddress, this.aztecNode, this.recipientTaggingStore, anchorBlockNumber)));
|
|
80
|
+
// Flatten all logs from all secrets
|
|
81
|
+
const allLogs = logArrays.flat();
|
|
82
|
+
// Store the logs for this recipient
|
|
83
|
+
if (allLogs.length > 0) {
|
|
84
|
+
await this.#storePendingTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, recipient, allLogs);
|
|
174
85
|
}
|
|
175
|
-
|
|
176
|
-
// newLargestIndexMapToStore contains "next" indexes to look for (one past the last found), so subtract 1 to get
|
|
177
|
-
// last used.
|
|
178
|
-
await this.recipientTaggingDataProvider.setLastUsedIndexes(Object.entries(newLargestIndexMapToStore).map(([directionalAppTaggingSecret, index])=>({
|
|
179
|
-
secret: DirectionalAppTaggingSecret.fromString(directionalAppTaggingSecret),
|
|
180
|
-
index: index - 1
|
|
181
|
-
})));
|
|
182
|
-
}
|
|
86
|
+
}));
|
|
183
87
|
}
|
|
184
|
-
|
|
185
|
-
* Returns the last used tagging indexes along with the directional app tagging secrets for a given recipient and all
|
|
186
|
-
* the senders in the address book.
|
|
187
|
-
* This method should be exposed as an oracle call to allow aztec.nr to perform the orchestration
|
|
188
|
-
* of the syncTaggedLogs and processTaggedLogs methods. However, it is not possible to do so at the moment,
|
|
189
|
-
* so we're keeping it private for now.
|
|
190
|
-
* @param contractAddress - The contract address to silo the secret for
|
|
191
|
-
* @param recipient - The address receiving the notes
|
|
192
|
-
* @returns A list of directional app tagging secrets along with the last used tagging indexes. If the corresponding
|
|
193
|
-
* secret was never used, the index is undefined.
|
|
194
|
-
* TODO(#17775): The naming here is broken as the function name does not reflect the return type. Make sure this gets
|
|
195
|
-
* fixed when implementing the linked issue.
|
|
196
|
-
*/ async getLastUsedTaggingIndexesForSenders(contractAddress, recipient) {
|
|
88
|
+
async #getSecretsForSenders(contractAddress, recipient) {
|
|
197
89
|
const recipientCompleteAddress = await this.#getCompleteAddress(recipient);
|
|
198
90
|
const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
199
91
|
// We implicitly add all PXE accounts as senders, this helps us decrypt tags on notes that we send to ourselves
|
|
200
92
|
// (recipient = us, sender = us)
|
|
201
|
-
const
|
|
202
|
-
...await this.
|
|
93
|
+
const allSenders = [
|
|
94
|
+
...await this.senderAddressBookStore.getSenders(),
|
|
203
95
|
...await this.keyStore.getAccounts()
|
|
204
|
-
]
|
|
205
|
-
|
|
206
|
-
|
|
96
|
+
];
|
|
97
|
+
// We deduplicate the senders by adding them to a set and then converting the set back to an array
|
|
98
|
+
const deduplicatedSenders = Array.from(new Set(allSenders.map((sender)=>sender.toString()))).map((sender)=>AztecAddress.fromString(sender));
|
|
99
|
+
return Promise.all(deduplicatedSenders.map((sender)=>{
|
|
100
|
+
return DirectionalAppTaggingSecret.compute(recipientCompleteAddress, recipientIvsk, sender, contractAddress, recipient);
|
|
207
101
|
}));
|
|
208
|
-
const indexes = await this.recipientTaggingDataProvider.getLastUsedIndexes(secrets);
|
|
209
|
-
if (indexes.length !== secrets.length) {
|
|
210
|
-
throw new Error('Indexes and directional app tagging secrets have different lengths');
|
|
211
|
-
}
|
|
212
|
-
return secrets.map((secret, i)=>({
|
|
213
|
-
secret,
|
|
214
|
-
index: indexes[i]
|
|
215
|
-
}));
|
|
216
102
|
}
|
|
217
|
-
|
|
218
|
-
// Build all pending tagged logs
|
|
219
|
-
const pendingTaggedLogs =
|
|
220
|
-
|
|
221
|
-
const txEffect = await this.aztecNode.getTxEffect(scopedLog.txHash);
|
|
222
|
-
if (!txEffect) {
|
|
223
|
-
throw new Error(`Could not find tx effect for tx hash ${scopedLog.txHash}`);
|
|
224
|
-
}
|
|
225
|
-
const pendingTaggedLog = new PendingTaggedLog(scopedLog.log.fields, scopedLog.txHash, txEffect.data.noteHashes, txEffect.data.nullifiers[0], recipient);
|
|
103
|
+
#storePendingTaggedLogs(contractAddress, capsuleArrayBaseSlot, recipient, privateLogs) {
|
|
104
|
+
// Build all pending tagged logs from the scoped logs
|
|
105
|
+
const pendingTaggedLogs = privateLogs.map((scopedLog)=>{
|
|
106
|
+
const pendingTaggedLog = new PendingTaggedLog(scopedLog.logData, scopedLog.txHash, scopedLog.noteHashes, scopedLog.firstNullifier, recipient);
|
|
226
107
|
return pendingTaggedLog.toFields();
|
|
227
|
-
})
|
|
108
|
+
});
|
|
228
109
|
// TODO: This looks like it could belong more at the oracle interface level
|
|
229
|
-
return this.
|
|
110
|
+
return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs);
|
|
230
111
|
}
|
|
231
112
|
async #getCompleteAddress(account) {
|
|
232
|
-
const completeAddress = await this.
|
|
113
|
+
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
233
114
|
if (!completeAddress) {
|
|
234
115
|
throw new Error(`No public key registered for address ${account}.
|
|
235
116
|
Register it by calling pxe.addAccount(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`);
|
|
@@ -3,13 +3,13 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
3
3
|
import { type AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import { Note, NoteStatus } from '@aztec/stdlib/note';
|
|
5
5
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
6
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
7
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
8
8
|
export declare class NoteService {
|
|
9
|
-
private readonly
|
|
9
|
+
private readonly noteStore;
|
|
10
10
|
private readonly aztecNode;
|
|
11
|
-
private readonly
|
|
12
|
-
constructor(
|
|
11
|
+
private readonly anchorBlockStore;
|
|
12
|
+
constructor(noteStore: NoteStore, aztecNode: AztecNode, anchorBlockStore: AnchorBlockStore);
|
|
13
13
|
/**
|
|
14
14
|
* Retrieves a set of notes stored in the database for a given contract address and storage slot.
|
|
15
15
|
* The query result is paginated using 'limit' and 'offset' values.
|
|
@@ -33,7 +33,7 @@ export declare class NoteService {
|
|
|
33
33
|
/**
|
|
34
34
|
* Looks for nullifiers of active contract notes and marks them as nullified if a nullifier is found.
|
|
35
35
|
*
|
|
36
|
-
* Fetches notes from the
|
|
36
|
+
* Fetches notes from the NoteStore and checks which nullifiers are present in the
|
|
37
37
|
* onchain nullifier Merkle tree - up to the latest locally synced block. We use the
|
|
38
38
|
* locally synced block instead of querying the chain's 'latest' block to ensure correctness:
|
|
39
39
|
* notes are only marked nullified once their corresponding nullifier has been included in a
|
|
@@ -45,4 +45,4 @@ export declare class NoteService {
|
|
|
45
45
|
syncNoteNullifiers(contractAddress: AztecAddress): Promise<void>;
|
|
46
46
|
deliverNote(contractAddress: AztecAddress, owner: AztecAddress, storageSlot: Fr, randomness: Fr, noteNonce: Fr, content: Fr[], noteHash: Fr, nullifier: Fr, txHash: TxHash, recipient: AztecAddress): Promise<void>;
|
|
47
47
|
}
|
|
48
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
48
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zZXJ2aWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbm90ZXMvbm90ZV9zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUdoRSxPQUFPLEVBQUUsS0FBSyxTQUFTLEVBQWUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM5RSxPQUFPLEVBQUUsSUFBSSxFQUFXLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRS9ELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRS9DLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scURBQXFELENBQUM7QUFDNUYsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0scUNBQXFDLENBQUM7QUFFckUscUJBQWEsV0FBVztJQUVwQixPQUFPLENBQUMsUUFBUSxDQUFDLFNBQVM7SUFDMUIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBQ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AK,EAAE,YAAY,EACnB,WAAW,EAAE,EAAE,EACf,UAAU,EAAE,EAAE,EACd,SAAS,EAAE,EAAE,EACb,OAAO,EAAE,EAAE,EAAE,EACb,QAAQ,EAAE,EAAE,EACZ,SAAS,EAAE,EAAE,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,IAAI,CAAC,CA6Ef;CACF"}
|
|
@@ -3,13 +3,13 @@ import { MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
|
|
|
3
3
|
import { Note, NoteDao } from '@aztec/stdlib/note';
|
|
4
4
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
5
5
|
export class NoteService {
|
|
6
|
-
|
|
6
|
+
noteStore;
|
|
7
7
|
aztecNode;
|
|
8
|
-
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
8
|
+
anchorBlockStore;
|
|
9
|
+
constructor(noteStore, aztecNode, anchorBlockStore){
|
|
10
|
+
this.noteStore = noteStore;
|
|
11
11
|
this.aztecNode = aztecNode;
|
|
12
|
-
this.
|
|
12
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Retrieves a set of notes stored in the database for a given contract address and storage slot.
|
|
@@ -20,7 +20,7 @@ export class NoteService {
|
|
|
20
20
|
* @param status - The status of notes to fetch.
|
|
21
21
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
22
22
|
*/ async getNotes(contractAddress, owner, storageSlot, status, scopes) {
|
|
23
|
-
const noteDaos = await this.
|
|
23
|
+
const noteDaos = await this.noteStore.getNotes({
|
|
24
24
|
contractAddress,
|
|
25
25
|
owner,
|
|
26
26
|
storageSlot,
|
|
@@ -43,7 +43,7 @@ export class NoteService {
|
|
|
43
43
|
/**
|
|
44
44
|
* Looks for nullifiers of active contract notes and marks them as nullified if a nullifier is found.
|
|
45
45
|
*
|
|
46
|
-
* Fetches notes from the
|
|
46
|
+
* Fetches notes from the NoteStore and checks which nullifiers are present in the
|
|
47
47
|
* onchain nullifier Merkle tree - up to the latest locally synced block. We use the
|
|
48
48
|
* locally synced block instead of querying the chain's 'latest' block to ensure correctness:
|
|
49
49
|
* notes are only marked nullified once their corresponding nullifier has been included in a
|
|
@@ -52,8 +52,8 @@ export class NoteService {
|
|
|
52
52
|
*
|
|
53
53
|
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
54
54
|
*/ async syncNoteNullifiers(contractAddress) {
|
|
55
|
-
const syncedBlockNumber = (await this.
|
|
56
|
-
const contractNotes = await this.
|
|
55
|
+
const syncedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
56
|
+
const contractNotes = await this.noteStore.getNotes({
|
|
57
57
|
contractAddress
|
|
58
58
|
});
|
|
59
59
|
if (contractNotes.length === 0) {
|
|
@@ -83,10 +83,10 @@ export class NoteService {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
}).filter((nullifier)=>nullifier !== undefined);
|
|
86
|
-
await this.
|
|
86
|
+
await this.noteStore.applyNullifiers(foundNullifiers);
|
|
87
87
|
}
|
|
88
88
|
async deliverNote(contractAddress, owner, storageSlot, randomness, noteNonce, content, noteHash, nullifier, txHash, recipient) {
|
|
89
|
-
// We are going to store the new note in the
|
|
89
|
+
// We are going to store the new note in the NoteStore, which will let us later return it via `getNotes`.
|
|
90
90
|
// There's two things we need to check before we do this however:
|
|
91
91
|
// - we must make sure the note does actually exist in the note hash tree
|
|
92
92
|
// - we need to check if the note has already been nullified
|
|
@@ -104,7 +104,7 @@ export class NoteService {
|
|
|
104
104
|
// number which *should* be recent enough to be available, even for non-archive nodes.
|
|
105
105
|
// Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
|
|
106
106
|
// logs up to the synced block making this only an additional safety check.
|
|
107
|
-
const syncedBlockNumber = (await this.
|
|
107
|
+
const syncedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
108
108
|
// By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
|
|
109
109
|
// of other contracts, which would constitute a security breach.
|
|
110
110
|
const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
|
|
@@ -136,12 +136,12 @@ export class NoteService {
|
|
|
136
136
|
}
|
|
137
137
|
const noteDao = new NoteDao(new Note(content), contractAddress, owner, storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, uniqueNoteHashTreeIndexInBlock.l2BlockNumber, uniqueNoteHashTreeIndexInBlock.l2BlockHash.toString(), uniqueNoteHashTreeIndexInBlock.data);
|
|
138
138
|
// The note was found by `recipient`, so we use that as the scope when storing the note.
|
|
139
|
-
await this.
|
|
139
|
+
await this.noteStore.addNotes([
|
|
140
140
|
noteDao
|
|
141
141
|
], recipient);
|
|
142
142
|
if (nullifierIndex !== undefined) {
|
|
143
143
|
const { data: _, ...blockHashAndNum } = nullifierIndex;
|
|
144
|
-
await this.
|
|
144
|
+
await this.noteStore.applyNullifiers([
|
|
145
145
|
{
|
|
146
146
|
data: siloedNullifier,
|
|
147
147
|
...blockHashAndNum
|
|
@@ -15,7 +15,7 @@ export declare class PrivateKernelResetPrivateInputsBuilder {
|
|
|
15
15
|
private requestedDimensions;
|
|
16
16
|
constructor(previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>, executionStack: PrivateCallExecutionResult[], noteHashNullifierCounterMap: Map<number, number>, splitCounter: number);
|
|
17
17
|
needsReset(): boolean;
|
|
18
|
-
build(oracle: PrivateKernelOracle
|
|
18
|
+
build(oracle: PrivateKernelOracle): Promise<PrivateKernelResetCircuitPrivateInputs>;
|
|
19
19
|
private reduceReadRequestActions;
|
|
20
20
|
private needsResetNoteHashReadRequests;
|
|
21
21
|
private needsResetNullifierReadRequests;
|
|
@@ -25,4 +25,4 @@ export declare class PrivateKernelResetPrivateInputsBuilder {
|
|
|
25
25
|
private needsSiloNullifiers;
|
|
26
26
|
private needs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RUFBRSwyQkFBMkIsQ0FBQyxnQ0FBZ0MsQ0FBQyxFQUNuRixjQUFjLEVBQUUsMEJBQTBCLEVBQUUsRUFDNUMsMkJBQTJCLEVBQUUsR0FBRyxDQUFDLE1BQU0sRUFBRSxNQUFNLENBQUMsRUFDaEQsWUFBWSxFQUFFLE1BQU0sRUFXN0I7SUFFRCxVQUFVLElBQUksT0FBTyxDQXNCcEI7SUFFSyxLQUFLLENBQUMsTUFBTSxFQUFFLG1CQUFtQixtREFtRXRDO0lBRUQsT0FBTyxDQUFDLHdCQUF3QjtJQTJCaEMsT0FBTyxDQUFDLDhCQUE4QjtJQXVEdEMsT0FBTyxDQUFDLCtCQUErQjtJQXVEdkMsT0FBTyxDQUFDLHVCQUF1QjtJQWEvQixPQUFPLENBQUMsdUJBQXVCO0lBc0UvQixPQUFPLENBQUMsbUJBQW1CO0lBYzNCLE9BQU8sQ0FBQyxtQkFBbUI7SUFrQjNCLE9BQU8sQ0FBQyxvQkFBb0I7Q0FxQjdCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_private_kernel_reset_private_inputs.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts"],"names":[],"mappings":"AAeA,OAAO,EAKL,KAAK,gCAAgC,EAErC,sCAAsC,EAGtC,KAAK,2BAA2B,EAejC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,kBAAkB,CAAC;AAGlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AA4CvE,qBAAa,sCAAsC;IAY/C,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,2BAA2B;IACnC,OAAO,CAAC,YAAY;IAdtB,OAAO,CAAC,cAAc,CAAmC;IAEzD,OAAO,CAAC,aAAa,CAAC,CAA6B;IAEnD,OAAO,CAAC,oBAAoB,CAAqE;IACjG,OAAO,CAAC,qBAAqB,CAAqE;IAClG,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,CAAC,2BAA2B,CAAkE;IACrG,OAAO,CAAC,mBAAmB,CAA+B;IAE1D,YACU,oBAAoB,EAAE,2BAA2B,CAAC,gCAAgC,CAAC,EACnF,cAAc,EAAE,0BAA0B,EAAE,EAC5C,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,YAAY,EAAE,MAAM,EAW7B;IAED,UAAU,IAAI,OAAO,CAsBpB;IAEK,KAAK,CAAC,MAAM,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"build_private_kernel_reset_private_inputs.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts"],"names":[],"mappings":"AAeA,OAAO,EAKL,KAAK,gCAAgC,EAErC,sCAAsC,EAGtC,KAAK,2BAA2B,EAejC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,kBAAkB,CAAC;AAGlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AA4CvE,qBAAa,sCAAsC;IAY/C,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,2BAA2B;IACnC,OAAO,CAAC,YAAY;IAdtB,OAAO,CAAC,cAAc,CAAmC;IAEzD,OAAO,CAAC,aAAa,CAAC,CAA6B;IAEnD,OAAO,CAAC,oBAAoB,CAAqE;IACjG,OAAO,CAAC,qBAAqB,CAAqE;IAClG,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,CAAC,2BAA2B,CAAkE;IACrG,OAAO,CAAC,mBAAmB,CAA+B;IAE1D,YACU,oBAAoB,EAAE,2BAA2B,CAAC,gCAAgC,CAAC,EACnF,cAAc,EAAE,0BAA0B,EAAE,EAC5C,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,YAAY,EAAE,MAAM,EAW7B;IAED,UAAU,IAAI,OAAO,CAsBpB;IAEK,KAAK,CAAC,MAAM,EAAE,mBAAmB,mDAmEtC;IAED,OAAO,CAAC,wBAAwB;IA2BhC,OAAO,CAAC,8BAA8B;IAuDtC,OAAO,CAAC,+BAA+B;IAuDvC,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,uBAAuB;IAsE/B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,oBAAoB;CAqB7B"}
|
|
@@ -82,7 +82,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
82
82
|
return result.some((r)=>r);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
async build(oracle
|
|
85
|
+
async build(oracle) {
|
|
86
86
|
if (privateKernelResetDimensionNames.every((name)=>!this.requestedDimensions[name])) {
|
|
87
87
|
throw new Error('Reset is not required.');
|
|
88
88
|
}
|
|
@@ -99,7 +99,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
99
99
|
this.reduceReadRequestActions(this.nullifierResetActions, dimensions.NULLIFIER_PENDING_READ, dimensions.NULLIFIER_SETTLED_READ);
|
|
100
100
|
// TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
|
|
101
101
|
const paddedSideEffects = PaddedSideEffects.empty();
|
|
102
|
-
return new PrivateKernelResetCircuitPrivateInputs(previousKernelData, paddedSideEffects, new PrivateKernelResetHints(await buildNoteHashReadRequestHintsFromResetActions(oracle, this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes, this.noteHashResetActions
|
|
102
|
+
return new PrivateKernelResetCircuitPrivateInputs(previousKernelData, paddedSideEffects, new PrivateKernelResetHints(await buildNoteHashReadRequestHintsFromResetActions(oracle, this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes, this.noteHashResetActions), await buildNullifierReadRequestHintsFromResetActions({
|
|
103
103
|
getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle)
|
|
104
104
|
}, this.previousKernel.validationRequests.nullifierReadRequests, this.nullifierResetActions), await getMasterSecretKeysAndAppKeyGenerators(this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators, dimensions.KEY_VALIDATION, oracle), this.transientDataSquashingHints), dimensions);
|
|
105
105
|
}
|
|
@@ -41,4 +41,4 @@ export declare class PrivateKernelExecutionProver {
|
|
|
41
41
|
private getVkData;
|
|
42
42
|
private createPrivateCallData;
|
|
43
43
|
}
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
44
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfZXhlY3V0aW9uX3Byb3Zlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL3ByaXZhdGVfa2VybmVsX2V4ZWN1dGlvbl9wcm92ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBUUEsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUMzRSxPQUFPLEVBUUwsS0FBSyxpQ0FBaUMsRUFLdEMsS0FBSyxvQ0FBb0MsRUFFMUMsTUFBTSxzQkFBc0IsQ0FBQztBQUU5QixPQUFPLEVBRUwsS0FBSyxzQkFBc0IsRUFDM0IsU0FBUyxFQUdWLE1BQU0sa0JBQWtCLENBQUM7QUFJMUIsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQVN0RSxNQUFNLFdBQVcsa0NBQWtDO0lBQ2pELFFBQVEsRUFBRSxPQUFPLENBQUM7SUFDbEIsa0JBQWtCLEVBQUUsT0FBTyxDQUFDO0lBQzVCLFdBQVcsRUFBRSxPQUFPLEdBQUcsaUJBQWlCLEdBQUcsTUFBTSxHQUFHLE1BQU0sQ0FBQztDQUM1RDtBQUVEOzs7OztHQUtHO0FBQ0gscUJBQWEsNEJBQTRCO0lBSXJDLE9BQU8sQ0FBQyxNQUFNO0lBQ2QsT0FBTyxDQUFDLFlBQVk7SUFDcEIsT0FBTyxDQUFDLFVBQVU7SUFMcEIsT0FBTyxDQUFDLEdBQUcsQ0FBdUQ7SUFFbEUsWUFDVSxNQUFNLEVBQUUsbUJBQW1CLEVBQzNCLFlBQVksRUFBRSxtQkFBbUIsRUFDakMsVUFBVSxVQUFRLEVBQ3hCO0lBRUo7Ozs7Ozs7Ozs7T0FVRztJQUNHLGdCQUFnQixDQUNwQixTQUFTLEVBQUUsU0FBUyxFQUNwQixlQUFlLEVBQUUsc0JBQXNCLEVBQ3ZDLEVBQUUsUUFBUSxFQUFFLGtCQUFrQixFQUFFLFdBQVcsRUFBRSxHQUFFLGtDQUk5QyxHQUNBLE9BQU8sQ0FBQyxpQ0FBaUMsQ0FBQyxvQ0FBb0MsQ0FBQyxDQUFDLENBb1JsRjtJQUVEOzs7OztPQUtHO0lBQ0gsT0FBTyxDQUFDLHVCQUF1QjtZQW9CakIsU0FBUztZQVNULHFCQUFxQjtDQStCcEMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAQL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,
|
|
1
|
+
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAQL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAStE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED;;;;;GAKG;AACH,qBAAa,4BAA4B;IAIrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAuD;IAElE,YACU,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ,EACxB;IAEJ;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAE,kCAI9C,GACA,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CAoRlF;IAED;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;YAoBjB,SAAS;YAST,qBAAqB;CA+BpC"}
|
|
@@ -8,7 +8,7 @@ import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
|
8
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
9
|
import { HidingKernelToPublicPrivateInputs, HidingKernelToRollupPrivateInputs, PaddedSideEffectAmounts, PrivateCallData, PrivateKernelCircuitPublicInputs, PrivateKernelData, PrivateKernelInitCircuitPrivateInputs, PrivateKernelInnerCircuitPrivateInputs, PrivateKernelTailCircuitPrivateInputs, PrivateVerificationKeyHints } from '@aztec/stdlib/kernel';
|
|
10
10
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
11
|
-
import {
|
|
11
|
+
import { collectNoteHashNullifierCounterMap, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
12
12
|
import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
13
13
|
import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
|
|
14
14
|
const NULL_SIMULATE_OUTPUT = {
|
|
@@ -60,7 +60,6 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
60
60
|
let firstIteration = true;
|
|
61
61
|
let output = NULL_SIMULATE_OUTPUT;
|
|
62
62
|
const executionSteps = [];
|
|
63
|
-
const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
|
|
64
63
|
const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
|
|
65
64
|
const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(executionResult);
|
|
66
65
|
const splitCounter = isPrivateOnlyTx ? 0 : minRevertibleSideEffectCounter;
|
|
@@ -69,7 +68,7 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
69
68
|
let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, executionStack, noteHashNullifierCounterMap, splitCounter);
|
|
70
69
|
while(resetBuilder.needsReset()){
|
|
71
70
|
const witgenTimer = new Timer();
|
|
72
|
-
const privateInputs = await resetBuilder.build(this.oracle
|
|
71
|
+
const privateInputs = await resetBuilder.build(this.oracle);
|
|
73
72
|
output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
|
|
74
73
|
executionSteps.push({
|
|
75
74
|
functionName: 'private_kernel_reset',
|
|
@@ -137,7 +136,7 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
137
136
|
let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
|
|
138
137
|
while(resetBuilder.needsReset()){
|
|
139
138
|
const witgenTimer = new Timer();
|
|
140
|
-
const privateInputs = await resetBuilder.build(this.oracle
|
|
139
|
+
const privateInputs = await resetBuilder.build(this.oracle);
|
|
141
140
|
output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
|
|
142
141
|
executionSteps.push({
|
|
143
142
|
functionName: 'private_kernel_reset',
|
|
@@ -37,7 +37,8 @@ export interface PrivateKernelOracle {
|
|
|
37
37
|
getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<typeof VK_TREE_HEIGHT>>;
|
|
38
38
|
/**
|
|
39
39
|
* Returns a membership witness with the sibling path and leaf index in our private function indexed merkle tree.
|
|
40
|
-
*/
|
|
40
|
+
*/
|
|
41
|
+
getNoteHashMembershipWitness(noteHash: Fr): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
|
|
41
42
|
/**
|
|
42
43
|
* Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree.
|
|
43
44
|
*/
|
|
@@ -60,4 +61,4 @@ export interface PrivateKernelOracle {
|
|
|
60
61
|
* along with an associated DelayedPublicMutable containing the class ID to update. */
|
|
61
62
|
getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
|
|
62
63
|
}
|
|
63
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfb3JhY2xlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJpdmF0ZV9rZXJuZWwvcHJpdmF0ZV9rZXJuZWxfb3JhY2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxxQkFBcUIsRUFBRSxjQUFjLEVBQUUsTUF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