@aztec/pxe 3.0.0-nightly.20251128 → 3.0.0-nightly.20251202
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/contract_function_simulator/execution_data_provider.d.ts +3 -2
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -2
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +3 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +4 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +6 -3
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +5 -3
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +3 -3
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +4 -4
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +5 -4
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +7 -5
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +3 -2
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +3 -2
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +4 -3
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +8 -6
- package/dest/private_kernel/hints/compute_side_effect_uniqueness_hints.d.ts +3 -0
- package/dest/private_kernel/hints/compute_side_effect_uniqueness_hints.d.ts.map +1 -0
- package/dest/private_kernel/hints/compute_side_effect_uniqueness_hints.js +48 -0
- 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 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts +4 -4
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +4 -1
- package/package.json +16 -16
- package/src/contract_function_simulator/execution_data_provider.ts +2 -0
- package/src/contract_function_simulator/execution_note_cache.ts +3 -2
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +4 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +4 -0
- package/src/contract_function_simulator/oracle/oracle.ts +4 -0
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +7 -2
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +9 -1
- package/src/contract_function_simulator/pxe_oracle_interface.ts +17 -6
- package/src/private_kernel/hints/compute_side_effect_uniqueness_hints.ts +173 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +5 -0
- package/src/storage/note_data_provider/note_data_provider.ts +7 -3
|
@@ -282,6 +282,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
282
282
|
* Real notes coming from DB will have a leafIndex which
|
|
283
283
|
* represents their index in the note hash tree.
|
|
284
284
|
*
|
|
285
|
+
* @param owner - The owner of the notes.
|
|
285
286
|
* @param storageSlot - The storage slot.
|
|
286
287
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
287
288
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -295,6 +296,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
295
296
|
* @returns Array of note data.
|
|
296
297
|
*/
|
|
297
298
|
public override async utilityGetNotes(
|
|
299
|
+
owner: AztecAddress,
|
|
298
300
|
storageSlot: Fr,
|
|
299
301
|
numSelects: number,
|
|
300
302
|
selectByIndexes: number[],
|
|
@@ -311,11 +313,12 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
311
313
|
status: NoteStatus,
|
|
312
314
|
): Promise<NoteData[]> {
|
|
313
315
|
// Nullified pending notes are already removed from the list.
|
|
314
|
-
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, storageSlot);
|
|
316
|
+
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, owner, storageSlot);
|
|
315
317
|
|
|
316
318
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
|
|
317
319
|
const dbNotes = await this.executionDataProvider.getNotes(
|
|
318
320
|
this.callContext.contractAddress,
|
|
321
|
+
owner,
|
|
319
322
|
storageSlot,
|
|
320
323
|
status,
|
|
321
324
|
this.scopes,
|
|
@@ -365,7 +368,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
365
368
|
/**
|
|
366
369
|
* Keep track of the new note created during execution.
|
|
367
370
|
* It can be used in subsequent calls (or transactions when chaining txs is possible).
|
|
368
|
-
* @param
|
|
371
|
+
* @param owner - The owner of the note.
|
|
369
372
|
* @param storageSlot - The storage slot.
|
|
370
373
|
* @param randomness - The randomness injected into the note.
|
|
371
374
|
* @param noteTypeId - The type ID of the note.
|
|
@@ -374,6 +377,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
374
377
|
* @returns
|
|
375
378
|
*/
|
|
376
379
|
public privateNotifyCreatedNote(
|
|
380
|
+
owner: AztecAddress,
|
|
377
381
|
storageSlot: Fr,
|
|
378
382
|
randomness: Fr,
|
|
379
383
|
noteTypeId: NoteSelector,
|
|
@@ -393,6 +397,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
393
397
|
this.noteCache.addNewNote(
|
|
394
398
|
{
|
|
395
399
|
contractAddress: this.callContext.contractAddress,
|
|
400
|
+
owner,
|
|
396
401
|
storageSlot,
|
|
397
402
|
randomness,
|
|
398
403
|
noteNonce: Fr.ZERO, // Nonce cannot be known during private execution.
|
|
@@ -164,6 +164,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
164
164
|
* Real notes coming from DB will have a leafIndex which
|
|
165
165
|
* represents their index in the note hash tree.
|
|
166
166
|
*
|
|
167
|
+
* @param owner - The owner of the notes.
|
|
167
168
|
* @param storageSlot - The storage slot.
|
|
168
169
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
169
170
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -177,6 +178,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
177
178
|
* @returns Array of note data.
|
|
178
179
|
*/
|
|
179
180
|
public async utilityGetNotes(
|
|
181
|
+
owner: AztecAddress,
|
|
180
182
|
storageSlot: Fr,
|
|
181
183
|
numSelects: number,
|
|
182
184
|
selectByIndexes: number[],
|
|
@@ -192,7 +194,13 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
192
194
|
offset: number,
|
|
193
195
|
status: NoteStatus,
|
|
194
196
|
): Promise<NoteData[]> {
|
|
195
|
-
const dbNotes = await this.executionDataProvider.getNotes(
|
|
197
|
+
const dbNotes = await this.executionDataProvider.getNotes(
|
|
198
|
+
this.contractAddress,
|
|
199
|
+
owner,
|
|
200
|
+
storageSlot,
|
|
201
|
+
status,
|
|
202
|
+
this.scopes,
|
|
203
|
+
);
|
|
196
204
|
return pickNotes<NoteData>(dbNotes, {
|
|
197
205
|
selects: selectByIndexes.slice(0, numSelects).map((index, i) => ({
|
|
198
206
|
selector: { index, offset: selectByOffsets[i], length: selectByLengths[i] },
|
|
@@ -5,7 +5,7 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
5
5
|
import type { KeyStore } from '@aztec/key-store';
|
|
6
6
|
import { EventSelector, type FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import type {
|
|
8
|
+
import type { DataInBlock, L2Block, L2BlockNumber } from '@aztec/stdlib/block';
|
|
9
9
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
10
10
|
import { computeUniqueNoteHash, siloNoteHash, siloNullifier, siloPrivateLog } from '@aztec/stdlib/hash';
|
|
11
11
|
import { type AztecNode, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
|
|
@@ -90,16 +90,24 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
90
90
|
return instance;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
async getNotes(
|
|
93
|
+
async getNotes(
|
|
94
|
+
contractAddress: AztecAddress,
|
|
95
|
+
owner: AztecAddress,
|
|
96
|
+
storageSlot: Fr,
|
|
97
|
+
status: NoteStatus,
|
|
98
|
+
scopes?: AztecAddress[],
|
|
99
|
+
) {
|
|
94
100
|
const noteDaos = await this.noteDataProvider.getNotes({
|
|
95
101
|
contractAddress,
|
|
102
|
+
owner,
|
|
96
103
|
storageSlot,
|
|
97
104
|
status,
|
|
98
105
|
scopes,
|
|
99
106
|
});
|
|
100
107
|
return noteDaos.map(
|
|
101
|
-
({ contractAddress, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier, index }) => ({
|
|
108
|
+
({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier, index }) => ({
|
|
102
109
|
contractAddress,
|
|
110
|
+
owner,
|
|
103
111
|
storageSlot,
|
|
104
112
|
randomness,
|
|
105
113
|
noteNonce,
|
|
@@ -599,6 +607,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
599
607
|
const noteDeliveries = noteValidationRequests.map(request =>
|
|
600
608
|
this.deliverNote(
|
|
601
609
|
request.contractAddress,
|
|
610
|
+
request.owner,
|
|
602
611
|
request.storageSlot,
|
|
603
612
|
request.randomness,
|
|
604
613
|
request.noteNonce,
|
|
@@ -630,6 +639,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
630
639
|
|
|
631
640
|
async deliverNote(
|
|
632
641
|
contractAddress: AztecAddress,
|
|
642
|
+
owner: AztecAddress,
|
|
633
643
|
storageSlot: Fr,
|
|
634
644
|
randomness: Fr,
|
|
635
645
|
noteNonce: Fr,
|
|
@@ -682,6 +692,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
682
692
|
const noteDao = new NoteDao(
|
|
683
693
|
new Note(content),
|
|
684
694
|
contractAddress,
|
|
695
|
+
owner,
|
|
685
696
|
storageSlot,
|
|
686
697
|
randomness,
|
|
687
698
|
noteNonce,
|
|
@@ -756,7 +767,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
756
767
|
privateLog.firstNullifierInTx,
|
|
757
768
|
);
|
|
758
769
|
} else {
|
|
759
|
-
null;
|
|
770
|
+
return null;
|
|
760
771
|
}
|
|
761
772
|
}),
|
|
762
773
|
);
|
|
@@ -941,10 +952,10 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
941
952
|
const foundNullifiers = nullifiersToCheck
|
|
942
953
|
.map((nullifier, i) => {
|
|
943
954
|
if (nullifierIndexes[i] !== undefined) {
|
|
944
|
-
return { ...nullifierIndexes[i], ...{ data: nullifier } } as
|
|
955
|
+
return { ...nullifierIndexes[i], ...{ data: nullifier } } as DataInBlock<Fr>;
|
|
945
956
|
}
|
|
946
957
|
})
|
|
947
|
-
.filter(nullifier => nullifier !== undefined) as
|
|
958
|
+
.filter(nullifier => nullifier !== undefined) as DataInBlock<Fr>[];
|
|
948
959
|
|
|
949
960
|
const nullifiedNotes = await this.noteDataProvider.applyNullifiers(foundNullifiers);
|
|
950
961
|
nullifiedNotes.forEach(noteDao => {
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GLOBAL_INDEX_CONTRACT_CLASS_LOG_HASH_OFFSET,
|
|
3
|
+
GLOBAL_INDEX_L2_TO_L1_MSG_OFFSET,
|
|
4
|
+
GLOBAL_INDEX_NOTE_HASH_OFFSET,
|
|
5
|
+
GLOBAL_INDEX_NOTE_HASH_READ_REQUEST_OFFSET,
|
|
6
|
+
GLOBAL_INDEX_NULLIFIER_OFFSET,
|
|
7
|
+
GLOBAL_INDEX_NULLIFIER_READ_REQUEST_OFFSET,
|
|
8
|
+
GLOBAL_INDEX_PRIVATE_CALL_REQUEST_OFFSET,
|
|
9
|
+
GLOBAL_INDEX_PRIVATE_LOG_OFFSET,
|
|
10
|
+
GLOBAL_INDEX_PUBLIC_CALL_REQUEST_OFFSET,
|
|
11
|
+
MAX_CONTRACT_CLASS_LOGS_PER_CALL,
|
|
12
|
+
MAX_ENQUEUED_CALLS_PER_CALL,
|
|
13
|
+
MAX_L2_TO_L1_MSGS_PER_CALL,
|
|
14
|
+
MAX_NOTE_HASHES_PER_CALL,
|
|
15
|
+
MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
|
|
16
|
+
MAX_NULLIFIERS_PER_CALL,
|
|
17
|
+
MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
|
|
18
|
+
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
|
|
19
|
+
MAX_PRIVATE_LOGS_PER_CALL,
|
|
20
|
+
TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL,
|
|
21
|
+
} from '@aztec/constants';
|
|
22
|
+
import { makeTuple } from '@aztec/foundation/array';
|
|
23
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
24
|
+
import type { Serializable } from '@aztec/foundation/serialize';
|
|
25
|
+
import {
|
|
26
|
+
ClaimedLengthArray,
|
|
27
|
+
PrivateCallRequest,
|
|
28
|
+
type PrivateCircuitPublicInputs,
|
|
29
|
+
SideEffectCounterRange,
|
|
30
|
+
SideEffectUniquenessHints,
|
|
31
|
+
} from '@aztec/stdlib/kernel';
|
|
32
|
+
|
|
33
|
+
export function computeSideEffectUniquenessHints(publicInputs: PrivateCircuitPublicInputs): SideEffectUniquenessHints {
|
|
34
|
+
let sideEffectRanges: SideEffectCounterRange[] = [];
|
|
35
|
+
|
|
36
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
37
|
+
createRangesFromClaimedLengthArray(
|
|
38
|
+
publicInputs.noteHashReadRequests,
|
|
39
|
+
GLOBAL_INDEX_NOTE_HASH_READ_REQUEST_OFFSET,
|
|
40
|
+
createRangeFromCountedItem,
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
44
|
+
createRangesFromClaimedLengthArray(
|
|
45
|
+
publicInputs.nullifierReadRequests,
|
|
46
|
+
GLOBAL_INDEX_NULLIFIER_READ_REQUEST_OFFSET,
|
|
47
|
+
createRangeFromCountedItem,
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
51
|
+
createRangesFromClaimedLengthArray(
|
|
52
|
+
publicInputs.noteHashes,
|
|
53
|
+
GLOBAL_INDEX_NOTE_HASH_OFFSET,
|
|
54
|
+
createRangeFromCountedItem,
|
|
55
|
+
),
|
|
56
|
+
);
|
|
57
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
58
|
+
createRangesFromClaimedLengthArray(
|
|
59
|
+
publicInputs.nullifiers,
|
|
60
|
+
GLOBAL_INDEX_NULLIFIER_OFFSET,
|
|
61
|
+
createRangeFromCountedItem,
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
65
|
+
createRangesFromClaimedLengthArray(
|
|
66
|
+
publicInputs.privateCallRequests,
|
|
67
|
+
GLOBAL_INDEX_PRIVATE_CALL_REQUEST_OFFSET,
|
|
68
|
+
createRangeFromPrivateCallRequest,
|
|
69
|
+
),
|
|
70
|
+
);
|
|
71
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
72
|
+
createRangesFromClaimedLengthArray(
|
|
73
|
+
publicInputs.publicCallRequests,
|
|
74
|
+
GLOBAL_INDEX_PUBLIC_CALL_REQUEST_OFFSET,
|
|
75
|
+
createRangeFromCountedItem,
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
79
|
+
createRangesFromClaimedLengthArray(
|
|
80
|
+
publicInputs.l2ToL1Msgs,
|
|
81
|
+
GLOBAL_INDEX_L2_TO_L1_MSG_OFFSET,
|
|
82
|
+
createRangeFromCountedItem,
|
|
83
|
+
),
|
|
84
|
+
);
|
|
85
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
86
|
+
createRangesFromClaimedLengthArray(
|
|
87
|
+
publicInputs.privateLogs,
|
|
88
|
+
GLOBAL_INDEX_PRIVATE_LOG_OFFSET,
|
|
89
|
+
createRangeFromCountedItem,
|
|
90
|
+
),
|
|
91
|
+
);
|
|
92
|
+
sideEffectRanges = sideEffectRanges.concat(
|
|
93
|
+
createRangesFromClaimedLengthArray(
|
|
94
|
+
publicInputs.contractClassLogsHashes,
|
|
95
|
+
GLOBAL_INDEX_CONTRACT_CLASS_LOG_HASH_OFFSET,
|
|
96
|
+
createRangeFromCountedItem,
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
sideEffectRanges.sort((a, b) => a.start - b.start);
|
|
101
|
+
|
|
102
|
+
const sideEffectRangeIndices = makeTuple(TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL, () => 0);
|
|
103
|
+
for (let i = 0; i < sideEffectRanges.length; i++) {
|
|
104
|
+
const range = sideEffectRanges[i];
|
|
105
|
+
sideEffectRangeIndices[range.sideEffectGlobalIndex] = i;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const hints = SideEffectUniquenessHints.from({
|
|
109
|
+
sideEffectRanges: padArrayEnd(
|
|
110
|
+
sideEffectRanges,
|
|
111
|
+
SideEffectCounterRange.empty(),
|
|
112
|
+
TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL,
|
|
113
|
+
),
|
|
114
|
+
noteHashReadRequestIndices: makeTuple(
|
|
115
|
+
MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
|
|
116
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_NOTE_HASH_READ_REQUEST_OFFSET],
|
|
117
|
+
),
|
|
118
|
+
nullifierReadRequestIndices: makeTuple(
|
|
119
|
+
MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
|
|
120
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_NULLIFIER_READ_REQUEST_OFFSET],
|
|
121
|
+
),
|
|
122
|
+
noteHashesIndices: makeTuple(
|
|
123
|
+
MAX_NOTE_HASHES_PER_CALL,
|
|
124
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_NOTE_HASH_OFFSET],
|
|
125
|
+
),
|
|
126
|
+
nullifiersIndices: makeTuple(
|
|
127
|
+
MAX_NULLIFIERS_PER_CALL,
|
|
128
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_NULLIFIER_OFFSET],
|
|
129
|
+
),
|
|
130
|
+
privateCallRequestsIndices: makeTuple(
|
|
131
|
+
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
|
|
132
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_PRIVATE_CALL_REQUEST_OFFSET],
|
|
133
|
+
),
|
|
134
|
+
publicCallRequestsIndices: makeTuple(
|
|
135
|
+
MAX_ENQUEUED_CALLS_PER_CALL,
|
|
136
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_PUBLIC_CALL_REQUEST_OFFSET],
|
|
137
|
+
),
|
|
138
|
+
l2ToL1MsgsIndices: makeTuple(
|
|
139
|
+
MAX_L2_TO_L1_MSGS_PER_CALL,
|
|
140
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_L2_TO_L1_MSG_OFFSET],
|
|
141
|
+
),
|
|
142
|
+
privateLogsIndices: makeTuple(
|
|
143
|
+
MAX_PRIVATE_LOGS_PER_CALL,
|
|
144
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_PRIVATE_LOG_OFFSET],
|
|
145
|
+
),
|
|
146
|
+
contractClassLogsHashesIndices: makeTuple(
|
|
147
|
+
MAX_CONTRACT_CLASS_LOGS_PER_CALL,
|
|
148
|
+
i => sideEffectRangeIndices[i + GLOBAL_INDEX_CONTRACT_CLASS_LOG_HASH_OFFSET],
|
|
149
|
+
),
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
return hints;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function createRangesFromClaimedLengthArray<T extends Serializable, N extends number>(
|
|
156
|
+
array: ClaimedLengthArray<T, N>,
|
|
157
|
+
globalIndexOffset: number,
|
|
158
|
+
rangeConstructor: (item: T, globalIndex: number) => SideEffectCounterRange,
|
|
159
|
+
): SideEffectCounterRange[] {
|
|
160
|
+
const ranges = [];
|
|
161
|
+
for (let i = 0; i < array.claimedLength; i++) {
|
|
162
|
+
ranges.push(rangeConstructor(array.array[i], globalIndexOffset + i));
|
|
163
|
+
}
|
|
164
|
+
return ranges;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function createRangeFromCountedItem(item: { counter: number }, globalIndex: number): SideEffectCounterRange {
|
|
168
|
+
return new SideEffectCounterRange(item.counter, item.counter, globalIndex);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function createRangeFromPrivateCallRequest(item: PrivateCallRequest, globalIndex: number): SideEffectCounterRange {
|
|
172
|
+
return new SideEffectCounterRange(item.startSideEffectCounter, item.endSideEffectCounter, globalIndex);
|
|
173
|
+
}
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
36
36
|
|
|
37
37
|
import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
|
|
38
|
+
import { computeSideEffectUniquenessHints } from './hints/compute_side_effect_uniqueness_hints.js';
|
|
38
39
|
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
39
40
|
|
|
40
41
|
const NULL_SIMULATE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
|
|
@@ -415,6 +416,9 @@ export class PrivateKernelExecutionProver {
|
|
|
415
416
|
await this.oracle.getContractClassIdPreimage(currentContractClassId);
|
|
416
417
|
|
|
417
418
|
const updatedClassIdHints = await this.oracle.getUpdatedClassIdHints(contractAddress);
|
|
419
|
+
|
|
420
|
+
const sideEffectUniquenessHints = computeSideEffectUniquenessHints(publicInputs);
|
|
421
|
+
|
|
418
422
|
return PrivateCallData.from({
|
|
419
423
|
publicInputs,
|
|
420
424
|
vk,
|
|
@@ -426,6 +430,7 @@ export class PrivateKernelExecutionProver {
|
|
|
426
430
|
functionLeafMembershipWitness,
|
|
427
431
|
updatedClassIdHints,
|
|
428
432
|
}),
|
|
433
|
+
sideEffectUniquenessHints,
|
|
429
434
|
});
|
|
430
435
|
}
|
|
431
436
|
}
|
|
@@ -3,7 +3,7 @@ import type { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import { toArray } from '@aztec/foundation/iterable';
|
|
4
4
|
import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncMultiMap } from '@aztec/kv-store';
|
|
5
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import type {
|
|
6
|
+
import type { DataInBlock } from '@aztec/stdlib/block';
|
|
7
7
|
import { NoteStatus, type NotesFilter } from '@aztec/stdlib/note';
|
|
8
8
|
import { NoteDao } from '@aztec/stdlib/note';
|
|
9
9
|
|
|
@@ -224,7 +224,7 @@ export class NoteDataProvider {
|
|
|
224
224
|
* parameters.
|
|
225
225
|
*
|
|
226
226
|
* @param filter - Filter criteria including contractAddress (required), and optional
|
|
227
|
-
* storageSlot, status, scopes and siloedNullifier.
|
|
227
|
+
* owner, storageSlot, status, scopes, and siloedNullifier.
|
|
228
228
|
* @returns Promise resolving to array of NoteDao objects matching the filter
|
|
229
229
|
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
230
230
|
*/
|
|
@@ -307,6 +307,10 @@ export class NoteDataProvider {
|
|
|
307
307
|
continue;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
if (filter.owner && !note.owner.equals(filter.owner)) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
|
|
310
314
|
if (filter.storageSlot && !note.storageSlot.equals(filter.storageSlot!)) {
|
|
311
315
|
continue;
|
|
312
316
|
}
|
|
@@ -333,7 +337,7 @@ export class NoteDataProvider {
|
|
|
333
337
|
* @returns Promise resolving to array of nullified NoteDao objects
|
|
334
338
|
* @throws Error if any nullifier is not found in the active notes
|
|
335
339
|
*/
|
|
336
|
-
applyNullifiers(nullifiers:
|
|
340
|
+
applyNullifiers(nullifiers: DataInBlock<Fr>[]): Promise<NoteDao[]> {
|
|
337
341
|
if (nullifiers.length === 0) {
|
|
338
342
|
return Promise.resolve([]);
|
|
339
343
|
}
|