Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add proving queue #5754

Merged
merged 6 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions yarn-project/prover-client/src/mocks/test_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +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 { ProverPool } from '../prover-pool/prover-pool.js';
import { type BBProverConfig } from '../prover/bb_prover.js';
import { type CircuitProver } from '../prover/interface.js';
import { TestCircuitProver } from '../prover/test_circuit_prover.js';
Expand All @@ -35,6 +37,7 @@ export class TestContext {
public globalVariables: GlobalVariables,
public actualDb: MerkleTreeOperations,
public prover: CircuitProver,
public proverPool: ProverPool,
public orchestrator: ProvingOrchestrator,
public blockNumber: number,
public directoriesToCleanup: string[],
Expand All @@ -43,6 +46,7 @@ export class TestContext {

static async new(
logger: DebugLogger,
proverCount = 4,
createProver: (bbConfig: BBProverConfig) => Promise<CircuitProver> = _ =>
Promise.resolve(new TestCircuitProver(new WASMSimulator())),
blockNumber = 3,
Expand Down Expand Up @@ -82,7 +86,10 @@ export class TestContext {
localProver = await createProver(bbConfig);
}

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

await proverPool.start();

return new this(
publicExecutor,
Expand All @@ -93,6 +100,7 @@ export class TestContext {
globalVariables,
actualDb,
localProver,
proverPool,
orchestrator,
blockNumber,
[config?.directoryToCleanup ?? ''],
Expand All @@ -101,7 +109,7 @@ export class TestContext {
}

async cleanup() {
await this.orchestrator.stop();
await this.proverPool.stop();
for (const dir of this.directoriesToCleanup.filter(x => x !== '')) {
await fs.rm(dir, { recursive: true, force: true });
}
Expand Down
Loading
Loading