-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: configure prover as separate process
- Loading branch information
Showing
24 changed files
with
287 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { type ProvingJobSource } from '@aztec/circuit-types'; | ||
import { ProverPool, createProvingJobSourceClient } from '@aztec/prover-client/prover-pool'; | ||
|
||
import { type ServiceStarter, parseModuleOptions } from '../util.js'; | ||
|
||
type ProverOptions = Partial<{ | ||
proverUrl: string; | ||
agents: string; | ||
acvmBinaryPath?: string; | ||
bbBinaryPath?: string; | ||
simulate?: string; | ||
}>; | ||
|
||
export const startProver: ServiceStarter = async (options, signalHandlers, logger) => { | ||
const proverOptions: ProverOptions = parseModuleOptions(options.prover); | ||
let source: ProvingJobSource; | ||
|
||
if (typeof proverOptions.proverUrl === 'string') { | ||
logger(`Connecting to prover at ${proverOptions.proverUrl}`); | ||
source = createProvingJobSourceClient(proverOptions.proverUrl, 'provingJobSource'); | ||
} else { | ||
throw new Error('Starting prover without an orchestrator is not supported'); | ||
} | ||
|
||
const agentCount = proverOptions.agents ? parseInt(proverOptions.agents, 10) : 1; | ||
if (agentCount === 0 || !Number.isSafeInteger(agentCount)) { | ||
throw new Error('Cannot start prover without agents'); | ||
} | ||
|
||
let pool: ProverPool; | ||
if (proverOptions.simulate) { | ||
pool = ProverPool.testPool(undefined, agentCount); | ||
} else if (proverOptions.acvmBinaryPath && proverOptions.bbBinaryPath) { | ||
pool = ProverPool.nativePool( | ||
{ | ||
acvmBinaryPath: proverOptions.acvmBinaryPath, | ||
bbBinaryPath: proverOptions.bbBinaryPath, | ||
}, | ||
agentCount, | ||
); | ||
} else { | ||
throw new Error('Cannot start prover without simulation or native prover options'); | ||
} | ||
|
||
logger(`Starting ${agentCount} prover agents`); | ||
await pool.start(source); | ||
signalHandlers.push(() => pool.stop()); | ||
|
||
return Promise.resolve([]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,9 @@ | |
{ | ||
"path": "../protocol-contracts" | ||
}, | ||
{ | ||
"path": "../prover-client" | ||
}, | ||
{ | ||
"path": "../pxe" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './prover-agent.js'; | ||
export * from './memory-proving-queue.js'; | ||
export * from './prover-pool.js'; | ||
export * from './rpc.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.