Skip to content
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
2 changes: 1 addition & 1 deletion yarn-project/native/src/native_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function cancelSimulation(token: CancellationToken): void {
* Maximum number of concurrent AVM simulations. Each simulation spawns a dedicated OS thread,
* so this controls resource usage. Defaults to 4. Set to 0 for unlimited.
*/
const AVM_MAX_CONCURRENT_SIMULATIONS = parseInt(process.env.AVM_MAX_CONCURRENT_SIMULATIONS ?? '4', 10);
export const AVM_MAX_CONCURRENT_SIMULATIONS = parseInt(process.env.AVM_MAX_CONCURRENT_SIMULATIONS ?? '4', 10);
const avmSimulationSemaphore =
AVM_MAX_CONCURRENT_SIMULATIONS > 0 ? new Semaphore(AVM_MAX_CONCURRENT_SIMULATIONS) : null;

Expand Down
1 change: 1 addition & 0 deletions yarn-project/prover-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@aztec/foundation": "workspace:^",
"@aztec/kv-store": "workspace:^",
"@aztec/l1-artifacts": "workspace:^",
"@aztec/native": "workspace:^",
"@aztec/node-keystore": "workspace:^",
"@aztec/node-lib": "workspace:^",
"@aztec/noir-protocol-circuits-types": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/prover-node/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const specificProverNodeConfigMappings: ConfigMappingsType<SpecificProver
proverNodeMaxParallelBlocksPerEpoch: {
env: 'PROVER_NODE_MAX_PARALLEL_BLOCKS_PER_EPOCH',
description: 'The Maximum number of blocks to process in parallel while proving an epoch',
...numberConfigHelper(32),
...numberConfigHelper(0),
},
proverNodeFailedEpochStore: {
env: 'PROVER_NODE_FAILED_EPOCH_STORE',
Expand Down
10 changes: 9 additions & 1 deletion yarn-project/prover-node/src/job/epoch-proving-job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
import { RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise';
import { Timer } from '@aztec/foundation/timer';
import { AVM_MAX_CONCURRENT_SIMULATIONS } from '@aztec/native';
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
import { protocolContractsHash } from '@aztec/protocol-contracts';
import { buildFinalBlobChallenges } from '@aztec/prover-client/helpers';
Expand Down Expand Up @@ -164,7 +165,14 @@ export class EpochProvingJob implements Traceable {
const previousBlockHeaders = this.gatherPreviousBlockHeaders();

const allCheckpointsTimer = new Timer();
await asyncPool(this.config.parallelBlockLimit ?? 32, this.checkpoints, async checkpoint => {

const parallelism = this.config.parallelBlockLimit
? this.config.parallelBlockLimit
: AVM_MAX_CONCURRENT_SIMULATIONS > 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funky looking logic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It mirrors what we have in the native package :D

? AVM_MAX_CONCURRENT_SIMULATIONS
: this.checkpoints.length;

await asyncPool(parallelism, this.checkpoints, async checkpoint => {
this.checkState();
const checkpointTimer = new Timer();

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/prover-node/src/prover-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
this.config = {
proverNodePollingIntervalMs: 1_000,
proverNodeMaxPendingJobs: 100,
proverNodeMaxParallelBlocksPerEpoch: 32,
proverNodeMaxParallelBlocksPerEpoch: 0,
txGatheringIntervalMs: 1_000,
txGatheringBatchSize: 10,
txGatheringMaxParallelRequestsPerNode: 100,
Expand Down
3 changes: 3 additions & 0 deletions yarn-project/prover-node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
{
"path": "../l1-artifacts"
},
{
"path": "../native"
},
{
"path": "../node-keystore"
},
Expand Down
Loading