@aztec/pxe 0.76.4 → 0.77.0-testnet-ignition.21
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/bin/index.js +4 -6
- package/dest/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +20 -23
- package/dest/config/package_info.js +4 -2
- package/dest/contract_data_oracle/index.d.ts +10 -10
- package/dest/contract_data_oracle/index.d.ts.map +1 -1
- package/dest/contract_data_oracle/index.js +74 -89
- package/dest/contract_data_oracle/private_functions_tree.d.ts +5 -4
- package/dest/contract_data_oracle/private_functions_tree.d.ts.map +1 -1
- package/dest/contract_data_oracle/private_functions_tree.js +47 -51
- package/dest/database/contracts/contract_artifact_db.d.ts +2 -2
- package/dest/database/contracts/contract_artifact_db.d.ts.map +1 -1
- package/dest/database/contracts/contract_artifact_db.js +3 -2
- package/dest/database/contracts/contract_instance_db.d.ts +2 -1
- package/dest/database/contracts/contract_instance_db.d.ts.map +1 -1
- package/dest/database/contracts/contract_instance_db.js +3 -2
- package/dest/database/index.js +0 -1
- package/dest/database/kv_pxe_database.d.ts +9 -5
- package/dest/database/kv_pxe_database.d.ts.map +1 -1
- package/dest/database/kv_pxe_database.js +244 -257
- package/dest/database/note_dao.d.ts +13 -10
- package/dest/database/note_dao.d.ts.map +1 -1
- package/dest/database/note_dao.js +35 -48
- package/dest/database/outgoing_note_dao.d.ts +6 -3
- package/dest/database/outgoing_note_dao.d.ts.map +1 -1
- package/dest/database/outgoing_note_dao.js +25 -37
- package/dest/database/pxe_database.d.ts +12 -8
- package/dest/database/pxe_database.d.ts.map +1 -1
- package/dest/database/pxe_database.js +4 -2
- package/dest/database/pxe_database_test_suite.d.ts +1 -1
- package/dest/database/pxe_database_test_suite.d.ts.map +1 -1
- package/dest/database/pxe_database_test_suite.js +286 -147
- package/dest/index.d.ts +1 -6
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -7
- package/dest/kernel_oracle/index.d.ts +20 -10
- package/dest/kernel_oracle/index.d.ts.map +1 -1
- package/dest/kernel_oracle/index.js +32 -9
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +71 -67
- package/dest/kernel_prover/hints/index.js +0 -1
- package/dest/kernel_prover/index.js +0 -1
- package/dest/kernel_prover/kernel_prover.d.ts +6 -6
- package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
- package/dest/kernel_prover/kernel_prover.js +98 -81
- package/dest/kernel_prover/proving_data_oracle.d.ts +15 -7
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -1
- package/dest/kernel_prover/proving_data_oracle.js +4 -2
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +3 -2
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +1 -1
- package/dest/note_decryption_utils/add_public_values_to_payload.js +11 -12
- package/dest/pxe_http/index.js +0 -1
- package/dest/pxe_http/pxe_http_server.d.ts +1 -1
- package/dest/pxe_http/pxe_http_server.d.ts.map +1 -1
- package/dest/pxe_http/pxe_http_server.js +9 -7
- package/dest/pxe_service/error_enriching.d.ts +3 -3
- package/dest/pxe_service/error_enriching.d.ts.map +1 -1
- package/dest/pxe_service/error_enriching.js +14 -17
- package/dest/pxe_service/index.d.ts +0 -1
- package/dest/pxe_service/index.d.ts.map +1 -1
- package/dest/pxe_service/index.js +0 -2
- package/dest/pxe_service/pxe_service.d.ts +21 -12
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +279 -333
- package/dest/pxe_service/test/pxe_test_suite.d.ts +1 -1
- package/dest/pxe_service/test/pxe_test_suite.d.ts.map +1 -1
- package/dest/pxe_service/test/pxe_test_suite.js +44 -28
- package/dest/simulator/index.d.ts +3 -3
- package/dest/simulator/index.d.ts.map +1 -1
- package/dest/simulator/index.js +1 -3
- package/dest/simulator_oracle/index.d.ts +18 -6
- package/dest/simulator_oracle/index.d.ts.map +1 -1
- package/dest/simulator_oracle/index.js +307 -235
- package/dest/simulator_oracle/tagging_utils.d.ts +2 -1
- package/dest/simulator_oracle/tagging_utils.d.ts.map +1 -1
- package/dest/simulator_oracle/tagging_utils.js +5 -7
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +7 -4
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +64 -43
- package/dest/utils/create_pxe_service.d.ts +2 -2
- package/dest/utils/create_pxe_service.d.ts.map +1 -1
- package/dest/utils/create_pxe_service.js +13 -11
- package/package.json +18 -19
- package/src/bin/index.ts +1 -1
- package/src/config/index.ts +3 -3
- package/src/contract_data_oracle/index.ts +20 -20
- package/src/contract_data_oracle/private_functions_tree.ts +6 -7
- package/src/database/contracts/contract_artifact_db.ts +2 -2
- package/src/database/contracts/contract_instance_db.ts +2 -1
- package/src/database/kv_pxe_database.ts +33 -32
- package/src/database/note_dao.ts +11 -8
- package/src/database/outgoing_note_dao.ts +7 -4
- package/src/database/pxe_database.ts +13 -15
- package/src/database/pxe_database_test_suite.ts +8 -11
- package/src/index.ts +1 -7
- package/src/kernel_oracle/index.ts +55 -22
- package/src/kernel_prover/hints/build_private_kernel_reset_private_inputs.ts +14 -11
- package/src/kernel_prover/kernel_prover.ts +89 -69
- package/src/kernel_prover/proving_data_oracle.ts +20 -20
- package/src/note_decryption_utils/add_public_values_to_payload.ts +5 -4
- package/src/pxe_http/pxe_http_server.ts +1 -1
- package/src/pxe_service/error_enriching.ts +6 -6
- package/src/pxe_service/index.ts +0 -1
- package/src/pxe_service/pxe_service.ts +121 -224
- package/src/pxe_service/test/pxe_test_suite.ts +6 -3
- package/src/simulator/index.ts +3 -3
- package/src/simulator_oracle/index.ts +77 -47
- package/src/simulator_oracle/tagging_utils.ts +2 -1
- package/src/synchronizer/synchronizer.ts +31 -12
- package/src/utils/create_pxe_service.ts +16 -4
|
@@ -1,45 +1,47 @@
|
|
|
1
|
+
import { CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
|
|
3
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { assertLength } from '@aztec/foundation/serialize';
|
|
6
|
+
import { pushTestData } from '@aztec/foundation/testing';
|
|
7
|
+
import { Timer } from '@aztec/foundation/timer';
|
|
8
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
|
+
import { getProtocolContractLeafAndMembershipWitness, protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
10
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
+
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
12
|
+
import { hashVK } from '@aztec/stdlib/hash';
|
|
13
|
+
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
1
14
|
import {
|
|
2
|
-
type PrivateCallExecutionResult,
|
|
3
|
-
type PrivateExecutionResult,
|
|
4
|
-
type PrivateKernelProver,
|
|
5
|
-
type PrivateKernelSimulateOutput,
|
|
6
|
-
collectEnqueuedPublicFunctionCalls,
|
|
7
|
-
collectNoteHashLeafIndexMap,
|
|
8
|
-
collectNoteHashNullifierCounterMap,
|
|
9
|
-
collectPublicTeardownFunctionCall,
|
|
10
|
-
getFinalMinRevertibleSideEffectCounter,
|
|
11
|
-
} from '@aztec/circuit-types';
|
|
12
|
-
import {
|
|
13
|
-
CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS,
|
|
14
|
-
ClientIvcProof,
|
|
15
|
-
Fr,
|
|
16
15
|
PrivateCallData,
|
|
17
16
|
PrivateKernelCircuitPublicInputs,
|
|
18
17
|
PrivateKernelData,
|
|
19
18
|
PrivateKernelInitCircuitPrivateInputs,
|
|
20
19
|
PrivateKernelInnerCircuitPrivateInputs,
|
|
20
|
+
type PrivateKernelSimulateOutput,
|
|
21
21
|
PrivateKernelTailCircuitPrivateInputs,
|
|
22
22
|
type PrivateKernelTailCircuitPublicInputs,
|
|
23
|
-
|
|
23
|
+
PrivateVerificationKeyHints,
|
|
24
24
|
type ScopedPrivateLogData,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
} from '@aztec/stdlib/kernel';
|
|
26
|
+
import type { PrivateLog } from '@aztec/stdlib/logs';
|
|
27
|
+
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
28
|
+
import {
|
|
29
|
+
type PrivateCallExecutionResult,
|
|
30
|
+
type PrivateExecutionResult,
|
|
31
|
+
TxRequest,
|
|
32
|
+
collectEnqueuedPublicFunctionCalls,
|
|
33
|
+
collectNoteHashLeafIndexMap,
|
|
34
|
+
collectNoteHashNullifierCounterMap,
|
|
35
|
+
collectPublicTeardownFunctionCall,
|
|
36
|
+
getFinalMinRevertibleSideEffectCounter,
|
|
37
|
+
} from '@aztec/stdlib/tx';
|
|
38
|
+
import { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
37
39
|
|
|
38
|
-
import {
|
|
40
|
+
import type { WitnessMap } from '@noir-lang/types';
|
|
39
41
|
import { strict as assert } from 'assert';
|
|
40
42
|
|
|
41
43
|
import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
|
|
42
|
-
import {
|
|
44
|
+
import type { ProvingDataOracle } from './proving_data_oracle.js';
|
|
43
45
|
|
|
44
46
|
// TODO(#10592): Temporary workaround to check that the private logs are correctly split into non-revertible set and revertible set.
|
|
45
47
|
// This should be done in TailToPublicOutputValidator in private kernel tail.
|
|
@@ -87,8 +89,8 @@ const NULL_PROVE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicI
|
|
|
87
89
|
|
|
88
90
|
export type ProvingConfig = {
|
|
89
91
|
simulate: boolean;
|
|
92
|
+
skipFeeEnforcement: boolean;
|
|
90
93
|
profile: boolean;
|
|
91
|
-
dryRun: boolean;
|
|
92
94
|
};
|
|
93
95
|
|
|
94
96
|
/**
|
|
@@ -115,20 +117,20 @@ export class KernelProver {
|
|
|
115
117
|
* @param txRequest - The authenticated transaction request object.
|
|
116
118
|
* @param executionResult - The execution result object containing nested executions and preimages.
|
|
117
119
|
* @param profile - Set true to profile the gate count for each circuit
|
|
118
|
-
* @param dryRun - Set true to skip the IVC proof generation (only simulation is run). Useful for profiling gate count without proof gen.
|
|
119
120
|
* @returns A Promise that resolves to a KernelProverOutput object containing proof, public inputs, and output notes.
|
|
120
121
|
* TODO(#7368) this should be refactored to not recreate the ACIR bytecode now that it operates on a program stack
|
|
121
122
|
*/
|
|
122
123
|
async prove(
|
|
123
124
|
txRequest: TxRequest,
|
|
124
125
|
executionResult: PrivateExecutionResult,
|
|
125
|
-
{ simulate,
|
|
126
|
+
{ simulate, skipFeeEnforcement, profile }: ProvingConfig = {
|
|
127
|
+
simulate: false,
|
|
128
|
+
skipFeeEnforcement: false,
|
|
129
|
+
profile: false,
|
|
130
|
+
},
|
|
126
131
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
simulate = simulate || this.fakeProofs;
|
|
132
|
+
const skipProofGeneration = this.fakeProofs || simulate;
|
|
133
|
+
const generateWitnesses = !skipProofGeneration || profile;
|
|
132
134
|
|
|
133
135
|
const timer = new Timer();
|
|
134
136
|
|
|
@@ -144,7 +146,7 @@ export class KernelProver {
|
|
|
144
146
|
const gateCount = (await this.proofCreator.computeGateCountForCircuit(bytecode, circuitName)) as number;
|
|
145
147
|
gateCounts.push({ circuitName, gateCount });
|
|
146
148
|
|
|
147
|
-
this.log.
|
|
149
|
+
this.log.debug(`Gate count for ${circuitName} - ${gateCount}`);
|
|
148
150
|
};
|
|
149
151
|
|
|
150
152
|
const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
|
|
@@ -167,9 +169,9 @@ export class KernelProver {
|
|
|
167
169
|
);
|
|
168
170
|
while (resetBuilder.needsReset()) {
|
|
169
171
|
const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
|
|
170
|
-
output =
|
|
171
|
-
? await this.proofCreator.
|
|
172
|
-
: await this.proofCreator.
|
|
172
|
+
output = generateWitnesses
|
|
173
|
+
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
174
|
+
: await this.proofCreator.simulateReset(privateInputs);
|
|
173
175
|
// TODO(#7368) consider refactoring this redundant bytecode pushing
|
|
174
176
|
acirs.push(output.bytecode);
|
|
175
177
|
witnessStack.push(output.outputWitness);
|
|
@@ -220,9 +222,9 @@ export class KernelProver {
|
|
|
220
222
|
|
|
221
223
|
pushTestData('private-kernel-inputs-init', proofInput);
|
|
222
224
|
|
|
223
|
-
output =
|
|
224
|
-
? await this.proofCreator.
|
|
225
|
-
: await this.proofCreator.
|
|
225
|
+
output = generateWitnesses
|
|
226
|
+
? await this.proofCreator.generateInitOutput(proofInput)
|
|
227
|
+
: await this.proofCreator.simulateInit(proofInput);
|
|
226
228
|
|
|
227
229
|
acirs.push(output.bytecode);
|
|
228
230
|
witnessStack.push(output.outputWitness);
|
|
@@ -241,9 +243,9 @@ export class KernelProver {
|
|
|
241
243
|
|
|
242
244
|
pushTestData('private-kernel-inputs-inner', proofInput);
|
|
243
245
|
|
|
244
|
-
output =
|
|
245
|
-
? await this.proofCreator.
|
|
246
|
-
: await this.proofCreator.
|
|
246
|
+
output = generateWitnesses
|
|
247
|
+
? await this.proofCreator.generateInnerOutput(proofInput)
|
|
248
|
+
: await this.proofCreator.simulateInner(proofInput);
|
|
247
249
|
|
|
248
250
|
acirs.push(output.bytecode);
|
|
249
251
|
witnessStack.push(output.outputWitness);
|
|
@@ -263,9 +265,9 @@ export class KernelProver {
|
|
|
263
265
|
);
|
|
264
266
|
while (resetBuilder.needsReset()) {
|
|
265
267
|
const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
|
|
266
|
-
output =
|
|
267
|
-
? await this.proofCreator.
|
|
268
|
-
: await this.proofCreator.
|
|
268
|
+
output = generateWitnesses
|
|
269
|
+
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
270
|
+
: await this.proofCreator.simulateReset(privateInputs);
|
|
269
271
|
|
|
270
272
|
acirs.push(output.bytecode);
|
|
271
273
|
witnessStack.push(output.outputWitness);
|
|
@@ -281,6 +283,12 @@ export class KernelProver {
|
|
|
281
283
|
);
|
|
282
284
|
}
|
|
283
285
|
|
|
286
|
+
if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
|
|
287
|
+
if (!skipProofGeneration) {
|
|
288
|
+
throw new Error('Fee payment must be enforced when creating real proof.');
|
|
289
|
+
}
|
|
290
|
+
output.publicInputs.feePayer = new AztecAddress(Fr.MAX_FIELD_VALUE);
|
|
291
|
+
}
|
|
284
292
|
// Private tail.
|
|
285
293
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey);
|
|
286
294
|
const previousKernelData = new PrivateKernelData(
|
|
@@ -298,9 +306,9 @@ export class KernelProver {
|
|
|
298
306
|
|
|
299
307
|
pushTestData('private-kernel-inputs-ordering', privateInputs);
|
|
300
308
|
|
|
301
|
-
const tailOutput =
|
|
302
|
-
? await this.proofCreator.
|
|
303
|
-
: await this.proofCreator.
|
|
309
|
+
const tailOutput = generateWitnesses
|
|
310
|
+
? await this.proofCreator.generateTailOutput(privateInputs)
|
|
311
|
+
: await this.proofCreator.simulateTail(privateInputs);
|
|
304
312
|
if (tailOutput.publicInputs.forPublic) {
|
|
305
313
|
const privateLogs = privateInputs.previousKernel.publicInputs.end.privateLogs;
|
|
306
314
|
const nonRevertiblePrivateLogs = tailOutput.publicInputs.forPublic.nonRevertibleAccumulatedData.privateLogs;
|
|
@@ -315,12 +323,12 @@ export class KernelProver {
|
|
|
315
323
|
tailOutput.profileResult = { gateCounts };
|
|
316
324
|
}
|
|
317
325
|
|
|
318
|
-
if (
|
|
326
|
+
if (generateWitnesses) {
|
|
319
327
|
this.log.info(`Private kernel witness generation took ${timer.ms()}ms`);
|
|
320
328
|
}
|
|
321
329
|
|
|
322
330
|
// TODO(#7368) how do we 'bincode' encode these inputs?
|
|
323
|
-
if (!
|
|
331
|
+
if (!skipProofGeneration) {
|
|
324
332
|
const ivcProof = await this.proofCreator.createClientIvcProof(acirs, witnessStack);
|
|
325
333
|
tailOutput.clientIvcProof = ivcProof;
|
|
326
334
|
} else {
|
|
@@ -336,34 +344,46 @@ export class KernelProver {
|
|
|
336
344
|
const vkAsFields = await vkAsFieldsMegaHonk(vkAsBuffer);
|
|
337
345
|
const vk = new VerificationKeyAsFields(vkAsFields, await hashVK(vkAsFields));
|
|
338
346
|
|
|
347
|
+
const { currentContractClassId, publicKeys, saltedInitializationHash } =
|
|
348
|
+
await this.oracle.getContractAddressPreimage(contractAddress);
|
|
339
349
|
const functionLeafMembershipWitness = await this.oracle.getFunctionMembershipWitness(
|
|
340
|
-
|
|
350
|
+
currentContractClassId,
|
|
341
351
|
functionSelector,
|
|
342
352
|
);
|
|
343
|
-
|
|
344
|
-
contractAddress,
|
|
345
|
-
);
|
|
353
|
+
|
|
346
354
|
const { artifactHash: contractClassArtifactHash, publicBytecodeCommitment: contractClassPublicBytecodeCommitment } =
|
|
347
|
-
await this.oracle.getContractClassIdPreimage(
|
|
355
|
+
await this.oracle.getContractClassIdPreimage(currentContractClassId);
|
|
348
356
|
|
|
349
357
|
// TODO(#262): Use real acir hash
|
|
350
358
|
// const acirHash = keccak256(Buffer.from(bytecode, 'hex'));
|
|
351
359
|
const acirHash = Fr.fromBuffer(Buffer.alloc(32, 0));
|
|
352
360
|
|
|
361
|
+
// This will be the address computed in the kernel by the executed class. We need to provide non membership of it in the protocol contract tree.
|
|
362
|
+
// This would only be equal to contractAddress if the currentClassId is equal to the original class id (no update happened).
|
|
363
|
+
const computedAddress = await computeContractAddressFromInstance({
|
|
364
|
+
originalContractClassId: currentContractClassId,
|
|
365
|
+
saltedInitializationHash,
|
|
366
|
+
publicKeys,
|
|
367
|
+
});
|
|
368
|
+
|
|
353
369
|
const { lowLeaf: protocolContractLeaf, witness: protocolContractMembershipWitness } =
|
|
354
|
-
await getProtocolContractLeafAndMembershipWitness(contractAddress);
|
|
370
|
+
await getProtocolContractLeafAndMembershipWitness(contractAddress, computedAddress);
|
|
355
371
|
|
|
372
|
+
const updatedClassIdHints = await this.oracle.getUpdatedClassIdHints(contractAddress);
|
|
356
373
|
return PrivateCallData.from({
|
|
357
374
|
publicInputs,
|
|
358
375
|
vk,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
376
|
+
verificationKeyHints: PrivateVerificationKeyHints.from({
|
|
377
|
+
publicKeys,
|
|
378
|
+
contractClassArtifactHash,
|
|
379
|
+
contractClassPublicBytecodeCommitment,
|
|
380
|
+
saltedInitializationHash,
|
|
381
|
+
functionLeafMembershipWitness,
|
|
382
|
+
protocolContractMembershipWitness,
|
|
383
|
+
protocolContractLeaf,
|
|
384
|
+
acirHash,
|
|
385
|
+
updatedClassIdHints,
|
|
386
|
+
}),
|
|
367
387
|
});
|
|
368
388
|
}
|
|
369
389
|
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type PublicKeys,
|
|
11
|
-
type VK_TREE_HEIGHT,
|
|
12
|
-
type VerificationKeyAsFields,
|
|
13
|
-
} from '@aztec/circuits.js';
|
|
14
|
-
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
1
|
+
import type { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
|
|
3
|
+
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
|
+
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
7
|
+
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
8
|
+
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
9
|
+
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
15
10
|
|
|
16
11
|
/**
|
|
17
12
|
* Provides functionality to fetch membership witnesses for verification keys,
|
|
@@ -19,9 +14,12 @@ import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
|
19
14
|
*/
|
|
20
15
|
export interface ProvingDataOracle {
|
|
21
16
|
/** Retrieves the preimage of a contract address from the registered contract instances db. */
|
|
22
|
-
getContractAddressPreimage(
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
getContractAddressPreimage(address: AztecAddress): Promise<{
|
|
18
|
+
saltedInitializationHash: Fr;
|
|
19
|
+
publicKeys: PublicKeys;
|
|
20
|
+
currentContractClassId: Fr;
|
|
21
|
+
originalContractClassId: Fr;
|
|
22
|
+
}>;
|
|
25
23
|
|
|
26
24
|
/** Retrieves the preimage of a contract class id from the contract classes db. */
|
|
27
25
|
getContractClassIdPreimage(
|
|
@@ -29,16 +27,16 @@ export interface ProvingDataOracle {
|
|
|
29
27
|
): Promise<{ artifactHash: Fr; publicBytecodeCommitment: Fr; privateFunctionsRoot: Fr }>;
|
|
30
28
|
|
|
31
29
|
/**
|
|
32
|
-
* Retrieve the function membership witness for the given contract
|
|
30
|
+
* Retrieve the function membership witness for the given contract class and function selector.
|
|
33
31
|
* The function membership witness represents a proof that the function belongs to the specified contract.
|
|
34
32
|
* Throws an error if the contract address or function selector is unknown.
|
|
35
33
|
*
|
|
36
|
-
* @param
|
|
34
|
+
* @param contractClassId - The id of the class.
|
|
37
35
|
* @param selector - The function selector.
|
|
38
36
|
* @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
|
|
39
37
|
*/
|
|
40
38
|
getFunctionMembershipWitness(
|
|
41
|
-
|
|
39
|
+
contractClassId: Fr,
|
|
42
40
|
selector: FunctionSelector,
|
|
43
41
|
): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
|
|
44
42
|
|
|
@@ -80,4 +78,6 @@ export interface ProvingDataOracle {
|
|
|
80
78
|
getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar>;
|
|
81
79
|
|
|
82
80
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
81
|
+
|
|
82
|
+
getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
|
|
83
83
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type L1NotePayload, Note } from '@aztec/circuit-types';
|
|
2
1
|
import { ContractNotFoundError } from '@aztec/simulator/client';
|
|
2
|
+
import type { L1NotePayload } from '@aztec/stdlib/logs';
|
|
3
|
+
import { Note } from '@aztec/stdlib/note';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import type { PxeDatabase } from '../database/pxe_database.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Merges privately and publicly delivered note values.
|
|
@@ -24,10 +25,10 @@ export async function getOrderedNoteItems(
|
|
|
24
25
|
);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
const artifact = await db.getContractArtifact(instance.
|
|
28
|
+
const artifact = await db.getContractArtifact(instance.currentContractClassId);
|
|
28
29
|
if (!artifact) {
|
|
29
30
|
throw new Error(
|
|
30
|
-
`Could not find artifact for contract class ${instance.
|
|
31
|
+
`Could not find artifact for contract class ${instance.currentContractClassId.toString()}. This should never happen here as the partial notes flow should be triggered only for non-deferred notes.`,
|
|
31
32
|
);
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type PXE, PXESchema } from '@aztec/circuit-types';
|
|
2
1
|
import { createNamespacedSafeJsonRpcServer, createSafeJsonRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
2
|
+
import { type PXE, PXESchema } from '@aztec/stdlib/interfaces/client';
|
|
3
3
|
|
|
4
4
|
import http from 'http';
|
|
5
5
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PUBLIC_DISPATCH_SELECTOR } from '@aztec/circuits.js/constants';
|
|
3
|
-
import { FunctionSelector } from '@aztec/foundation/abi';
|
|
4
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
1
|
+
import { PUBLIC_DISPATCH_SELECTOR } from '@aztec/constants';
|
|
5
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
6
|
-
import {
|
|
3
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
7
4
|
import { resolveAssertionMessageFromRevertData, resolveOpcodeLocations } from '@aztec/simulator/client';
|
|
5
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
+
import { type SimulationError, isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import type { ContractDataOracle, PxeDatabase } from '../index.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Adds contract and function names to a simulation error, if they
|
package/src/pxe_service/index.ts
CHANGED