-
Notifications
You must be signed in to change notification settings - Fork 234
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
16 changed files
with
186 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export { getSimulationProvider } from './aztec-node/simulator-factory.js'; | ||
|
||
export * from './aztec-node/config.js'; | ||
export * from './aztec-node/server.js'; | ||
export * from './aztec-node/http_rpc_server.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
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,34 @@ | ||
import { getSimulationProvider } from '@aztec/aztec-node'; | ||
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<{ | ||
jobsUrl: string; | ||
agents: string; | ||
}>; | ||
|
||
export const startProver: ServiceStarter = async (options, signalHandlers, logger) => { | ||
const proverOptions: ProverOptions = parseModuleOptions(options.prover); | ||
let source: ProvingJobSource; | ||
|
||
if (typeof proverOptions.jobsUrl === 'string') { | ||
logger(`Connecting to prover at ${proverOptions.jobsUrl}`); | ||
source = createProvingJobSourceClient(proverOptions.jobsUrl, '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'); | ||
} | ||
|
||
logger(`Starting ${agentCount} prover agents`); | ||
const pool = ProverPool.testPool(await getSimulationProvider(options), agentCount); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { type ProvingJobSource } from '@aztec/circuit-types'; | ||
import { | ||
BaseOrMergeRollupPublicInputs, | ||
BaseParityInputs, | ||
BaseRollupInputs, | ||
MergeRollupInputs, | ||
ParityPublicInputs, | ||
Proof, | ||
PublicKernelCircuitPrivateInputs, | ||
RootParityInputs, | ||
RootRollupInputs, | ||
RootRollupPublicInputs, | ||
} from '@aztec/circuits.js'; | ||
import { createJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client'; | ||
import { JsonRpcServer } from '@aztec/foundation/json-rpc/server'; | ||
|
||
export function createProvingJobSourceServer(queue: ProvingJobSource): JsonRpcServer { | ||
return new JsonRpcServer( | ||
queue, | ||
{ | ||
BaseParityInputs, | ||
BaseOrMergeRollupPublicInputs, | ||
BaseRollupInputs, | ||
MergeRollupInputs, | ||
ParityPublicInputs, | ||
Proof, | ||
RootParityInputs, | ||
RootRollupInputs, | ||
RootRollupPublicInputs, | ||
PublicKernelCircuitPrivateInputs, | ||
}, | ||
{}, | ||
); | ||
} | ||
|
||
export function createProvingJobSourceClient( | ||
url: string, | ||
namespace?: string, | ||
fetch = makeFetch([1, 2, 3], false), | ||
): ProvingJobSource { | ||
return createJsonRpcClient( | ||
url, | ||
{ | ||
BaseParityInputs, | ||
BaseOrMergeRollupPublicInputs, | ||
BaseRollupInputs, | ||
MergeRollupInputs, | ||
ParityPublicInputs, | ||
Proof, | ||
RootParityInputs, | ||
RootRollupInputs, | ||
RootRollupPublicInputs, | ||
PublicKernelCircuitPrivateInputs, | ||
}, | ||
{}, | ||
false, | ||
namespace, | ||
fetch, | ||
) as ProvingJobSource; | ||
} |
Oops, something went wrong.