@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.1142ef1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/block_synchronizer/block_synchronizer.d.ts +8 -8
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +15 -20
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +25 -22
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +34 -28
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -2
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +4 -4
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +4 -5
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +17 -26
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +14 -39
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +20 -19
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +47 -45
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +5 -5
- package/dest/debug/pxe_debug_utils.d.ts +6 -6
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +7 -7
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +10 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +10 -1
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +11 -7
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- package/dest/events/event_service.d.ts +7 -7
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +8 -8
- package/dest/events/private_event_filter_validator.d.ts +6 -6
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +4 -4
- package/dest/job_coordinator/job_coordinator.d.ts +74 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +93 -0
- package/dest/logs/log_service.d.ts +14 -31
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +61 -180
- package/dest/notes/note_service.d.ts +7 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -14
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +2 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +3 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +5 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +9 -10
- package/dest/public_storage/public_storage_service.d.ts +4 -4
- package/dest/public_storage/public_storage_service.d.ts.map +1 -1
- package/dest/public_storage/public_storage_service.js +4 -4
- package/dest/pxe.d.ts +11 -9
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +113 -87
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +1 -1
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.d.ts → capsule_store/capsule_store.d.ts} +2 -2
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +1 -1
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +4 -3
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +14 -2
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/{note_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +7 -7
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +6 -6
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/{private_event_data_provider/private_event_data_provider.js → private_event_store/private_event_store.js} +59 -16
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/{tagging/recipient_sync/new_recipient_tagging_data_provider.js → storage/tagging_store/recipient_tagging_store.js} +3 -3
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +3 -3
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.js → tagging_store/sender_tagging_store.js} +3 -3
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -3
- package/dest/tagging/index.d.ts +14 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +13 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.d.ts +3 -4
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +8 -23
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +2 -2
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +3 -3
- package/dest/tree_membership/tree_membership_service.d.ts +4 -4
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -1
- package/dest/tree_membership/tree_membership_service.js +5 -5
- package/package.json +16 -16
- package/src/block_synchronizer/block_synchronizer.ts +14 -19
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +57 -48
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +4 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -6
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +52 -80
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +53 -49
- package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -7
- package/src/debug/pxe_debug_utils.ts +6 -6
- package/src/entrypoints/client/bundle/utils.ts +7 -1
- package/src/entrypoints/client/lazy/utils.ts +7 -2
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/utils.ts +11 -15
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +8 -6
- package/src/events/private_event_filter_validator.ts +5 -5
- package/src/job_coordinator/job_coordinator.ts +149 -0
- package/src/logs/log_service.ts +92 -254
- package/src/notes/note_service.ts +13 -13
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +1 -2
- package/src/private_kernel/private_kernel_execution_prover.ts +2 -4
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +8 -14
- package/src/public_storage/public_storage_service.ts +3 -3
- package/src/pxe.ts +154 -106
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +1 -1
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +1 -1
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +22 -2
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/index.ts +7 -7
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +7 -7
- package/src/storage/{private_event_data_provider/private_event_data_provider.ts → private_event_store/private_event_store.ts} +72 -18
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/{tagging/recipient_sync/new_recipient_tagging_data_provider.ts → storage/tagging_store/recipient_tagging_store.ts} +3 -3
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/{tagging_data_provider/sender_tagging_data_provider.ts → tagging_store/sender_tagging_store.ts} +3 -3
- package/src/tagging/constants.ts +10 -3
- package/src/tagging/index.ts +16 -2
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +11 -8
- package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +9 -25
- package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +6 -2
- package/src/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.ts +4 -4
- package/src/tree_membership/tree_membership_service.ts +4 -4
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
- package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -3
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -2
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
- package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -25
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/anchor_block_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
- package/src/tagging/utils.ts +0 -32
- /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
- /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
|
|
1
|
+
// This window has to be as large as the largest expected number of logs emitted in a tx for a given directional app
|
|
2
|
+
// tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
|
|
3
|
+
// This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
|
|
4
|
+
// MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
|
|
5
|
+
// and the note is nullified in the same tx.
|
|
6
|
+
//
|
|
7
|
+
// Having a large window significantly slowed down `e2e_l1_with_wall_time` test as there we perform sync for more than
|
|
8
|
+
// 1000 secrets. For this reason we set it to a relatively low value of 20. 20 should be sufficient for all the use
|
|
9
|
+
// cases.
|
|
10
|
+
export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 20;
|
package/dest/tagging/index.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This directory contains the sender and recipient synchronization algorithms that use tagging.
|
|
3
|
+
*
|
|
4
|
+
* The objective of the sender sync algorithm is to determine which tags have already been used by a sender, thereby
|
|
5
|
+
* deciding which tag should be used next.
|
|
6
|
+
*
|
|
7
|
+
* The objective of the recipient sync algorithm is to load and process the corresponding logs.
|
|
8
|
+
*
|
|
9
|
+
* @module tagging
|
|
10
|
+
*/
|
|
11
|
+
export { loadPrivateLogsForSenderRecipientPair } from './recipient_sync/load_private_logs_for_sender_recipient_pair.js';
|
|
12
|
+
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
13
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
3
14
|
export { DirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
4
15
|
export { type PreTag } from '@aztec/stdlib/logs';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7R0FTRztBQUVILE9BQU8sRUFBRSxxQ0FBcUMsRUFBRSxNQUFNLGlFQUFpRSxDQUFDO0FBQ3hILE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxzQ0FBc0MsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBR3hFLE9BQU8sRUFBRSwyQkFBMkIsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDakYsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qCAAqC,EAAE,MAAM,iEAAiE,CAAC;AACxH,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,2BAA2B,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dest/tagging/index.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This directory contains the sender and recipient synchronization algorithms that use tagging.
|
|
3
|
+
*
|
|
4
|
+
* The objective of the sender sync algorithm is to determine which tags have already been used by a sender, thereby
|
|
5
|
+
* deciding which tag should be used next.
|
|
6
|
+
*
|
|
7
|
+
* The objective of the recipient sync algorithm is to load and process the corresponding logs.
|
|
8
|
+
*
|
|
9
|
+
* @module tagging
|
|
10
|
+
*/ export { loadPrivateLogsForSenderRecipientPair } from './recipient_sync/load_private_logs_for_sender_recipient_pair.js';
|
|
11
|
+
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
12
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
13
|
+
// Re-export tagging-related types from stdlib
|
|
3
14
|
export { DirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
@@ -2,7 +2,7 @@ import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
5
|
-
import type {
|
|
5
|
+
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
6
6
|
/**
|
|
7
7
|
* Loads private logs for `app` and sender-recipient pair defined by `secret` and updates the highest aged and
|
|
8
8
|
* finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
|
|
@@ -10,5 +10,5 @@ import type { NewRecipientTaggingDataProvider } from './new_recipient_tagging_da
|
|
|
10
10
|
* @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
|
|
11
11
|
* in the tagging data provider is indexed by the secret and hence completely disjoint.
|
|
12
12
|
*/
|
|
13
|
-
export declare function loadPrivateLogsForSenderRecipientPair(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode,
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
export declare function loadPrivateLogsForSenderRecipientPair(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockNumber: BlockNumber): Promise<TxScopedL2Log[]>;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVyRixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdEQUF3RCxDQUFDO0FBS3BHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUscUJBQXFCLEVBQ25DLGlCQUFpQixFQUFFLFdBQVcsR0FDN0IsT0FBTyxDQUFDLGFBQWEsRUFBRSxDQUFDLENBNEcxQiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_private_logs_for_sender_recipient_pair.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"load_private_logs_for_sender_recipient_pair.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAErF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;GAMG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,GAC7B,OAAO,CAAC,aAAa,EAAE,CAAC,CA4G1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../
|
|
1
|
+
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
|
|
2
2
|
import { findHighestIndexes } from './utils/find_highest_indexes.js';
|
|
3
3
|
import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
7
7
|
*
|
|
8
8
|
* @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
|
|
9
9
|
* in the tagging data provider is indexed by the secret and hence completely disjoint.
|
|
10
|
-
*/ export async function loadPrivateLogsForSenderRecipientPair(secret, app, aztecNode,
|
|
10
|
+
*/ export async function loadPrivateLogsForSenderRecipientPair(secret, app, aztecNode, taggingStore, anchorBlockNumber) {
|
|
11
11
|
// # Explanation of how the algorithm works
|
|
12
12
|
// When we perform the sync we will look at logs that correspond to the tagging index range
|
|
13
13
|
// (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
|
|
@@ -55,14 +55,14 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
55
55
|
throw new Error('Node failed to return latest block header when syncing logs');
|
|
56
56
|
}
|
|
57
57
|
[finalizedBlockNumber, currentTimestamp] = [
|
|
58
|
-
l2Tips.finalized.number,
|
|
58
|
+
l2Tips.finalized.block.number,
|
|
59
59
|
latestBlockHeader.globalVariables.timestamp
|
|
60
60
|
];
|
|
61
61
|
}
|
|
62
62
|
let start, end;
|
|
63
63
|
{
|
|
64
|
-
const currentHighestAgedIndex = await
|
|
65
|
-
const currentHighestFinalizedIndex = await
|
|
64
|
+
const currentHighestAgedIndex = await taggingStore.getHighestAgedIndex(secret);
|
|
65
|
+
const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret);
|
|
66
66
|
// We don't want to include the highest aged index so we start from `currentHighestAgedIndex + 1` (or 0 if not set)
|
|
67
67
|
start = currentHighestAgedIndex === undefined ? 0 : currentHighestAgedIndex + 1;
|
|
68
68
|
// The highest index a sender can choose is "highest finalized index + window length" but given that
|
|
@@ -80,7 +80,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
80
80
|
const { highestAgedIndex, highestFinalizedIndex } = findHighestIndexes(privateLogsWithIndexes, currentTimestamp, finalizedBlockNumber);
|
|
81
81
|
// Store updates in data provider and update local variables
|
|
82
82
|
if (highestAgedIndex !== undefined) {
|
|
83
|
-
await
|
|
83
|
+
await taggingStore.updateHighestAgedIndex(secret, highestAgedIndex);
|
|
84
84
|
}
|
|
85
85
|
if (highestFinalizedIndex === undefined) {
|
|
86
86
|
break;
|
|
@@ -89,7 +89,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
89
89
|
// This is just a sanity check as this should never happen.
|
|
90
90
|
throw new Error('Highest aged index lower than highest finalized index invariant violated');
|
|
91
91
|
}
|
|
92
|
-
await
|
|
92
|
+
await taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex);
|
|
93
93
|
// For the next iteration we want to look only at indexes for which we have not attempted to load logs yet while
|
|
94
94
|
// ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
|
|
95
95
|
start = end;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
2
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
3
3
|
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
4
|
-
import type {
|
|
5
|
-
export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
|
|
4
|
+
import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
|
|
6
5
|
/**
|
|
7
6
|
* Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
|
|
8
7
|
*
|
|
@@ -17,5 +16,5 @@ export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
|
|
|
17
16
|
* @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
|
|
18
17
|
* updates its status accordingly.
|
|
19
18
|
*/
|
|
20
|
-
export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode,
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: SenderTaggingStore): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19zZW5kZXJfdGFnZ2luZ19pbmRleGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9zZW5kZXJfc3luYy9zeW5jX3NlbmRlcl90YWdnaW5nX2luZGV4ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUV0RSxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBSzlGOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixHQUMvQixPQUFPLENBQUMsSUFBSSxDQUFDLENBbUVmIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync_sender_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../src/tagging/sender_sync/sync_sender_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AAK9F;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
+
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
|
|
1
2
|
import { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
|
|
2
3
|
import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
|
|
3
|
-
// This window has to be as large as the largest expected number of logs emitted in a tx for a given directional app
|
|
4
|
-
// tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
|
|
5
|
-
// This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
|
|
6
|
-
// MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
|
|
7
|
-
// and the note is nullified in the same tx.
|
|
8
|
-
//
|
|
9
|
-
// Rationale for value 95:
|
|
10
|
-
// - The `e2e_pending_note_hashes_contract` test's "Should handle overflowing the kernel data structures in nested
|
|
11
|
-
// calls" test case hits 95 tagging indexes emitted in a single transaction. This test creates and nullifies many
|
|
12
|
-
// notes recursively to test kernel reset circuit behavior, which causes logs to be squashed but still consume
|
|
13
|
-
// tagging indexes during the sync process. Since this is testing MAX_PRIVATE_LOGS_PER_TX overflow we can be
|
|
14
|
-
// reasonably certain that this value is large enough for standard use cases.
|
|
15
|
-
// - This value is below MAX_RPC_LEN (100) which is the limit for array parameters in the JSON RPC schema for
|
|
16
|
-
// `getLogsByTags`. Any test that would perform sync over JSON RPC (not by having access to the Aztec node instance
|
|
17
|
-
// directly) would error out if that maximum was hit (docs_examples.test.ts is an example of this).
|
|
18
|
-
export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
|
|
19
4
|
/**
|
|
20
5
|
* Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
|
|
21
6
|
*
|
|
@@ -29,7 +14,7 @@ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
|
|
|
29
14
|
* is simply the highest pending index plus one (or finalized if pending is undefined).
|
|
30
15
|
* @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
|
|
31
16
|
* updates its status accordingly.
|
|
32
|
-
*/ export async function syncSenderTaggingIndexes(secret, app, aztecNode,
|
|
17
|
+
*/ export async function syncSenderTaggingIndexes(secret, app, aztecNode, taggingStore) {
|
|
33
18
|
// # Explanation of how syncing works
|
|
34
19
|
//
|
|
35
20
|
// When choosing an index, we select: highest pending index + 1 (or highest finalized index + 1 if no pending).
|
|
@@ -47,7 +32,7 @@ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
|
|
|
47
32
|
// # Note on performance
|
|
48
33
|
// Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
|
|
49
34
|
// 100 takes at least 10 round trips (5 windows × 2 queries).
|
|
50
|
-
const finalizedIndex = await
|
|
35
|
+
const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret);
|
|
51
36
|
let start = finalizedIndex === undefined ? 0 : finalizedIndex + 1;
|
|
52
37
|
let end = start + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN;
|
|
53
38
|
let previousFinalizedIndex = finalizedIndex;
|
|
@@ -55,17 +40,17 @@ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
|
|
|
55
40
|
while(true){
|
|
56
41
|
// Load and store indexes for the current window. These indexes may already exist in the database if txs using
|
|
57
42
|
// them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
|
|
58
|
-
await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode,
|
|
43
|
+
await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore);
|
|
59
44
|
// Retrieve all indexes within the current window from storage and update their status accordingly.
|
|
60
|
-
const pendingTxHashes = await
|
|
45
|
+
const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end);
|
|
61
46
|
if (pendingTxHashes.length === 0) {
|
|
62
47
|
break;
|
|
63
48
|
}
|
|
64
49
|
const { txHashesToFinalize, txHashesToDrop } = await getStatusChangeOfPending(pendingTxHashes, aztecNode);
|
|
65
|
-
await
|
|
66
|
-
await
|
|
50
|
+
await taggingStore.dropPendingIndexes(txHashesToDrop);
|
|
51
|
+
await taggingStore.finalizePendingIndexes(txHashesToFinalize);
|
|
67
52
|
// We check if the finalized index has been updated.
|
|
68
|
-
newFinalizedIndex = await
|
|
53
|
+
newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret);
|
|
69
54
|
if (previousFinalizedIndex !== newFinalizedIndex) {
|
|
70
55
|
// A new finalized index was found, so we'll run the loop again. For example:
|
|
71
56
|
// - Previous finalized index: 10
|
|
@@ -8,4 +8,4 @@ export declare function getStatusChangeOfPending(pending: TxHash[], aztecNode: A
|
|
|
8
8
|
txHashesToFinalize: TxHash[];
|
|
9
9
|
txHashesToDrop: TxHash[];
|
|
10
10
|
}>;
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsTUFBTSxFQUFZLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQ7OztHQUdHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEdBQ25CLE9BQU8sQ0FBQztJQUFFLGtCQUFrQixFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sRUFBRSxDQUFBO0NBQUUsQ0FBQyxDQXFDckUifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAqCrE"}
|
|
@@ -4,7 +4,7 @@ import { TxStatus } from '@aztec/stdlib/tx';
|
|
|
4
4
|
* dropped.
|
|
5
5
|
*/ export async function getStatusChangeOfPending(pending, aztecNode) {
|
|
6
6
|
// Get receipts for all pending tx hashes and the finalized block number.
|
|
7
|
-
const [receipts,
|
|
7
|
+
const [receipts, tips] = await Promise.all([
|
|
8
8
|
Promise.all(pending.map((pendingTxHash)=>aztecNode.getTxReceipt(pendingTxHash))),
|
|
9
9
|
aztecNode.getL2Tips()
|
|
10
10
|
]);
|
|
@@ -13,7 +13,7 @@ import { TxStatus } from '@aztec/stdlib/tx';
|
|
|
13
13
|
for(let i = 0; i < receipts.length; i++){
|
|
14
14
|
const receipt = receipts[i];
|
|
15
15
|
const txHash = pending[i];
|
|
16
|
-
if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= finalized.number) {
|
|
16
|
+
if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= tips.finalized.block.number) {
|
|
17
17
|
// Tx has been included in a block and the corresponding block is finalized --> we mark the indexes as
|
|
18
18
|
// finalized.
|
|
19
19
|
txHashesToFinalize.push(txHash);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
2
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
3
3
|
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
|
|
5
5
|
/**
|
|
6
6
|
* Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
|
|
7
7
|
* @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
|
|
@@ -12,7 +12,7 @@ import type { SenderTaggingDataProvider } from '../../../storage/tagging_data_pr
|
|
|
12
12
|
* @param start - The starting index (inclusive) of the window to process.
|
|
13
13
|
* @param end - The ending index (exclusive) of the window to process.
|
|
14
14
|
* @param aztecNode - The Aztec node instance to query for logs.
|
|
15
|
-
* @param
|
|
15
|
+
* @param taggingStore - The data provider to store pending indexes.
|
|
16
16
|
*/
|
|
17
|
-
export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode,
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBVSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFFakc7Ozs7Ozs7Ozs7O0dBV0c7QUFDSCx3QkFBc0IsNkJBQTZCLENBQ2pELE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsS0FBSyxFQUFFLE1BQU0sRUFDYixHQUFHLEVBQUUsTUFBTSxFQUNYLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxrQkFBa0IsaUJBa0JqQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAEjG;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,iBAkBjC"}
|
|
@@ -10,8 +10,8 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
10
10
|
* @param start - The starting index (inclusive) of the window to process.
|
|
11
11
|
* @param end - The ending index (exclusive) of the window to process.
|
|
12
12
|
* @param aztecNode - The Aztec node instance to query for logs.
|
|
13
|
-
* @param
|
|
14
|
-
*/ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode,
|
|
13
|
+
* @param taggingStore - The data provider to store pending indexes.
|
|
14
|
+
*/ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore) {
|
|
15
15
|
// We compute the tags for the current window of indexes
|
|
16
16
|
const preTagsForWindow = Array(end - start).fill(0).map((_, i)=>({
|
|
17
17
|
secret,
|
|
@@ -23,7 +23,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
23
23
|
// Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
|
|
24
24
|
for (const [txHashStr, highestIndex] of highestIndexMap.entries()){
|
|
25
25
|
const txHash = TxHash.fromString(txHashStr);
|
|
26
|
-
await
|
|
26
|
+
await taggingStore.storePendingIndexes([
|
|
27
27
|
{
|
|
28
28
|
secret,
|
|
29
29
|
index: highestIndex
|
|
@@ -5,12 +5,12 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
5
5
|
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
6
6
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
7
7
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
8
|
-
import type {
|
|
8
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
9
9
|
export declare class TreeMembershipService {
|
|
10
10
|
#private;
|
|
11
11
|
private readonly aztecNode;
|
|
12
|
-
private readonly
|
|
13
|
-
constructor(aztecNode: AztecNode,
|
|
12
|
+
private readonly anchorBlockStore;
|
|
13
|
+
constructor(aztecNode: AztecNode, anchorBlockStore: AnchorBlockStore);
|
|
14
14
|
/**
|
|
15
15
|
* Gets the index of a nullifier in the nullifier tree.
|
|
16
16
|
* @returns - The index of the nullifier. Undefined if it does not exist in the tree.
|
|
@@ -49,4 +49,4 @@ export declare class TreeMembershipService {
|
|
|
49
49
|
*/
|
|
50
50
|
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
|
|
51
51
|
}
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
52
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEVBQUUsWUFBWSxFQUFFLDBCQUEwQixFQUFFLGlCQUFpQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFbEcsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxREFBcUQsQ0FBQztBQUU1RixxQkFBYSxxQkFBcUI7O0lBRTlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUMxQixPQUFPLENBQUMsUUFBUSxDQUFDLGdCQUFnQjtJQUZuQyxZQUNtQixTQUFTLEVBQUUsU0FBUyxFQUNwQixnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDakQ7SUFFSjs7O09BR0c7SUFDSSxpQkFBaUIsQ0FBQyxTQUFTLEVBQUUsRUFBRSwrQkFFckM7SUFFRDs7Ozs7O09BTUc7SUFDVSxvQkFBb0IsQ0FBQyxXQUFXLEVBQUUsY0FBYyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FNakg7SUFFRDs7Ozs7Ozs7T0FRRztJQUNVLGdDQUFnQyxDQUMzQyxXQUFXLEVBQUUsY0FBYyxFQUMzQixTQUFTLEVBQUUsRUFBRSxHQUNaLE9BQU8sQ0FBQywwQkFBMEIsR0FBRyxTQUFTLENBQUMsQ0FNakQ7SUFFRDs7OztPQUlHO0lBQ1Usb0JBQW9CLENBQUMsV0FBVyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsR0FBRyxTQUFTLENBQUMsQ0FNbkg7SUFFRDs7Ozs7O09BTUc7SUFDSSwwQkFBMEIsQ0FDL0IsZUFBZSxFQUFFLFlBQVksRUFDN0IsV0FBVyxFQUFFLEVBQUUsRUFDZixNQUFNLEVBQUUsRUFBRSxHQUNULE9BQU8sQ0FBQyxDQUFDLE1BQU0sRUFBRSxXQUFXLENBQUMsT0FBTyx3QkFBd0IsQ0FBQyxDQUFDLENBQUMsQ0FFakU7Q0F5QkYifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAE5F,qBAAa,qBAAqB;;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFnC,YACmB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EACjD;IAEJ;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,EAAE,+BAErC;IAED;;;;;;OAMG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAMjH;IAED;;;;;;;;OAQG;IACU,gCAAgC,CAC3C,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAMjD;IAED;;;;OAIG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAMnH;IAED;;;;;;OAMG;IACI,0BAA0B,CAC/B,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAEjE;CAyBF"}
|
|
@@ -2,10 +2,10 @@ import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
|
2
2
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
3
3
|
export class TreeMembershipService {
|
|
4
4
|
aztecNode;
|
|
5
|
-
|
|
6
|
-
constructor(aztecNode,
|
|
5
|
+
anchorBlockStore;
|
|
6
|
+
constructor(aztecNode, anchorBlockStore){
|
|
7
7
|
this.aztecNode = aztecNode;
|
|
8
|
-
this.
|
|
8
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Gets the index of a nullifier in the nullifier tree.
|
|
@@ -35,7 +35,7 @@ export class TreeMembershipService {
|
|
|
35
35
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
36
36
|
* we are trying to prove non-inclusion for.
|
|
37
37
|
*/ async getLowNullifierMembershipWitness(blockNumber, nullifier) {
|
|
38
|
-
const anchorBlockNumber = (await this.
|
|
38
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
39
39
|
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
40
40
|
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
41
41
|
}
|
|
@@ -46,7 +46,7 @@ export class TreeMembershipService {
|
|
|
46
46
|
* @param blockNumber - The block number at which to get the witness.
|
|
47
47
|
* @param leafSlot - The slot of the public data in the public data tree.
|
|
48
48
|
*/ async getPublicDataWitness(blockNumber, leafSlot) {
|
|
49
|
-
const anchorBlockNumber = (await this.
|
|
49
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
50
50
|
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
51
51
|
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
52
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.1142ef1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/entrypoints/server/index.js",
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
65
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
66
|
-
"@aztec/builder": "0.0.1-commit.
|
|
67
|
-
"@aztec/constants": "0.0.1-commit.
|
|
68
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
69
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
70
|
-
"@aztec/key-store": "0.0.1-commit.
|
|
71
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
73
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
74
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
75
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
76
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
64
|
+
"@aztec/bb-prover": "0.0.1-commit.1142ef1",
|
|
65
|
+
"@aztec/bb.js": "0.0.1-commit.1142ef1",
|
|
66
|
+
"@aztec/builder": "0.0.1-commit.1142ef1",
|
|
67
|
+
"@aztec/constants": "0.0.1-commit.1142ef1",
|
|
68
|
+
"@aztec/ethereum": "0.0.1-commit.1142ef1",
|
|
69
|
+
"@aztec/foundation": "0.0.1-commit.1142ef1",
|
|
70
|
+
"@aztec/key-store": "0.0.1-commit.1142ef1",
|
|
71
|
+
"@aztec/kv-store": "0.0.1-commit.1142ef1",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.1142ef1",
|
|
73
|
+
"@aztec/noir-types": "0.0.1-commit.1142ef1",
|
|
74
|
+
"@aztec/protocol-contracts": "0.0.1-commit.1142ef1",
|
|
75
|
+
"@aztec/simulator": "0.0.1-commit.1142ef1",
|
|
76
|
+
"@aztec/stdlib": "0.0.1-commit.1142ef1",
|
|
77
77
|
"koa": "^2.16.1",
|
|
78
78
|
"koa-router": "^13.1.1",
|
|
79
79
|
"lodash.omit": "^4.5.0",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
85
|
+
"@aztec/merkle-tree": "0.0.1-commit.1142ef1",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.1142ef1",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -5,9 +5,9 @@ import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler
|
|
|
5
5
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
6
6
|
|
|
7
7
|
import type { PXEConfig } from '../config/index.js';
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
8
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
9
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
10
|
+
import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
|
|
@@ -21,9 +21,9 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
21
21
|
|
|
22
22
|
constructor(
|
|
23
23
|
private node: AztecNode,
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
24
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
25
|
+
private noteStore: NoteStore,
|
|
26
|
+
private privateEventStore: PrivateEventStore,
|
|
27
27
|
private l2TipsStore: L2TipsKVStore,
|
|
28
28
|
config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
|
|
29
29
|
loggerOrSuffix?: string | Logger,
|
|
@@ -50,32 +50,27 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
50
50
|
|
|
51
51
|
switch (event.type) {
|
|
52
52
|
case 'blocks-added': {
|
|
53
|
-
const lastBlock = event.blocks.at(-1)
|
|
53
|
+
const lastBlock = event.blocks.at(-1)!;
|
|
54
54
|
this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
|
|
55
55
|
blockHash: lastBlock.hash(),
|
|
56
56
|
archive: lastBlock.archive.root.toString(),
|
|
57
57
|
header: lastBlock.header.toInspect(),
|
|
58
58
|
});
|
|
59
|
-
await this.
|
|
59
|
+
await this.anchorBlockStore.setHeader(lastBlock.header);
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
62
|
case 'chain-pruned': {
|
|
63
63
|
this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
|
|
64
64
|
// We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
|
|
65
|
-
const lastSynchedBlockNumber = (await this.
|
|
66
|
-
await this.
|
|
67
|
-
|
|
68
|
-
// block number in which each index is used it's all we can do.
|
|
69
|
-
// Note: This is now unnecessary for the sender tagging data provider because the new algorithm handles reorgs.
|
|
70
|
-
// TODO(#17775): Once this issue is implemented we will have the index-block number mapping, so we can
|
|
71
|
-
// implement this more intelligently.
|
|
72
|
-
await this.recipientTaggingDataProvider.resetNoteSyncData();
|
|
65
|
+
const lastSynchedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
66
|
+
await this.noteStore.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
|
|
67
|
+
await this.privateEventStore.rollbackEventsAfterBlock(event.block.number, lastSynchedBlockNumber);
|
|
73
68
|
// Update the header to the last block.
|
|
74
69
|
const newHeader = await this.node.getBlockHeader(event.block.number);
|
|
75
70
|
if (!newHeader) {
|
|
76
71
|
this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
|
|
77
72
|
} else {
|
|
78
|
-
await this.
|
|
73
|
+
await this.anchorBlockStore.setHeader(newHeader);
|
|
79
74
|
}
|
|
80
75
|
break;
|
|
81
76
|
}
|
|
@@ -112,13 +107,13 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
112
107
|
let currentHeader;
|
|
113
108
|
|
|
114
109
|
try {
|
|
115
|
-
currentHeader = await this.
|
|
110
|
+
currentHeader = await this.anchorBlockStore.getBlockHeader();
|
|
116
111
|
} catch {
|
|
117
112
|
this.log.debug('Header is not set, requesting from the node');
|
|
118
113
|
}
|
|
119
114
|
if (!currentHeader) {
|
|
120
115
|
// REFACTOR: We should know the header of the genesis block without having to request it from the node.
|
|
121
|
-
await this.
|
|
116
|
+
await this.anchorBlockStore.setHeader((await this.node.getBlockHeader(BlockNumber.ZERO))!);
|
|
122
117
|
}
|
|
123
118
|
await this.blockStream.sync();
|
|
124
119
|
}
|