Skip to content

Commit

Permalink
refactor: replace queue with facade over CircuitProver
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Apr 24, 2024
1 parent 81b6c03 commit 871786b
Show file tree
Hide file tree
Showing 14 changed files with 408 additions and 403 deletions.
1 change: 1 addition & 0 deletions yarn-project/circuit-types/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export * from './configs.js';
export * from './nullifier_tree.js';
export * from './public_data_tree.js';
export * from './prover-client.js';
export * from './proving-job.js';
export * from './block-prover.js';
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { type PublicKernelNonTailRequest, type PublicKernelTailRequest } from '@aztec/circuit-types';
import {
type BaseOrMergeRollupPublicInputs,
type BaseParityInputs,
Expand All @@ -13,6 +12,13 @@ import {
type RootRollupPublicInputs,
} from '@aztec/circuits.js';

import type { PublicKernelNonTailRequest, PublicKernelTailRequest } from '../tx/processed_tx.js';

export type ProvingJob<T extends ProvingRequest> = {
id: string;
request: T;
};

export enum ProvingRequestType {
PUBLIC_VM,

Expand Down Expand Up @@ -79,3 +85,11 @@ export type ProvingRequestPublicInputs = {
};

export type ProvingRequestResult<T extends ProvingRequestType> = [ProvingRequestPublicInputs[T], Proof];

export interface ProvingJobSource {
getProvingJob(): Promise<ProvingJob<ProvingRequest> | null>;

resolveProvingJob<T extends ProvingRequestType>(jobId: string, result: ProvingRequestResult<T>): Promise<void>;

rejectProvingJob(jobId: string, reason: Error): Promise<void>;
}
10 changes: 6 additions & 4 deletions yarn-project/prover-client/src/mocks/test_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import * as fs from 'fs/promises';
import { type MockProxy, mock } from 'jest-mock-extended';

import { ProvingOrchestrator } from '../orchestrator/orchestrator.js';
import { CircuitProverAgent } from '../prover-pool/circuit-prover-agent.js';
import { MemoryProvingQueue } from '../prover-pool/memory-proving-queue.js';
import { ProverAgent } from '../prover-pool/prover-agent.js';
import { ProverPool } from '../prover-pool/prover-pool.js';
import { type BBProverConfig } from '../prover/bb_prover.js';
import { type CircuitProver } from '../prover/interface.js';
Expand Down Expand Up @@ -86,10 +87,11 @@ export class TestContext {
localProver = await createProver(bbConfig);
}

const proverPool = new ProverPool(proverCount, i => new CircuitProverAgent(localProver, 10, `${i}`));
const orchestrator = new ProvingOrchestrator(actualDb, proverPool.queue);
const queue = new MemoryProvingQueue();
const proverPool = new ProverPool(proverCount, i => new ProverAgent(localProver, 10, `${i}`));
const orchestrator = new ProvingOrchestrator(actualDb, queue);

await proverPool.start();
await proverPool.start(queue);

return new this(
publicExecutor,
Expand Down
Loading

0 comments on commit 871786b

Please sign in to comment.