@aztec/pxe 0.0.1-commit.c7c42ec → 0.0.1-commit.f295ac2
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 +6 -2
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +21 -13
- 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 +8 -9
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +33 -16
- 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/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/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 +9 -8
- 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 +4 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +5 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts +6 -6
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +20 -19
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +5 -9
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +11 -10
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +8 -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 +10 -35
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +14 -12
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +54 -52
- 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/index.d.ts +2 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -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 +11 -7
- package/dest/events/event_service.d.ts +4 -3
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +17 -19
- 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 +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 +3 -2
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +5 -3
- package/dest/notes/note_service.d.ts +3 -3
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +23 -28
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- 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 +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +4 -5
- 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 +8 -36
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +65 -87
- 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 +132 -23
- package/dest/storage/contract_store/contract_store.d.ts +2 -1
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +12 -0
- package/dest/storage/note_store/note_store.d.ts +6 -5
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +89 -94
- package/dest/storage/private_event_store/private_event_store.d.ts +33 -6
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +139 -32
- 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 +69 -12
- 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 +110 -28
- 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/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -10
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +2 -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 +7 -7
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +2 -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 +2 -2
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -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 +4 -2
- package/dest/tree_membership/tree_membership_service.d.ts +9 -11
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -1
- package/dest/tree_membership/tree_membership_service.js +25 -34
- package/package.json +18 -18
- package/src/block_synchronizer/block_synchronizer.ts +30 -12
- 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 +42 -16
- package/src/contract_function_simulator/execution_note_cache.ts +44 -25
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +4 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +8 -7
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +6 -6
- package/src/contract_function_simulator/oracle/oracle.ts +24 -22
- package/src/contract_function_simulator/oracle/private_execution.ts +10 -19
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +13 -38
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +56 -50
- 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/index.ts +1 -0
- package/src/entrypoints/server/utils.ts +11 -15
- package/src/events/event_service.ts +17 -21
- package/src/events/private_event_filter_validator.ts +3 -5
- package/src/job_coordinator/job_coordinator.ts +149 -0
- package/src/logs/log_service.ts +3 -1
- package/src/notes/note_service.ts +23 -29
- package/src/oracle_version.ts +2 -2
- 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 +3 -5
- package/src/private_kernel/private_kernel_oracle.ts +116 -36
- package/src/pxe.ts +98 -116
- package/src/storage/capsule_store/capsule_store.ts +159 -23
- package/src/storage/contract_store/contract_store.ts +20 -0
- package/src/storage/note_store/note_store.ts +98 -95
- package/src/storage/private_event_store/private_event_store.ts +199 -37
- package/src/storage/tagging_store/recipient_tagging_store.ts +89 -13
- package/src/storage/tagging_store/sender_tagging_store.ts +129 -28
- package/src/tagging/constants.ts +10 -0
- package/src/tagging/index.ts +1 -11
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +10 -6
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +8 -7
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +6 -2
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +4 -1
- package/src/tree_membership/tree_membership_service.ts +27 -42
- 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/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
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { toArray } from '@aztec/foundation/iterable';
|
|
2
2
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
3
|
-
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/
|
|
3
|
+
import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/constants.js';
|
|
4
4
|
/**
|
|
5
5
|
* Data provider of tagging data used when syncing the sender tagging indexes. The recipient counterpart of this class
|
|
6
|
-
* is called RecipientTaggingStore. We have the
|
|
6
|
+
* is called RecipientTaggingStore. We have the data stores separate for sender and recipient because
|
|
7
7
|
* the algorithms are completely disjoint and there is not data reuse between the two.
|
|
8
8
|
*/ export class SenderTaggingStore {
|
|
9
|
+
storeName = 'sender_tagging';
|
|
9
10
|
#store;
|
|
10
11
|
// Stores the pending indexes for each directional app tagging secret. Pending here means that the tx that contained
|
|
11
12
|
// the private logs with tags corresponding to these indexes has not been finalized yet.
|
|
@@ -15,15 +16,95 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
15
16
|
// the smaller ones are irrelevant due to tx atomicity.
|
|
16
17
|
//
|
|
17
18
|
// TODO(#17615): This assumes no logs are used in the non-revertible phase.
|
|
19
|
+
//
|
|
20
|
+
// directional app tagging secret => { pending index, txHash }[]
|
|
18
21
|
#pendingIndexes;
|
|
22
|
+
// jobId => directional app tagging secret => { pending index, txHash }[]
|
|
23
|
+
#pendingIndexesForJob;
|
|
19
24
|
// Stores the last (highest) finalized index for each directional app tagging secret. We care only about the last
|
|
20
25
|
// index because unlike the pending indexes, it will never happen that a finalized index would be removed and hence
|
|
21
26
|
// we don't need to store the history.
|
|
27
|
+
//
|
|
28
|
+
// directional app tagging secret => highest finalized index
|
|
22
29
|
#lastFinalizedIndexes;
|
|
30
|
+
// jobId => directional app tagging secret => highest finalized index
|
|
31
|
+
#lastFinalizedIndexesForJob;
|
|
23
32
|
constructor(store){
|
|
24
33
|
this.#store = store;
|
|
25
34
|
this.#pendingIndexes = this.#store.openMap('pending_indexes');
|
|
26
35
|
this.#lastFinalizedIndexes = this.#store.openMap('last_finalized_indexes');
|
|
36
|
+
this.#pendingIndexesForJob = new Map();
|
|
37
|
+
this.#lastFinalizedIndexesForJob = new Map();
|
|
38
|
+
}
|
|
39
|
+
#getPendingIndexesForJob(jobId) {
|
|
40
|
+
let pendingIndexesForJob = this.#pendingIndexesForJob.get(jobId);
|
|
41
|
+
if (!pendingIndexesForJob) {
|
|
42
|
+
pendingIndexesForJob = new Map();
|
|
43
|
+
this.#pendingIndexesForJob.set(jobId, pendingIndexesForJob);
|
|
44
|
+
}
|
|
45
|
+
return pendingIndexesForJob;
|
|
46
|
+
}
|
|
47
|
+
#getLastFinalizedIndexesForJob(jobId) {
|
|
48
|
+
let jobStagedLastFinalizedIndexes = this.#lastFinalizedIndexesForJob.get(jobId);
|
|
49
|
+
if (!jobStagedLastFinalizedIndexes) {
|
|
50
|
+
jobStagedLastFinalizedIndexes = new Map();
|
|
51
|
+
this.#lastFinalizedIndexesForJob.set(jobId, jobStagedLastFinalizedIndexes);
|
|
52
|
+
}
|
|
53
|
+
return jobStagedLastFinalizedIndexes;
|
|
54
|
+
}
|
|
55
|
+
async #readPendingIndexes(jobId, secret) {
|
|
56
|
+
const jobStagedPendingIndexes = this.#getPendingIndexesForJob(jobId);
|
|
57
|
+
const pendingIndexes = jobStagedPendingIndexes.get(secret);
|
|
58
|
+
// We return the staged version of this if it exists, if not, we read from the DB.
|
|
59
|
+
// If the DB also has nothing, we return an empty array [].
|
|
60
|
+
return pendingIndexes !== undefined ? pendingIndexes : await this.#pendingIndexes.getAsync(secret) ?? [];
|
|
61
|
+
}
|
|
62
|
+
#writePendingIndexes(jobId, secret, pendingIndexes) {
|
|
63
|
+
this.#getPendingIndexesForJob(jobId).set(secret, pendingIndexes);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns a job view of all the secrets that have a corresponding list of pending indexes either in persistent
|
|
67
|
+
* storage or the current job.
|
|
68
|
+
*/ async #readSecretsWithPendingIndexes(jobId) {
|
|
69
|
+
const storedSecrets = new Set(await toArray(this.#pendingIndexes.keysAsync()));
|
|
70
|
+
const stagedSecrets = this.#getPendingIndexesForJob(jobId).keys();
|
|
71
|
+
return [
|
|
72
|
+
...storedSecrets.union(new Set(stagedSecrets))
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
async #readLastFinalizedIndex(jobId, secret) {
|
|
76
|
+
return this.#getLastFinalizedIndexesForJob(jobId).get(secret) ?? await this.#lastFinalizedIndexes.getAsync(secret);
|
|
77
|
+
}
|
|
78
|
+
#writeLastFinalizedIndex(jobId, secret, lastFinalizedIndex) {
|
|
79
|
+
this.#getLastFinalizedIndexesForJob(jobId).set(secret, lastFinalizedIndex);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Writes all job-specific in-memory data to persistent storage.
|
|
83
|
+
*
|
|
84
|
+
* @remark This method must run in a DB transaction context. It's designed to be called from JobCoordinator#commitJob.
|
|
85
|
+
*/ async commit(jobId) {
|
|
86
|
+
const pendingIndexesForJob = this.#pendingIndexesForJob.get(jobId);
|
|
87
|
+
if (pendingIndexesForJob) {
|
|
88
|
+
for (const [secret, pendingIndexes] of pendingIndexesForJob.entries()){
|
|
89
|
+
if (pendingIndexes.length === 0) {
|
|
90
|
+
await this.#pendingIndexes.delete(secret);
|
|
91
|
+
} else {
|
|
92
|
+
await this.#pendingIndexes.set(secret, pendingIndexes);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const lastFinalizedIndexesForJob = this.#lastFinalizedIndexesForJob.get(jobId);
|
|
97
|
+
if (lastFinalizedIndexesForJob) {
|
|
98
|
+
for (const [secret, lastFinalizedIndex] of lastFinalizedIndexesForJob.entries()){
|
|
99
|
+
await this.#lastFinalizedIndexes.set(secret, lastFinalizedIndex);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return this.discardStaged(jobId);
|
|
103
|
+
}
|
|
104
|
+
discardStaged(jobId) {
|
|
105
|
+
this.#pendingIndexesForJob.delete(jobId);
|
|
106
|
+
this.#lastFinalizedIndexesForJob.delete(jobId);
|
|
107
|
+
return Promise.resolve();
|
|
27
108
|
}
|
|
28
109
|
/**
|
|
29
110
|
* Stores pending indexes.
|
|
@@ -33,6 +114,7 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
33
114
|
* @param preTags - The pre-tags containing the directional app tagging secrets and the indexes that are to be
|
|
34
115
|
* stored in the db.
|
|
35
116
|
* @param txHash - The tx in which the pretags were used in private logs.
|
|
117
|
+
* @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
|
|
36
118
|
* @throws If any two pre-tags contain the same directional app tagging secret. This is enforced because we care
|
|
37
119
|
* only about the highest index for a given secret that was used in the tx. Hence this check is a good way to catch
|
|
38
120
|
* bugs.
|
|
@@ -45,7 +127,7 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
45
127
|
* @throws If the newly stored pending index is lower than or equal to the last finalized index for the same secret.
|
|
46
128
|
* This is enforced because this should never happen if the syncing is done correctly as we look for logs from higher
|
|
47
129
|
* indexes than finalized ones.
|
|
48
|
-
*/ async storePendingIndexes(preTags, txHash) {
|
|
130
|
+
*/ async storePendingIndexes(preTags, txHash, jobId) {
|
|
49
131
|
// The secrets in pre-tags should be unique because we always store just the highest index per given secret-txHash
|
|
50
132
|
// pair. Below we check that this is the case.
|
|
51
133
|
const secretsSet = new Set(preTags.map((preTag)=>preTag.secret.toString()));
|
|
@@ -55,7 +137,7 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
55
137
|
for (const { secret, index } of preTags){
|
|
56
138
|
// First we check that for any secret the highest used index in tx is not further than window length from
|
|
57
139
|
// the highest finalized index.
|
|
58
|
-
const finalizedIndex = await this.getLastFinalizedIndex(secret) ?? 0;
|
|
140
|
+
const finalizedIndex = await this.getLastFinalizedIndex(secret, jobId) ?? 0;
|
|
59
141
|
if (index > finalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) {
|
|
60
142
|
throw new Error(`Highest used index ${index} is further than window length from the highest finalized index ${finalizedIndex}.
|
|
61
143
|
Tagging window length ${UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN} is configured too low. Contact the Aztec team
|
|
@@ -63,13 +145,13 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
63
145
|
}
|
|
64
146
|
// Throw if the new pending index is lower than or equal to the last finalized index
|
|
65
147
|
const secretStr = secret.toString();
|
|
66
|
-
const lastFinalizedIndex = await this.#
|
|
148
|
+
const lastFinalizedIndex = await this.#readLastFinalizedIndex(jobId, secretStr);
|
|
67
149
|
if (lastFinalizedIndex !== undefined && index <= lastFinalizedIndex) {
|
|
68
150
|
throw new Error(`Cannot store pending index ${index} for secret ${secretStr}: ` + `it is lower than or equal to the last finalized index ${lastFinalizedIndex}`);
|
|
69
151
|
}
|
|
70
152
|
// Check if this secret + txHash combination already exists
|
|
71
153
|
const txHashStr = txHash.toString();
|
|
72
|
-
const existingForSecret = await this.#
|
|
154
|
+
const existingForSecret = await this.#readPendingIndexes(jobId, secretStr);
|
|
73
155
|
const existingForSecretAndTx = existingForSecret.find((entry)=>entry.txHash === txHashStr);
|
|
74
156
|
if (existingForSecretAndTx) {
|
|
75
157
|
// If it exists with a different index, throw an error
|
|
@@ -79,7 +161,7 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
79
161
|
// If it exists with the same index, ignore the update (no-op)
|
|
80
162
|
} else {
|
|
81
163
|
// If it doesn't exist, add it
|
|
82
|
-
|
|
164
|
+
this.#writePendingIndexes(jobId, secretStr, [
|
|
83
165
|
...existingForSecret,
|
|
84
166
|
{
|
|
85
167
|
index,
|
|
@@ -97,8 +179,8 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
97
179
|
* @param endIndex - The upper bound of the index range (exclusive).
|
|
98
180
|
* @returns An array of unique transaction hashes for pending transactions that contain indexes in the range
|
|
99
181
|
* [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
|
|
100
|
-
*/ async getTxHashesOfPendingIndexes(secret, startIndex, endIndex) {
|
|
101
|
-
const existing = await this.#
|
|
182
|
+
*/ async getTxHashesOfPendingIndexes(secret, startIndex, endIndex, jobId) {
|
|
183
|
+
const existing = await this.#readPendingIndexes(jobId, secret.toString());
|
|
102
184
|
const txHashes = existing.filter((entry)=>entry.index >= startIndex && entry.index < endIndex).map((entry)=>entry.txHash);
|
|
103
185
|
return Array.from(new Set(txHashes)).map(TxHash.fromString);
|
|
104
186
|
}
|
|
@@ -106,20 +188,20 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
106
188
|
* Returns the last (highest) finalized index for a given secret.
|
|
107
189
|
* @param secret - The secret to get the last finalized index for.
|
|
108
190
|
* @returns The last (highest) finalized index for the given secret.
|
|
109
|
-
*/ getLastFinalizedIndex(secret) {
|
|
110
|
-
return this.#
|
|
191
|
+
*/ getLastFinalizedIndex(secret, jobId) {
|
|
192
|
+
return this.#readLastFinalizedIndex(jobId, secret.toString());
|
|
111
193
|
}
|
|
112
194
|
/**
|
|
113
195
|
* Returns the last used index for a given directional app tagging secret, considering both finalized and pending
|
|
114
196
|
* indexes.
|
|
115
197
|
* @param secret - The directional app tagging secret to query the last used index for.
|
|
116
198
|
* @returns The last used index.
|
|
117
|
-
*/ async getLastUsedIndex(secret) {
|
|
199
|
+
*/ async getLastUsedIndex(secret, jobId) {
|
|
118
200
|
const secretStr = secret.toString();
|
|
119
|
-
const pendingTxScopedIndexes = await this.#
|
|
201
|
+
const pendingTxScopedIndexes = await this.#readPendingIndexes(jobId, secretStr);
|
|
120
202
|
const pendingIndexes = pendingTxScopedIndexes.map((entry)=>entry.index);
|
|
121
203
|
if (pendingTxScopedIndexes.length === 0) {
|
|
122
|
-
return this.#
|
|
204
|
+
return this.#readLastFinalizedIndex(jobId, secretStr);
|
|
123
205
|
}
|
|
124
206
|
// As the last used index we return the highest one from the pending indexes. Note that this value will be always
|
|
125
207
|
// higher than the last finalized index because we prune lower pending indexes when a tx is finalized.
|
|
@@ -127,21 +209,21 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
127
209
|
}
|
|
128
210
|
/**
|
|
129
211
|
* Drops all pending indexes corresponding to the given transaction hashes.
|
|
130
|
-
*/ async dropPendingIndexes(txHashes) {
|
|
212
|
+
*/ async dropPendingIndexes(txHashes, jobId) {
|
|
131
213
|
if (txHashes.length === 0) {
|
|
132
214
|
return;
|
|
133
215
|
}
|
|
134
|
-
const
|
|
135
|
-
const allSecrets = await
|
|
216
|
+
const txHashStrings = new Set(txHashes.map((txHash)=>txHash.toString()));
|
|
217
|
+
const allSecrets = await this.#readSecretsWithPendingIndexes(jobId);
|
|
136
218
|
for (const secret of allSecrets){
|
|
137
|
-
const pendingData = await this.#
|
|
219
|
+
const pendingData = await this.#readPendingIndexes(jobId, secret);
|
|
138
220
|
if (pendingData) {
|
|
139
|
-
const filtered = pendingData.filter((item)=>!
|
|
221
|
+
const filtered = pendingData.filter((item)=>!txHashStrings.has(item.txHash));
|
|
140
222
|
if (filtered.length === 0) {
|
|
141
|
-
|
|
223
|
+
this.#writePendingIndexes(jobId, secret, []);
|
|
142
224
|
} else if (filtered.length !== pendingData.length) {
|
|
143
225
|
// Some items were filtered out, so update the pending data
|
|
144
|
-
|
|
226
|
+
this.#writePendingIndexes(jobId, secret, filtered);
|
|
145
227
|
}
|
|
146
228
|
// else: No items were filtered out (txHashes not found for this secret) --> no-op
|
|
147
229
|
}
|
|
@@ -150,15 +232,15 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
150
232
|
/**
|
|
151
233
|
* Updates pending indexes corresponding to the given transaction hashes to be finalized and prunes any lower pending
|
|
152
234
|
* indexes.
|
|
153
|
-
*/ async finalizePendingIndexes(txHashes) {
|
|
235
|
+
*/ async finalizePendingIndexes(txHashes, jobId) {
|
|
154
236
|
if (txHashes.length === 0) {
|
|
155
237
|
return;
|
|
156
238
|
}
|
|
157
239
|
for (const txHash of txHashes){
|
|
158
240
|
const txHashStr = txHash.toString();
|
|
159
|
-
const allSecrets = await
|
|
241
|
+
const allSecrets = await this.#readSecretsWithPendingIndexes(jobId);
|
|
160
242
|
for (const secret of allSecrets){
|
|
161
|
-
const pendingData = await this.#
|
|
243
|
+
const pendingData = await this.#readPendingIndexes(jobId, secret);
|
|
162
244
|
if (!pendingData) {
|
|
163
245
|
continue;
|
|
164
246
|
}
|
|
@@ -171,14 +253,14 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
171
253
|
// values are irrelevant.
|
|
172
254
|
throw new Error(`Multiple pending indexes found for tx hash ${txHashStr} and secret ${secret}`);
|
|
173
255
|
}
|
|
174
|
-
let lastFinalized = await this.#
|
|
256
|
+
let lastFinalized = await this.#readLastFinalizedIndex(jobId, secret);
|
|
175
257
|
const newFinalized = matchingIndexes[0];
|
|
176
258
|
if (newFinalized < (lastFinalized ?? 0)) {
|
|
177
259
|
// This should never happen because when last finalized index was finalized we should have pruned the lower
|
|
178
260
|
// pending indexes.
|
|
179
261
|
throw new Error(`New finalized index ${newFinalized} is smaller than the current last finalized index ${lastFinalized}`);
|
|
180
262
|
}
|
|
181
|
-
|
|
263
|
+
this.#writeLastFinalizedIndex(jobId, secret, newFinalized);
|
|
182
264
|
lastFinalized = newFinalized;
|
|
183
265
|
// When we add pending indexes, we ensure they are higher than the last finalized index. However, because we
|
|
184
266
|
// cannot control the order in which transactions are finalized, there may be pending indexes that are now
|
|
@@ -186,9 +268,9 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/index.js';
|
|
|
186
268
|
// outdated pending indexes.
|
|
187
269
|
const remainingItemsOfHigherIndex = pendingData.filter((item)=>item.index > (lastFinalized ?? 0));
|
|
188
270
|
if (remainingItemsOfHigherIndex.length === 0) {
|
|
189
|
-
|
|
271
|
+
this.#writePendingIndexes(jobId, secret, []);
|
|
190
272
|
} else {
|
|
191
|
-
|
|
273
|
+
this.#writePendingIndexes(jobId, secret, remainingItemsOfHigherIndex);
|
|
192
274
|
}
|
|
193
275
|
}
|
|
194
276
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 20;
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGFnZ2luZy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBU0EsZUFBTyxNQUFNLHNDQUFzQyxLQUFLLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tagging/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,sCAAsC,KAAK,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { loadPrivateLogsForSenderRecipientPair } from './recipient_sync/load_private_logs_for_sender_recipient_pair.js';
|
|
12
12
|
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
13
|
-
export
|
|
13
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
14
14
|
export { DirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
15
15
|
export { type PreTag } from '@aztec/stdlib/logs';
|
|
16
|
-
//# 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;;;;;;;;;GASG;AAEH,OAAO,EAAE,qCAAqC,EAAE,MAAM,iEAAiE,CAAC;AACxH,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;
|
|
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
|
@@ -9,15 +9,6 @@
|
|
|
9
9
|
* @module tagging
|
|
10
10
|
*/ export { loadPrivateLogsForSenderRecipientPair } from './recipient_sync/load_private_logs_for_sender_recipient_pair.js';
|
|
11
11
|
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
12
|
-
|
|
13
|
-
// tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
|
|
14
|
-
// This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
|
|
15
|
-
// MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
|
|
16
|
-
// and the note is nullified in the same tx.
|
|
17
|
-
//
|
|
18
|
-
// Having a large window significantly slowed down `e2e_l1_with_wall_time` test as there we perform sync for more than
|
|
19
|
-
// 1000 secrets. For this reason we set it to a relatively low value of 20. 20 should be sufficient for all the use
|
|
20
|
-
// cases.
|
|
21
|
-
export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 20;
|
|
12
|
+
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
22
13
|
// Re-export tagging-related types from stdlib
|
|
23
14
|
export { DirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
@@ -10,5 +10,5 @@ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipien
|
|
|
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, taggingStore: RecipientTaggingStore, anchorBlockNumber: BlockNumber): Promise<TxScopedL2Log[]>;
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
export declare function loadPrivateLogsForSenderRecipientPair(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockNumber: BlockNumber, jobId: string): Promise<TxScopedL2Log[]>;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVyRixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdEQUF3RCxDQUFDO0FBS3BHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUscUJBQXFCLEVBQ25DLGlCQUFpQixFQUFFLFdBQVcsRUFDOUIsS0FBSyxFQUFFLE1BQU0sR0FDWixPQUFPLENBQUMsYUFBYSxFQUFFLENBQUMsQ0E0RzFCIn0=
|
|
@@ -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;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,
|
|
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,EAC9B,KAAK,EAAE,MAAM,GACZ,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, taggingStore, anchorBlockNumber) {
|
|
10
|
+
*/ export async function loadPrivateLogsForSenderRecipientPair(secret, app, aztecNode, taggingStore, anchorBlockNumber, jobId) {
|
|
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 taggingStore.getHighestAgedIndex(secret);
|
|
65
|
-
const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret);
|
|
64
|
+
const currentHighestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
|
|
65
|
+
const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret, jobId);
|
|
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 taggingStore.updateHighestAgedIndex(secret, highestAgedIndex);
|
|
83
|
+
await taggingStore.updateHighestAgedIndex(secret, highestAgedIndex, jobId);
|
|
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 taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex);
|
|
92
|
+
await taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex, jobId);
|
|
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;
|
|
@@ -16,5 +16,5 @@ import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagg
|
|
|
16
16
|
* @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
|
|
17
17
|
* updates its status accordingly.
|
|
18
18
|
*/
|
|
19
|
-
export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: SenderTaggingStore): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: SenderTaggingStore, jobId: string): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19zZW5kZXJfdGFnZ2luZ19pbmRleGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9zZW5kZXJfc3luYy9zeW5jX3NlbmRlcl90YWdnaW5nX2luZGV4ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUV0RSxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBSzlGOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixFQUNoQyxLQUFLLEVBQUUsTUFBTSxHQUNaLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FtRWYifQ==
|
|
@@ -1 +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,
|
|
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,EAChC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
|
@@ -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 { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
|
|
3
3
|
import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
|
|
4
4
|
/**
|
|
@@ -14,7 +14,7 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
|
|
|
14
14
|
* is simply the highest pending index plus one (or finalized if pending is undefined).
|
|
15
15
|
* @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
|
|
16
16
|
* updates its status accordingly.
|
|
17
|
-
*/ export async function syncSenderTaggingIndexes(secret, app, aztecNode, taggingStore) {
|
|
17
|
+
*/ export async function syncSenderTaggingIndexes(secret, app, aztecNode, taggingStore, jobId) {
|
|
18
18
|
// # Explanation of how syncing works
|
|
19
19
|
//
|
|
20
20
|
// When choosing an index, we select: highest pending index + 1 (or highest finalized index + 1 if no pending).
|
|
@@ -32,7 +32,7 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
|
|
|
32
32
|
// # Note on performance
|
|
33
33
|
// Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
|
|
34
34
|
// 100 takes at least 10 round trips (5 windows × 2 queries).
|
|
35
|
-
const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret);
|
|
35
|
+
const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
|
|
36
36
|
let start = finalizedIndex === undefined ? 0 : finalizedIndex + 1;
|
|
37
37
|
let end = start + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN;
|
|
38
38
|
let previousFinalizedIndex = finalizedIndex;
|
|
@@ -40,17 +40,17 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
|
|
|
40
40
|
while(true){
|
|
41
41
|
// Load and store indexes for the current window. These indexes may already exist in the database if txs using
|
|
42
42
|
// them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
|
|
43
|
-
await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore);
|
|
43
|
+
await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, jobId);
|
|
44
44
|
// Retrieve all indexes within the current window from storage and update their status accordingly.
|
|
45
|
-
const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end);
|
|
45
|
+
const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
|
|
46
46
|
if (pendingTxHashes.length === 0) {
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
const { txHashesToFinalize, txHashesToDrop } = await getStatusChangeOfPending(pendingTxHashes, aztecNode);
|
|
50
|
-
await taggingStore.dropPendingIndexes(txHashesToDrop);
|
|
51
|
-
await taggingStore.finalizePendingIndexes(txHashesToFinalize);
|
|
50
|
+
await taggingStore.dropPendingIndexes(txHashesToDrop, jobId);
|
|
51
|
+
await taggingStore.finalizePendingIndexes(txHashesToFinalize, jobId);
|
|
52
52
|
// We check if the finalized index has been updated.
|
|
53
|
-
newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret);
|
|
53
|
+
newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
|
|
54
54
|
if (previousFinalizedIndex !== newFinalizedIndex) {
|
|
55
55
|
// A new finalized index was found, so we'll run the loop again. For example:
|
|
56
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==
|
|
@@ -1 +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,
|
|
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);
|
|
@@ -13,6 +13,8 @@ import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_t
|
|
|
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
15
|
* @param taggingStore - The data provider to store pending indexes.
|
|
16
|
+
* @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
|
|
17
|
+
* preserving way.
|
|
16
18
|
*/
|
|
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,
|
|
19
|
+
export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore, jobId: string): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBVSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFFakc7Ozs7Ozs7Ozs7Ozs7R0FhRztBQUNILHdCQUFzQiw2QkFBNkIsQ0FDakQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixLQUFLLEVBQUUsTUFBTSxFQUNiLEdBQUcsRUFBRSxNQUFNLEVBQ1gsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixFQUNoQyxLQUFLLEVBQUUsTUFBTSxpQkFrQmQifQ==
|
|
@@ -1 +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
|
|
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;;;;;;;;;;;;;GAaG;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,EAChC,KAAK,EAAE,MAAM,iBAkBd"}
|
|
@@ -11,7 +11,9 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
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
13
|
* @param taggingStore - The data provider to store pending indexes.
|
|
14
|
-
|
|
14
|
+
* @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
|
|
15
|
+
* preserving way.
|
|
16
|
+
*/ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, jobId) {
|
|
15
17
|
// We compute the tags for the current window of indexes
|
|
16
18
|
const preTagsForWindow = Array(end - start).fill(0).map((_, i)=>({
|
|
17
19
|
secret,
|
|
@@ -28,7 +30,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
28
30
|
secret,
|
|
29
31
|
index: highestIndex
|
|
30
32
|
}
|
|
31
|
-
], txHash);
|
|
33
|
+
], txHash, jobId);
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
// Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
|
|
@@ -2,15 +2,13 @@ import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
|
2
2
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import
|
|
5
|
+
import { L2BlockHash } 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 { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
9
8
|
export declare class TreeMembershipService {
|
|
10
9
|
#private;
|
|
11
10
|
private readonly aztecNode;
|
|
12
|
-
|
|
13
|
-
constructor(aztecNode: AztecNode, anchorBlockStore: AnchorBlockStore);
|
|
11
|
+
constructor(aztecNode: AztecNode);
|
|
14
12
|
/**
|
|
15
13
|
* Gets the index of a nullifier in the nullifier tree.
|
|
16
14
|
* @returns - The index of the nullifier. Undefined if it does not exist in the tree.
|
|
@@ -18,28 +16,28 @@ export declare class TreeMembershipService {
|
|
|
18
16
|
getNullifierIndex(nullifier: Fr): Promise<bigint | undefined>;
|
|
19
17
|
/**
|
|
20
18
|
* Fetches the index and sibling path of a leaf at a given block from a given tree.
|
|
21
|
-
* @param
|
|
19
|
+
* @param blockHash - The block hash at which to get the membership witness.
|
|
22
20
|
* @param treeId - Id of the tree to get the sibling path from.
|
|
23
21
|
* @param leafValue - The leaf value
|
|
24
22
|
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
25
23
|
*/
|
|
26
|
-
getMembershipWitness(
|
|
24
|
+
getMembershipWitness(blockHash: L2BlockHash, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
|
|
27
25
|
/**
|
|
28
26
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
29
|
-
* @param
|
|
27
|
+
* @param blockHash - The block hash at which to get the index.
|
|
30
28
|
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
31
29
|
* @returns The low nullifier membership witness (if found).
|
|
32
30
|
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
33
31
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
34
32
|
* we are trying to prove non-inclusion for.
|
|
35
33
|
*/
|
|
36
|
-
getLowNullifierMembershipWitness(
|
|
34
|
+
getLowNullifierMembershipWitness(blockHash: L2BlockHash, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
37
35
|
/**
|
|
38
36
|
* Returns a witness for a given slot of the public data tree at a given block.
|
|
39
|
-
* @param
|
|
37
|
+
* @param blockHash - The block hash at which to get the witness.
|
|
40
38
|
* @param leafSlot - The slot of the public data in the public data tree.
|
|
41
39
|
*/
|
|
42
|
-
getPublicDataWitness(
|
|
40
|
+
getPublicDataWitness(blockHash: L2BlockHash, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
43
41
|
/**
|
|
44
42
|
* Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
|
|
45
43
|
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
@@ -49,4 +47,4 @@ export declare class TreeMembershipService {
|
|
|
49
47
|
*/
|
|
50
48
|
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
|
|
51
49
|
}
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
50
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDbEQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakUsT0FBTyxFQUFFLFlBQVksRUFBRSwwQkFBMEIsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBTWxHLHFCQUFhLHFCQUFxQjs7SUFDcEIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBQXRDLFlBQTZCLFNBQVMsRUFBRSxTQUFTLEVBQUk7SUFFckQ7OztPQUdHO0lBQ1UsaUJBQWlCLENBQUMsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQyxDQUd6RTtJQUVEOzs7Ozs7T0FNRztJQUNVLG9CQUFvQixDQUFDLFNBQVMsRUFBRSxXQUFXLEVBQUUsTUFBTSxFQUFFLFlBQVksRUFBRSxTQUFTLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQVE1RztJQUVEOzs7Ozs7OztPQVFHO0lBQ0ksZ0NBQWdDLENBQ3JDLFNBQVMsRUFBRSxXQUFXLEVBQ3RCLFNBQVMsRUFBRSxFQUFFLEdBQ1osT0FBTyxDQUFDLDBCQUEwQixHQUFHLFNBQVMsQ0FBQyxDQUVqRDtJQUVEOzs7O09BSUc7SUFDSSxvQkFBb0IsQ0FBQyxTQUFTLEVBQUUsV0FBVyxFQUFFLFFBQVEsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixHQUFHLFNBQVMsQ0FBQyxDQUV4RztJQUVEOzs7Ozs7T0FNRztJQUNJLDBCQUEwQixDQUMvQixlQUFlLEVBQUUsWUFBWSxFQUM3QixXQUFXLEVBQUUsRUFBRSxFQUNmLE1BQU0sRUFBRSxFQUFFLEdBQ1QsT0FBTyxDQUFDLENBQUMsTUFBTSxFQUFFLFdBQVcsQ0FBQyxPQUFPLHdCQUF3QixDQUFDLENBQUMsQ0FBQyxDQUVqRTtDQWdCRiJ9
|