@aztec/pxe 0.0.1-commit.6c91f13 → 0.0.1-commit.6d63667d
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/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 +11 -12
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +39 -28
- 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 +6 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- 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 +16 -12
- 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 +11 -9
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +64 -41
- 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 +13 -18
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +24 -40
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +38 -24
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +86 -83
- package/dest/contract_sync/contract_sync_service.d.ts +41 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +82 -0
- package/dest/contract_sync/helpers.d.ts +28 -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 -9
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +31 -17
- 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 +22 -7
- 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 +23 -8
- 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 +3 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -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 +30 -15
- 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 +7 -5
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +23 -20
- 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 +31 -36
- 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/index.d.ts +2 -2
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- 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} +13 -7
- 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 +6 -7
- package/dest/private_kernel/private_kernel_oracle.d.ts +24 -28
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +90 -2
- package/dest/pxe.d.ts +9 -36
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +87 -97
- 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 +1 -2
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +22 -25
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +51 -52
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +282 -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 +46 -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 +8 -8
- 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/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 +46 -32
- 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 +5 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +21 -11
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
- package/src/contract_function_simulator/oracle/oracle.ts +76 -44
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -69
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +41 -49
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +108 -90
- package/src/contract_sync/contract_sync_service.ts +129 -0
- package/src/contract_sync/helpers.ts +93 -0
- package/src/debug/pxe_debug_utils.ts +65 -17
- package/src/entrypoints/client/bundle/utils.ts +15 -16
- package/src/entrypoints/client/lazy/utils.ts +16 -17
- package/src/entrypoints/pxe_creation_options.ts +4 -2
- package/src/entrypoints/server/index.ts +2 -0
- package/src/entrypoints/server/utils.ts +26 -34
- 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 +34 -16
- package/src/notes/note_service.ts +38 -43
- package/src/oracle_version.ts +4 -3
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +33 -22
- package/src/private_kernel/private_kernel_execution_prover.ts +9 -8
- package/src/private_kernel/private_kernel_oracle.ts +116 -36
- package/src/pxe.ts +156 -132
- 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 +22 -31
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +317 -318
- 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 +68 -0
- package/src/tagging/index.ts +2 -11
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +21 -7
- 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/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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
2
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
|
+
/**
|
|
4
|
+
* Interface that stores must implement to support staged writes.
|
|
5
|
+
*/
|
|
6
|
+
export interface StagedStore {
|
|
7
|
+
/** Unique name identifying this store (used for tracking staged stores from JobCoordinator) */
|
|
8
|
+
readonly storeName: string;
|
|
9
|
+
/**
|
|
10
|
+
* Commits staged data to main storage.
|
|
11
|
+
* Should be called within a transaction for atomicity.
|
|
12
|
+
*
|
|
13
|
+
* @param jobId - The job identifier
|
|
14
|
+
*/
|
|
15
|
+
commit(jobId: string): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Discards staged data without committing.
|
|
18
|
+
* Called on abort.
|
|
19
|
+
*
|
|
20
|
+
* @param jobId - The job identifier
|
|
21
|
+
*/
|
|
22
|
+
discardStaged(jobId: string): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* JobCoordinator manages job lifecycle and provides crash resilience for PXE operations.
|
|
26
|
+
*
|
|
27
|
+
* It uses a staged writes pattern:
|
|
28
|
+
* 1. When a job begins, a unique job ID is created
|
|
29
|
+
* 2. During the job, all writes go to staging (keyed by job ID)
|
|
30
|
+
* 3. On commit, staging is promoted to main storage
|
|
31
|
+
* 4. On abort, staged data is discarded
|
|
32
|
+
*
|
|
33
|
+
* Note: PXE should only rely on a single JobCoordinator instance, so it can eventually
|
|
34
|
+
* orchestrate concurrent jobs. Right now it doesn't make a difference because we're
|
|
35
|
+
* using a job queue with concurrency=1.
|
|
36
|
+
*/
|
|
37
|
+
export declare class JobCoordinator {
|
|
38
|
+
#private;
|
|
39
|
+
private readonly log;
|
|
40
|
+
/** The underlying KV store */
|
|
41
|
+
kvStore: AztecAsyncKVStore;
|
|
42
|
+
constructor(kvStore: AztecAsyncKVStore, bindings?: LoggerBindings);
|
|
43
|
+
/**
|
|
44
|
+
* Registers a staged store.
|
|
45
|
+
* Must be called during initialization for all stores that need staging support.
|
|
46
|
+
*/
|
|
47
|
+
registerStore(store: StagedStore): void;
|
|
48
|
+
/**
|
|
49
|
+
* Registers multiple staged stores.
|
|
50
|
+
*/
|
|
51
|
+
registerStores(stores: StagedStore[]): void;
|
|
52
|
+
/**
|
|
53
|
+
* Begins a new job and returns a job ID for staged writes.
|
|
54
|
+
*
|
|
55
|
+
* @returns Job ID to pass to store operations
|
|
56
|
+
*/
|
|
57
|
+
beginJob(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Commits a job by promoting all staged data to main storage.
|
|
60
|
+
*
|
|
61
|
+
* @param jobId - The job ID returned from beginJob
|
|
62
|
+
*/
|
|
63
|
+
commitJob(jobId: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Aborts a job by discarding all staged data.
|
|
66
|
+
*
|
|
67
|
+
* @param jobId - The job ID returned from beginJob
|
|
68
|
+
*/
|
|
69
|
+
abortJob(jobId: string): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Checks if there's a job currently in progress.
|
|
72
|
+
*/
|
|
73
|
+
hasJobInProgress(): boolean;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiam9iX2Nvb3JkaW5hdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvam9iX2Nvb3JkaW5hdG9yL2pvYl9jb29yZGluYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQWUsS0FBSyxjQUFjLEVBQWdC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94 @@
|
|
|
1
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
/**
|
|
4
|
+
* JobCoordinator manages job lifecycle and provides crash resilience for PXE operations.
|
|
5
|
+
*
|
|
6
|
+
* It uses a staged writes pattern:
|
|
7
|
+
* 1. When a job begins, a unique job ID is created
|
|
8
|
+
* 2. During the job, all writes go to staging (keyed by job ID)
|
|
9
|
+
* 3. On commit, staging is promoted to main storage
|
|
10
|
+
* 4. On abort, staged data is discarded
|
|
11
|
+
*
|
|
12
|
+
* Note: PXE should only rely on a single JobCoordinator instance, so it can eventually
|
|
13
|
+
* orchestrate concurrent jobs. Right now it doesn't make a difference because we're
|
|
14
|
+
* using a job queue with concurrency=1.
|
|
15
|
+
*/ export class JobCoordinator {
|
|
16
|
+
log;
|
|
17
|
+
/** The underlying KV store */ kvStore;
|
|
18
|
+
#currentJobId;
|
|
19
|
+
#stores = new Map();
|
|
20
|
+
constructor(kvStore, bindings){
|
|
21
|
+
this.kvStore = kvStore;
|
|
22
|
+
this.log = createLogger('pxe:job_coordinator', bindings);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Registers a staged store.
|
|
26
|
+
* Must be called during initialization for all stores that need staging support.
|
|
27
|
+
*/ registerStore(store) {
|
|
28
|
+
if (this.#stores.has(store.storeName)) {
|
|
29
|
+
throw new Error(`Store "${store.storeName}" is already registered`);
|
|
30
|
+
}
|
|
31
|
+
this.#stores.set(store.storeName, store);
|
|
32
|
+
this.log.debug(`Registered staged store: ${store.storeName}`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Registers multiple staged stores.
|
|
36
|
+
*/ registerStores(stores) {
|
|
37
|
+
for (const store of stores){
|
|
38
|
+
this.registerStore(store);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Begins a new job and returns a job ID for staged writes.
|
|
43
|
+
*
|
|
44
|
+
* @returns Job ID to pass to store operations
|
|
45
|
+
*/ beginJob() {
|
|
46
|
+
if (this.#currentJobId) {
|
|
47
|
+
throw new Error(`Cannot begin job: job ${this.#currentJobId} is already in progress. ` + `This should not happen - ensure jobs are properly committed or aborted.`);
|
|
48
|
+
}
|
|
49
|
+
const jobId = randomBytes(8).toString('hex');
|
|
50
|
+
this.#currentJobId = jobId;
|
|
51
|
+
this.log.debug(`Started job ${jobId}`);
|
|
52
|
+
return jobId;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Commits a job by promoting all staged data to main storage.
|
|
56
|
+
*
|
|
57
|
+
* @param jobId - The job ID returned from beginJob
|
|
58
|
+
*/ async commitJob(jobId) {
|
|
59
|
+
if (!this.#currentJobId || this.#currentJobId !== jobId) {
|
|
60
|
+
throw new Error(`Cannot commit job ${jobId}: no matching job in progress. ` + `Current job: ${this.#currentJobId ?? 'none'}`);
|
|
61
|
+
}
|
|
62
|
+
this.log.debug(`Committing job ${jobId}`);
|
|
63
|
+
// Commit all stores atomically in a single transaction.
|
|
64
|
+
// Each store's commit is a no-op if it has no staged data (but that's up to each store to handle).
|
|
65
|
+
await this.kvStore.transactionAsync(async ()=>{
|
|
66
|
+
for (const store of this.#stores.values()){
|
|
67
|
+
await store.commit(jobId);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
this.#currentJobId = undefined;
|
|
71
|
+
this.log.debug(`Job ${jobId} committed successfully`);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Aborts a job by discarding all staged data.
|
|
75
|
+
*
|
|
76
|
+
* @param jobId - The job ID returned from beginJob
|
|
77
|
+
*/ async abortJob(jobId) {
|
|
78
|
+
if (!this.#currentJobId || this.#currentJobId !== jobId) {
|
|
79
|
+
// Job may have already been aborted or never started properly
|
|
80
|
+
this.log.warn(`Abort called for job ${jobId} but current job is ${this.#currentJobId ?? 'none'}`);
|
|
81
|
+
}
|
|
82
|
+
this.log.debug(`Aborting job ${jobId}`);
|
|
83
|
+
for (const store of this.#stores.values()){
|
|
84
|
+
await store.discardStaged(jobId);
|
|
85
|
+
}
|
|
86
|
+
this.#currentJobId = undefined;
|
|
87
|
+
this.log.debug(`Job ${jobId} aborted`);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Checks if there's a job currently in progress.
|
|
91
|
+
*/ hasJobInProgress() {
|
|
92
|
+
return this.#currentJobId !== undefined;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
2
3
|
import type { KeyStore } from '@aztec/key-store';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
5
7
|
import type { LogRetrievalRequest } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
|
|
6
8
|
import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
|
|
7
9
|
import { AddressStore } from '../storage/address_store/address_store.js';
|
|
8
|
-
import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
9
10
|
import { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
|
|
10
11
|
import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
|
|
11
12
|
import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
|
|
12
13
|
export declare class LogService {
|
|
13
14
|
#private;
|
|
14
15
|
private readonly aztecNode;
|
|
15
|
-
private readonly
|
|
16
|
+
private readonly anchorBlockHeader;
|
|
16
17
|
private readonly keyStore;
|
|
17
18
|
private readonly capsuleStore;
|
|
18
19
|
private readonly recipientTaggingStore;
|
|
19
20
|
private readonly senderAddressBookStore;
|
|
20
21
|
private readonly addressStore;
|
|
22
|
+
private readonly jobId;
|
|
21
23
|
private log;
|
|
22
|
-
constructor(aztecNode: AztecNode,
|
|
24
|
+
constructor(aztecNode: AztecNode, anchorBlockHeader: BlockHeader, keyStore: KeyStore, capsuleStore: CapsuleStore, recipientTaggingStore: RecipientTaggingStore, senderAddressBookStore: SenderAddressBookStore, addressStore: AddressStore, jobId: string, bindings?: LoggerBindings);
|
|
23
25
|
bulkRetrieveLogs(logRetrievalRequests: LogRetrievalRequest[]): Promise<(LogRetrievalResponse | null)[]>;
|
|
24
|
-
|
|
26
|
+
fetchTaggedLogs(contractAddress: AztecAddress, pendingTaggedLogArrayBaseSlot: Fr, scopes?: AztecAddress[]): Promise<void>;
|
|
25
27
|
}
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dzL2xvZ19zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3pELE9BQU8sRUFBZSxLQUFLLGNBQWMsRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUN2RixPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFM0QsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxzRUFBc0UsQ0FBQztBQUNoSCx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xHQUFHLE9BQU8sQ0FBQyxDQUFDLG9CQUFvQixHQUFHLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FpQm5IO0lBdURZLGVBQWUsQ0FDMUIsZUFBZSxFQUFFLFlBQVksRUFDN0IsNkJBQTZCLEVBQUUsRUFBRSxFQUNqQyxNQUFNLENBQUMsRUFBRSxZQUFZLEVBQUUsaUJBMEN4QjtDQWdFRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log_service.d.ts","sourceRoot":"","sources":["../../src/logs/log_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"log_service.d.ts","sourceRoot":"","sources":["../../src/logs/log_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sEAAsE,CAAC;AAChH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uEAAuE,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAOpG,qBAAa,UAAU;;IAInB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAVxB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACmB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,WAAW,EAC9B,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,qBAAqB,EAAE,qBAAqB,EAC5C,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EAC9B,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAEY,gBAAgB,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,CAAC,oBAAoB,GAAG,IAAI,CAAC,EAAE,CAAC,CAiBnH;IAuDY,eAAe,CAC1B,eAAe,EAAE,YAAY,EAC7B,6BAA6B,EAAE,EAAE,EACjC,MAAM,CAAC,EAAE,YAAY,EAAE,iBA0CxB;CAgEF"}
|
package/dest/logs/log_service.js
CHANGED
|
@@ -2,25 +2,27 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag } from '@aztec/stdlib/logs';
|
|
4
4
|
import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
|
|
5
|
-
import { loadPrivateLogsForSenderRecipientPair } from '../tagging/index.js';
|
|
5
|
+
import { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract, loadPrivateLogsForSenderRecipientPair } from '../tagging/index.js';
|
|
6
6
|
export class LogService {
|
|
7
7
|
aztecNode;
|
|
8
|
-
|
|
8
|
+
anchorBlockHeader;
|
|
9
9
|
keyStore;
|
|
10
10
|
capsuleStore;
|
|
11
11
|
recipientTaggingStore;
|
|
12
12
|
senderAddressBookStore;
|
|
13
13
|
addressStore;
|
|
14
|
+
jobId;
|
|
14
15
|
log;
|
|
15
|
-
constructor(aztecNode,
|
|
16
|
+
constructor(aztecNode, anchorBlockHeader, keyStore, capsuleStore, recipientTaggingStore, senderAddressBookStore, addressStore, jobId, bindings){
|
|
16
17
|
this.aztecNode = aztecNode;
|
|
17
|
-
this.
|
|
18
|
+
this.anchorBlockHeader = anchorBlockHeader;
|
|
18
19
|
this.keyStore = keyStore;
|
|
19
20
|
this.capsuleStore = capsuleStore;
|
|
20
21
|
this.recipientTaggingStore = recipientTaggingStore;
|
|
21
22
|
this.senderAddressBookStore = senderAddressBookStore;
|
|
22
23
|
this.addressStore = addressStore;
|
|
23
|
-
this.
|
|
24
|
+
this.jobId = jobId;
|
|
25
|
+
this.log = createLogger('pxe:log_service', bindings);
|
|
24
26
|
}
|
|
25
27
|
async bulkRetrieveLogs(logRetrievalRequests) {
|
|
26
28
|
return await Promise.all(logRetrievalRequests.map(async (request)=>{
|
|
@@ -35,11 +37,12 @@ export class LogService {
|
|
|
35
37
|
}));
|
|
36
38
|
}
|
|
37
39
|
async #getPublicLogByTag(tag, contractAddress) {
|
|
38
|
-
const
|
|
40
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
41
|
+
const allLogsPerTag = await getAllPublicLogsByTagsFromContract(this.aztecNode, contractAddress, [
|
|
39
42
|
tag
|
|
40
|
-
]);
|
|
41
|
-
const logsForTag =
|
|
42
|
-
if (logsForTag.length
|
|
43
|
+
], anchorBlockHash);
|
|
44
|
+
const logsForTag = allLogsPerTag[0];
|
|
45
|
+
if (logsForTag.length === 0) {
|
|
43
46
|
return null;
|
|
44
47
|
} else if (logsForTag.length > 1) {
|
|
45
48
|
// TODO(#11627): handle this case
|
|
@@ -49,11 +52,12 @@ export class LogService {
|
|
|
49
52
|
return new LogRetrievalResponse(scopedLog.logData.slice(1), scopedLog.txHash, scopedLog.noteHashes, scopedLog.firstNullifier);
|
|
50
53
|
}
|
|
51
54
|
async #getPrivateLogByTag(siloedTag) {
|
|
52
|
-
const
|
|
55
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
56
|
+
const allLogsPerTag = await getAllPrivateLogsByTags(this.aztecNode, [
|
|
53
57
|
siloedTag
|
|
54
|
-
]);
|
|
55
|
-
const logsForTag =
|
|
56
|
-
if (logsForTag.length
|
|
58
|
+
], anchorBlockHash);
|
|
59
|
+
const logsForTag = allLogsPerTag[0];
|
|
60
|
+
if (logsForTag.length === 0) {
|
|
57
61
|
return null;
|
|
58
62
|
} else if (logsForTag.length > 1) {
|
|
59
63
|
// TODO(#11627): handle this case
|
|
@@ -62,12 +66,11 @@ export class LogService {
|
|
|
62
66
|
const scopedLog = logsForTag[0];
|
|
63
67
|
return new LogRetrievalResponse(scopedLog.logData.slice(1), scopedLog.txHash, scopedLog.noteHashes, scopedLog.firstNullifier);
|
|
64
68
|
}
|
|
65
|
-
async
|
|
66
|
-
this.log.verbose(
|
|
67
|
-
contract: contractAddress
|
|
68
|
-
});
|
|
69
|
+
async fetchTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, scopes) {
|
|
70
|
+
this.log.verbose(`Fetching tagged logs for ${contractAddress.toString()}`);
|
|
69
71
|
// We only load logs from block up to and including the anchor block number
|
|
70
|
-
const anchorBlockNumber =
|
|
72
|
+
const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
|
|
73
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
71
74
|
// Determine recipients: use scopes if provided, otherwise get all accounts
|
|
72
75
|
const recipients = scopes && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
|
|
73
76
|
// For each recipient, fetch secrets, load logs, and store them.
|
|
@@ -76,7 +79,7 @@ export class LogService {
|
|
|
76
79
|
// Get all secrets for this recipient (one per sender)
|
|
77
80
|
const secrets = await this.#getSecretsForSenders(contractAddress, recipient);
|
|
78
81
|
// 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)));
|
|
82
|
+
const logArrays = await Promise.all(secrets.map((secret)=>loadPrivateLogsForSenderRecipientPair(secret, contractAddress, this.aztecNode, this.recipientTaggingStore, anchorBlockNumber, anchorBlockHash, this.jobId)));
|
|
80
83
|
// Flatten all logs from all secrets
|
|
81
84
|
const allLogs = logArrays.flat();
|
|
82
85
|
// Store the logs for this recipient
|
|
@@ -107,7 +110,7 @@ export class LogService {
|
|
|
107
110
|
return pendingTaggedLog.toFields();
|
|
108
111
|
});
|
|
109
112
|
// TODO: This looks like it could belong more at the oracle interface level
|
|
110
|
-
return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs);
|
|
113
|
+
return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs, this.jobId);
|
|
111
114
|
}
|
|
112
115
|
async #getCompleteAddress(account) {
|
|
113
116
|
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
@@ -2,14 +2,14 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
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
|
-
import type { TxHash } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
5
|
+
import type { BlockHeader, TxHash } from '@aztec/stdlib/tx';
|
|
7
6
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
8
7
|
export declare class NoteService {
|
|
9
8
|
private readonly noteStore;
|
|
10
9
|
private readonly aztecNode;
|
|
11
|
-
private readonly
|
|
12
|
-
|
|
10
|
+
private readonly anchorBlockHeader;
|
|
11
|
+
private readonly jobId;
|
|
12
|
+
constructor(noteStore: NoteStore, aztecNode: AztecNode, anchorBlockHeader: BlockHeader, jobId: string);
|
|
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.
|
|
@@ -27,8 +27,8 @@ export declare class NoteService {
|
|
|
27
27
|
noteNonce: Fr;
|
|
28
28
|
note: Note;
|
|
29
29
|
noteHash: Fr;
|
|
30
|
+
isPending: boolean;
|
|
30
31
|
siloedNullifier: Fr;
|
|
31
|
-
index: bigint;
|
|
32
32
|
}[]>;
|
|
33
33
|
/**
|
|
34
34
|
* Looks for nullifiers of active contract notes and marks them as nullified if a nullifier is found.
|
|
@@ -43,6 +43,6 @@ export declare class NoteService {
|
|
|
43
43
|
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
44
44
|
*/
|
|
45
45
|
syncNoteNullifiers(contractAddress: AztecAddress): Promise<void>;
|
|
46
|
-
|
|
46
|
+
validateAndStoreNote(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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zZXJ2aWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbm90ZXMvbm90ZV9zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCx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WUFBWSxFQUM3QixLQUFLLEVBQUUsWUFBWSxFQUNuQixXQUFXLEVBQUUsRUFBRSxFQUNmLFVBQVUsRUFBRSxFQUFFLEVBQ2QsU0FBUyxFQUFFLEVBQUUsRUFDYixPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQ2IsUUFBUSxFQUFFLEVBQUUsRUFDWixTQUFTLEVBQUUsRUFBRSxFQUNiLE1BQU0sRUFBRSxNQUFNLEVBQ2QsU0FBUyxFQUFFLFlBQVksR0FDdEIsT0FBTyxDQUFDLElBQUksQ0FBQyxDQXNFZjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_service.d.ts","sourceRoot":"","sources":["../../src/notes/note_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAW,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"note_service.d.ts","sourceRoot":"","sources":["../../src/notes/note_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAW,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,YACmB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,WAAW,EAC9B,KAAK,EAAE,MAAM,EAC5B;IAEJ;;;;;;;;OAQG;IACU,QAAQ,CACnB,eAAe,EAAE,YAAY,EAC7B,KAAK,EAAE,YAAY,GAAG,SAAS,EAC/B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,YAAY,EAAE;;;;;;;;;;SAyBxB;IAED;;;;;;;;;;;OAWG;IACU,kBAAkB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsC5E;IAEY,oBAAoB,CAC/B,eAAe,EAAE,YAAY,EAC7B,KAAK,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,CAsEf;CACF"}
|
|
@@ -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
|
/**
|
|
@@ -52,10 +53,10 @@ export class NoteService {
|
|
|
52
53
|
*
|
|
53
54
|
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
54
55
|
*/ async syncNoteNullifiers(contractAddress) {
|
|
55
|
-
const
|
|
56
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
56
57
|
const contractNotes = await this.noteStore.getNotes({
|
|
57
58
|
contractAddress
|
|
58
|
-
});
|
|
59
|
+
}, this.jobId);
|
|
59
60
|
if (contractNotes.length === 0) {
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
@@ -72,7 +73,7 @@ export class NoteService {
|
|
|
72
73
|
}, [
|
|
73
74
|
[]
|
|
74
75
|
]);
|
|
75
|
-
const nullifierIndexes = (await Promise.all(nullifierBatches.map((batch)=>this.aztecNode.findLeavesIndexes(
|
|
76
|
+
const nullifierIndexes = (await Promise.all(nullifierBatches.map((batch)=>this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, batch)))).flat();
|
|
76
77
|
const foundNullifiers = nullifiersToCheck.map((nullifier, i)=>{
|
|
77
78
|
if (nullifierIndexes[i] !== undefined) {
|
|
78
79
|
return {
|
|
@@ -83,9 +84,9 @@ export class NoteService {
|
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
}).filter((nullifier)=>nullifier !== undefined);
|
|
86
|
-
await this.noteStore.applyNullifiers(foundNullifiers);
|
|
87
|
+
await this.noteStore.applyNullifiers(foundNullifiers, this.jobId);
|
|
87
88
|
}
|
|
88
|
-
async
|
|
89
|
+
async validateAndStoreNote(contractAddress, owner, storageSlot, randomness, noteNonce, content, noteHash, nullifier, txHash, recipient) {
|
|
89
90
|
// We are going to store the new note in the NoteStore, which will let us later return it via `getNotes`.
|
|
90
91
|
// There's two things we need to check before we do this however:
|
|
91
92
|
// - we must make sure the note does actually exist in the note hash tree
|
|
@@ -104,49 +105,43 @@ export class NoteService {
|
|
|
104
105
|
// number which *should* be recent enough to be available, even for non-archive nodes.
|
|
105
106
|
// Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
|
|
106
107
|
// logs up to the synced block making this only an additional safety check.
|
|
107
|
-
const
|
|
108
|
+
const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
|
|
109
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
108
110
|
// By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
|
|
109
111
|
// of other contracts, which would constitute a security breach.
|
|
110
112
|
const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
|
|
111
113
|
const siloedNullifier = await siloNullifier(contractAddress, nullifier);
|
|
112
|
-
const txEffect = await
|
|
114
|
+
const [txEffect, [nullifierIndex]] = await Promise.all([
|
|
115
|
+
this.aztecNode.getTxEffect(txHash),
|
|
116
|
+
this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [
|
|
117
|
+
siloedNullifier
|
|
118
|
+
])
|
|
119
|
+
]);
|
|
113
120
|
if (!txEffect) {
|
|
114
121
|
throw new Error(`Could not find tx effect for tx hash ${txHash}`);
|
|
115
122
|
}
|
|
116
|
-
if (txEffect.l2BlockNumber >
|
|
117
|
-
throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${
|
|
123
|
+
if (txEffect.l2BlockNumber > anchorBlockNumber) {
|
|
124
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${anchorBlockNumber}`);
|
|
118
125
|
}
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
// Find the index of the note hash in the noteHashes array to determine note ordering within the tx
|
|
127
|
+
const noteIndexInTx = txEffect.data.noteHashes.findIndex((nh)=>nh.equals(uniqueNoteHash));
|
|
128
|
+
if (noteIndexInTx === -1) {
|
|
121
129
|
throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
|
|
122
130
|
}
|
|
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);
|
|
131
|
+
const noteDao = new NoteDao(new Note(content), contractAddress, owner, storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, txEffect.l2BlockNumber, txEffect.l2BlockHash.toString(), txEffect.txIndexInBlock, noteIndexInTx);
|
|
138
132
|
// The note was found by `recipient`, so we use that as the scope when storing the note.
|
|
139
133
|
await this.noteStore.addNotes([
|
|
140
134
|
noteDao
|
|
141
|
-
], recipient);
|
|
135
|
+
], recipient, this.jobId);
|
|
142
136
|
if (nullifierIndex !== undefined) {
|
|
137
|
+
// We found nullifier index which implies that the note has already been nullified.
|
|
143
138
|
const { data: _, ...blockHashAndNum } = nullifierIndex;
|
|
144
139
|
await this.noteStore.applyNullifiers([
|
|
145
140
|
{
|
|
146
141
|
data: siloedNullifier,
|
|
147
142
|
...blockHashAndNum
|
|
148
143
|
}
|
|
149
|
-
]);
|
|
144
|
+
], this.jobId);
|
|
150
145
|
}
|
|
151
146
|
}
|
|
152
147
|
}
|
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 = 11;
|
|
2
|
+
export declare const ORACLE_INTERFACE_HASH = "20c4d02d8cd5e448c11001a5f72ea2e0927630aeda75e537550872a9627bf40b";
|
|
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 = 11;
|
|
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 = '20c4d02d8cd5e448c11001a5f72ea2e0927630aeda75e537550872a9627bf40b';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './private_kernel_reset_private_inputs_builder.js';
|
|
2
2
|
export * from './compute_tx_include_by_timestamp.js';
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
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 './
|
|
1
|
+
export * from './private_kernel_reset_private_inputs_builder.js';
|
|
2
2
|
export * from './compute_tx_include_by_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"}
|