-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR refactors the types of the prover broker and agent config to reuse more of the existing helpers. Built on top of #10981 Fix #10267
- Loading branch information
Showing
17 changed files
with
145 additions
and
153 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 |
---|---|---|
@@ -1,3 +1 @@ | ||
export { ProverAgentConfig, proverAgentConfigMappings } from './interfaces/prover-agent.js'; | ||
export { ProverBrokerConfig, proverBrokerConfigMappings } from './interfaces/prover-broker.js'; | ||
export { SequencerConfig, AllowedElement, SequencerConfigSchema } from './interfaces/configs.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
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,93 @@ | ||
import { ProvingRequestType } from '@aztec/circuit-types'; | ||
import { type ConfigMappingsType, booleanConfigHelper, numberConfigHelper } from '@aztec/foundation/config'; | ||
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config'; | ||
|
||
import { z } from 'zod'; | ||
|
||
export const ProverBrokerConfig = z.object({ | ||
/** If starting a prover broker locally, the max number of retries per proving job */ | ||
proverBrokerJobMaxRetries: z.number(), | ||
/** If starting a prover broker locally, the time after which a job times out and gets assigned to a different agent */ | ||
proverBrokerJobTimeoutMs: z.number(), | ||
/** If starting a prover broker locally, the interval the broker checks for timed out jobs */ | ||
proverBrokerPollIntervalMs: z.number(), | ||
/** If starting a prover broker locally, the directory to store broker data */ | ||
dataDirectory: z.string().optional(), | ||
/** The size of the data store map */ | ||
dataStoreMapSizeKB: z.number(), | ||
}); | ||
|
||
export type ProverBrokerConfig = z.infer<typeof ProverBrokerConfig> & | ||
Pick<DataStoreConfig, 'dataStoreMapSizeKB' | 'dataDirectory'>; | ||
|
||
export const proverBrokerConfigMappings: ConfigMappingsType<ProverBrokerConfig> = { | ||
proverBrokerJobTimeoutMs: { | ||
env: 'PROVER_BROKER_JOB_TIMEOUT_MS', | ||
description: 'Jobs are retried if not kept alive for this long', | ||
...numberConfigHelper(30_000), | ||
}, | ||
proverBrokerPollIntervalMs: { | ||
env: 'PROVER_BROKER_POLL_INTERVAL_MS', | ||
description: 'The interval to check job health status', | ||
...numberConfigHelper(1_000), | ||
}, | ||
proverBrokerJobMaxRetries: { | ||
env: 'PROVER_BROKER_JOB_MAX_RETRIES', | ||
description: 'If starting a prover broker locally, the max number of retries per proving job', | ||
...numberConfigHelper(3), | ||
}, | ||
...dataConfigMappings, | ||
}; | ||
|
||
export const ProverAgentConfig = z.object({ | ||
/** The number of prover agents to start */ | ||
proverAgentCount: z.number(), | ||
/** The types of proofs the prover agent can generate */ | ||
proverAgentProofTypes: z.array(z.nativeEnum(ProvingRequestType)), | ||
/** How often the prover agents poll for jobs */ | ||
proverAgentPollIntervalMs: z.number(), | ||
/** The URL where this agent takes jobs from */ | ||
proverBrokerUrl: z.string().optional(), | ||
/** Whether to construct real proofs */ | ||
realProofs: z.boolean(), | ||
/** Artificial delay to introduce to all operations to the test prover. */ | ||
proverTestDelayMs: z.number(), | ||
}); | ||
|
||
export type ProverAgentConfig = z.infer<typeof ProverAgentConfig>; | ||
|
||
export const proverAgentConfigMappings: ConfigMappingsType<ProverAgentConfig> = { | ||
proverAgentCount: { | ||
env: 'PROVER_AGENT_COUNT', | ||
description: 'Whether this prover has a local prover agent', | ||
...numberConfigHelper(1), | ||
}, | ||
proverAgentPollIntervalMs: { | ||
env: 'PROVER_AGENT_POLL_INTERVAL_MS', | ||
description: 'The interval agents poll for jobs at', | ||
...numberConfigHelper(100), | ||
}, | ||
proverAgentProofTypes: { | ||
env: 'PROVER_AGENT_PROOF_TYPES', | ||
description: 'The types of proofs the prover agent can generate', | ||
parseEnv: (val: string) => | ||
val | ||
.split(',') | ||
.map(v => ProvingRequestType[v as any]) | ||
.filter(v => typeof v === 'number'), | ||
}, | ||
proverBrokerUrl: { | ||
env: 'PROVER_BROKER_HOST', | ||
description: 'The URL where this agent takes jobs from', | ||
}, | ||
realProofs: { | ||
env: 'PROVER_REAL_PROOFS', | ||
description: 'Whether to construct real proofs', | ||
...booleanConfigHelper(false), | ||
}, | ||
proverTestDelayMs: { | ||
env: 'PROVER_TEST_DELAY_MS', | ||
description: 'Artificial delay to introduce to all operations to the test prover.', | ||
...numberConfigHelper(0), | ||
}, | ||
}; |
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
Oops, something went wrong.