@aztec/prover-client 0.42.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ import {
9
9
  } from '@aztec/circuit-types/interfaces';
10
10
  import { type Fr, type GlobalVariables, type Header, type VerificationKeys } from '@aztec/circuits.js';
11
11
  import { NativeACVMSimulator } from '@aztec/simulator';
12
+ import { type TelemetryClient } from '@aztec/telemetry-client';
12
13
  import { type WorldStateSynchronizer } from '@aztec/world-state';
13
14
 
14
15
  import { type ProverClientConfig } from '../config.js';
@@ -21,17 +22,24 @@ import { ProverAgent } from '../prover-agent/prover-agent.js';
21
22
  */
22
23
  export class TxProver implements ProverClient {
23
24
  private orchestrator: ProvingOrchestrator;
24
- private queue = new MemoryProvingQueue();
25
+ private queue: MemoryProvingQueue;
25
26
  private running = false;
26
27
 
27
28
  private constructor(
28
29
  private config: ProverClientConfig,
29
30
  private worldStateSynchronizer: WorldStateSynchronizer,
30
31
  private vks: VerificationKeys,
32
+ private telemetry: TelemetryClient,
31
33
  private agent?: ProverAgent,
32
34
  initialHeader?: Header,
33
35
  ) {
34
- this.orchestrator = new ProvingOrchestrator(worldStateSynchronizer.getLatest(), this.queue, initialHeader);
36
+ this.queue = new MemoryProvingQueue(config.proverJobTimeoutMs, config.proverJobPollIntervalMs);
37
+ this.orchestrator = new ProvingOrchestrator(
38
+ worldStateSynchronizer.getLatest(),
39
+ this.queue,
40
+ telemetry,
41
+ initialHeader,
42
+ );
35
43
  }
36
44
 
37
45
  async updateProverConfig(config: Partial<ProverClientConfig & { vks: VerificationKeys }>): Promise<void> {
@@ -42,7 +50,7 @@ export class TxProver implements ProverClient {
42
50
  }
43
51
 
44
52
  if (newConfig.realProofs !== this.config.realProofs && this.agent) {
45
- const circuitProver = await TxProver.buildCircuitProver(newConfig);
53
+ const circuitProver = await TxProver.buildCircuitProver(newConfig, this.telemetry);
46
54
  this.agent.setCircuitProver(circuitProver);
47
55
  }
48
56
 
@@ -66,6 +74,7 @@ export class TxProver implements ProverClient {
66
74
  }
67
75
 
68
76
  this.running = true;
77
+ this.queue.start();
69
78
  this.agent?.start(this.queue);
70
79
  return Promise.resolve();
71
80
  }
@@ -79,6 +88,7 @@ export class TxProver implements ProverClient {
79
88
  }
80
89
  this.running = false;
81
90
  await this.agent?.stop();
91
+ await this.queue.stop();
82
92
  }
83
93
 
84
94
  /**
@@ -92,31 +102,35 @@ export class TxProver implements ProverClient {
92
102
  config: ProverClientConfig,
93
103
  vks: VerificationKeys,
94
104
  worldStateSynchronizer: WorldStateSynchronizer,
105
+ telemetry: TelemetryClient,
95
106
  initialHeader?: Header,
96
107
  ) {
97
108
  const agent = config.proverAgentEnabled
98
109
  ? new ProverAgent(
99
- await TxProver.buildCircuitProver(config),
110
+ await TxProver.buildCircuitProver(config, telemetry),
100
111
  config.proverAgentConcurrency,
101
112
  config.proverAgentPollInterval,
102
113
  )
103
114
  : undefined;
104
115
 
105
- const prover = new TxProver(config, worldStateSynchronizer, vks, agent, initialHeader);
116
+ const prover = new TxProver(config, worldStateSynchronizer, vks, telemetry, agent, initialHeader);
106
117
  await prover.start();
107
118
  return prover;
108
119
  }
109
120
 
110
- private static async buildCircuitProver(config: ProverClientConfig): Promise<ServerCircuitProver> {
121
+ private static async buildCircuitProver(
122
+ config: ProverClientConfig,
123
+ telemetry: TelemetryClient,
124
+ ): Promise<ServerCircuitProver> {
111
125
  if (config.realProofs) {
112
- return await BBNativeRollupProver.new(config);
126
+ return await BBNativeRollupProver.new(config, telemetry);
113
127
  }
114
128
 
115
129
  const simulationProvider = config.acvmBinaryPath
116
130
  ? new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath)
117
131
  : undefined;
118
132
 
119
- return new TestCircuitProver(simulationProvider);
133
+ return new TestCircuitProver(telemetry, simulationProvider);
120
134
  }
121
135
 
122
136
  /**