@aztec/pxe 0.45.0 → 0.46.1
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_data_oracle/index.d.ts +2 -12
- package/dest/contract_data_oracle/index.d.ts.map +1 -1
- package/dest/contract_data_oracle/index.js +1 -15
- package/dest/database/deferred_note_dao.d.ts +2 -2
- package/dest/database/deferred_note_dao.d.ts.map +1 -1
- package/dest/database/deferred_note_dao.js +4 -4
- package/dest/kernel_oracle/index.d.ts +3 -3
- package/dest/kernel_oracle/index.d.ts.map +1 -1
- package/dest/kernel_oracle/index.js +6 -4
- package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
- package/dest/kernel_prover/kernel_prover.js +13 -15
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.js +9 -11
- package/dest/kernel_prover/private_inputs_builders/index.d.ts +0 -3
- package/dest/kernel_prover/private_inputs_builders/index.d.ts.map +1 -1
- package/dest/kernel_prover/private_inputs_builders/index.js +1 -4
- package/dest/kernel_prover/proving_data_oracle.d.ts +2 -2
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -1
- package/dest/kernel_prover/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/kernel_prover/test/test_circuit_prover.js +9 -9
- package/dest/note_processor/note_processor.d.ts.map +1 -1
- package/dest/note_processor/note_processor.js +10 -10
- package/dest/note_processor/produce_note_dao.d.ts +2 -2
- package/dest/note_processor/produce_note_dao.d.ts.map +1 -1
- package/dest/note_processor/produce_note_dao.js +7 -7
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +2 -1
- package/package.json +14 -14
- package/src/contract_data_oracle/index.ts +1 -15
- package/src/database/deferred_note_dao.ts +2 -2
- package/src/kernel_oracle/index.ts +8 -4
- package/src/kernel_prover/kernel_prover.ts +13 -25
- package/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.ts +14 -35
- package/src/kernel_prover/private_inputs_builders/index.ts +0 -3
- package/src/kernel_prover/proving_data_oracle.ts +2 -2
- package/src/kernel_prover/test/test_circuit_prover.ts +12 -9
- package/src/note_processor/note_processor.ts +9 -14
- package/src/note_processor/produce_note_dao.ts +6 -6
- package/src/pxe_service/pxe_service.ts +1 -0
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.d.ts +0 -3
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.d.ts.map +0 -1
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.js +0 -6
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.d.ts +0 -3
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.d.ts.map +0 -1
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.js +0 -6
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.d.ts +0 -4
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.d.ts.map +0 -1
- package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.js +0 -14
- package/src/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.ts +0 -17
- package/src/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.ts +0 -17
- package/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.ts +0 -45
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
CallRequest,
|
|
4
4
|
Fr,
|
|
5
5
|
MAX_KEY_VALIDATION_REQUESTS_PER_TX,
|
|
6
|
-
MAX_NEW_NOTE_HASHES_PER_TX,
|
|
7
|
-
MAX_NEW_NULLIFIERS_PER_TX,
|
|
8
6
|
MAX_NOTE_ENCRYPTED_LOGS_PER_TX,
|
|
7
|
+
MAX_NOTE_HASHES_PER_TX,
|
|
9
8
|
MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
9
|
+
MAX_NULLIFIERS_PER_TX,
|
|
10
10
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
11
11
|
MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL,
|
|
12
12
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
@@ -29,13 +29,10 @@ import { padArrayEnd } from '@aztec/foundation/collection';
|
|
|
29
29
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
30
30
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
31
31
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
32
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types';
|
|
32
33
|
import { type ExecutionResult, collectNoteHashLeafIndexMap, collectNullifiedNoteHashCounters } from '@aztec/simulator';
|
|
33
34
|
|
|
34
|
-
import {
|
|
35
|
-
buildPrivateKernelInitHints,
|
|
36
|
-
buildPrivateKernelInnerHints,
|
|
37
|
-
buildPrivateKernelResetInputs,
|
|
38
|
-
} from './private_inputs_builders/index.js';
|
|
35
|
+
import { buildPrivateKernelResetInputs } from './private_inputs_builders/index.js';
|
|
39
36
|
import { type ProvingDataOracle } from './proving_data_oracle.js';
|
|
40
37
|
|
|
41
38
|
/**
|
|
@@ -107,18 +104,10 @@ export class KernelProver {
|
|
|
107
104
|
);
|
|
108
105
|
|
|
109
106
|
if (firstIteration) {
|
|
110
|
-
const
|
|
111
|
-
currentExecution.callStackItem.publicInputs,
|
|
112
|
-
noteHashNullifierCounterMap,
|
|
113
|
-
);
|
|
114
|
-
const proofInput = new PrivateKernelInitCircuitPrivateInputs(txRequest, privateCallData, hints);
|
|
107
|
+
const proofInput = new PrivateKernelInitCircuitPrivateInputs(txRequest, getVKTreeRoot(), privateCallData);
|
|
115
108
|
pushTestData('private-kernel-inputs-init', proofInput);
|
|
116
109
|
output = await this.proofCreator.createProofInit(proofInput);
|
|
117
110
|
} else {
|
|
118
|
-
const hints = buildPrivateKernelInnerHints(
|
|
119
|
-
currentExecution.callStackItem.publicInputs,
|
|
120
|
-
noteHashNullifierCounterMap,
|
|
121
|
-
);
|
|
122
111
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey);
|
|
123
112
|
const previousKernelData = new PrivateKernelData(
|
|
124
113
|
output.publicInputs,
|
|
@@ -127,7 +116,7 @@ export class KernelProver {
|
|
|
127
116
|
Number(previousVkMembershipWitness.leafIndex),
|
|
128
117
|
assertLength<Fr, typeof VK_TREE_HEIGHT>(previousVkMembershipWitness.siblingPath, VK_TREE_HEIGHT),
|
|
129
118
|
);
|
|
130
|
-
const proofInput = new PrivateKernelInnerCircuitPrivateInputs(previousKernelData, privateCallData
|
|
119
|
+
const proofInput = new PrivateKernelInnerCircuitPrivateInputs(previousKernelData, privateCallData);
|
|
131
120
|
pushTestData('private-kernel-inputs-inner', proofInput);
|
|
132
121
|
output = await this.proofCreator.createProofInner(proofInput);
|
|
133
122
|
}
|
|
@@ -159,12 +148,12 @@ export class KernelProver {
|
|
|
159
148
|
private needsReset(executionStack: ExecutionResult[], output: KernelProofOutput<PrivateKernelCircuitPublicInputs>) {
|
|
160
149
|
const nextIteration = executionStack[executionStack.length - 1];
|
|
161
150
|
return (
|
|
162
|
-
getNonEmptyItems(nextIteration.callStackItem.publicInputs.
|
|
163
|
-
getNonEmptyItems(output.publicInputs.end.
|
|
164
|
-
|
|
165
|
-
getNonEmptyItems(nextIteration.callStackItem.publicInputs.
|
|
166
|
-
getNonEmptyItems(output.publicInputs.end.
|
|
167
|
-
|
|
151
|
+
getNonEmptyItems(nextIteration.callStackItem.publicInputs.noteHashes).length +
|
|
152
|
+
getNonEmptyItems(output.publicInputs.end.noteHashes).length >
|
|
153
|
+
MAX_NOTE_HASHES_PER_TX ||
|
|
154
|
+
getNonEmptyItems(nextIteration.callStackItem.publicInputs.nullifiers).length +
|
|
155
|
+
getNonEmptyItems(output.publicInputs.end.nullifiers).length >
|
|
156
|
+
MAX_NULLIFIERS_PER_TX ||
|
|
168
157
|
getNonEmptyItems(nextIteration.callStackItem.publicInputs.noteEncryptedLogsHashes).length +
|
|
169
158
|
getNonEmptyItems(output.publicInputs.end.noteEncryptedLogsHashes).length >
|
|
170
159
|
MAX_NOTE_ENCRYPTED_LOGS_PER_TX ||
|
|
@@ -185,8 +174,7 @@ export class KernelProver {
|
|
|
185
174
|
getNonEmptyItems(output.publicInputs.validationRequests.noteHashReadRequests).length > 0 ||
|
|
186
175
|
getNonEmptyItems(output.publicInputs.validationRequests.nullifierReadRequests).length > 0 ||
|
|
187
176
|
getNonEmptyItems(output.publicInputs.validationRequests.scopedKeyValidationRequestsAndGenerators).length > 0 ||
|
|
188
|
-
output.publicInputs.end.
|
|
189
|
-
output.publicInputs.end.newNullifiers.find(nullifier => !nullifier.nullifiedNoteHash.equals(Fr.zero()))
|
|
177
|
+
output.publicInputs.end.nullifiers.find(nullifier => !nullifier.nullifiedNoteHash.equals(Fr.zero()))
|
|
190
178
|
);
|
|
191
179
|
}
|
|
192
180
|
|
|
@@ -2,10 +2,9 @@ import {
|
|
|
2
2
|
type Fr,
|
|
3
3
|
KeyValidationHint,
|
|
4
4
|
MAX_KEY_VALIDATION_REQUESTS_PER_TX,
|
|
5
|
-
|
|
6
|
-
MAX_NEW_NULLIFIERS_PER_TX,
|
|
7
|
-
MAX_NOTE_ENCRYPTED_LOGS_PER_TX,
|
|
5
|
+
MAX_NOTE_HASHES_PER_TX,
|
|
8
6
|
MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
7
|
+
MAX_NULLIFIERS_PER_TX,
|
|
9
8
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
10
9
|
MembershipWitness,
|
|
11
10
|
NULLIFIER_TREE_HEIGHT,
|
|
@@ -29,11 +28,10 @@ import { type Tuple } from '@aztec/foundation/serialize';
|
|
|
29
28
|
import type { ExecutionResult } from '@aztec/simulator';
|
|
30
29
|
|
|
31
30
|
import { type ProvingDataOracle } from '../proving_data_oracle.js';
|
|
32
|
-
import { buildPrivateKernelResetOutputs } from './build_private_kernel_reset_outputs.js';
|
|
33
31
|
|
|
34
32
|
function getNullifierReadRequestHints<PENDING extends number, SETTLED extends number>(
|
|
35
33
|
nullifierReadRequests: Tuple<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
|
|
36
|
-
nullifiers: Tuple<ScopedNullifier, typeof
|
|
34
|
+
nullifiers: Tuple<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX>,
|
|
37
35
|
oracle: ProvingDataOracle,
|
|
38
36
|
sizePending: PENDING,
|
|
39
37
|
sizeSettled: SETTLED,
|
|
@@ -99,14 +97,10 @@ export async function buildPrivateKernelResetInputs(
|
|
|
99
97
|
// Use max sizes, they will be trimmed down later.
|
|
100
98
|
|
|
101
99
|
const futureNoteHashes = collectNested(executionStack, executionResult => {
|
|
102
|
-
const nonEmptyNoteHashes = getNonEmptyItems(executionResult.callStackItem.publicInputs.
|
|
100
|
+
const nonEmptyNoteHashes = getNonEmptyItems(executionResult.callStackItem.publicInputs.noteHashes);
|
|
103
101
|
return nonEmptyNoteHashes.map(
|
|
104
102
|
noteHash =>
|
|
105
|
-
new ScopedNoteHash(
|
|
106
|
-
noteHash,
|
|
107
|
-
noteHashNullifierCounterMap.get(noteHash.counter) ?? 0,
|
|
108
|
-
executionResult.callStackItem.publicInputs.callContext.storageContractAddress,
|
|
109
|
-
),
|
|
103
|
+
new ScopedNoteHash(noteHash, executionResult.callStackItem.publicInputs.callContext.storageContractAddress),
|
|
110
104
|
);
|
|
111
105
|
});
|
|
112
106
|
|
|
@@ -117,7 +111,7 @@ export async function buildPrivateKernelResetInputs(
|
|
|
117
111
|
} = await buildNoteHashReadRequestHints(
|
|
118
112
|
oracle,
|
|
119
113
|
publicInputs.validationRequests.noteHashReadRequests,
|
|
120
|
-
publicInputs.end.
|
|
114
|
+
publicInputs.end.noteHashes,
|
|
121
115
|
noteHashLeafIndexMap,
|
|
122
116
|
MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
123
117
|
MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
@@ -125,7 +119,7 @@ export async function buildPrivateKernelResetInputs(
|
|
|
125
119
|
);
|
|
126
120
|
|
|
127
121
|
const futureNullifiers = collectNested(executionStack, executionResult => {
|
|
128
|
-
const nonEmptyNullifiers = getNonEmptyItems(executionResult.callStackItem.publicInputs.
|
|
122
|
+
const nonEmptyNullifiers = getNonEmptyItems(executionResult.callStackItem.publicInputs.nullifiers);
|
|
129
123
|
return nonEmptyNullifiers.map(
|
|
130
124
|
nullifier =>
|
|
131
125
|
new ScopedNullifier(nullifier, executionResult.callStackItem.publicInputs.callContext.storageContractAddress),
|
|
@@ -138,7 +132,7 @@ export async function buildPrivateKernelResetInputs(
|
|
|
138
132
|
hints: nullifierReadRequestHints,
|
|
139
133
|
} = await getNullifierReadRequestHints(
|
|
140
134
|
publicInputs.validationRequests.nullifierReadRequests,
|
|
141
|
-
publicInputs.end.
|
|
135
|
+
publicInputs.end.nullifiers,
|
|
142
136
|
oracle,
|
|
143
137
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
144
138
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
@@ -159,27 +153,14 @@ export async function buildPrivateKernelResetInputs(
|
|
|
159
153
|
executionResult => executionResult.callStackItem.publicInputs.nullifierReadRequests,
|
|
160
154
|
);
|
|
161
155
|
|
|
162
|
-
const [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
transientNoteHashIndexesForLogs,
|
|
166
|
-
] = buildTransientDataHints(
|
|
167
|
-
publicInputs.end.newNoteHashes,
|
|
168
|
-
publicInputs.end.newNullifiers,
|
|
169
|
-
publicInputs.end.noteEncryptedLogsHashes,
|
|
156
|
+
const [transientNullifierIndexesForNoteHashes, transientNoteHashIndexesForNullifiers] = buildTransientDataHints(
|
|
157
|
+
publicInputs.end.noteHashes,
|
|
158
|
+
publicInputs.end.nullifiers,
|
|
170
159
|
futureNoteHashReads,
|
|
171
160
|
futureNullifierReads,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
const expectedOutputs = buildPrivateKernelResetOutputs(
|
|
178
|
-
previousKernelData.publicInputs.end.newNoteHashes,
|
|
179
|
-
previousKernelData.publicInputs.end.newNullifiers,
|
|
180
|
-
previousKernelData.publicInputs.end.noteEncryptedLogsHashes,
|
|
181
|
-
transientNullifierIndexesForNoteHashes,
|
|
182
|
-
transientNoteHashIndexesForNullifiers,
|
|
161
|
+
noteHashNullifierCounterMap,
|
|
162
|
+
MAX_NOTE_HASHES_PER_TX,
|
|
163
|
+
MAX_NULLIFIERS_PER_TX,
|
|
183
164
|
);
|
|
184
165
|
|
|
185
166
|
let privateInputs;
|
|
@@ -194,11 +175,9 @@ export async function buildPrivateKernelResetInputs(
|
|
|
194
175
|
) {
|
|
195
176
|
privateInputs = new PrivateKernelResetCircuitPrivateInputs(
|
|
196
177
|
previousKernelData,
|
|
197
|
-
expectedOutputs,
|
|
198
178
|
new PrivateKernelResetHints(
|
|
199
179
|
transientNullifierIndexesForNoteHashes,
|
|
200
180
|
transientNoteHashIndexesForNullifiers,
|
|
201
|
-
transientNoteHashIndexesForLogs,
|
|
202
181
|
noteHashReadRequestHints,
|
|
203
182
|
nullifierReadRequestHints,
|
|
204
183
|
keysHints,
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export { buildPrivateKernelInitHints } from './build_private_kernel_init_hints.js';
|
|
2
|
-
export { buildPrivateKernelInnerHints } from './build_private_kernel_inner_hints.js';
|
|
3
1
|
export { buildPrivateKernelResetInputs } from './build_private_kernel_reset_hints.js';
|
|
4
|
-
export { buildPrivateKernelResetOutputs } from './build_private_kernel_reset_outputs.js';
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
type FUNCTION_TREE_HEIGHT,
|
|
4
4
|
type Fr,
|
|
5
5
|
type FunctionSelector,
|
|
6
|
-
type
|
|
6
|
+
type GrumpkinScalar,
|
|
7
7
|
type MembershipWitness,
|
|
8
8
|
type NOTE_HASH_TREE_HEIGHT,
|
|
9
9
|
type Point,
|
|
@@ -76,7 +76,7 @@ export interface ProvingDataOracle {
|
|
|
76
76
|
* @returns A Promise that resolves to sk_m.
|
|
77
77
|
* @dev Used when feeding the sk_m to the kernel circuit for keys verification.
|
|
78
78
|
*/
|
|
79
|
-
getMasterSecretKey(masterPublicKey: Point): Promise<
|
|
79
|
+
getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar>;
|
|
80
80
|
|
|
81
81
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
82
82
|
}
|
|
@@ -17,6 +17,8 @@ import { siloNoteHash } from '@aztec/circuits.js/hash';
|
|
|
17
17
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
18
18
|
import { elapsed } from '@aztec/foundation/timer';
|
|
19
19
|
import {
|
|
20
|
+
type ProtocolArtifact,
|
|
21
|
+
ProtocolCircuitVks,
|
|
20
22
|
executeInit,
|
|
21
23
|
executeInner,
|
|
22
24
|
executeReset,
|
|
@@ -33,9 +35,7 @@ export class TestProofCreator implements ProofCreator {
|
|
|
33
35
|
public getSiloedCommitments(publicInputs: PrivateCircuitPublicInputs) {
|
|
34
36
|
const contractAddress = publicInputs.callContext.storageContractAddress;
|
|
35
37
|
|
|
36
|
-
return Promise.resolve(
|
|
37
|
-
publicInputs.newNoteHashes.map(commitment => siloNoteHash(contractAddress, commitment.value)),
|
|
38
|
-
);
|
|
38
|
+
return Promise.resolve(publicInputs.noteHashes.map(commitment => siloNoteHash(contractAddress, commitment.value)));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
public async createProofInit(
|
|
@@ -49,7 +49,7 @@ export class TestProofCreator implements ProofCreator {
|
|
|
49
49
|
inputSize: privateInputs.toBuffer().length,
|
|
50
50
|
outputSize: result.toBuffer().length,
|
|
51
51
|
} satisfies CircuitSimulationStats);
|
|
52
|
-
return this.makeEmptyKernelProofOutput<PrivateKernelCircuitPublicInputs>(result);
|
|
52
|
+
return this.makeEmptyKernelProofOutput<PrivateKernelCircuitPublicInputs>(result, 'PrivateKernelInitArtifact');
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
public async createProofInner(
|
|
@@ -63,7 +63,7 @@ export class TestProofCreator implements ProofCreator {
|
|
|
63
63
|
inputSize: privateInputs.toBuffer().length,
|
|
64
64
|
outputSize: result.toBuffer().length,
|
|
65
65
|
} satisfies CircuitSimulationStats);
|
|
66
|
-
return this.makeEmptyKernelProofOutput<PrivateKernelCircuitPublicInputs>(result);
|
|
66
|
+
return this.makeEmptyKernelProofOutput<PrivateKernelCircuitPublicInputs>(result, 'PrivateKernelInnerArtifact');
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
public async createProofReset(
|
|
@@ -77,7 +77,7 @@ export class TestProofCreator implements ProofCreator {
|
|
|
77
77
|
inputSize: privateInputs.toBuffer().length,
|
|
78
78
|
outputSize: result.toBuffer().length,
|
|
79
79
|
} satisfies CircuitSimulationStats);
|
|
80
|
-
return this.makeEmptyKernelProofOutput<PrivateKernelCircuitPublicInputs>(result);
|
|
80
|
+
return this.makeEmptyKernelProofOutput<PrivateKernelCircuitPublicInputs>(result, 'PrivateKernelResetFullArtifact');
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
public async createProofTail(
|
|
@@ -94,7 +94,10 @@ export class TestProofCreator implements ProofCreator {
|
|
|
94
94
|
inputSize: privateInputs.toBuffer().length,
|
|
95
95
|
outputSize: result.toBuffer().length,
|
|
96
96
|
} satisfies CircuitSimulationStats);
|
|
97
|
-
return this.makeEmptyKernelProofOutput<PrivateKernelTailCircuitPublicInputs>(
|
|
97
|
+
return this.makeEmptyKernelProofOutput<PrivateKernelTailCircuitPublicInputs>(
|
|
98
|
+
result,
|
|
99
|
+
isForPublic ? 'PrivateKernelTailToPublicArtifact' : 'PrivateKernelTailArtifact',
|
|
100
|
+
);
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
createAppCircuitProof(_1: Map<number, string>, _2: Buffer): Promise<AppCircuitProofOutput> {
|
|
@@ -105,11 +108,11 @@ export class TestProofCreator implements ProofCreator {
|
|
|
105
108
|
return Promise.resolve(appCircuitProofOutput);
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
private makeEmptyKernelProofOutput<PublicInputsType>(publicInputs: PublicInputsType) {
|
|
111
|
+
private makeEmptyKernelProofOutput<PublicInputsType>(publicInputs: PublicInputsType, circuitType: ProtocolArtifact) {
|
|
109
112
|
const kernelProofOutput: KernelProofOutput<PublicInputsType> = {
|
|
110
113
|
publicInputs,
|
|
111
114
|
proof: makeRecursiveProof<typeof NESTED_RECURSIVE_PROOF_LENGTH>(NESTED_RECURSIVE_PROOF_LENGTH),
|
|
112
|
-
verificationKey:
|
|
115
|
+
verificationKey: ProtocolCircuitVks[circuitType].keyAsFields,
|
|
113
116
|
};
|
|
114
117
|
return kernelProofOutput;
|
|
115
118
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { type AztecNode, L1NotePayload, type L2Block, TaggedLog } from '@aztec/circuit-types';
|
|
2
2
|
import { type NoteProcessorStats } from '@aztec/circuit-types/stats';
|
|
3
|
-
import {
|
|
4
|
-
type AztecAddress,
|
|
5
|
-
INITIAL_L2_BLOCK_NUM,
|
|
6
|
-
MAX_NEW_NOTE_HASHES_PER_TX,
|
|
7
|
-
type PublicKey,
|
|
8
|
-
} from '@aztec/circuits.js';
|
|
3
|
+
import { type AztecAddress, INITIAL_L2_BLOCK_NUM, MAX_NOTE_HASHES_PER_TX, type PublicKey } from '@aztec/circuits.js';
|
|
9
4
|
import { type Fr } from '@aztec/foundation/fields';
|
|
10
5
|
import { type Logger, createDebugLogger } from '@aztec/foundation/log';
|
|
11
6
|
import { Timer } from '@aztec/foundation/timer';
|
|
@@ -128,7 +123,7 @@ export class NoteProcessor {
|
|
|
128
123
|
const { txLogs } = block.body.noteEncryptedLogs;
|
|
129
124
|
const dataStartIndexForBlock =
|
|
130
125
|
block.header.state.partial.noteHashTree.nextAvailableLeafIndex -
|
|
131
|
-
block.body.numberOfTxsIncludingPadded *
|
|
126
|
+
block.body.numberOfTxsIncludingPadded * MAX_NOTE_HASHES_PER_TX;
|
|
132
127
|
|
|
133
128
|
// We are using set for `userPertainingTxIndices` to avoid duplicates. This would happen in case there were
|
|
134
129
|
// multiple encrypted logs in a tx pertaining to a user.
|
|
@@ -138,8 +133,8 @@ export class NoteProcessor {
|
|
|
138
133
|
// Iterate over all the encrypted logs and try decrypting them. If successful, store the note.
|
|
139
134
|
for (let indexOfTxInABlock = 0; indexOfTxInABlock < txLogs.length; ++indexOfTxInABlock) {
|
|
140
135
|
this.stats.txs++;
|
|
141
|
-
const dataStartIndexForTx = dataStartIndexForBlock + indexOfTxInABlock *
|
|
142
|
-
const
|
|
136
|
+
const dataStartIndexForTx = dataStartIndexForBlock + indexOfTxInABlock * MAX_NOTE_HASHES_PER_TX;
|
|
137
|
+
const noteHashes = block.body.txEffects[indexOfTxInABlock].noteHashes;
|
|
143
138
|
// Note: Each tx generates a `TxL2Logs` object and for this reason we can rely on its index corresponding
|
|
144
139
|
// to the index of a tx in a block.
|
|
145
140
|
const txFunctionLogs = txLogs[indexOfTxInABlock].functionLogs;
|
|
@@ -172,7 +167,7 @@ export class NoteProcessor {
|
|
|
172
167
|
outgoingTaggedNote ? this.ovpkM : undefined,
|
|
173
168
|
payload,
|
|
174
169
|
txHash,
|
|
175
|
-
|
|
170
|
+
noteHashes,
|
|
176
171
|
dataStartIndexForTx,
|
|
177
172
|
excludedIndices,
|
|
178
173
|
this.log,
|
|
@@ -245,10 +240,10 @@ export class NoteProcessor {
|
|
|
245
240
|
});
|
|
246
241
|
}
|
|
247
242
|
|
|
248
|
-
const
|
|
243
|
+
const nullifiers: Fr[] = blocksAndNotes.flatMap(b =>
|
|
249
244
|
b.block.body.txEffects.flatMap(txEffect => txEffect.nullifiers),
|
|
250
245
|
);
|
|
251
|
-
const removedNotes = await this.db.removeNullifiedNotes(
|
|
246
|
+
const removedNotes = await this.db.removeNullifiedNotes(nullifiers, this.ivpkM);
|
|
252
247
|
removedNotes.forEach(noteDao => {
|
|
253
248
|
this.log.verbose(
|
|
254
249
|
`Removed note for contract ${noteDao.contractAddress} at slot ${
|
|
@@ -305,7 +300,7 @@ export class NoteProcessor {
|
|
|
305
300
|
const outgoingNotes: OutgoingNoteDao[] = [];
|
|
306
301
|
|
|
307
302
|
for (const deferredNote of deferredNoteDaos) {
|
|
308
|
-
const { publicKey, note, contractAddress, storageSlot, noteTypeId, txHash,
|
|
303
|
+
const { publicKey, note, contractAddress, storageSlot, noteTypeId, txHash, noteHashes, dataStartIndexForTx } =
|
|
309
304
|
deferredNote;
|
|
310
305
|
const payload = new L1NotePayload(note, contractAddress, storageSlot, noteTypeId);
|
|
311
306
|
|
|
@@ -323,7 +318,7 @@ export class NoteProcessor {
|
|
|
323
318
|
isOutgoing ? this.ovpkM : undefined,
|
|
324
319
|
payload,
|
|
325
320
|
txHash,
|
|
326
|
-
|
|
321
|
+
noteHashes,
|
|
327
322
|
dataStartIndexForTx,
|
|
328
323
|
excludedIndices,
|
|
329
324
|
this.log,
|
|
@@ -18,7 +18,7 @@ import { OutgoingNoteDao } from '../database/outgoing_note_dao.js';
|
|
|
18
18
|
* @param ovpkM - The public counterpart to the secret key to be used in the decryption of outgoing note logs.
|
|
19
19
|
* @param payload - An instance of l1NotePayload.
|
|
20
20
|
* @param txHash - The hash of the transaction that created the note. Equivalent to the first nullifier of the transaction.
|
|
21
|
-
* @param
|
|
21
|
+
* @param noteHashes - New note hashes in this transaction, one of which belongs to this note.
|
|
22
22
|
* @param dataStartIndexForTx - The next available leaf index for the note hash tree for this transaction.
|
|
23
23
|
* @param excludedIndices - Indices that have been assigned a note in the same tx. Notes in a tx can have the same l1NotePayload, we need to find a different index for each replicate.
|
|
24
24
|
* @param simulator - An instance of AcirSimulator.
|
|
@@ -30,7 +30,7 @@ export async function produceNoteDaos(
|
|
|
30
30
|
ovpkM: PublicKey | undefined,
|
|
31
31
|
payload: L1NotePayload,
|
|
32
32
|
txHash: TxHash,
|
|
33
|
-
|
|
33
|
+
noteHashes: Fr[],
|
|
34
34
|
dataStartIndexForTx: number,
|
|
35
35
|
excludedIndices: Set<number>,
|
|
36
36
|
log: Logger,
|
|
@@ -53,7 +53,7 @@ export async function produceNoteDaos(
|
|
|
53
53
|
if (ivpkM) {
|
|
54
54
|
const { noteHashIndex, nonce, innerNoteHash, siloedNullifier } = await findNoteIndexAndNullifier(
|
|
55
55
|
simulator,
|
|
56
|
-
|
|
56
|
+
noteHashes,
|
|
57
57
|
txHash,
|
|
58
58
|
payload,
|
|
59
59
|
excludedIndices,
|
|
@@ -87,7 +87,7 @@ export async function produceNoteDaos(
|
|
|
87
87
|
payload.storageSlot,
|
|
88
88
|
payload.noteTypeId,
|
|
89
89
|
txHash,
|
|
90
|
-
|
|
90
|
+
noteHashes,
|
|
91
91
|
dataStartIndexForTx,
|
|
92
92
|
);
|
|
93
93
|
}
|
|
@@ -115,7 +115,7 @@ export async function produceNoteDaos(
|
|
|
115
115
|
} else {
|
|
116
116
|
const { noteHashIndex, nonce, innerNoteHash } = await findNoteIndexAndNullifier(
|
|
117
117
|
simulator,
|
|
118
|
-
|
|
118
|
+
noteHashes,
|
|
119
119
|
txHash,
|
|
120
120
|
payload,
|
|
121
121
|
excludedIndices,
|
|
@@ -148,7 +148,7 @@ export async function produceNoteDaos(
|
|
|
148
148
|
payload.storageSlot,
|
|
149
149
|
payload.noteTypeId,
|
|
150
150
|
txHash,
|
|
151
|
-
|
|
151
|
+
noteHashes,
|
|
152
152
|
dataStartIndexForTx,
|
|
153
153
|
);
|
|
154
154
|
}
|
|
@@ -936,6 +936,7 @@ export class PXEService implements PXE {
|
|
|
936
936
|
const decodedEvents = unencryptedLogs
|
|
937
937
|
.map(unencryptedLog => {
|
|
938
938
|
const unencryptedLogBuf = unencryptedLog.log.data;
|
|
939
|
+
// We are assuming here that event logs are the last 4 bytes of the event. This is not enshrined but is a function of aztec.nr raw log emission.
|
|
939
940
|
if (
|
|
940
941
|
!EventSelector.fromBuffer(unencryptedLogBuf.subarray(unencryptedLogBuf.byteLength - 4)).equals(
|
|
941
942
|
eventMetadata.eventSelector,
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type PrivateCircuitPublicInputs, PrivateKernelInitHints } from '@aztec/circuits.js';
|
|
2
|
-
export declare function buildPrivateKernelInitHints(publicInputs: PrivateCircuitPublicInputs, noteHashNullifierCounterMap: Map<number, number>): PrivateKernelInitHints;
|
|
3
|
-
//# sourceMappingURL=build_private_kernel_init_hints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_private_kernel_init_hints.d.ts","sourceRoot":"","sources":["../../../src/kernel_prover/private_inputs_builders/build_private_kernel_init_hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAC/B,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAG5B,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,0BAA0B,EACxC,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,0BAOjD"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PrivateKernelInitHints, } from '@aztec/circuits.js';
|
|
2
|
-
export function buildPrivateKernelInitHints(publicInputs, noteHashNullifierCounterMap) {
|
|
3
|
-
const nullifierCounters = publicInputs.newNoteHashes.map(n => noteHashNullifierCounterMap.get(n.counter) ?? 0);
|
|
4
|
-
return new PrivateKernelInitHints(nullifierCounters);
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRfcHJpdmF0ZV9rZXJuZWxfaW5pdF9oaW50cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9rZXJuZWxfcHJvdmVyL3ByaXZhdGVfaW5wdXRzX2J1aWxkZXJzL2J1aWxkX3ByaXZhdGVfa2VybmVsX2luaXRfaGludHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUdMLHNCQUFzQixHQUN2QixNQUFNLG9CQUFvQixDQUFDO0FBRzVCLE1BQU0sVUFBVSwyQkFBMkIsQ0FDekMsWUFBd0MsRUFDeEMsMkJBQWdEO0lBRWhELE1BQU0saUJBQWlCLEdBQUcsWUFBWSxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQ3RELENBQUMsQ0FBQyxFQUFFLENBQUMsMkJBQTJCLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQ0MsQ0FBQztJQUV4RCxPQUFPLElBQUksc0JBQXNCLENBQUMsaUJBQWlCLENBQUMsQ0FBQztBQUN2RCxDQUFDIn0=
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type PrivateCircuitPublicInputs, PrivateKernelInnerHints } from '@aztec/circuits.js';
|
|
2
|
-
export declare function buildPrivateKernelInnerHints(publicInputs: PrivateCircuitPublicInputs, noteHashNullifierCounterMap: Map<number, number>): PrivateKernelInnerHints;
|
|
3
|
-
//# sourceMappingURL=build_private_kernel_inner_hints.d.ts.map
|
package/dest/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_private_kernel_inner_hints.d.ts","sourceRoot":"","sources":["../../../src/kernel_prover/private_inputs_builders/build_private_kernel_inner_hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAC/B,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAG5B,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,0BAA0B,EACxC,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,2BAOjD"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PrivateKernelInnerHints, } from '@aztec/circuits.js';
|
|
2
|
-
export function buildPrivateKernelInnerHints(publicInputs, noteHashNullifierCounterMap) {
|
|
3
|
-
const nullifierCounters = publicInputs.newNoteHashes.map(n => noteHashNullifierCounterMap.get(n.counter) ?? 0);
|
|
4
|
-
return new PrivateKernelInnerHints(nullifierCounters);
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRfcHJpdmF0ZV9rZXJuZWxfaW5uZXJfaGludHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMva2VybmVsX3Byb3Zlci9wcml2YXRlX2lucHV0c19idWlsZGVycy9idWlsZF9wcml2YXRlX2tlcm5lbF9pbm5lcl9oaW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBR0wsdUJBQXVCLEdBQ3hCLE1BQU0sb0JBQW9CLENBQUM7QUFHNUIsTUFBTSxVQUFVLDRCQUE0QixDQUMxQyxZQUF3QyxFQUN4QywyQkFBZ0Q7SUFFaEQsTUFBTSxpQkFBaUIsR0FBRyxZQUFZLENBQUMsYUFBYSxDQUFDLEdBQUcsQ0FDdEQsQ0FBQyxDQUFDLEVBQUUsQ0FBQywyQkFBMkIsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FDQyxDQUFDO0lBRXhELE9BQU8sSUFBSSx1QkFBdUIsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO0FBQ3hELENBQUMifQ==
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, NoteLogHash, PrivateKernelResetOutputs, ScopedNoteHash, ScopedNullifier } from '@aztec/circuits.js';
|
|
2
|
-
import { type Tuple } from '@aztec/foundation/serialize';
|
|
3
|
-
export declare function buildPrivateKernelResetOutputs(prevNoteHashes: Tuple<ScopedNoteHash, typeof MAX_NEW_NOTE_HASHES_PER_TX>, prevNullifiers: Tuple<ScopedNullifier, typeof MAX_NEW_NULLIFIERS_PER_TX>, prevLogs: Tuple<NoteLogHash, typeof MAX_NOTE_ENCRYPTED_LOGS_PER_TX>, transientNullifierIndexesForNoteHashes: Tuple<number, typeof MAX_NEW_NOTE_HASHES_PER_TX>, transientNoteHashIndexesForNullifiers: Tuple<number, typeof MAX_NEW_NULLIFIERS_PER_TX>): PrivateKernelResetOutputs;
|
|
4
|
-
//# sourceMappingURL=build_private_kernel_reset_outputs.d.ts.map
|
package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_private_kernel_reset_outputs.d.ts","sourceRoot":"","sources":["../../../src/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,8BAA8B,EAC9B,WAAW,EACX,yBAAyB,EACzB,cAAc,EACd,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,OAAO,0BAA0B,CAAC,EACxE,cAAc,EAAE,KAAK,CAAC,eAAe,EAAE,OAAO,yBAAyB,CAAC,EACxE,QAAQ,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,8BAA8B,CAAC,EACnE,sCAAsC,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,0BAA0B,CAAC,EACxF,qCAAqC,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,yBAAyB,CAAC,6BA2BvF"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_ENCRYPTED_LOGS_PER_TX, NoteLogHash, PrivateKernelResetOutputs, ScopedNoteHash, ScopedNullifier, } from '@aztec/circuits.js';
|
|
2
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
-
export function buildPrivateKernelResetOutputs(prevNoteHashes, prevNullifiers, prevLogs, transientNullifierIndexesForNoteHashes, transientNoteHashIndexesForNullifiers) {
|
|
4
|
-
// Propagate note hashes that are not going to be squashed in the transient arrays.
|
|
5
|
-
// A value isn't going to be squashed if the symmetrical index in the corresponding array is the length of the array.
|
|
6
|
-
const noteHashes = padArrayEnd(prevNoteHashes.filter((_, index) => transientNullifierIndexesForNoteHashes[index] === MAX_NEW_NULLIFIERS_PER_TX), ScopedNoteHash.empty(), MAX_NEW_NOTE_HASHES_PER_TX);
|
|
7
|
-
const nullifiers = padArrayEnd(prevNullifiers.filter((_, index) => transientNoteHashIndexesForNullifiers[index] === MAX_NEW_NOTE_HASHES_PER_TX), ScopedNullifier.empty(), MAX_NEW_NULLIFIERS_PER_TX);
|
|
8
|
-
const nullifiedNotes = prevNoteHashes
|
|
9
|
-
.filter((_, index) => transientNullifierIndexesForNoteHashes[index] < MAX_NEW_NULLIFIERS_PER_TX)
|
|
10
|
-
.map(n => n.counter);
|
|
11
|
-
const logs = padArrayEnd(prevLogs.filter(l => !l.isEmpty() && !nullifiedNotes.includes(l.noteHashCounter)), NoteLogHash.empty(), MAX_NOTE_ENCRYPTED_LOGS_PER_TX);
|
|
12
|
-
return new PrivateKernelResetOutputs(noteHashes, nullifiers, logs);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRfcHJpdmF0ZV9rZXJuZWxfcmVzZXRfb3V0cHV0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9rZXJuZWxfcHJvdmVyL3ByaXZhdGVfaW5wdXRzX2J1aWxkZXJzL2J1aWxkX3ByaXZhdGVfa2VybmVsX3Jlc2V0X291dHB1dHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLDBCQUEwQixFQUMxQix5QkFBeUIsRUFDekIsOEJBQThCLEVBQzlCLFdBQVcsRUFDWCx5QkFBeUIsRUFDekIsY0FBYyxFQUNkLGVBQWUsR0FDaEIsTUFBTSxvQkFBb0IsQ0FBQztBQUM1QixPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFHM0QsTUFBTSxVQUFVLDhCQUE4QixDQUM1QyxjQUF3RSxFQUN4RSxjQUF3RSxFQUN4RSxRQUFtRSxFQUNuRSxzQ0FBd0YsRUFDeEYscUNBQXNGO0lBRXRGLG1GQUFtRjtJQUNuRixxSEFBcUg7SUFDckgsTUFBTSxVQUFVLEdBQUcsV0FBVyxDQUM1QixjQUFjLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLEtBQUssRUFBRSxFQUFFLENBQUMsc0NBQXNDLENBQUMsS0FBSyxDQUFDLEtBQUsseUJBQXlCLENBQUMsRUFDaEgsY0FBYyxDQUFDLEtBQUssRUFBRSxFQUN0QiwwQkFBMEIsQ0FDM0IsQ0FBQztJQUVGLE1BQU0sVUFBVSxHQUFHLFdBQVcsQ0FDNUIsY0FBYyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsRUFBRSxLQUFLLEVBQUUsRUFBRSxDQUFDLHFDQUFxQyxDQUFDLEtBQUssQ0FBQyxLQUFLLDBCQUEwQixDQUFDLEVBQ2hILGVBQWUsQ0FBQyxLQUFLLEVBQUUsRUFDdkIseUJBQXlCLENBQzFCLENBQUM7SUFFRixNQUFNLGNBQWMsR0FBRyxjQUFjO1NBQ2xDLE1BQU0sQ0FBQyxDQUFDLENBQUMsRUFBRSxLQUFLLEVBQUUsRUFBRSxDQUFDLHNDQUFzQyxDQUFDLEtBQUssQ0FBQyxHQUFHLHlCQUF5QixDQUFDO1NBQy9GLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUV2QixNQUFNLElBQUksR0FBRyxXQUFXLENBQ3RCLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLGVBQWUsQ0FBQyxDQUFDLEVBQ2pGLFdBQVcsQ0FBQyxLQUFLLEVBQUUsRUFDbkIsOEJBQThCLENBQy9CLENBQUM7SUFFRixPQUFPLElBQUkseUJBQXlCLENBQUMsVUFBVSxFQUFFLFVBQVUsRUFBRSxJQUFJLENBQUMsQ0FBQztBQUNyRSxDQUFDIn0=
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type MAX_NEW_NOTE_HASHES_PER_CALL,
|
|
3
|
-
type PrivateCircuitPublicInputs,
|
|
4
|
-
PrivateKernelInitHints,
|
|
5
|
-
} from '@aztec/circuits.js';
|
|
6
|
-
import { type Tuple } from '@aztec/foundation/serialize';
|
|
7
|
-
|
|
8
|
-
export function buildPrivateKernelInitHints(
|
|
9
|
-
publicInputs: PrivateCircuitPublicInputs,
|
|
10
|
-
noteHashNullifierCounterMap: Map<number, number>,
|
|
11
|
-
) {
|
|
12
|
-
const nullifierCounters = publicInputs.newNoteHashes.map(
|
|
13
|
-
n => noteHashNullifierCounterMap.get(n.counter) ?? 0,
|
|
14
|
-
) as Tuple<number, typeof MAX_NEW_NOTE_HASHES_PER_CALL>;
|
|
15
|
-
|
|
16
|
-
return new PrivateKernelInitHints(nullifierCounters);
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type MAX_NEW_NOTE_HASHES_PER_CALL,
|
|
3
|
-
type PrivateCircuitPublicInputs,
|
|
4
|
-
PrivateKernelInnerHints,
|
|
5
|
-
} from '@aztec/circuits.js';
|
|
6
|
-
import { type Tuple } from '@aztec/foundation/serialize';
|
|
7
|
-
|
|
8
|
-
export function buildPrivateKernelInnerHints(
|
|
9
|
-
publicInputs: PrivateCircuitPublicInputs,
|
|
10
|
-
noteHashNullifierCounterMap: Map<number, number>,
|
|
11
|
-
) {
|
|
12
|
-
const nullifierCounters = publicInputs.newNoteHashes.map(
|
|
13
|
-
n => noteHashNullifierCounterMap.get(n.counter) ?? 0,
|
|
14
|
-
) as Tuple<number, typeof MAX_NEW_NOTE_HASHES_PER_CALL>;
|
|
15
|
-
|
|
16
|
-
return new PrivateKernelInnerHints(nullifierCounters);
|
|
17
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MAX_NEW_NOTE_HASHES_PER_TX,
|
|
3
|
-
MAX_NEW_NULLIFIERS_PER_TX,
|
|
4
|
-
MAX_NOTE_ENCRYPTED_LOGS_PER_TX,
|
|
5
|
-
NoteLogHash,
|
|
6
|
-
PrivateKernelResetOutputs,
|
|
7
|
-
ScopedNoteHash,
|
|
8
|
-
ScopedNullifier,
|
|
9
|
-
} from '@aztec/circuits.js';
|
|
10
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
11
|
-
import { type Tuple } from '@aztec/foundation/serialize';
|
|
12
|
-
|
|
13
|
-
export function buildPrivateKernelResetOutputs(
|
|
14
|
-
prevNoteHashes: Tuple<ScopedNoteHash, typeof MAX_NEW_NOTE_HASHES_PER_TX>,
|
|
15
|
-
prevNullifiers: Tuple<ScopedNullifier, typeof MAX_NEW_NULLIFIERS_PER_TX>,
|
|
16
|
-
prevLogs: Tuple<NoteLogHash, typeof MAX_NOTE_ENCRYPTED_LOGS_PER_TX>,
|
|
17
|
-
transientNullifierIndexesForNoteHashes: Tuple<number, typeof MAX_NEW_NOTE_HASHES_PER_TX>,
|
|
18
|
-
transientNoteHashIndexesForNullifiers: Tuple<number, typeof MAX_NEW_NULLIFIERS_PER_TX>,
|
|
19
|
-
) {
|
|
20
|
-
// Propagate note hashes that are not going to be squashed in the transient arrays.
|
|
21
|
-
// A value isn't going to be squashed if the symmetrical index in the corresponding array is the length of the array.
|
|
22
|
-
const noteHashes = padArrayEnd(
|
|
23
|
-
prevNoteHashes.filter((_, index) => transientNullifierIndexesForNoteHashes[index] === MAX_NEW_NULLIFIERS_PER_TX),
|
|
24
|
-
ScopedNoteHash.empty(),
|
|
25
|
-
MAX_NEW_NOTE_HASHES_PER_TX,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const nullifiers = padArrayEnd(
|
|
29
|
-
prevNullifiers.filter((_, index) => transientNoteHashIndexesForNullifiers[index] === MAX_NEW_NOTE_HASHES_PER_TX),
|
|
30
|
-
ScopedNullifier.empty(),
|
|
31
|
-
MAX_NEW_NULLIFIERS_PER_TX,
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const nullifiedNotes = prevNoteHashes
|
|
35
|
-
.filter((_, index) => transientNullifierIndexesForNoteHashes[index] < MAX_NEW_NULLIFIERS_PER_TX)
|
|
36
|
-
.map(n => n.counter);
|
|
37
|
-
|
|
38
|
-
const logs = padArrayEnd(
|
|
39
|
-
prevLogs.filter(l => !l.isEmpty() && !nullifiedNotes.includes(l.noteHashCounter)),
|
|
40
|
-
NoteLogHash.empty(),
|
|
41
|
-
MAX_NOTE_ENCRYPTED_LOGS_PER_TX,
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
return new PrivateKernelResetOutputs(noteHashes, nullifiers, logs);
|
|
45
|
-
}
|