@aztec/pxe 4.1.0-rc.2 → 4.1.0-rc.4
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/contract_function_simulator.js +3 -3
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +7 -3
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +9 -5
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +11 -4
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- 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 +125 -64
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -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 +13 -5
- package/package.json +16 -16
- package/src/contract_function_simulator/contract_function_simulator.ts +3 -10
- package/src/contract_function_simulator/oracle/interfaces.ts +5 -2
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +12 -6
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +157 -110
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +13 -6
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { PrivateCircuitPublicInputs, PrivateKernelCircuitPublicInputs, type PrivateKernelSimulateOutput } from '@aztec/stdlib/kernel';
|
|
4
|
+
import { PrivateCallExecutionResult } from '@aztec/stdlib/tx';
|
|
5
|
+
/** Builder for PrivateKernelCircuitPublicInputs with fluent API for adding side effects. */
|
|
6
|
+
export declare class PrivateKernelCircuitPublicInputsBuilder {
|
|
7
|
+
private contractAddress;
|
|
8
|
+
private noteHashes;
|
|
9
|
+
private nullifiers;
|
|
10
|
+
private noteHashReadRequests;
|
|
11
|
+
private nullifierReadRequests;
|
|
12
|
+
private keyValidationRequests;
|
|
13
|
+
private privateLogs;
|
|
14
|
+
private nextCounter;
|
|
15
|
+
constructor(contractAddress?: AztecAddress, startCounter?: number);
|
|
16
|
+
private getCounter;
|
|
17
|
+
/** Adds a note hash to the accumulated data. Defaults are generated randomly. */
|
|
18
|
+
addNoteHash(opts?: {
|
|
19
|
+
value?: Fr;
|
|
20
|
+
counter?: number;
|
|
21
|
+
contractAddress?: AztecAddress;
|
|
22
|
+
}): this;
|
|
23
|
+
/** Adds a nullifier to the accumulated data. Defaults are generated randomly. */
|
|
24
|
+
addNullifier(opts?: {
|
|
25
|
+
value?: Fr;
|
|
26
|
+
noteHash?: Fr;
|
|
27
|
+
counter?: number;
|
|
28
|
+
contractAddress?: AztecAddress;
|
|
29
|
+
}): this;
|
|
30
|
+
/** Adds a pending note hash read request (non-empty contract address, can match a pending note hash). */
|
|
31
|
+
addPendingNoteHashReadRequest(opts?: {
|
|
32
|
+
value?: Fr;
|
|
33
|
+
counter?: number;
|
|
34
|
+
contractAddress?: AztecAddress;
|
|
35
|
+
}): this;
|
|
36
|
+
/** Adds a settled note hash read request (empty contract address, resolved against the note hash tree). */
|
|
37
|
+
addSettledNoteHashReadRequest(opts?: {
|
|
38
|
+
value?: Fr;
|
|
39
|
+
counter?: number;
|
|
40
|
+
}): this;
|
|
41
|
+
/** Adds a pending nullifier read request (non-empty contract address, can match a pending nullifier). */
|
|
42
|
+
addPendingNullifierReadRequest(opts?: {
|
|
43
|
+
value?: Fr;
|
|
44
|
+
counter?: number;
|
|
45
|
+
contractAddress?: AztecAddress;
|
|
46
|
+
}): this;
|
|
47
|
+
/** Adds a settled nullifier read request (empty contract address, resolved against the nullifier tree). */
|
|
48
|
+
addSettledNullifierReadRequest(opts?: {
|
|
49
|
+
value?: Fr;
|
|
50
|
+
counter?: number;
|
|
51
|
+
}): this;
|
|
52
|
+
/** Adds a key validation request to validation requests. */
|
|
53
|
+
addKeyValidationRequest(opts?: {
|
|
54
|
+
contractAddress?: AztecAddress;
|
|
55
|
+
}): this;
|
|
56
|
+
/** Adds a private log to the accumulated data. Defaults are generated randomly. */
|
|
57
|
+
addPrivateLog(opts?: {
|
|
58
|
+
noteHashCounter?: number;
|
|
59
|
+
counter?: number;
|
|
60
|
+
contractAddress?: AztecAddress;
|
|
61
|
+
}): this;
|
|
62
|
+
/** Builds the PrivateKernelCircuitPublicInputs with all added side effects. */
|
|
63
|
+
build(): PrivateKernelCircuitPublicInputs;
|
|
64
|
+
}
|
|
65
|
+
/** Builder for PrivateCircuitPublicInputs (call-level) with fluent API for adding side effects. */
|
|
66
|
+
export declare class PrivateCircuitPublicInputsBuilder {
|
|
67
|
+
private contractAddress;
|
|
68
|
+
private noteHashes;
|
|
69
|
+
private nullifiers;
|
|
70
|
+
private noteHashReadRequests;
|
|
71
|
+
private nullifierReadRequests;
|
|
72
|
+
private keyValidationRequests;
|
|
73
|
+
private privateLogs;
|
|
74
|
+
private nextCounter;
|
|
75
|
+
constructor(contractAddress?: AztecAddress, startCounter?: number);
|
|
76
|
+
private getCounter;
|
|
77
|
+
/** Adds a note hash. Defaults are generated randomly. */
|
|
78
|
+
addNoteHash(opts?: {
|
|
79
|
+
value?: Fr;
|
|
80
|
+
counter?: number;
|
|
81
|
+
}): this;
|
|
82
|
+
/** Adds a nullifier. Defaults are generated randomly. */
|
|
83
|
+
addNullifier(opts?: {
|
|
84
|
+
value?: Fr;
|
|
85
|
+
noteHash?: Fr;
|
|
86
|
+
counter?: number;
|
|
87
|
+
}): this;
|
|
88
|
+
/** Adds a pending note hash read request (non-empty contract address, can match a pending note hash). */
|
|
89
|
+
addPendingNoteHashReadRequest(opts?: {
|
|
90
|
+
value?: Fr;
|
|
91
|
+
counter?: number;
|
|
92
|
+
}): this;
|
|
93
|
+
/** Adds a settled note hash read request (empty contract address, resolved against the note hash tree). */
|
|
94
|
+
addSettledNoteHashReadRequest(opts?: {
|
|
95
|
+
value?: Fr;
|
|
96
|
+
counter?: number;
|
|
97
|
+
}): this;
|
|
98
|
+
/** Adds a pending nullifier read request (non-empty contract address, can match a pending nullifier). */
|
|
99
|
+
addPendingNullifierReadRequest(opts?: {
|
|
100
|
+
value?: Fr;
|
|
101
|
+
counter?: number;
|
|
102
|
+
}): this;
|
|
103
|
+
/** Adds a settled nullifier read request (empty contract address, resolved against the nullifier tree). */
|
|
104
|
+
addSettledNullifierReadRequest(opts?: {
|
|
105
|
+
value?: Fr;
|
|
106
|
+
counter?: number;
|
|
107
|
+
}): this;
|
|
108
|
+
/** Adds a key validation request. */
|
|
109
|
+
addKeyValidationRequest(): this;
|
|
110
|
+
/** Adds a private log. Defaults are generated randomly. */
|
|
111
|
+
addPrivateLog(opts?: {
|
|
112
|
+
noteHashCounter?: number;
|
|
113
|
+
counter?: number;
|
|
114
|
+
}): this;
|
|
115
|
+
/** Builds the PrivateCircuitPublicInputs with all added side effects. */
|
|
116
|
+
build(): PrivateCircuitPublicInputs;
|
|
117
|
+
}
|
|
118
|
+
/** Wraps a PrivateKernelCircuitPublicInputs in a PrivateKernelSimulateOutput. */
|
|
119
|
+
export declare function makeKernelOutput(publicInputs?: PrivateKernelCircuitPublicInputs): PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>;
|
|
120
|
+
/** Wraps a PrivateCircuitPublicInputs in a PrivateCallExecutionResult. */
|
|
121
|
+
export declare function makeExecutionResult(publicInputs?: PrivateCircuitPublicInputs): PrivateCallExecutionResult;
|
|
122
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdF91dGlscy5kLn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E,KAAK,CAAC,EAAE,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAK5E;IAED,qCAAqC;IACrC,uBAAuB,IAAI,IAAI,CAQ9B;IAED,2DAA2D;IAC3D,aAAa,CAAC,IAAI,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAKzE;IAED,yEAAyE;IACzE,KAAK,IAAI,0BAA0B,CAsBlC;CACF;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAC9B,YAAY,CAAC,EAAE,gCAAgC,GAC9C,2BAA2B,CAAC,gCAAgC,CAAC,CAO/D;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,YAAY,CAAC,EAAE,0BAA0B,GAAG,0BAA0B,CAczG"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_LOGS_PER_CALL, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
+
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
5
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import { ClaimedLengthArray, KeyValidationRequest, KeyValidationRequestAndSeparator, NoteHash, Nullifier, PrivateCircuitPublicInputs, PrivateKernelCircuitPublicInputs, ReadRequest, ScopedKeyValidationRequestAndSeparator, ScopedNoteHash, ScopedNullifier, ScopedReadRequest } from '@aztec/stdlib/kernel';
|
|
7
|
+
import { PrivateLogData, ScopedPrivateLogData } from '@aztec/stdlib/kernel';
|
|
8
|
+
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
9
|
+
import { PrivateCallExecutionResult } from '@aztec/stdlib/tx';
|
|
10
|
+
import { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
11
|
+
const DEFAULT_CONTRACT_ADDRESS = AztecAddress.fromBigInt(987654n);
|
|
12
|
+
/**
|
|
13
|
+
* Builds a ClaimedLengthArray from a list of items, padding to the required size.
|
|
14
|
+
*/ function makeClaimed(items, emptyFactory, maxSize) {
|
|
15
|
+
const padded = makeTuple(maxSize, (i)=>items[i] ?? emptyFactory.empty());
|
|
16
|
+
return new ClaimedLengthArray(padded, items.length);
|
|
17
|
+
}
|
|
18
|
+
/** Builder for PrivateKernelCircuitPublicInputs with fluent API for adding side effects. */ export class PrivateKernelCircuitPublicInputsBuilder {
|
|
19
|
+
contractAddress;
|
|
20
|
+
noteHashes;
|
|
21
|
+
nullifiers;
|
|
22
|
+
noteHashReadRequests;
|
|
23
|
+
nullifierReadRequests;
|
|
24
|
+
keyValidationRequests;
|
|
25
|
+
privateLogs;
|
|
26
|
+
nextCounter;
|
|
27
|
+
constructor(contractAddress = DEFAULT_CONTRACT_ADDRESS, startCounter = 1){
|
|
28
|
+
this.contractAddress = contractAddress;
|
|
29
|
+
this.noteHashes = [];
|
|
30
|
+
this.nullifiers = [];
|
|
31
|
+
this.noteHashReadRequests = [];
|
|
32
|
+
this.nullifierReadRequests = [];
|
|
33
|
+
this.keyValidationRequests = [];
|
|
34
|
+
this.privateLogs = [];
|
|
35
|
+
this.nextCounter = startCounter;
|
|
36
|
+
}
|
|
37
|
+
getCounter(sideEffectCounter) {
|
|
38
|
+
if (sideEffectCounter !== undefined) {
|
|
39
|
+
this.nextCounter = sideEffectCounter + 1;
|
|
40
|
+
return sideEffectCounter;
|
|
41
|
+
}
|
|
42
|
+
return this.nextCounter++;
|
|
43
|
+
}
|
|
44
|
+
/** Adds a note hash to the accumulated data. Defaults are generated randomly. */ addNoteHash(opts) {
|
|
45
|
+
const value = opts?.value ?? Fr.random();
|
|
46
|
+
const counter = this.getCounter(opts?.counter);
|
|
47
|
+
const addr = opts?.contractAddress ?? this.contractAddress;
|
|
48
|
+
this.noteHashes.push(new NoteHash(value, counter).scope(addr));
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
/** Adds a nullifier to the accumulated data. Defaults are generated randomly. */ addNullifier(opts) {
|
|
52
|
+
const value = opts?.value ?? Fr.random();
|
|
53
|
+
const noteHash = opts?.noteHash ?? Fr.ZERO;
|
|
54
|
+
const counter = this.getCounter(opts?.counter);
|
|
55
|
+
const addr = opts?.contractAddress ?? this.contractAddress;
|
|
56
|
+
this.nullifiers.push(new Nullifier(value, noteHash, counter).scope(addr));
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
/** Adds a pending note hash read request (non-empty contract address, can match a pending note hash). */ addPendingNoteHashReadRequest(opts) {
|
|
60
|
+
const value = opts?.value ?? Fr.random();
|
|
61
|
+
const counter = this.getCounter(opts?.counter);
|
|
62
|
+
const addr = opts?.contractAddress ?? this.contractAddress;
|
|
63
|
+
this.noteHashReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), addr));
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
/** Adds a settled note hash read request (empty contract address, resolved against the note hash tree). */ addSettledNoteHashReadRequest(opts) {
|
|
67
|
+
const value = opts?.value ?? Fr.random();
|
|
68
|
+
const counter = this.getCounter(opts?.counter);
|
|
69
|
+
this.noteHashReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), AztecAddress.ZERO));
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
/** Adds a pending nullifier read request (non-empty contract address, can match a pending nullifier). */ addPendingNullifierReadRequest(opts) {
|
|
73
|
+
const value = opts?.value ?? Fr.random();
|
|
74
|
+
const counter = this.getCounter(opts?.counter);
|
|
75
|
+
const addr = opts?.contractAddress ?? this.contractAddress;
|
|
76
|
+
this.nullifierReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), addr));
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
/** Adds a settled nullifier read request (empty contract address, resolved against the nullifier tree). */ addSettledNullifierReadRequest(opts) {
|
|
80
|
+
const value = opts?.value ?? Fr.random();
|
|
81
|
+
const counter = this.getCounter(opts?.counter);
|
|
82
|
+
this.nullifierReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), AztecAddress.ZERO));
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
/** Adds a key validation request to validation requests. */ addKeyValidationRequest(opts) {
|
|
86
|
+
const addr = opts?.contractAddress ?? this.contractAddress;
|
|
87
|
+
this.keyValidationRequests.push(new ScopedKeyValidationRequestAndSeparator(new KeyValidationRequestAndSeparator(new KeyValidationRequest(new Point(Fr.random(), Fr.random(), false), Fr.random()), Fr.random()), addr));
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
/** Adds a private log to the accumulated data. Defaults are generated randomly. */ addPrivateLog(opts) {
|
|
91
|
+
const noteHashCounter = opts?.noteHashCounter ?? 0;
|
|
92
|
+
const counter = this.getCounter(opts?.counter);
|
|
93
|
+
const addr = opts?.contractAddress ?? this.contractAddress;
|
|
94
|
+
this.privateLogs.push(new ScopedPrivateLogData(new PrivateLogData(PrivateLog.empty(), noteHashCounter, counter), addr));
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
/** Builds the PrivateKernelCircuitPublicInputs with all added side effects. */ build() {
|
|
98
|
+
const publicInputs = PrivateKernelCircuitPublicInputs.empty();
|
|
99
|
+
publicInputs.end.noteHashes = makeClaimed(this.noteHashes, ScopedNoteHash, MAX_NOTE_HASHES_PER_TX);
|
|
100
|
+
publicInputs.end.nullifiers = makeClaimed(this.nullifiers, ScopedNullifier, MAX_NULLIFIERS_PER_TX);
|
|
101
|
+
publicInputs.end.privateLogs = makeClaimed(this.privateLogs, ScopedPrivateLogData, MAX_PRIVATE_LOGS_PER_TX);
|
|
102
|
+
publicInputs.validationRequests.noteHashReadRequests = makeClaimed(this.noteHashReadRequests, ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
103
|
+
publicInputs.validationRequests.nullifierReadRequests = makeClaimed(this.nullifierReadRequests, ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
104
|
+
publicInputs.validationRequests.scopedKeyValidationRequestsAndSeparators = makeClaimed(this.keyValidationRequests, ScopedKeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_TX);
|
|
105
|
+
return publicInputs;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** Builder for PrivateCircuitPublicInputs (call-level) with fluent API for adding side effects. */ export class PrivateCircuitPublicInputsBuilder {
|
|
109
|
+
contractAddress;
|
|
110
|
+
noteHashes;
|
|
111
|
+
nullifiers;
|
|
112
|
+
noteHashReadRequests;
|
|
113
|
+
nullifierReadRequests;
|
|
114
|
+
keyValidationRequests;
|
|
115
|
+
privateLogs;
|
|
116
|
+
nextCounter;
|
|
117
|
+
constructor(contractAddress = DEFAULT_CONTRACT_ADDRESS, startCounter = 1){
|
|
118
|
+
this.contractAddress = contractAddress;
|
|
119
|
+
this.noteHashes = [];
|
|
120
|
+
this.nullifiers = [];
|
|
121
|
+
this.noteHashReadRequests = [];
|
|
122
|
+
this.nullifierReadRequests = [];
|
|
123
|
+
this.keyValidationRequests = [];
|
|
124
|
+
this.privateLogs = [];
|
|
125
|
+
this.nextCounter = startCounter;
|
|
126
|
+
}
|
|
127
|
+
getCounter(sideEffectCounter) {
|
|
128
|
+
if (sideEffectCounter !== undefined) {
|
|
129
|
+
this.nextCounter = sideEffectCounter + 1;
|
|
130
|
+
return sideEffectCounter;
|
|
131
|
+
}
|
|
132
|
+
return this.nextCounter++;
|
|
133
|
+
}
|
|
134
|
+
/** Adds a note hash. Defaults are generated randomly. */ addNoteHash(opts) {
|
|
135
|
+
const value = opts?.value ?? Fr.random();
|
|
136
|
+
const counter = this.getCounter(opts?.counter);
|
|
137
|
+
this.noteHashes.push(new NoteHash(value, counter));
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
/** Adds a nullifier. Defaults are generated randomly. */ addNullifier(opts) {
|
|
141
|
+
const value = opts?.value ?? Fr.random();
|
|
142
|
+
const noteHash = opts?.noteHash ?? Fr.ZERO;
|
|
143
|
+
const counter = this.getCounter(opts?.counter);
|
|
144
|
+
this.nullifiers.push(new Nullifier(value, noteHash, counter));
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
/** Adds a pending note hash read request (non-empty contract address, can match a pending note hash). */ addPendingNoteHashReadRequest(opts) {
|
|
148
|
+
const value = opts?.value ?? Fr.random();
|
|
149
|
+
const counter = this.getCounter(opts?.counter);
|
|
150
|
+
this.noteHashReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), this.contractAddress));
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
/** Adds a settled note hash read request (empty contract address, resolved against the note hash tree). */ addSettledNoteHashReadRequest(opts) {
|
|
154
|
+
const value = opts?.value ?? Fr.random();
|
|
155
|
+
const counter = this.getCounter(opts?.counter);
|
|
156
|
+
this.noteHashReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), AztecAddress.ZERO));
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
/** Adds a pending nullifier read request (non-empty contract address, can match a pending nullifier). */ addPendingNullifierReadRequest(opts) {
|
|
160
|
+
const value = opts?.value ?? Fr.random();
|
|
161
|
+
const counter = this.getCounter(opts?.counter);
|
|
162
|
+
this.nullifierReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), this.contractAddress));
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
/** Adds a settled nullifier read request (empty contract address, resolved against the nullifier tree). */ addSettledNullifierReadRequest(opts) {
|
|
166
|
+
const value = opts?.value ?? Fr.random();
|
|
167
|
+
const counter = this.getCounter(opts?.counter);
|
|
168
|
+
this.nullifierReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), AztecAddress.ZERO));
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
/** Adds a key validation request. */ addKeyValidationRequest() {
|
|
172
|
+
this.keyValidationRequests.push(new KeyValidationRequestAndSeparator(new KeyValidationRequest(new Point(Fr.random(), Fr.random(), false), Fr.random()), Fr.random()));
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
175
|
+
/** Adds a private log. Defaults are generated randomly. */ addPrivateLog(opts) {
|
|
176
|
+
const noteHashCounter = opts?.noteHashCounter ?? 0;
|
|
177
|
+
const counter = this.getCounter(opts?.counter);
|
|
178
|
+
this.privateLogs.push(new PrivateLogData(PrivateLog.empty(), noteHashCounter, counter));
|
|
179
|
+
return this;
|
|
180
|
+
}
|
|
181
|
+
/** Builds the PrivateCircuitPublicInputs with all added side effects. */ build() {
|
|
182
|
+
const publicInputs = PrivateCircuitPublicInputs.empty();
|
|
183
|
+
publicInputs.callContext.contractAddress = this.contractAddress;
|
|
184
|
+
publicInputs.noteHashes = makeClaimed(this.noteHashes, NoteHash, MAX_NOTE_HASHES_PER_CALL);
|
|
185
|
+
publicInputs.nullifiers = makeClaimed(this.nullifiers, Nullifier, MAX_NULLIFIERS_PER_CALL);
|
|
186
|
+
publicInputs.privateLogs = makeClaimed(this.privateLogs, PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL);
|
|
187
|
+
publicInputs.noteHashReadRequests = makeClaimed(this.noteHashReadRequests, ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL);
|
|
188
|
+
publicInputs.nullifierReadRequests = makeClaimed(this.nullifierReadRequests, ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL);
|
|
189
|
+
publicInputs.keyValidationRequestsAndSeparators = makeClaimed(this.keyValidationRequests, KeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL);
|
|
190
|
+
return publicInputs;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/** Wraps a PrivateKernelCircuitPublicInputs in a PrivateKernelSimulateOutput. */ export function makeKernelOutput(publicInputs) {
|
|
194
|
+
return {
|
|
195
|
+
publicInputs: publicInputs ?? PrivateKernelCircuitPublicInputs.empty(),
|
|
196
|
+
verificationKey: VerificationKeyData.empty(),
|
|
197
|
+
outputWitness: new Map(),
|
|
198
|
+
bytecode: Buffer.from([])
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/** Wraps a PrivateCircuitPublicInputs in a PrivateCallExecutionResult. */ export function makeExecutionResult(publicInputs) {
|
|
202
|
+
return new PrivateCallExecutionResult(Buffer.alloc(0), Buffer.alloc(0), new Map(), publicInputs ?? PrivateCircuitPublicInputs.empty(), [], new Map(), [], [], [], [], []);
|
|
203
|
+
}
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfZXhlY3V0aW9uX3Byb3Zlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL3ByaXZhdGVfa2VybmVsX2V4ZWN1dGlvbl9wcm92ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFlLEtBQUssY0FBYyxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBTXZGLE9BQU8sS0FBSyxFQUFFLG1CQUFtQix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BQXVCO1lBb0JqQixTQUFTO1lBU1QscUJBQXFCO0NBK0JwQyJ9
|
|
@@ -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,CA2RlF;IAED;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;YAoBjB,SAAS;YAST,qBAAqB;CA+BpC"}
|
|
@@ -67,6 +67,7 @@ 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.
|
|
70
71
|
const witgenTimer = new Timer();
|
|
71
72
|
const privateInputs = await resetBuilder.build(this.oracle);
|
|
72
73
|
output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
|
|
@@ -132,11 +133,19 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
132
133
|
}
|
|
133
134
|
firstIteration = false;
|
|
134
135
|
}
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
// Final reset: include siloing of note hashes, nullifiers and private logs.
|
|
137
|
+
const finalResetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
|
|
138
|
+
if (!finalResetBuilder.needsReset()) {
|
|
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 {
|
|
138
147
|
const witgenTimer = new Timer();
|
|
139
|
-
const privateInputs = await
|
|
148
|
+
const privateInputs = await finalResetBuilder.build(this.oracle);
|
|
140
149
|
output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
|
|
141
150
|
executionSteps.push({
|
|
142
151
|
functionName: 'private_kernel_reset',
|
|
@@ -147,7 +156,6 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
147
156
|
witgen: witgenTimer.ms()
|
|
148
157
|
}
|
|
149
158
|
});
|
|
150
|
-
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
|
|
151
159
|
}
|
|
152
160
|
if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
|
|
153
161
|
if (!skipProofGeneration) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "4.1.0-rc.
|
|
3
|
+
"version": "4.1.0-rc.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"typedocOptions": {
|
|
6
6
|
"entryPoints": [
|
|
@@ -70,19 +70,19 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/bb-prover": "4.1.0-rc.
|
|
74
|
-
"@aztec/bb.js": "4.1.0-rc.
|
|
75
|
-
"@aztec/builder": "4.1.0-rc.
|
|
76
|
-
"@aztec/constants": "4.1.0-rc.
|
|
77
|
-
"@aztec/ethereum": "4.1.0-rc.
|
|
78
|
-
"@aztec/foundation": "4.1.0-rc.
|
|
79
|
-
"@aztec/key-store": "4.1.0-rc.
|
|
80
|
-
"@aztec/kv-store": "4.1.0-rc.
|
|
81
|
-
"@aztec/noir-protocol-circuits-types": "4.1.0-rc.
|
|
82
|
-
"@aztec/noir-types": "4.1.0-rc.
|
|
83
|
-
"@aztec/protocol-contracts": "4.1.0-rc.
|
|
84
|
-
"@aztec/simulator": "4.1.0-rc.
|
|
85
|
-
"@aztec/stdlib": "4.1.0-rc.
|
|
73
|
+
"@aztec/bb-prover": "4.1.0-rc.4",
|
|
74
|
+
"@aztec/bb.js": "4.1.0-rc.4",
|
|
75
|
+
"@aztec/builder": "4.1.0-rc.4",
|
|
76
|
+
"@aztec/constants": "4.1.0-rc.4",
|
|
77
|
+
"@aztec/ethereum": "4.1.0-rc.4",
|
|
78
|
+
"@aztec/foundation": "4.1.0-rc.4",
|
|
79
|
+
"@aztec/key-store": "4.1.0-rc.4",
|
|
80
|
+
"@aztec/kv-store": "4.1.0-rc.4",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "4.1.0-rc.4",
|
|
82
|
+
"@aztec/noir-types": "4.1.0-rc.4",
|
|
83
|
+
"@aztec/protocol-contracts": "4.1.0-rc.4",
|
|
84
|
+
"@aztec/simulator": "4.1.0-rc.4",
|
|
85
|
+
"@aztec/stdlib": "4.1.0-rc.4",
|
|
86
86
|
"koa": "^2.16.1",
|
|
87
87
|
"koa-router": "^13.1.1",
|
|
88
88
|
"lodash.omit": "^4.5.0",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@aztec/merkle-tree": "4.1.0-rc.
|
|
95
|
-
"@aztec/noir-test-contracts.js": "4.1.0-rc.
|
|
94
|
+
"@aztec/merkle-tree": "4.1.0-rc.4",
|
|
95
|
+
"@aztec/noir-test-contracts.js": "4.1.0-rc.4",
|
|
96
96
|
"@jest/globals": "^30.0.0",
|
|
97
97
|
"@types/jest": "^30.0.0",
|
|
98
98
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -689,6 +689,7 @@ function squashTransientSideEffects(
|
|
|
689
689
|
scopedNullifiersCLA,
|
|
690
690
|
/*futureNoteHashReads=*/ [],
|
|
691
691
|
/*futureNullifierReads=*/ [],
|
|
692
|
+
/*futureLogs=*/ [],
|
|
692
693
|
noteHashNullifierCounterMap,
|
|
693
694
|
minRevertibleSideEffectCounter,
|
|
694
695
|
);
|
|
@@ -731,16 +732,8 @@ async function verifyReadRequests(
|
|
|
731
732
|
nullifierReadRequests.length,
|
|
732
733
|
);
|
|
733
734
|
|
|
734
|
-
const noteHashResetActions = getNoteHashReadRequestResetActions(
|
|
735
|
-
|
|
736
|
-
scopedNoteHashesCLA,
|
|
737
|
-
/*futureNoteHashes=*/ [],
|
|
738
|
-
);
|
|
739
|
-
const nullifierResetActions = getNullifierReadRequestResetActions(
|
|
740
|
-
nullifierReadRequestsCLA,
|
|
741
|
-
scopedNullifiersCLA,
|
|
742
|
-
/*futureNullifiers=*/ [],
|
|
743
|
-
);
|
|
735
|
+
const noteHashResetActions = getNoteHashReadRequestResetActions(noteHashReadRequestsCLA, scopedNoteHashesCLA);
|
|
736
|
+
const nullifierResetActions = getNullifierReadRequestResetActions(nullifierReadRequestsCLA, scopedNullifiersCLA);
|
|
744
737
|
|
|
745
738
|
const settledNoteHashReads: { index: number; value: Fr }[] = [];
|
|
746
739
|
for (let i = 0; i < noteHashResetActions.actions.length; i++) {
|
|
@@ -6,8 +6,9 @@ import { MembershipWitness } from '@aztec/foundation/trees';
|
|
|
6
6
|
import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
7
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
8
|
import { BlockHash } from '@aztec/stdlib/block';
|
|
9
|
-
import type {
|
|
9
|
+
import type { ContractInstance, PartialAddress } from '@aztec/stdlib/contract';
|
|
10
10
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
11
|
+
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
11
12
|
import type { ContractClassLog, Tag } from '@aztec/stdlib/logs';
|
|
12
13
|
import type { Note, NoteStatus } from '@aztec/stdlib/note';
|
|
13
14
|
import { type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
@@ -85,7 +86,9 @@ export interface IUtilityExecutionOracle {
|
|
|
85
86
|
nullifier: Fr,
|
|
86
87
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
87
88
|
utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined>;
|
|
88
|
-
utilityTryGetPublicKeysAndPartialAddress(
|
|
89
|
+
utilityTryGetPublicKeysAndPartialAddress(
|
|
90
|
+
account: AztecAddress,
|
|
91
|
+
): Promise<{ publicKeys: PublicKeys; partialAddress: PartialAddress } | undefined>;
|
|
89
92
|
utilityGetAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
90
93
|
utilityGetNotes(
|
|
91
94
|
owner: AztecAddress | undefined,
|
|
@@ -9,11 +9,11 @@ import type { KeyStore } from '@aztec/key-store';
|
|
|
9
9
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
10
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
11
|
import { BlockHash } from '@aztec/stdlib/block';
|
|
12
|
-
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
12
|
+
import type { CompleteAddress, ContractInstance, PartialAddress } from '@aztec/stdlib/contract';
|
|
13
13
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
14
14
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
15
15
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
16
|
-
import { computeAddressSecret } from '@aztec/stdlib/keys';
|
|
16
|
+
import { type PublicKeys, computeAddressSecret } from '@aztec/stdlib/keys';
|
|
17
17
|
import { deriveEcdhSharedSecret } from '@aztec/stdlib/logs';
|
|
18
18
|
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
19
19
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
@@ -232,12 +232,18 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
|
-
* Retrieve the
|
|
235
|
+
* Retrieve the public keys and partial address associated to a given address.
|
|
236
236
|
* @param account - The account address.
|
|
237
|
-
* @returns
|
|
237
|
+
* @returns The public keys and partial address, or `undefined` if the account is not registered.
|
|
238
238
|
*/
|
|
239
|
-
public utilityTryGetPublicKeysAndPartialAddress(
|
|
240
|
-
|
|
239
|
+
public async utilityTryGetPublicKeysAndPartialAddress(
|
|
240
|
+
account: AztecAddress,
|
|
241
|
+
): Promise<{ publicKeys: PublicKeys; partialAddress: PartialAddress } | undefined> {
|
|
242
|
+
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
243
|
+
if (!completeAddress) {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
return { publicKeys: completeAddress.publicKeys, partialAddress: completeAddress.partialAddress };
|
|
241
247
|
}
|
|
242
248
|
|
|
243
249
|
protected async getCompleteAddressOrFail(account: AztecAddress): Promise<CompleteAddress> {
|