@aztec/pxe 0.0.1-commit.fcb71a6 → 0.0.1-commit.ff7989d6c
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/bin/check_oracle_version.js +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +13 -5
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +74 -20
- package/dest/config/index.d.ts +3 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +17 -0
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +57 -34
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +197 -82
- package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +45 -28
- package/dest/contract_function_simulator/index.d.ts +2 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
- 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 +7 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -3
- 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 +2 -2
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +17 -13
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
- package/dest/contract_function_simulator/oracle/oracle.d.ts +12 -10
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +67 -44
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -37
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +44 -50
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +83 -54
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +67 -33
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +131 -110
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +55 -0
- package/dest/debug/pxe_debug_utils.d.ts +24 -10
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +28 -17
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -0
- 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 +31 -8
- package/dest/entrypoints/client/lazy/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +32 -9
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -3
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +5 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -0
- 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 +39 -16
- package/dest/events/event_service.d.ts +6 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +19 -22
- package/dest/events/private_event_filter_validator.d.ts +5 -5
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +5 -6
- package/dest/job_coordinator/job_coordinator.d.ts +75 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +94 -0
- package/dest/logs/log_service.d.ts +8 -5
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +28 -30
- package/dest/notes/note_service.d.ts +10 -9
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +34 -38
- 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/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +4 -3
- 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 +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +16 -10
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +12 -13
- package/dest/private_kernel/private_kernel_oracle.d.ts +24 -24
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +94 -2
- package/dest/pxe.d.ts +76 -58
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +149 -138
- package/dest/storage/address_store/address_store.d.ts +1 -1
- package/dest/storage/address_store/address_store.d.ts.map +1 -1
- package/dest/storage/address_store/address_store.js +12 -11
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
- package/dest/storage/capsule_store/capsule_store.d.ts +24 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +130 -23
- package/dest/storage/contract_store/contract_store.d.ts +42 -16
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +157 -84
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +50 -51
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +284 -263
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +47 -7
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +231 -73
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +15 -8
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.js +88 -19
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +19 -9
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +253 -101
- package/dest/tagging/constants.d.ts +2 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +10 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +60 -0
- package/dest/tagging/index.d.ts +3 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +2 -10
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -2
- 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 +12 -12
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +5 -2
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +3 -2
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +8 -8
- package/dest/tagging/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 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +5 -8
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -2
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +10 -5
- package/package.json +27 -18
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +1 -0
- package/src/block_synchronizer/block_synchronizer.ts +93 -32
- package/src/config/index.ts +14 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +350 -143
- package/src/contract_function_simulator/execution_note_cache.ts +44 -25
- package/src/contract_function_simulator/index.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +6 -2
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +22 -12
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
- package/src/contract_function_simulator/oracle/oracle.ts +79 -47
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -69
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +119 -137
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +198 -115
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/helpers.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +63 -18
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +23 -16
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +24 -17
- package/src/entrypoints/pxe_creation_options.ts +4 -2
- package/src/entrypoints/server/index.ts +4 -0
- package/src/entrypoints/server/utils.ts +33 -41
- package/src/events/event_service.ts +19 -25
- package/src/events/private_event_filter_validator.ts +3 -5
- package/src/job_coordinator/job_coordinator.ts +150 -0
- package/src/logs/log_service.ts +40 -34
- package/src/notes/note_service.ts +41 -45
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +4 -3
- 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 +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +39 -28
- package/src/private_kernel/private_kernel_execution_prover.ts +15 -14
- package/src/private_kernel/private_kernel_oracle.ts +116 -36
- package/src/pxe.ts +280 -209
- package/src/storage/address_store/address_store.ts +15 -15
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
- package/src/storage/capsule_store/capsule_store.ts +159 -23
- package/src/storage/contract_store/contract_store.ts +186 -96
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +326 -320
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +301 -79
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +106 -20
- package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
- package/src/storage/tagging_store/sender_tagging_store.ts +294 -109
- package/src/tagging/constants.ts +10 -0
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +2 -11
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +25 -11
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +10 -7
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +5 -13
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +16 -4
- package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- 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
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
- package/dest/public_storage/public_storage_service.d.ts +0 -24
- package/dest/public_storage/public_storage_service.d.ts.map +0 -1
- package/dest/public_storage/public_storage_service.js +0 -26
- package/dest/tree_membership/tree_membership_service.d.ts +0 -52
- package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.js +0 -84
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
- package/src/public_storage/public_storage_service.ts +0 -33
- package/src/tree_membership/tree_membership_service.ts +0 -112
|
@@ -5,11 +5,13 @@ import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
|
5
5
|
export class NoteService {
|
|
6
6
|
noteStore;
|
|
7
7
|
aztecNode;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
anchorBlockHeader;
|
|
9
|
+
jobId;
|
|
10
|
+
constructor(noteStore, aztecNode, anchorBlockHeader, jobId){
|
|
10
11
|
this.noteStore = noteStore;
|
|
11
12
|
this.aztecNode = aztecNode;
|
|
12
|
-
this.
|
|
13
|
+
this.anchorBlockHeader = anchorBlockHeader;
|
|
14
|
+
this.jobId = jobId;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Retrieves a set of notes stored in the database for a given contract address and storage slot.
|
|
@@ -26,8 +28,8 @@ export class NoteService {
|
|
|
26
28
|
storageSlot,
|
|
27
29
|
status,
|
|
28
30
|
scopes
|
|
29
|
-
});
|
|
30
|
-
return noteDaos.map(({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier
|
|
31
|
+
}, this.jobId);
|
|
32
|
+
return noteDaos.map(({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier })=>({
|
|
31
33
|
contractAddress,
|
|
32
34
|
owner,
|
|
33
35
|
storageSlot,
|
|
@@ -35,9 +37,8 @@ export class NoteService {
|
|
|
35
37
|
noteNonce,
|
|
36
38
|
note,
|
|
37
39
|
noteHash,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
index
|
|
40
|
+
isPending: false,
|
|
41
|
+
siloedNullifier
|
|
41
42
|
}));
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
@@ -51,11 +52,12 @@ export class NoteService {
|
|
|
51
52
|
* This allows recent nullifications to be processed even if the node is not an archive node.
|
|
52
53
|
*
|
|
53
54
|
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
54
|
-
*/ async syncNoteNullifiers(contractAddress) {
|
|
55
|
-
const
|
|
55
|
+
*/ async syncNoteNullifiers(contractAddress, scopes) {
|
|
56
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
56
57
|
const contractNotes = await this.noteStore.getNotes({
|
|
57
|
-
contractAddress
|
|
58
|
-
|
|
58
|
+
contractAddress,
|
|
59
|
+
scopes
|
|
60
|
+
}, this.jobId);
|
|
59
61
|
if (contractNotes.length === 0) {
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
@@ -72,7 +74,7 @@ export class NoteService {
|
|
|
72
74
|
}, [
|
|
73
75
|
[]
|
|
74
76
|
]);
|
|
75
|
-
const nullifierIndexes = (await Promise.all(nullifierBatches.map((batch)=>this.aztecNode.findLeavesIndexes(
|
|
77
|
+
const nullifierIndexes = (await Promise.all(nullifierBatches.map((batch)=>this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, batch)))).flat();
|
|
76
78
|
const foundNullifiers = nullifiersToCheck.map((nullifier, i)=>{
|
|
77
79
|
if (nullifierIndexes[i] !== undefined) {
|
|
78
80
|
return {
|
|
@@ -83,9 +85,9 @@ export class NoteService {
|
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
}).filter((nullifier)=>nullifier !== undefined);
|
|
86
|
-
await this.noteStore.applyNullifiers(foundNullifiers);
|
|
88
|
+
await this.noteStore.applyNullifiers(foundNullifiers, this.jobId);
|
|
87
89
|
}
|
|
88
|
-
async
|
|
90
|
+
async validateAndStoreNote(contractAddress, owner, storageSlot, randomness, noteNonce, content, noteHash, nullifier, txHash, recipient) {
|
|
89
91
|
// We are going to store the new note in the NoteStore, which will let us later return it via `getNotes`.
|
|
90
92
|
// There's two things we need to check before we do this however:
|
|
91
93
|
// - we must make sure the note does actually exist in the note hash tree
|
|
@@ -104,49 +106,43 @@ export class NoteService {
|
|
|
104
106
|
// number which *should* be recent enough to be available, even for non-archive nodes.
|
|
105
107
|
// Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
|
|
106
108
|
// logs up to the synced block making this only an additional safety check.
|
|
107
|
-
const
|
|
109
|
+
const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
|
|
110
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
108
111
|
// By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
|
|
109
112
|
// of other contracts, which would constitute a security breach.
|
|
110
113
|
const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
|
|
111
114
|
const siloedNullifier = await siloNullifier(contractAddress, nullifier);
|
|
112
|
-
const txEffect = await
|
|
115
|
+
const [txEffect, [nullifierIndex]] = await Promise.all([
|
|
116
|
+
this.aztecNode.getTxEffect(txHash),
|
|
117
|
+
this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [
|
|
118
|
+
siloedNullifier
|
|
119
|
+
])
|
|
120
|
+
]);
|
|
113
121
|
if (!txEffect) {
|
|
114
122
|
throw new Error(`Could not find tx effect for tx hash ${txHash}`);
|
|
115
123
|
}
|
|
116
|
-
if (txEffect.l2BlockNumber >
|
|
117
|
-
throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${
|
|
124
|
+
if (txEffect.l2BlockNumber > anchorBlockNumber) {
|
|
125
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${anchorBlockNumber}`);
|
|
118
126
|
}
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
// Find the index of the note hash in the noteHashes array to determine note ordering within the tx
|
|
128
|
+
const noteIndexInTx = txEffect.data.noteHashes.findIndex((nh)=>nh.equals(uniqueNoteHash));
|
|
129
|
+
if (noteIndexInTx === -1) {
|
|
121
130
|
throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
|
|
122
131
|
}
|
|
123
|
-
|
|
124
|
-
// note existence in said tree. We concurrently also check if the note's nullifier exists, performing all node
|
|
125
|
-
// queries in a single round-trip.
|
|
126
|
-
const [[uniqueNoteHashTreeIndexInBlock], [nullifierIndex]] = await Promise.all([
|
|
127
|
-
this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NOTE_HASH_TREE, [
|
|
128
|
-
uniqueNoteHash
|
|
129
|
-
]),
|
|
130
|
-
this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, [
|
|
131
|
-
siloedNullifier
|
|
132
|
-
])
|
|
133
|
-
]);
|
|
134
|
-
if (uniqueNoteHashTreeIndexInBlock === undefined) {
|
|
135
|
-
throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present on the tree at block ${syncedBlockNumber} (from tx ${txHash})`);
|
|
136
|
-
}
|
|
137
|
-
const noteDao = new NoteDao(new Note(content), contractAddress, owner, storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, uniqueNoteHashTreeIndexInBlock.l2BlockNumber, uniqueNoteHashTreeIndexInBlock.l2BlockHash.toString(), uniqueNoteHashTreeIndexInBlock.data);
|
|
132
|
+
const noteDao = new NoteDao(new Note(content), contractAddress, owner, storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, txEffect.l2BlockNumber, txEffect.l2BlockHash.toString(), txEffect.txIndexInBlock, noteIndexInTx);
|
|
138
133
|
// The note was found by `recipient`, so we use that as the scope when storing the note.
|
|
139
134
|
await this.noteStore.addNotes([
|
|
140
135
|
noteDao
|
|
141
|
-
], recipient);
|
|
136
|
+
], recipient, this.jobId);
|
|
142
137
|
if (nullifierIndex !== undefined) {
|
|
138
|
+
// We found nullifier index which implies that the note has already been nullified.
|
|
143
139
|
const { data: _, ...blockHashAndNum } = nullifierIndex;
|
|
144
140
|
await this.noteStore.applyNullifiers([
|
|
145
141
|
{
|
|
146
142
|
data: siloedNullifier,
|
|
147
143
|
...blockHashAndNum
|
|
148
144
|
}
|
|
149
|
-
]);
|
|
145
|
+
], this.jobId);
|
|
150
146
|
}
|
|
151
147
|
}
|
|
152
148
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
4
|
+
import type { AccessScopes } from './access_scopes.js';
|
|
5
|
+
/**
|
|
6
|
+
* A filter used to fetch notes.
|
|
7
|
+
* @remarks This filter is applied as an intersection of all its params.
|
|
8
|
+
*/
|
|
9
|
+
export type NotesFilter = {
|
|
10
|
+
/**
|
|
11
|
+
* The contract address the note belongs to.
|
|
12
|
+
* @remarks Providing a contract address is required as we need that information to trigger private state sync.
|
|
13
|
+
*/
|
|
14
|
+
contractAddress: AztecAddress;
|
|
15
|
+
/** The owner of the note. */
|
|
16
|
+
owner?: AztecAddress;
|
|
17
|
+
/** The specific storage location of the note on the contract. */
|
|
18
|
+
storageSlot?: Fr;
|
|
19
|
+
/** The status of the note. Defaults to 'ACTIVE'. */
|
|
20
|
+
status?: NoteStatus;
|
|
21
|
+
/** The siloed nullifier for the note. */
|
|
22
|
+
siloedNullifier?: Fr;
|
|
23
|
+
scopes: AccessScopes;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZXNfZmlsdGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvbm90ZXNfZmlsdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXJELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXZEOzs7R0FHRztBQUNILE1BQU0sTUFBTSxXQUFXLEdBQUc7SUFDeEI7OztPQUdHO0lBQ0gsZUFBZSxFQUFFLFlBQVksQ0FBQztJQUM5Qiw2QkFBNkI7SUFDN0IsS0FBSyxDQUFDLEVBQUUsWUFBWSxDQUFDO0lBQ3JCLGlFQUFpRTtJQUNqRSxXQUFXLENBQUMsRUFBRSxFQUFFLENBQUM7SUFDakIsb0RBQW9EO0lBQ3BELE1BQU0sQ0FBQyxFQUFFLFVBQVUsQ0FBQztJQUNwQix5Q0FBeUM7SUFDekMsZUFBZSxDQUFDLEVBQUUsRUFBRSxDQUFDO0lBQ3JCLE1BQU0sRUFBRSxZQUFZLENBQUM7Q0FDdEIsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes_filter.d.ts","sourceRoot":"","sources":["../src/notes_filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,eAAe,EAAE,YAAY,CAAC;IAC9B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,iEAAiE;IACjE,WAAW,CAAC,EAAE,EAAE,CAAC;IACjB,oDAAoD;IACpD,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,yCAAyC;IACzC,eAAe,CAAC,EAAE,EAAE,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC"}
|
package/dest/oracle_version.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const ORACLE_VERSION =
|
|
2
|
-
export declare const ORACLE_INTERFACE_HASH = "
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
export declare const ORACLE_VERSION = 12;
|
|
2
|
+
export declare const ORACLE_INTERFACE_HASH = "666a8a7fc697f72b29dbf0ae7464db269cf5afa019acac8861f814543147dbb4";
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JhY2xlX3ZlcnNpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9vcmFjbGVfdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxlQUFPLE1BQU0sY0FBYyxLQUFLLENBQUM7QUFLakMsZUFBTyxNQUFNLHFCQUFxQixxRUFBcUUsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oracle_version.d.ts","sourceRoot":"","sources":["../src/oracle_version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"oracle_version.d.ts","sourceRoot":"","sources":["../src/oracle_version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,KAAK,CAAC;AAKjC,eAAO,MAAM,qBAAqB,qEAAqE,CAAC"}
|
package/dest/oracle_version.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 12;
|
|
8
8
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
9
|
-
/// which in turn implies that you need to update the ORACLE_VERSION constant
|
|
10
|
-
|
|
9
|
+
/// which in turn implies that you need to update the ORACLE_VERSION constant in this file and in
|
|
10
|
+
/// `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
|
|
11
|
+
export const ORACLE_INTERFACE_HASH = '666a8a7fc697f72b29dbf0ae7464db269cf5afa019acac8861f814543147dbb4';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
2
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
3
|
+
export declare function computeTxExpirationTimestamp(previousKernel: PrivateKernelCircuitPublicInputs, txLifetime?: number): UInt64;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcHV0ZV90eF9leHBpcmF0aW9uX3RpbWVzdGFtcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL2hpbnRzL2NvbXB1dGVfdHhfZXhwaXJhdGlvbl90aW1lc3RhbXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsZ0NBQWdDLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUM3RSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQXFCbEQsd0JBQWdCLDRCQUE0QixDQUMxQyxjQUFjLEVBQUUsZ0NBQWdDLEVBQ2hELFVBQVUsU0FBa0IsR0FDM0IsTUFBTSxDQStCUiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute_tx_expiration_timestamp.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/compute_tx_expiration_timestamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAqBlD,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,gCAAgC,EAChD,UAAU,SAAkB,GAC3B,MAAM,CA+BR"}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_TX_LIFETIME } from '@aztec/constants';
|
|
2
2
|
const ROUNDED_DURATIONS = [
|
|
3
3
|
3600,
|
|
4
4
|
1800,
|
|
5
5
|
1
|
|
6
6
|
];
|
|
7
|
-
function roundTimestamp(blockTimestamp,
|
|
7
|
+
function roundTimestamp(blockTimestamp, expirationTimestamp) {
|
|
8
8
|
return ROUNDED_DURATIONS.reduce((timestamp, duration)=>{
|
|
9
9
|
if (timestamp <= blockTimestamp) {
|
|
10
10
|
// The timestamp must be greater than the block timestamp.
|
|
11
11
|
// If it is too small, round it down again using a smaller duration.
|
|
12
|
-
const totalDuration =
|
|
12
|
+
const totalDuration = expirationTimestamp - blockTimestamp;
|
|
13
13
|
const roundedDuration = totalDuration - totalDuration % BigInt(duration);
|
|
14
14
|
return blockTimestamp + roundedDuration;
|
|
15
15
|
}
|
|
16
16
|
return timestamp;
|
|
17
17
|
}, 0n);
|
|
18
18
|
}
|
|
19
|
-
export function
|
|
20
|
-
if (
|
|
21
|
-
throw new Error(`Custom
|
|
19
|
+
export function computeTxExpirationTimestamp(previousKernel, txLifetime = MAX_TX_LIFETIME) {
|
|
20
|
+
if (txLifetime > MAX_TX_LIFETIME) {
|
|
21
|
+
throw new Error(`Custom tx lifetime cannot be greater than the max allowed. Max allowed: ${MAX_TX_LIFETIME}. Custom value: ${txLifetime}.`);
|
|
22
22
|
}
|
|
23
23
|
const anchorBlockTimestamp = previousKernel.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
24
|
-
const maxTimestamp = anchorBlockTimestamp + BigInt(
|
|
25
|
-
const
|
|
26
|
-
// If the
|
|
24
|
+
const maxTimestamp = anchorBlockTimestamp + BigInt(txLifetime);
|
|
25
|
+
const expirationTimestamp = previousKernel.expirationTimestamp;
|
|
26
|
+
// If the expirationTimestamp set during the tx execution is greater than or equal to the max allowed duration,
|
|
27
27
|
// use the maximum allowed timestamp.
|
|
28
28
|
// Note: It shouldn't be larger than the max allowed duration, but we check for it anyway.
|
|
29
|
-
if (
|
|
29
|
+
if (expirationTimestamp >= maxTimestamp) {
|
|
30
30
|
return maxTimestamp;
|
|
31
31
|
}
|
|
32
32
|
// Round it down to the nearest hour/min/second to reduce precision and avoid revealing the exact value.
|
|
33
33
|
// This makes it harder for others to infer what function calls may have been used to produce a specific timestamp.
|
|
34
|
-
const roundedTimestamp = roundTimestamp(anchorBlockTimestamp,
|
|
34
|
+
const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, expirationTimestamp);
|
|
35
35
|
// The tx can't be published if the timestamp is the same or less than the anchor block's timestamp.
|
|
36
36
|
// Future blocks will have a greater timestamp, so the tx would never be included.
|
|
37
37
|
if (roundedTimestamp <= anchorBlockTimestamp) {
|
|
38
|
-
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${
|
|
38
|
+
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestamp}.`);
|
|
39
39
|
}
|
|
40
40
|
return roundedTimestamp;
|
|
41
41
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
export * from './private_kernel_reset_private_inputs_builder.js';
|
|
2
|
+
export * from './compute_tx_expiration_timestamp.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9oaW50cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtEQUFrRCxDQUFDO0FBQ2pFLGNBQWMsc0NBQXNDLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/index.ts"],"names":[],"mappings":"AAAA,cAAc,kDAAkD,CAAC;AACjE,cAAc,sCAAsC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './private_kernel_reset_private_inputs_builder.js';
|
|
2
|
+
export * from './compute_tx_expiration_timestamp.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type PrivateKernelCircuitPublicInputs, PrivateKernelResetCircuitPrivateInputs, type PrivateKernelSimulateOutput } from '@aztec/stdlib/kernel';
|
|
2
|
+
import { type PrivateCallExecutionResult } from '@aztec/stdlib/tx';
|
|
3
|
+
import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
4
|
+
export declare class PrivateKernelResetPrivateInputsBuilder {
|
|
5
|
+
private previousKernelOutput;
|
|
6
|
+
private executionStack;
|
|
7
|
+
private noteHashNullifierCounterMap;
|
|
8
|
+
private splitCounter;
|
|
9
|
+
private previousKernel;
|
|
10
|
+
private nextIteration?;
|
|
11
|
+
private noteHashResetActions;
|
|
12
|
+
private nullifierResetActions;
|
|
13
|
+
private numTransientData?;
|
|
14
|
+
private transientDataSquashingHints;
|
|
15
|
+
private requestedDimensions;
|
|
16
|
+
constructor(previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>, executionStack: PrivateCallExecutionResult[], noteHashNullifierCounterMap: Map<number, number>, splitCounter: number);
|
|
17
|
+
needsReset(): boolean;
|
|
18
|
+
build(oracle: PrivateKernelOracle): Promise<PrivateKernelResetCircuitPrivateInputs>;
|
|
19
|
+
private reduceReadRequestActions;
|
|
20
|
+
private needsResetNoteHashReadRequests;
|
|
21
|
+
private needsResetNullifierReadRequests;
|
|
22
|
+
private needsResetNullifierKeys;
|
|
23
|
+
private needsResetTransientData;
|
|
24
|
+
private needsSiloNoteHashes;
|
|
25
|
+
private needsSiloNullifiers;
|
|
26
|
+
private needsSiloPrivateLogs;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfcmVzZXRfcHJpdmF0ZV9pbnB1dHNfYnVpbGRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL2hpbnRzL3ByaXZhdGVfa2VybmVsX3Jlc2V0X3ByaXZhdGVfaW5wdXRzX2J1aWxkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZUEsT0FBTyxFQUtMLEtBQUssZ0NBQWdDLEVBRXJDLHNDQUFzQyxFQUd0QyxLQUFLLDJCQUEyQixFQWVqQyxNQUFNLHNCQUFzQixDQUFDO0FBQzlCLE9BQU8sRUFBRSxLQUFLLDBCQUEwQixFQUFpQixNQUFNLGtCQUFrQixDQUFDO0FBR2xGLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUE0Q3ZFLHFCQUFhLHNDQUFzQztJQVkvQyxPQUFPLENBQUMsb0JBQW9CO0lBQzVCLE9BQU8sQ0FBQyxjQUFjO0lBQ3RCLE9BQU8sQ0FBQywyQkFBMkI7SUFDbkMsT0FBTyxDQUFDLFlBQVk7SUFkdEIsT0FBTyxDQUFDLGNBQWMsQ0FBbUM7SUFFekQsT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQUE2QjtJQUVuRCxPQUFPLENBQUMsb0JBQW9CLENBQXFFO0lBQ2pHLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBcUU7SUFDbEcsT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBQVM7SUFDbEMsT0FBTyxDQUFDLDJCQUEyQixDQUFrRTtJQUNyRyxPQUFPLENBQUMsbUJBQW1CLENBQStCO0lBRTFELFlBQ1Usb0JBQW9CLEVBQUUsMkJBQTJCLENBQUMsZ0NBQWdDLENBQUMsRUFDbkYsY0FBYyxFQUFFLDBCQUEwQixFQUFFLEVBQzVDLDJCQUEyQixFQUFFLEdBQUcsQ0FBQyxNQUFNLEVBQUUsTUFBTSxDQUFDLEVBQ2hELFlBQVksRUFBRSxNQUFNLEVBVzdCO0lBRUQsVUFBVSxJQUFJLE9BQU8sQ0FzQnBCO0lBRUssS0FBSyxDQUFDLE1BQU0sRUFBRSxtQkFBbUIsbURBK0V0QztJQUVELE9BQU8sQ0FBQyx3QkFBd0I7SUEyQmhDLE9BQU8sQ0FBQyw4QkFBOEI7SUF1RHRDLE9BQU8sQ0FBQywrQkFBK0I7SUF1RHZDLE9BQU8sQ0FBQyx1QkFBdUI7SUFhL0IsT0FBTyxDQUFDLHVCQUF1QjtJQXNFL0IsT0FBTyxDQUFDLG1CQUFtQjtJQWMzQixPQUFPLENBQUMsbUJBQW1CO0lBa0IzQixPQUFPLENBQUMsb0JBQW9CO0NBcUI3QiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private_kernel_reset_private_inputs_builder.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/private_kernel_reset_private_inputs_builder.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,mDA+EtC;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"}
|
|
@@ -25,7 +25,7 @@ function getNullifierMembershipWitnessResolver(oracle) {
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
async function
|
|
28
|
+
async function getMasterSecretKeysAndKeyTypeDomainSeparators(keyValidationRequests, numRequestsToVerify, oracle) {
|
|
29
29
|
const numRequestsToProcess = Math.min(keyValidationRequests.claimedLength, numRequestsToVerify);
|
|
30
30
|
const keysHints = await Promise.all(keyValidationRequests.array.slice(0, numRequestsToProcess).map(async ({ request })=>{
|
|
31
31
|
const secretKeys = await oracle.getMasterSecretKey(request.request.pkM);
|
|
@@ -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
|
}
|
|
@@ -92,16 +92,22 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
92
92
|
// The dimensions found must be big enough to reset all values, i.e. empty remainder.
|
|
93
93
|
const allowRemainder = isInner;
|
|
94
94
|
const dimensions = findPrivateKernelResetDimensions(this.requestedDimensions, privateKernelResetDimensionsConfig, isInner, allowRemainder);
|
|
95
|
-
const previousVkMembershipWitness = await oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields);
|
|
96
|
-
const vkData = new VkData(this.previousKernelOutput.verificationKey, Number(previousVkMembershipWitness.leafIndex), previousVkMembershipWitness.siblingPath);
|
|
97
|
-
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
98
95
|
this.reduceReadRequestActions(this.noteHashResetActions, dimensions.NOTE_HASH_PENDING_READ, dimensions.NOTE_HASH_SETTLED_READ);
|
|
99
96
|
this.reduceReadRequestActions(this.nullifierResetActions, dimensions.NULLIFIER_PENDING_READ, dimensions.NULLIFIER_SETTLED_READ);
|
|
97
|
+
// Execute all the expensive node querying operations in parallel.
|
|
98
|
+
const [previousVkMembershipWitness, noteHashReadRequestHints, nullifierReadRequestHints, keyValidationHints] = await Promise.all([
|
|
99
|
+
oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields),
|
|
100
|
+
buildNoteHashReadRequestHintsFromResetActions(oracle, this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes, this.noteHashResetActions),
|
|
101
|
+
buildNullifierReadRequestHintsFromResetActions({
|
|
102
|
+
getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle)
|
|
103
|
+
}, this.previousKernel.validationRequests.nullifierReadRequests, this.nullifierResetActions),
|
|
104
|
+
getMasterSecretKeysAndKeyTypeDomainSeparators(this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators, dimensions.KEY_VALIDATION, oracle)
|
|
105
|
+
]);
|
|
106
|
+
const vkData = new VkData(this.previousKernelOutput.verificationKey, Number(previousVkMembershipWitness.leafIndex), previousVkMembershipWitness.siblingPath);
|
|
107
|
+
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
100
108
|
// TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
|
|
101
109
|
const paddedSideEffects = PaddedSideEffects.empty();
|
|
102
|
-
return new PrivateKernelResetCircuitPrivateInputs(previousKernelData, paddedSideEffects, new PrivateKernelResetHints(
|
|
103
|
-
getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle)
|
|
104
|
-
}, this.previousKernel.validationRequests.nullifierReadRequests, this.nullifierResetActions), await getMasterSecretKeysAndAppKeyGenerators(this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators, dimensions.KEY_VALIDATION, oracle), this.transientDataSquashingHints), dimensions);
|
|
110
|
+
return new PrivateKernelResetCircuitPrivateInputs(previousKernelData, paddedSideEffects, new PrivateKernelResetHints(noteHashReadRequestHints, nullifierReadRequestHints, keyValidationHints, this.transientDataSquashingHints), dimensions);
|
|
105
111
|
}
|
|
106
112
|
reduceReadRequestActions(resetActions, maxPending, maxSettled) {
|
|
107
113
|
let numPending = 0;
|
|
@@ -185,8 +191,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
185
191
|
return true;
|
|
186
192
|
}
|
|
187
193
|
needsResetNullifierKeys() {
|
|
188
|
-
const numCurr = this.previousKernel.validationRequests.
|
|
189
|
-
const numNext = this.nextIteration ? this.nextIteration.
|
|
194
|
+
const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators.claimedLength;
|
|
195
|
+
const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndSeparators.claimedLength : 0;
|
|
190
196
|
const maxAmountToKeep = !this.nextIteration ? 0 : MAX_KEY_VALIDATION_REQUESTS_PER_TX;
|
|
191
197
|
if (numCurr + numNext <= maxAmountToKeep) {
|
|
192
198
|
return false;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
1
2
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
2
3
|
import { type PrivateKernelExecutionProofOutput, type PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
3
4
|
import { type PrivateExecutionResult, TxRequest } from '@aztec/stdlib/tx';
|
|
@@ -18,7 +19,7 @@ export declare class PrivateKernelExecutionProver {
|
|
|
18
19
|
private proofCreator;
|
|
19
20
|
private fakeProofs;
|
|
20
21
|
private log;
|
|
21
|
-
constructor(oracle: PrivateKernelOracle, proofCreator: PrivateKernelProver, fakeProofs?: boolean);
|
|
22
|
+
constructor(oracle: PrivateKernelOracle, proofCreator: PrivateKernelProver, fakeProofs?: boolean, bindings?: LoggerBindings);
|
|
22
23
|
/**
|
|
23
24
|
* Generate a proof for a given transaction request and execution result.
|
|
24
25
|
* The function iterates through the nested executions in the execution result, creates private call data,
|
|
@@ -41,4 +42,4 @@ export declare class PrivateKernelExecutionProver {
|
|
|
41
42
|
private getVkData;
|
|
42
43
|
private createPrivateCallData;
|
|
43
44
|
}
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfZXhlY3V0aW9uX3Byb3Zlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL3ByaXZhdGVfa2VybmVsX2V4ZWN1dGlvbl9wcm92ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFlLEtBQUssY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QUFvQyxDQUFDLENBQUMsQ0FvUmxGO0lBRUQ7Ozs7O09BS0c7SUFDSCxPQUFPLENBQUMsdUJBQXVCO1lBb0JqQixTQUFTO1lBU1QscUJBQXFCO0NBK0JwQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAMvF,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,CAAS;IAEpB,YACU,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ,EAC1B,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAED;;;;;;;;;;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,9 +8,9 @@ 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
|
-
import { PrivateKernelResetPrivateInputsBuilder } from './hints/
|
|
13
|
+
import { PrivateKernelResetPrivateInputsBuilder } from './hints/private_kernel_reset_private_inputs_builder.js';
|
|
14
14
|
const NULL_SIMULATE_OUTPUT = {
|
|
15
15
|
publicInputs: PrivateKernelCircuitPublicInputs.empty(),
|
|
16
16
|
verificationKey: VerificationKeyData.empty(),
|
|
@@ -27,11 +27,11 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
27
27
|
proofCreator;
|
|
28
28
|
fakeProofs;
|
|
29
29
|
log;
|
|
30
|
-
constructor(oracle, proofCreator, fakeProofs = false){
|
|
30
|
+
constructor(oracle, proofCreator, fakeProofs = false, bindings){
|
|
31
31
|
this.oracle = oracle;
|
|
32
32
|
this.proofCreator = proofCreator;
|
|
33
33
|
this.fakeProofs = fakeProofs;
|
|
34
|
-
this.log = createLogger('pxe:private-kernel-execution-prover');
|
|
34
|
+
this.log = createLogger('pxe:private-kernel-execution-prover', bindings);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Generate a proof for a given transaction request and execution result.
|
|
@@ -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',
|
|
@@ -162,14 +161,14 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
162
161
|
this.log.debug(`Calling private kernel tail with hwm ${previousKernelData.publicInputs.minRevertibleSideEffectCounter}`);
|
|
163
162
|
// TODO: Enable padding once we better understand the final amounts to pad to.
|
|
164
163
|
const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
|
|
165
|
-
// Use the aggregated
|
|
166
|
-
// TODO: Call `
|
|
167
|
-
const
|
|
164
|
+
// Use the aggregated expirationTimestamp set throughout the tx execution.
|
|
165
|
+
// TODO: Call `computeTxExpirationTimestamp` to round the value down and reduce precision, improving privacy.
|
|
166
|
+
const expirationTimestampUpperBound = previousKernelData.publicInputs.expirationTimestamp;
|
|
168
167
|
const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
169
|
-
if (
|
|
170
|
-
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${
|
|
168
|
+
if (expirationTimestampUpperBound <= anchorBlockTimestamp) {
|
|
169
|
+
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestampUpperBound}.`);
|
|
171
170
|
}
|
|
172
|
-
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(previousKernelData, paddedSideEffectAmounts,
|
|
171
|
+
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(previousKernelData, paddedSideEffectAmounts, expirationTimestampUpperBound);
|
|
173
172
|
const witgenTimer = new Timer();
|
|
174
173
|
const tailOutput = generateWitnesses ? await this.proofCreator.generateTailOutput(privateInputs) : await this.proofCreator.simulateTail(privateInputs);
|
|
175
174
|
executionSteps.push({
|
|
@@ -2,62 +2,62 @@ import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@az
|
|
|
2
2
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
|
|
4
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
5
6
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
9
|
+
import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
10
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
7
11
|
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
8
|
-
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
9
12
|
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
10
13
|
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
14
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
11
15
|
/**
|
|
12
16
|
* Provides functionality needed by the private kernel for interacting with our state trees.
|
|
13
|
-
* This is either PrivateKernelOracleImpl, or a mocked test implementation.
|
|
14
17
|
*/
|
|
15
|
-
export
|
|
18
|
+
export declare class PrivateKernelOracle {
|
|
19
|
+
private contractStore;
|
|
20
|
+
private keyStore;
|
|
21
|
+
private node;
|
|
22
|
+
private blockHash;
|
|
23
|
+
constructor(contractStore: ContractStore, keyStore: KeyStore, node: AztecNode, blockHash: BlockHash);
|
|
16
24
|
/** Retrieves the preimage of a contract address from the registered contract instances db. */
|
|
17
|
-
getContractAddressPreimage(address: AztecAddress): Promise<{
|
|
25
|
+
getContractAddressPreimage(address: AztecAddress): Promise<ContractInstanceWithAddress & {
|
|
18
26
|
saltedInitializationHash: Fr;
|
|
19
|
-
publicKeys: PublicKeys;
|
|
20
|
-
currentContractClassId: Fr;
|
|
21
|
-
originalContractClassId: Fr;
|
|
22
27
|
}>;
|
|
23
28
|
/** Retrieves the preimage of a contract class id from the contract classes db. */
|
|
24
29
|
getContractClassIdPreimage(contractClassId: Fr): Promise<{
|
|
25
30
|
artifactHash: Fr;
|
|
26
|
-
publicBytecodeCommitment: Fr;
|
|
27
31
|
privateFunctionsRoot: Fr;
|
|
32
|
+
publicBytecodeCommitment: Fr;
|
|
28
33
|
}>;
|
|
29
|
-
/**
|
|
30
|
-
* Returns a membership witness with the sibling path and leaf index in our private functions tree.
|
|
31
|
-
*/
|
|
34
|
+
/** Returns a membership witness with the sibling path and leaf index in our private functions tree. */
|
|
32
35
|
getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
|
|
33
36
|
/**
|
|
34
37
|
* Returns a membership witness with the sibling path and leaf index in our protocol VK indexed merkle tree.
|
|
35
38
|
* Used to validate the previous kernel's verification key.
|
|
36
39
|
*/
|
|
37
40
|
getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<typeof VK_TREE_HEIGHT>>;
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree.
|
|
43
|
-
*/
|
|
41
|
+
/** Returns a membership witness with the sibling path and leaf index in our note hash tree. */
|
|
42
|
+
getNoteHashMembershipWitness(noteHash: Fr): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
|
|
43
|
+
/** Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree. */
|
|
44
44
|
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
45
|
-
/**
|
|
46
|
-
* Returns the root of our note hash merkle tree.
|
|
47
|
-
*/
|
|
45
|
+
/** Returns the root of our note hash merkle tree. */
|
|
48
46
|
getNoteHashTreeRoot(): Promise<Fr>;
|
|
49
47
|
/**
|
|
50
48
|
* Retrieves the sk_m corresponding to the pk_m.
|
|
51
49
|
* @throws If the provided public key is not associated with any of the registered accounts.
|
|
52
|
-
* @param
|
|
50
|
+
* @param masterPublicKey - The master public key to get secret key for.
|
|
53
51
|
* @returns A Promise that resolves to sk_m.
|
|
54
52
|
* @dev Used when feeding the sk_m to the kernel circuit for keys verification.
|
|
55
53
|
*/
|
|
56
54
|
getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar>;
|
|
57
55
|
/** Use debug data to get the function name corresponding to a selector. */
|
|
58
56
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
57
|
+
/**
|
|
58
|
+
* Returns a membership witness and leaf index to our public data indexed merkle tree,
|
|
59
|
+
* along with an associated DelayedPublicMutable containing the class ID to update.
|
|
60
|
+
*/
|
|
61
61
|
getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
|
|
62
62
|
}
|
|
63
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfb3JhY2xlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJpdmF0ZV9rZXJuZWwvcHJpdmF0ZV9rZXJuZWxfb3JhY2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxxQkFBcUIsRUFBMkIsY0FBYyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDeEgsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQ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dCLEdBQUcsT0FBTyxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUMsQ0FFbEg7SUFFRDs7O09BR0c7SUFDVSxzQkFBc0IsQ0FBQyxlQUFlLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQThCL0Y7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_oracle.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"private_kernel_oracle.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAA2B,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,2BAA2B,EAAmC,MAAM,wBAAwB,CAAC;AAG3G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,M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