Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
saleel committed Mar 3, 2025
1 parent 629b3c5 commit c81d259
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
39 changes: 17 additions & 22 deletions yarn-project/pxe/src/kernel_prover/kernel_prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class KernelProver {
profile: false,
},
): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>> {
const skipWitnessGeneration = simulate && !profile;
const generateWitnesses = profile || !simulate;
const skipProofGeneration = this.fakeProofs || simulate;

const timer = new Timer();
Expand Down Expand Up @@ -169,10 +169,9 @@ export class KernelProver {
);
while (resetBuilder.needsReset()) {
const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
output =
skipWitnessGeneration
? await this.proofCreator.simulateReset(privateInputs)
: await this.proofCreator.generateResetOutput(privateInputs);
output = generateWitnesses
? await this.proofCreator.generateResetOutput(privateInputs)
: await this.proofCreator.simulateReset(privateInputs);
// TODO(#7368) consider refactoring this redundant bytecode pushing
acirs.push(output.bytecode);
witnessStack.push(output.outputWitness);
Expand Down Expand Up @@ -223,10 +222,9 @@ export class KernelProver {

pushTestData('private-kernel-inputs-init', proofInput);

output =
skipWitnessGeneration
? await this.proofCreator.simulateInit(proofInput)
: await this.proofCreator.generateInitOutput(proofInput);
output = generateWitnesses
? await this.proofCreator.generateInitOutput(proofInput)
: await this.proofCreator.simulateInit(proofInput);

acirs.push(output.bytecode);
witnessStack.push(output.outputWitness);
Expand All @@ -245,10 +243,9 @@ export class KernelProver {

pushTestData('private-kernel-inputs-inner', proofInput);

output =
skipWitnessGeneration
? await this.proofCreator.simulateInner(proofInput)
: await this.proofCreator.generateInnerOutput(proofInput);
output = generateWitnesses
? await this.proofCreator.generateInnerOutput(proofInput)
: await this.proofCreator.simulateInner(proofInput);

acirs.push(output.bytecode);
witnessStack.push(output.outputWitness);
Expand All @@ -268,10 +265,9 @@ export class KernelProver {
);
while (resetBuilder.needsReset()) {
const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
output =
skipWitnessGeneration
? await this.proofCreator.simulateReset(privateInputs)
: await this.proofCreator.generateResetOutput(privateInputs);
output = generateWitnesses
? await this.proofCreator.generateResetOutput(privateInputs)
: await this.proofCreator.simulateReset(privateInputs);

acirs.push(output.bytecode);
witnessStack.push(output.outputWitness);
Expand Down Expand Up @@ -310,10 +306,9 @@ export class KernelProver {

pushTestData('private-kernel-inputs-ordering', privateInputs);

const tailOutput =
skipWitnessGeneration
? await this.proofCreator.simulateTail(privateInputs)
: await this.proofCreator.generateTailOutput(privateInputs);
const tailOutput = generateWitnesses
? await this.proofCreator.generateTailOutput(privateInputs)
: await this.proofCreator.simulateTail(privateInputs);
if (tailOutput.publicInputs.forPublic) {
const privateLogs = privateInputs.previousKernel.publicInputs.end.privateLogs;
const nonRevertiblePrivateLogs = tailOutput.publicInputs.forPublic.nonRevertibleAccumulatedData.privateLogs;
Expand All @@ -328,7 +323,7 @@ export class KernelProver {
tailOutput.profileResult = { gateCounts };
}

if (!skipWitnessGeneration) {
if (generateWitnesses) {
this.log.info(`Private kernel witness generation took ${timer.ms()}ms`);
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/pxe_service/pxe_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export class PXEService implements PXE {
const privateExecutionResult = await this.#executePrivate(txRequest, msgSender, scopes);

const { publicInputs, profileResult } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
simulate: true,
simulate: !profile,
skipFeeEnforcement,
profile,
});
Expand Down

0 comments on commit c81d259

Please sign in to comment.