@aztec/pxe 0.0.1-commit.96dac018d → 0.0.1-commit.993d52e
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/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +3 -3
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +18 -10
- package/dest/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +4 -4
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +3 -4
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +64 -125
- 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 +5 -13
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +4 -4
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
- 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 +3 -3
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
- 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 +14 -15
- package/package.json +16 -16
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +10 -3
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +23 -11
- package/src/logs/log_service.ts +10 -5
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +110 -157
- package/src/private_kernel/private_kernel_execution_prover.ts +6 -13
- package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
- package/src/storage/tagging_store/sender_tagging_store.ts +8 -8
- package/src/tagging/index.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +3 -6
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
- package/dest/private_kernel/hints/test_utils.d.ts +0 -122
- package/dest/private_kernel/hints/test_utils.d.ts.map +0 -1
- package/dest/private_kernel/hints/test_utils.js +0 -203
- package/src/private_kernel/hints/test_utils.ts +0 -325
|
@@ -4,9 +4,14 @@ import { padArrayEnd } from '@aztec/foundation/collection';
|
|
|
4
4
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
5
5
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
6
6
|
import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
|
|
7
|
-
import { KeyValidationHint, PaddedSideEffects, PrivateKernelData, PrivateKernelResetCircuitPrivateInputs, PrivateKernelResetDimensions, PrivateKernelResetHints, ReadRequestActionEnum, ReadRequestResetActions, TransientDataSquashingHint, buildNoteHashReadRequestHintsFromResetActions, buildNullifierReadRequestHintsFromResetActions, buildTransientDataHints,
|
|
7
|
+
import { KeyValidationHint, PaddedSideEffects, PrivateKernelData, PrivateKernelResetCircuitPrivateInputs, PrivateKernelResetDimensions, PrivateKernelResetHints, ReadRequestActionEnum, ReadRequestResetActions, ScopedNoteHash, ScopedNullifier, TransientDataSquashingHint, buildNoteHashReadRequestHintsFromResetActions, buildNullifierReadRequestHintsFromResetActions, buildTransientDataHints, findPrivateKernelResetDimensions, getNoteHashReadRequestResetActions, getNullifierReadRequestResetActions, privateKernelResetDimensionNames } from '@aztec/stdlib/kernel';
|
|
8
8
|
import { collectNested } from '@aztec/stdlib/tx';
|
|
9
9
|
import { VkData } from '@aztec/stdlib/vks';
|
|
10
|
+
function collectNestedReadRequests(executionStack, extractReadRequests) {
|
|
11
|
+
return collectNested(executionStack, (executionResult)=>{
|
|
12
|
+
return extractReadRequests(executionResult).getActiveItems();
|
|
13
|
+
});
|
|
14
|
+
}
|
|
10
15
|
function getNullifierMembershipWitnessResolver(oracle) {
|
|
11
16
|
return async (nullifier)=>{
|
|
12
17
|
const res = await oracle.getNullifierMembershipWitness(nullifier);
|
|
@@ -46,21 +51,18 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
46
51
|
this.executionStack = executionStack;
|
|
47
52
|
this.noteHashNullifierCounterMap = noteHashNullifierCounterMap;
|
|
48
53
|
this.splitCounter = splitCounter;
|
|
54
|
+
this.previousKernel = previousKernelOutput.publicInputs;
|
|
55
|
+
this.requestedDimensions = PrivateKernelResetDimensions.empty();
|
|
49
56
|
this.noteHashResetActions = ReadRequestResetActions.empty(MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
50
57
|
this.nullifierResetActions = ReadRequestResetActions.empty(MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
51
58
|
this.transientDataSquashingHints = makeTuple(MAX_NULLIFIERS_PER_TX, ()=>new TransientDataSquashingHint(MAX_NULLIFIERS_PER_TX, MAX_NOTE_HASHES_PER_TX));
|
|
52
|
-
this.requestedDimensions = PrivateKernelResetDimensions.empty();
|
|
53
|
-
this.previousKernel = previousKernelOutput.publicInputs;
|
|
54
59
|
this.nextIteration = executionStack[this.executionStack.length - 1]?.publicInputs;
|
|
55
60
|
}
|
|
56
|
-
getRequestedDimensions() {
|
|
57
|
-
return this.requestedDimensions;
|
|
58
|
-
}
|
|
59
61
|
needsReset() {
|
|
60
62
|
const fns = [
|
|
61
63
|
()=>this.needsResetNoteHashReadRequests(),
|
|
62
64
|
()=>this.needsResetNullifierReadRequests(),
|
|
63
|
-
()=>this.
|
|
65
|
+
()=>this.needsResetNullifierKeys(),
|
|
64
66
|
()=>this.needsResetTransientData()
|
|
65
67
|
];
|
|
66
68
|
if (this.nextIteration) {
|
|
@@ -85,7 +87,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
85
87
|
throw new Error('Reset is not required.');
|
|
86
88
|
}
|
|
87
89
|
const isInner = !!this.nextIteration;
|
|
88
|
-
// "final" reset must be done
|
|
90
|
+
// "final" reset must be done at most once.
|
|
91
|
+
// Because the code that silo note hashes can't be run repeatedly.
|
|
89
92
|
// The dimensions found must be big enough to reset all values, i.e. empty remainder.
|
|
90
93
|
const allowRemainder = isInner;
|
|
91
94
|
const dimensions = findPrivateKernelResetDimensions(this.requestedDimensions, privateKernelResetDimensionsConfig, isInner, allowRemainder);
|
|
@@ -127,110 +130,67 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
127
130
|
}
|
|
128
131
|
resetActions.pendingReadHints = resetActions.pendingReadHints.slice(0, maxPending);
|
|
129
132
|
}
|
|
130
|
-
needsResetNoteHashReadRequests(
|
|
133
|
+
needsResetNoteHashReadRequests(forceResetAll = false) {
|
|
131
134
|
const numCurr = this.previousKernel.validationRequests.noteHashReadRequests.claimedLength;
|
|
132
135
|
const numNext = this.nextIteration ? this.nextIteration.noteHashReadRequests.claimedLength : 0;
|
|
133
|
-
const maxAmountToKeep = !this.nextIteration ||
|
|
136
|
+
const maxAmountToKeep = !this.nextIteration || forceResetAll ? 0 : MAX_NOTE_HASH_READ_REQUESTS_PER_TX;
|
|
134
137
|
if (numCurr + numNext <= maxAmountToKeep) {
|
|
135
138
|
return false;
|
|
136
139
|
}
|
|
137
|
-
const
|
|
140
|
+
const futureNoteHashes = collectNested(this.executionStack, (executionResult)=>{
|
|
141
|
+
return executionResult.publicInputs.noteHashes.getActiveItems().map((noteHash)=>new ScopedNoteHash(noteHash, executionResult.publicInputs.callContext.contractAddress));
|
|
142
|
+
});
|
|
143
|
+
const resetActions = getNoteHashReadRequestResetActions(this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes, futureNoteHashes);
|
|
138
144
|
const numPendingReads = resetActions.pendingReadHints.length;
|
|
139
145
|
const numSettledReads = resetActions.actions.reduce((accum, action)=>accum + (action === ReadRequestActionEnum.READ_AS_SETTLED ? 1 : 0), 0);
|
|
140
|
-
const totalReadsToReset = numPendingReads + numSettledReads;
|
|
141
|
-
const minResetNeeded = numCurr + numNext - maxAmountToKeep;
|
|
142
|
-
if (totalReadsToReset < minResetNeeded) {
|
|
143
|
-
if (!this.nextIteration) {
|
|
144
|
-
// In the final reset, all note hashes have been emitted. So if we can't reset all requests, at least one
|
|
145
|
-
// pending read request doesn't match any of them.
|
|
146
|
-
throw new Error('No matching note hash found for note hash read request.');
|
|
147
|
-
} else if (!forceReset) {
|
|
148
|
-
// A pending read request can only be reset if its note hash has already been included (e.g. a parent call might
|
|
149
|
-
// be reading a note hash emitted by a child call. The read request of the parent call is included before the note
|
|
150
|
-
// hash of the child call).
|
|
151
|
-
// If we can't clear enough read requests to make room for the next iteration's reads, we're stuck.
|
|
152
|
-
throw new Error('Number of note hash read requests exceeds the limit.');
|
|
153
|
-
} else if (totalReadsToReset == 0) {
|
|
154
|
-
// It's transient data squashing asking for the read requests to be reset first (forceReset == true), and
|
|
155
|
-
// there's nothing to reset, returns false and let needsResetTransientData throw a more descriptive error.
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
// Otherwise, forceReset is true, we should proceed to reset as many as we can.
|
|
159
|
-
}
|
|
160
146
|
if (!this.nextIteration) {
|
|
161
|
-
// If there's no next iteration, we need to reset all the read requests.
|
|
162
147
|
this.noteHashResetActions = resetActions;
|
|
163
148
|
this.requestedDimensions.NOTE_HASH_PENDING_READ = numPendingReads;
|
|
164
149
|
this.requestedDimensions.NOTE_HASH_SETTLED_READ = numSettledReads;
|
|
165
150
|
} else {
|
|
166
|
-
//
|
|
167
|
-
// So we pick the dimension that has more read requests to reset.
|
|
151
|
+
// Pick only one dimension to reset if next iteration is not empty.
|
|
168
152
|
if (numPendingReads > numSettledReads) {
|
|
169
|
-
// Reset the pending read requests.
|
|
170
|
-
const pendingOnlyActions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP), MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
171
|
-
this.noteHashResetActions = new ReadRequestResetActions(pendingOnlyActions, resetActions.pendingReadHints);
|
|
172
153
|
this.requestedDimensions.NOTE_HASH_PENDING_READ = numPendingReads;
|
|
154
|
+
this.noteHashResetActions.actions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP), MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
155
|
+
this.noteHashResetActions.pendingReadHints = resetActions.pendingReadHints;
|
|
173
156
|
} else {
|
|
174
|
-
// Reset the settled read requests.
|
|
175
|
-
const settledOnlyActions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP), MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
176
|
-
this.noteHashResetActions = new ReadRequestResetActions(settledOnlyActions, []);
|
|
177
157
|
this.requestedDimensions.NOTE_HASH_SETTLED_READ = numSettledReads;
|
|
158
|
+
this.noteHashResetActions.actions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP), MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
178
159
|
}
|
|
179
160
|
}
|
|
180
161
|
return true;
|
|
181
162
|
}
|
|
182
|
-
needsResetNullifierReadRequests(
|
|
163
|
+
needsResetNullifierReadRequests(forceResetAll = false) {
|
|
183
164
|
const numCurr = this.previousKernel.validationRequests.nullifierReadRequests.claimedLength;
|
|
184
165
|
const numNext = this.nextIteration ? this.nextIteration.nullifierReadRequests.claimedLength : 0;
|
|
185
|
-
const maxAmountToKeep = !this.nextIteration ||
|
|
166
|
+
const maxAmountToKeep = !this.nextIteration || forceResetAll ? 0 : MAX_NULLIFIER_READ_REQUESTS_PER_TX;
|
|
186
167
|
if (numCurr + numNext <= maxAmountToKeep) {
|
|
187
168
|
return false;
|
|
188
169
|
}
|
|
189
|
-
const
|
|
170
|
+
const futureNullifiers = collectNested(this.executionStack, (executionResult)=>{
|
|
171
|
+
return executionResult.publicInputs.nullifiers.getActiveItems().map((nullifier)=>new ScopedNullifier(nullifier, executionResult.publicInputs.callContext.contractAddress));
|
|
172
|
+
});
|
|
173
|
+
const resetActions = getNullifierReadRequestResetActions(this.previousKernel.validationRequests.nullifierReadRequests, this.previousKernel.end.nullifiers, futureNullifiers);
|
|
190
174
|
const numPendingReads = resetActions.pendingReadHints.length;
|
|
191
175
|
const numSettledReads = resetActions.actions.reduce((accum, action)=>accum + (action === ReadRequestActionEnum.READ_AS_SETTLED ? 1 : 0), 0);
|
|
192
|
-
const totalReadsToReset = numPendingReads + numSettledReads;
|
|
193
|
-
const minResetNeeded = numCurr + numNext - maxAmountToKeep;
|
|
194
|
-
if (totalReadsToReset < minResetNeeded) {
|
|
195
|
-
if (!this.nextIteration) {
|
|
196
|
-
// In the final reset, all nullifiers have been emitted. So if we can't reset all requests, at least one pending
|
|
197
|
-
// read request doesn't match any of them.
|
|
198
|
-
throw new Error('No matching nullifier found for nullifier read request.');
|
|
199
|
-
} else if (!forceReset) {
|
|
200
|
-
// A pending read request can only be reset if its nullifier has already been included (e.g. a parent call might
|
|
201
|
-
// be reading a nullifier emitted by a child call. The read request of the parent call is included before the
|
|
202
|
-
// nullifier of the child call).
|
|
203
|
-
// If we can't clear enough read requests to make room for the next iteration's reads, we're stuck.
|
|
204
|
-
throw new Error('Number of nullifier read requests exceeds the limit.');
|
|
205
|
-
} else if (totalReadsToReset == 0) {
|
|
206
|
-
// It's transient data squashing asking for the read requests to be reset first (forceReset == true), and
|
|
207
|
-
// there's nothing to reset, returns false and let needsResetTransientData throw a more descriptive error.
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
// Otherwise, forceReset is true, we should proceed to reset as many as we can.
|
|
211
|
-
}
|
|
212
176
|
if (!this.nextIteration) {
|
|
213
|
-
// If there's no next iteration, we need to reset all the read requests.
|
|
214
177
|
this.nullifierResetActions = resetActions;
|
|
215
178
|
this.requestedDimensions.NULLIFIER_PENDING_READ = numPendingReads;
|
|
216
179
|
this.requestedDimensions.NULLIFIER_SETTLED_READ = numSettledReads;
|
|
217
180
|
} else {
|
|
218
|
-
//
|
|
181
|
+
// Pick only one dimension to reset if next iteration is not empty.
|
|
219
182
|
if (numPendingReads > numSettledReads) {
|
|
220
|
-
// Reset the pending read requests.
|
|
221
|
-
const pendingOnlyActions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP), MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
222
|
-
this.nullifierResetActions = new ReadRequestResetActions(pendingOnlyActions, resetActions.pendingReadHints);
|
|
223
183
|
this.requestedDimensions.NULLIFIER_PENDING_READ = numPendingReads;
|
|
184
|
+
this.nullifierResetActions.actions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP), MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
185
|
+
this.nullifierResetActions.pendingReadHints = resetActions.pendingReadHints;
|
|
224
186
|
} else {
|
|
225
|
-
// Reset the settled read requests.
|
|
226
|
-
const settledOnlyActions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP), MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
227
|
-
this.nullifierResetActions = new ReadRequestResetActions(settledOnlyActions, []);
|
|
228
187
|
this.requestedDimensions.NULLIFIER_SETTLED_READ = numSettledReads;
|
|
188
|
+
this.nullifierResetActions.actions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP), MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
229
189
|
}
|
|
230
190
|
}
|
|
231
191
|
return true;
|
|
232
192
|
}
|
|
233
|
-
|
|
193
|
+
needsResetNullifierKeys() {
|
|
234
194
|
const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators.claimedLength;
|
|
235
195
|
const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndSeparators.claimedLength : 0;
|
|
236
196
|
const maxAmountToKeep = !this.nextIteration ? 0 : MAX_KEY_VALIDATION_REQUESTS_PER_TX;
|
|
@@ -241,6 +201,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
241
201
|
return true;
|
|
242
202
|
}
|
|
243
203
|
needsResetTransientData() {
|
|
204
|
+
// Initialize this to 0 so that needsSilo can be run.
|
|
205
|
+
this.numTransientData = 0;
|
|
244
206
|
const nextAccumNoteHashes = this.previousKernel.end.noteHashes.claimedLength + (this.nextIteration?.noteHashes.claimedLength ?? 0);
|
|
245
207
|
const noteHashWillOverflow = nextAccumNoteHashes > MAX_NOTE_HASHES_PER_TX;
|
|
246
208
|
const nextAccumNullifiers = this.previousKernel.end.nullifiers.claimedLength + (this.nextIteration?.nullifiers.claimedLength ?? 0);
|
|
@@ -250,45 +212,27 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
250
212
|
if (this.nextIteration && !noteHashWillOverflow && !nullifierWillOverflow && !logsWillOverflow) {
|
|
251
213
|
return false;
|
|
252
214
|
}
|
|
253
|
-
const futureNoteHashReads =
|
|
254
|
-
const futureNullifierReads =
|
|
255
|
-
|
|
215
|
+
const futureNoteHashReads = collectNestedReadRequests(this.executionStack, (executionResult)=>executionResult.publicInputs.noteHashReadRequests);
|
|
216
|
+
const futureNullifierReads = collectNestedReadRequests(this.executionStack, (executionResult)=>executionResult.publicInputs.nullifierReadRequests);
|
|
217
|
+
// TODO(#15902): Collect future logs and only allow squashing a note hash when all its logs have been emitted
|
|
218
|
+
// (i.e. none of the future logs are linked to the to-be-squashed note hashes).
|
|
256
219
|
if (this.nextIteration) {
|
|
257
|
-
// If it's not the final reset, only one dimension will be reset at a time.
|
|
258
|
-
//
|
|
259
|
-
// included in the future read requests.
|
|
220
|
+
// If it's not the final reset, only one dimension will be reset at a time.
|
|
221
|
+
// The note hashes and nullifiers for the remaining read requests can't be squashed.
|
|
260
222
|
futureNoteHashReads.push(...this.previousKernel.validationRequests.noteHashReadRequests.getActiveItems());
|
|
261
223
|
futureNullifierReads.push(...this.previousKernel.validationRequests.nullifierReadRequests.getActiveItems());
|
|
262
224
|
}
|
|
263
|
-
const { numTransientData, hints: transientDataSquashingHints } = buildTransientDataHints(this.previousKernel.end.noteHashes, this.previousKernel.end.nullifiers, futureNoteHashReads, futureNullifierReads,
|
|
264
|
-
if (this.nextIteration) {
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
// There's not enough transient data to squash to clear space for the overflow. It may be because some data is
|
|
271
|
-
// still required for read requests. Force a reset of the read requests first, and return to transient data
|
|
272
|
-
// squashing in the next round of reset.
|
|
273
|
-
// Note that clearing the read requests might not be enough to clear more space for the overflow. In this case,
|
|
274
|
-
// running the next reset will fail at the following check.
|
|
275
|
-
// Only one dimension can be reset at a time for an inner reset, so we try the note hash read requests first
|
|
276
|
-
// (which also helps with log overflow), then fall back to nullifier read requests.
|
|
277
|
-
const forceReset = true;
|
|
278
|
-
if ((noteHashOverflowBy > 0 || logsOverflowBy > 0) && this.needsResetNoteHashReadRequests(forceReset)) {
|
|
279
|
-
return true;
|
|
280
|
-
}
|
|
281
|
-
if (nullifierOverflowBy > 0 && this.needsResetNullifierReadRequests(forceReset)) {
|
|
282
|
-
return true;
|
|
283
|
-
}
|
|
284
|
-
if (noteHashWillOverflow) {
|
|
285
|
-
throw new Error('Number of note hashes exceeds the limit.');
|
|
286
|
-
}
|
|
287
|
-
if (nullifierWillOverflow) {
|
|
288
|
-
throw new Error('Number of nullifiers exceeds the limit.');
|
|
289
|
-
}
|
|
290
|
-
throw new Error('Number of private logs exceeds the limit.');
|
|
225
|
+
const { numTransientData, hints: transientDataSquashingHints } = buildTransientDataHints(this.previousKernel.end.noteHashes, this.previousKernel.end.nullifiers, futureNoteHashReads, futureNullifierReads, this.noteHashNullifierCounterMap, this.splitCounter);
|
|
226
|
+
if (this.nextIteration && !numTransientData) {
|
|
227
|
+
const forceResetAll = true;
|
|
228
|
+
const canClearReadRequests = noteHashWillOverflow && this.needsResetNoteHashReadRequests(forceResetAll) || nullifierWillOverflow && this.needsResetNullifierReadRequests(forceResetAll) || logsWillOverflow && this.needsResetNoteHashReadRequests(forceResetAll);
|
|
229
|
+
if (!canClearReadRequests) {
|
|
230
|
+
const overflownData = noteHashWillOverflow ? 'note hashes' : nullifierWillOverflow ? 'nullifiers' : 'private logs';
|
|
231
|
+
throw new Error(`Number of ${overflownData} exceeds the limit.`);
|
|
291
232
|
}
|
|
233
|
+
// Clearing the read requests might not be enough to squash the overflown data.
|
|
234
|
+
// In this case, the next iteration will fail at the above check.
|
|
235
|
+
return true;
|
|
292
236
|
}
|
|
293
237
|
this.numTransientData = numTransientData;
|
|
294
238
|
this.transientDataSquashingHints = transientDataSquashingHints;
|
|
@@ -299,12 +243,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
299
243
|
if (this.numTransientData === undefined) {
|
|
300
244
|
throw new Error('`needsResetTransientData` must be run before `needsSiloNoteHashes`.');
|
|
301
245
|
}
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
// Already siloed.
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
const numToSilo = noteHashes.claimedLength - this.numTransientData;
|
|
246
|
+
const numNoteHashes = this.previousKernel.end.noteHashes.getActiveItems().filter((n)=>!n.contractAddress.isZero()).length;
|
|
247
|
+
const numToSilo = Math.max(0, numNoteHashes - this.numTransientData);
|
|
308
248
|
this.requestedDimensions.NOTE_HASH_SILOING = numToSilo;
|
|
309
249
|
return numToSilo > 0;
|
|
310
250
|
}
|
|
@@ -312,13 +252,13 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
312
252
|
if (this.numTransientData === undefined) {
|
|
313
253
|
throw new Error('`needsResetTransientData` must be run before `needsSiloNullifiers`.');
|
|
314
254
|
}
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
this.requestedDimensions.NULLIFIER_SILOING =
|
|
255
|
+
const numNullifiers = this.previousKernel.end.nullifiers.getActiveItems().filter((n)=>!n.contractAddress.isZero()).length;
|
|
256
|
+
const numToSilo = Math.max(0, numNullifiers - this.numTransientData);
|
|
257
|
+
// Include the first nullifier if there's something to silo.
|
|
258
|
+
// The reset circuit checks that capped_size must be greater than or equal to all non-empty nullifiers.
|
|
259
|
+
// Which includes the first nullifier, even though its contract address is always zero and doesn't need siloing.
|
|
260
|
+
const cappedSize = numToSilo ? numToSilo + 1 : 0;
|
|
261
|
+
this.requestedDimensions.NULLIFIER_SILOING = cappedSize;
|
|
322
262
|
return numToSilo > 0;
|
|
323
263
|
}
|
|
324
264
|
needsSiloPrivateLogs() {
|
|
@@ -326,12 +266,11 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
326
266
|
throw new Error('`needsResetTransientData` must be run before `needsSiloPrivateLogs`.');
|
|
327
267
|
}
|
|
328
268
|
const privateLogs = this.previousKernel.end.privateLogs;
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const
|
|
334
|
-
const numToSilo = privateLogs.claimedLength - numSquashedLogs;
|
|
269
|
+
const numLogs = privateLogs.getActiveItems().filter((l)=>!l.contractAddress.isZero()).length;
|
|
270
|
+
const noteHashes = this.previousKernel.end.noteHashes;
|
|
271
|
+
const squashedNoteHashCounters = this.transientDataSquashingHints.filter((h)=>h.noteHashIndex < noteHashes.claimedLength).map((h)=>noteHashes.array[h.noteHashIndex].counter);
|
|
272
|
+
const numSquashedLogs = privateLogs.getActiveItems().filter((l)=>squashedNoteHashCounters.includes(l.inner.noteHashCounter)).length;
|
|
273
|
+
const numToSilo = numLogs - numSquashedLogs;
|
|
335
274
|
this.requestedDimensions.PRIVATE_LOG_SILOING = numToSilo;
|
|
336
275
|
return numToSilo > 0;
|
|
337
276
|
}
|
|
@@ -42,4 +42,4 @@ export declare class PrivateKernelExecutionProver {
|
|
|
42
42
|
private getVkData;
|
|
43
43
|
private createPrivateCallData;
|
|
44
44
|
}
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfZXhlY3V0aW9uX3Byb3Zlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL3ByaXZhdGVfa2VybmVsX2V4ZWN1dGlvbl9wcm92ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFlLEtBQUssY0FBYyxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBTXZGLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDM0UsT0FBTyxFQVFMLEtBQUssaUNBQWlDLEVBS3RDLEtBQUssb0NBQW9DLEVBRTFDLE1BQU0sc0JBQXNCLENBQUM7QUFFOUIsT0FBTyxFQUVMLEtBQUssc0JBQXNCLEVBQzNCLFNBQVMsRUFHVixNQUFNLGtCQUFrQixDQUFDO0FBSTFCLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFTdEUsTUFBTSxXQUFXLGtDQUFrQztJQUNqRCxRQUFRLEVBQUUsT0FBTyxDQUFDO0lBQ2xCLGtCQUFrQixFQUFFLE9BQU8sQ0FBQztJQUM1QixXQUFXLEVBQUUsT0FBTyxHQUFHLGlCQUFpQixHQUFHLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDNUQ7QUFFRDs7Ozs7R0FLRztBQUNILHFCQUFhLDRCQUE0QjtJQUlyQyxPQUFPLENBQUMsTUFBTTtJQUNkLE9BQU8sQ0FBQyxZQUFZO0lBQ3BCLE9BQU8sQ0FBQyxVQUFVO0lBTHBCLE9BQU8sQ0FBQyxHQUFHLENBQVM7SUFFcEIsWUFDVSxNQUFNLEVBQUUsbUJBQW1CLEVBQzNCLFlBQVksRUFBRSxtQkFBbUIsRUFDakMsVUFBVSxVQUFRLEVBQzFCLFFBQVEsQ0FBQyxFQUFFLGNBQWMsRUFHMUI7SUFFRDs7Ozs7Ozs7OztPQVVHO0lBQ0csZ0JBQWdCLENBQ3BCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLGVBQWUsRUFBRSxzQkFBc0IsRUFDdkMsRUFBRSxRQUFRLEVBQUUsa0JBQWtCLEVBQUUsV0FBVyxFQUFFLEdBQUUsa0NBSTlDLEdBQ0EsT0FBTyxDQUFDLGlDQUFpQyxDQUFDLG9DQUFvQyxDQUFDLENBQUMsQ0FvUmxGO0lBRUQ7Ozs7O09BS0c7SUFDSCxPQUFPLENBQUMsdUJBQXVCO1lBb0JqQixTQUFTO1lBU1QscUJBQXFCO0NBK0JwQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAMvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAQL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAStE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED;;;;;GAKG;AACH,qBAAa,4BAA4B;IAIrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACU,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ,EAC1B,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAED;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAE,kCAI9C,GACA,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAMvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAQL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAStE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED;;;;;GAKG;AACH,qBAAa,4BAA4B;IAIrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACU,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ,EAC1B,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAED;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAE,kCAI9C,GACA,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CAoRlF;IAED;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;YAoBjB,SAAS;YAST,qBAAqB;CA+BpC"}
|
|
@@ -67,7 +67,6 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
67
67
|
if (!firstIteration) {
|
|
68
68
|
let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, executionStack, noteHashNullifierCounterMap, splitCounter);
|
|
69
69
|
while(resetBuilder.needsReset()){
|
|
70
|
-
// Inner reset: without siloing.
|
|
71
70
|
const witgenTimer = new Timer();
|
|
72
71
|
const privateInputs = await resetBuilder.build(this.oracle);
|
|
73
72
|
output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
|
|
@@ -133,19 +132,11 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
133
132
|
}
|
|
134
133
|
firstIteration = false;
|
|
135
134
|
}
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// The final reset must be performed exactly once, because each tx has at least one nullifier that requires
|
|
140
|
-
// siloing, and siloing cannot be done multiple times.
|
|
141
|
-
// While, in theory, it might be possible to silo note hashes first and then run another reset to silo nullifiers
|
|
142
|
-
// and/or private logs, we currently don't have standalone dimensions for the arrays that require siloing. As a
|
|
143
|
-
// result, all necessary siloing must be done together in a single reset.
|
|
144
|
-
// Refer to the possible combinations of dimensions in private_kernel_reset_config.json.
|
|
145
|
-
throw new Error('Nothing to reset for the final reset.');
|
|
146
|
-
} else {
|
|
135
|
+
// Reset.
|
|
136
|
+
let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
|
|
137
|
+
while(resetBuilder.needsReset()){
|
|
147
138
|
const witgenTimer = new Timer();
|
|
148
|
-
const privateInputs = await
|
|
139
|
+
const privateInputs = await resetBuilder.build(this.oracle);
|
|
149
140
|
output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
|
|
150
141
|
executionSteps.push({
|
|
151
142
|
functionName: 'private_kernel_reset',
|
|
@@ -156,6 +147,7 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
156
147
|
witgen: witgenTimer.ms()
|
|
157
148
|
}
|
|
158
149
|
});
|
|
150
|
+
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
|
|
159
151
|
}
|
|
160
152
|
if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
|
|
161
153
|
if (!skipProofGeneration) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
3
3
|
import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
|
|
4
4
|
/**
|
|
5
5
|
* Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class
|
|
@@ -20,9 +20,9 @@ export declare class RecipientTaggingStore implements StagedStore {
|
|
|
20
20
|
*/
|
|
21
21
|
commit(jobId: string): Promise<void>;
|
|
22
22
|
discardStaged(jobId: string): Promise<void>;
|
|
23
|
-
getHighestAgedIndex(secret:
|
|
24
|
-
updateHighestAgedIndex(secret:
|
|
25
|
-
getHighestFinalizedIndex(secret:
|
|
26
|
-
updateHighestFinalizedIndex(secret:
|
|
23
|
+
getHighestAgedIndex(secret: ExtendedDirectionalAppTaggingSecret, jobId: string): Promise<number | undefined>;
|
|
24
|
+
updateHighestAgedIndex(secret: ExtendedDirectionalAppTaggingSecret, index: number, jobId: string): Promise<void>;
|
|
25
|
+
getHighestFinalizedIndex(secret: ExtendedDirectionalAppTaggingSecret, jobId: string): Promise<number | undefined>;
|
|
26
|
+
updateHighestFinalizedIndex(secret: ExtendedDirectionalAppTaggingSecret, index: number, jobId: string): Promise<void>;
|
|
27
27
|
}
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVjaXBpZW50X3RhZ2dpbmdfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL3RhZ2dpbmdfc3RvcmUvcmVjaXBpZW50X3RhZ2dpbmdfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsbUNBQW1DLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU5RSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSwwQ0FBMEMsQ0FBQztBQUU1RTs7Ozs7OztHQU9HO0FBQ0gscUJBQWEscUJBQXNCLFlBQVcsV0FBVzs7SUFDdkQsU0FBUyxFQUFFLE1BQU0sQ0FBdUI7SUFheEMsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBUW5DO0lBNENEOzs7O09BSUc7SUFDRyxNQUFNLENBQUMsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBZ0J6QztJQUVELGFBQWEsQ0FBQyxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FJMUM7SUFFRCxtQkFBbUIsQ0FBQyxNQUFNLEVBQUUsbUNBQW1DLEVBQUUsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQyxDQUUzRztJQUVELHNCQUFzQixDQUFDLE1BQU0sRUFBRSxtQ0FBbUMsRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQVMvRztJQUVELHdCQUF3QixDQUFDLE1BQU0sRUFBRSxtQ0FBbUMsRUFBRSxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRWhIO0lBRUQsMkJBQTJCLENBQ3pCLE1BQU0sRUFBRSxtQ0FBbUMsRUFDM0MsS0FBSyxFQUFFLE1BQU0sRUFDYixLQUFLLEVBQUUsTUFBTSxHQUNaLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FVZjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipient_tagging_store.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/recipient_tagging_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"recipient_tagging_store.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/recipient_tagging_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAE5E;;;;;;;GAOG;AACH,qBAAa,qBAAsB,YAAW,WAAW;;IACvD,SAAS,EAAE,MAAM,CAAuB;IAaxC,YAAY,KAAK,EAAE,iBAAiB,EAQnC;IA4CD;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBzC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI1C;IAED,mBAAmB,CAAC,MAAM,EAAE,mCAAmC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE3G;IAED,sBAAsB,CAAC,MAAM,EAAE,mCAAmC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS/G;IAED,wBAAwB,CAAC,MAAM,EAAE,mCAAmC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEhH;IAED,2BAA2B,CACzB,MAAM,EAAE,mCAAmC,EAC3C,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAUf;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtendedDirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
|
|
3
3
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
4
4
|
import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
|
|
5
5
|
/**
|
|
@@ -50,20 +50,20 @@ export declare class SenderTaggingStore implements StagedStore {
|
|
|
50
50
|
* @returns An array of unique transaction hashes for pending transactions that contain indexes in the range
|
|
51
51
|
* [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
|
|
52
52
|
*/
|
|
53
|
-
getTxHashesOfPendingIndexes(secret:
|
|
53
|
+
getTxHashesOfPendingIndexes(secret: ExtendedDirectionalAppTaggingSecret, startIndex: number, endIndex: number, jobId: string): Promise<TxHash[]>;
|
|
54
54
|
/**
|
|
55
55
|
* Returns the last (highest) finalized index for a given secret.
|
|
56
56
|
* @param secret - The secret to get the last finalized index for.
|
|
57
57
|
* @returns The last (highest) finalized index for the given secret.
|
|
58
58
|
*/
|
|
59
|
-
getLastFinalizedIndex(secret:
|
|
59
|
+
getLastFinalizedIndex(secret: ExtendedDirectionalAppTaggingSecret, jobId: string): Promise<number | undefined>;
|
|
60
60
|
/**
|
|
61
61
|
* Returns the last used index for a given directional app tagging secret, considering both finalized and pending
|
|
62
62
|
* indexes.
|
|
63
63
|
* @param secret - The directional app tagging secret to query the last used index for.
|
|
64
64
|
* @returns The last used index.
|
|
65
65
|
*/
|
|
66
|
-
getLastUsedIndex(secret:
|
|
66
|
+
getLastUsedIndex(secret: ExtendedDirectionalAppTaggingSecret, jobId: string): Promise<number | undefined>;
|
|
67
67
|
/**
|
|
68
68
|
* Drops all pending indexes corresponding to the given transaction hashes.
|
|
69
69
|
*/
|
|
@@ -74,4 +74,4 @@ export declare class SenderTaggingStore implements StagedStore {
|
|
|
74
74
|
*/
|
|
75
75
|
finalizePendingIndexes(txHashes: TxHash[], jobId: string): Promise<void>;
|
|
76
76
|
}
|
|
77
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
77
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZGVyX3RhZ2dpbmdfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL3RhZ2dpbmdfc3RvcmUvc2VuZGVyX3RhZ2dpbmdfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsbUNBQW1DLEVBQUUsTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDdEYsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRTFDLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBRzVFOzs7O0dBSUc7QUFDSCxxQkFBYSxrQkFBbUIsWUFBVyxXQUFXOztJQUNwRCxRQUFRLENBQUMsU0FBUyxvQkFBb0I7SUE2QnRDLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQVFuQztJQTRDRDs7OztPQUlHO0lBQ0csTUFBTSxDQUFDLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQW9CekM7SUFFRCxhQUFhLENBQUMsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBSTFDO0lBRUQ7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztPQXFCRztJQUNILG1CQUFtQixDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQTBFbkY7SUFFRDs7Ozs7Ozs7T0FRRztJQUNILDJCQUEyQixDQUN6QixNQUFNLEVBQUUsbUNBQW1DLEVBQzNDLFVBQVUsRUFBRSxNQUFNLEVBQ2xCLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLEtBQUssRUFBRSxNQUFNLEdBQ1osT0FBTyxDQUFDLE1BQU0sRUFBRSxDQUFDLENBUW5CO0lBRUQ7Ozs7T0FJRztJQUNILHFCQUFxQixDQUFDLE1BQU0sRUFBRSxtQ0FBbUMsRUFBRSxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRTdHO0lBRUQ7Ozs7O09BS0c7SUFDSCxnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsbUNBQW1DLEVBQUUsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQyxDQWtCeEc7SUFFRDs7T0FFRztJQUNILGtCQUFrQixDQUFDLFFBQVEsRUFBRSxNQUFNLEVBQUUsRUFBRSxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0EyQ25FO0lBRUQ7OztPQUdHO0lBQ0gsc0JBQXNCLENBQUMsUUFBUSxFQUFFLE1BQU0sRUFBRSxFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQTJGdkU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sender_tagging_store.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/sender_tagging_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sender_tagging_store.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/sender_tagging_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAG5E;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,WAAW;;IACpD,QAAQ,CAAC,SAAS,oBAAoB;IA6BtC,YAAY,KAAK,EAAE,iBAAiB,EAQnC;IA4CD;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBzC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI1C;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0EnF;IAED;;;;;;;;OAQG;IACH,2BAA2B,CACzB,MAAM,EAAE,mCAAmC,EAC3C,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnB;IAED;;;;OAIG;IACH,qBAAqB,CAAC,MAAM,EAAE,mCAAmC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7G;IAED;;;;;OAKG;IACH,gBAAgB,CAAC,MAAM,EAAE,mCAAmC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkBxG;IAED;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CnE;IAED;;;OAGG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2FvE;CACF"}
|
|
@@ -126,17 +126,17 @@ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/constants.
|
|
|
126
126
|
}
|
|
127
127
|
// The secrets in pre-tags should be unique because we always store just the highest index per given secret-txHash
|
|
128
128
|
// pair. Below we check that this is the case.
|
|
129
|
-
const secretsSet = new Set(preTags.map((preTag)=>preTag.
|
|
129
|
+
const secretsSet = new Set(preTags.map((preTag)=>preTag.extendedSecret.toString()));
|
|
130
130
|
if (secretsSet.size !== preTags.length) {
|
|
131
131
|
return Promise.reject(new Error(`Duplicate secrets found when storing pending indexes`));
|
|
132
132
|
}
|
|
133
133
|
const txHashStr = txHash.toString();
|
|
134
134
|
return this.#store.transactionAsync(async ()=>{
|
|
135
135
|
// Prefetch all data, start reads during iteration to keep IndexedDB transaction alive
|
|
136
|
-
const preTagReadPromises = preTags.map(({
|
|
137
|
-
const secretStr =
|
|
136
|
+
const preTagReadPromises = preTags.map(({ extendedSecret, index })=>{
|
|
137
|
+
const secretStr = extendedSecret.toString();
|
|
138
138
|
return {
|
|
139
|
-
|
|
139
|
+
extendedSecret,
|
|
140
140
|
secretStr,
|
|
141
141
|
index,
|
|
142
142
|
pending: this.#readPendingIndexes(jobId, secretStr),
|
package/dest/tagging/index.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export { loadPrivateLogsForSenderRecipientPair } from './recipient_sync/load_pri
|
|
|
12
12
|
export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
|
|
13
13
|
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
14
14
|
export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
|
|
15
|
-
export {
|
|
15
|
+
export { ExtendedDirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
16
16
|
export { type PreTag } from '@aztec/stdlib/logs';
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7R0FTRztBQUVILE9BQU8sRUFBRSxxQ0FBcUMsRUFBRSxNQUFNLGlFQUFpRSxDQUFDO0FBQ3hILE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxzQ0FBc0MsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxrQ0FBa0MsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR3hHLE9BQU8sRUFBRSxtQ0FBbUMsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDekYsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUMifQ==
|
|
@@ -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;AACxF,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EAAE,
|
|
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;AACxE,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EAAE,mCAAmC,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dest/tagging/index.js
CHANGED
|
@@ -12,4 +12,4 @@ export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_inde
|
|
|
12
12
|
export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
|
|
13
13
|
export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
|
|
14
14
|
// Re-export tagging-related types from stdlib
|
|
15
|
-
export {
|
|
15
|
+
export { ExtendedDirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
2
|
import type { BlockHash } from '@aztec/stdlib/block';
|
|
4
3
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
import type {
|
|
4
|
+
import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
6
5
|
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
7
6
|
/**
|
|
8
|
-
* Loads private logs for
|
|
7
|
+
* Loads private logs for the app-sender-recipient triplet defined by `secret` and updates the highest aged and
|
|
9
8
|
* finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
|
|
10
9
|
*
|
|
11
10
|
* @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
|
|
12
11
|
* in the tagging data provider is indexed by the secret and hence completely disjoint.
|
|
13
12
|
*/
|
|
14
|
-
export declare function loadPrivateLogsForSenderRecipientPair(secret:
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
export declare function loadPrivateLogsForSenderRecipientPair(secret: ExtendedDirectionalAppTaggingSecret, aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockNumber: BlockNumber, anchorBlockHash: BlockHash, jobId: string): Promise<TxScopedL2Log[]>;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxtQ0FBbUMsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU3RixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdEQUF3RCxDQUFDO0FBS3BHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLG1DQUFtQyxFQUMzQyxTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUscUJBQXFCLEVBQ25DLGlCQUFpQixFQUFFLFdBQVcsRUFDOUIsZUFBZSxFQUFFLFNBQVMsRUFDMUIsS0FBSyxFQUFFLE1BQU0sR0FDWixPQUFPLENBQUMsYUFBYSxFQUFFLENBQUMsQ0FtSDFCIn0=
|
|
@@ -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,
|
|
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,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,mCAAmC,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;GAMG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,mCAAmC,EAC3C,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,EAC9B,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,aAAa,EAAE,CAAC,CAmH1B"}
|
|
@@ -2,12 +2,12 @@ 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
|
/**
|
|
5
|
-
* Loads private logs for
|
|
5
|
+
* Loads private logs for the app-sender-recipient triplet defined by `secret` and updates the highest aged and
|
|
6
6
|
* finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
|
|
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,
|
|
10
|
+
*/ export async function loadPrivateLogsForSenderRecipientPair(secret, aztecNode, taggingStore, anchorBlockNumber, anchorBlockHash, 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]
|
|
@@ -72,7 +72,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
|
|
|
72
72
|
const logs = [];
|
|
73
73
|
while(true){
|
|
74
74
|
// Get private logs with their block timestamps and corresponding tagging indexes
|
|
75
|
-
const privateLogsWithIndexes = await loadLogsForRange(secret,
|
|
75
|
+
const privateLogsWithIndexes = await loadLogsForRange(secret, aztecNode, start, end, anchorBlockNumber, anchorBlockHash);
|
|
76
76
|
if (privateLogsWithIndexes.length === 0) {
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
2
|
import type { BlockHash } from '@aztec/stdlib/block';
|
|
4
3
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
import type {
|
|
4
|
+
import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
6
5
|
/**
|
|
7
|
-
* Gets private logs with their corresponding block timestamps and tagging indexes for the given index range
|
|
8
|
-
* `
|
|
9
|
-
* exclusive.
|
|
6
|
+
* Gets private logs with their corresponding block timestamps and tagging indexes for the given index range and
|
|
7
|
+
* `extendedSecret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and
|
|
8
|
+
* `end` is exclusive.
|
|
10
9
|
*/
|
|
11
|
-
export declare function loadLogsForRange(
|
|
10
|
+
export declare function loadLogsForRange(extendedSecret: ExtendedDirectionalAppTaggingSecret, aztecNode: AztecNode, start: number, end: number, anchorBlockNumber: BlockNumber, anchorBlockHash: BlockHash): Promise<Array<{
|
|
12
11
|
log: TxScopedL2Log;
|
|
13
12
|
taggingIndex: number;
|
|
14
13
|
}>>;
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9sb2dzX2Zvcl9yYW5nZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvdXRpbHMvbG9hZF9sb2dzX2Zvcl9yYW5nZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxtQ0FBbUMsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUs3Rjs7OztHQUlHO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUNwQyxjQUFjLEVBQUUsbUNBQW1DLEVBQ25ELFNBQVMsRUFBRSxTQUFTLEVBQ3BCLEtBQUssRUFBRSxNQUFNLEVBQ2IsR0FBRyxFQUFFLE1BQU0sRUFDWCxpQkFBaUIsRUFBRSxXQUFXLEVBQzlCLGVBQWUsRUFBRSxTQUFTLEdBQ3pCLE9BQU8sQ0FBQyxLQUFLLENBQUM7SUFBRSxHQUFHLEVBQUUsYUFBYSxDQUFDO0lBQUMsWUFBWSxFQUFFLE1BQU0sQ0FBQTtDQUFFLENBQUMsQ0FBQyxDQXVCOUQifQ==
|