@aztec/prover-client 0.0.1-commit.d431d1c → 0.0.1-commit.e310a4c8

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.
Files changed (39) hide show
  1. package/dest/light/lightweight_checkpoint_builder.d.ts +9 -6
  2. package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
  3. package/dest/light/lightweight_checkpoint_builder.js +15 -9
  4. package/dest/mocks/fixtures.d.ts +1 -1
  5. package/dest/mocks/fixtures.d.ts.map +1 -1
  6. package/dest/mocks/fixtures.js +2 -1
  7. package/dest/orchestrator/block-building-helpers.js +1 -1
  8. package/dest/orchestrator/orchestrator.d.ts +8 -3
  9. package/dest/orchestrator/orchestrator.d.ts.map +1 -1
  10. package/dest/orchestrator/orchestrator.js +90 -74
  11. package/dest/prover-client/prover-client.d.ts +1 -1
  12. package/dest/prover-client/prover-client.d.ts.map +1 -1
  13. package/dest/prover-client/prover-client.js +7 -4
  14. package/dest/proving_broker/broker_prover_facade.d.ts +4 -3
  15. package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
  16. package/dest/proving_broker/broker_prover_facade.js +3 -3
  17. package/dest/proving_broker/config.d.ts +5 -1
  18. package/dest/proving_broker/config.d.ts.map +1 -1
  19. package/dest/proving_broker/config.js +7 -1
  20. package/dest/proving_broker/proving_agent.d.ts +4 -3
  21. package/dest/proving_broker/proving_agent.d.ts.map +1 -1
  22. package/dest/proving_broker/proving_agent.js +4 -4
  23. package/dest/proving_broker/proving_broker_instrumentation.d.ts +1 -1
  24. package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
  25. package/dest/proving_broker/proving_broker_instrumentation.js +11 -7
  26. package/dest/proving_broker/proving_job_controller.d.ts +4 -3
  27. package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
  28. package/dest/proving_broker/proving_job_controller.js +6 -3
  29. package/package.json +15 -15
  30. package/src/light/lightweight_checkpoint_builder.ts +22 -7
  31. package/src/mocks/fixtures.ts +2 -1
  32. package/src/orchestrator/block-building-helpers.ts +1 -1
  33. package/src/orchestrator/orchestrator.ts +89 -75
  34. package/src/prover-client/prover-client.ts +23 -6
  35. package/src/proving_broker/broker_prover_facade.ts +6 -3
  36. package/src/proving_broker/config.ts +9 -0
  37. package/src/proving_broker/proving_agent.ts +5 -2
  38. package/src/proving_broker/proving_broker_instrumentation.ts +10 -6
  39. package/src/proving_broker/proving_job_controller.ts +9 -3
@@ -100,6 +100,8 @@ export const ProverAgentConfig = z.object({
100
100
  proverTestDelayFactor: z.number(),
101
101
  /** The delay (ms) to inject during fake proof verification */
102
102
  proverTestVerificationDelayMs: z.number().optional(),
103
+ /** Whether to abort pending proving jobs when the orchestrator is cancelled */
104
+ cancelJobsOnStop: z.boolean(),
103
105
  });
104
106
 
105
107
  export type ProverAgentConfig = z.infer<typeof ProverAgentConfig>;
@@ -153,4 +155,11 @@ export const proverAgentConfigMappings: ConfigMappingsType<ProverAgentConfig> =
153
155
  description: 'The delay (ms) to inject during fake proof verification',
154
156
  ...numberConfigHelper(10),
155
157
  },
158
+ cancelJobsOnStop: {
159
+ env: 'PROVER_CANCEL_JOBS_ON_STOP',
160
+ description:
161
+ 'Whether to abort pending proving jobs when the orchestrator is cancelled. ' +
162
+ 'When false (default), jobs remain in the broker queue and can be reused on restart/reorg.',
163
+ ...booleanConfigHelper(false),
164
+ },
156
165
  };
@@ -1,5 +1,5 @@
1
1
  import { AbortError } from '@aztec/foundation/error';
2
- import { createLogger } from '@aztec/foundation/log';
2
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
3
  import { RunningPromise } from '@aztec/foundation/running-promise';
4
4
  import { truncate } from '@aztec/foundation/string';
5
5
  import { ProvingError } from '@aztec/stdlib/errors';
@@ -23,6 +23,7 @@ import { ProvingJobController, ProvingJobControllerStatus } from './proving_job_
23
23
  export class ProvingAgent {
24
24
  private currentJobController?: ProvingJobController;
25
25
  private runningPromise: RunningPromise;
26
+ private log: Logger;
26
27
 
27
28
  constructor(
28
29
  /** The source of proving jobs */
@@ -35,8 +36,9 @@ export class ProvingAgent {
35
36
  private proofAllowList: Array<ProvingRequestType> = [],
36
37
  /** How long to wait between jobs */
37
38
  private pollIntervalMs = 1000,
38
- private log = createLogger('prover-client:proving-agent'),
39
+ bindings?: LoggerBindings,
39
40
  ) {
41
+ this.log = createLogger('prover-client:proving-agent', bindings);
40
42
  this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.pollIntervalMs);
41
43
  }
42
44
 
@@ -159,6 +161,7 @@ export class ProvingAgent {
159
161
  // no need to await this here. The controller will stay alive (in DONE state) until the result is send to the broker
160
162
  void this.runningPromise.trigger();
161
163
  },
164
+ this.log.getBindings(),
162
165
  );
163
166
 
164
167
  if (abortedProofJobId) {
@@ -8,6 +8,7 @@ import {
8
8
  type ObservableResult,
9
9
  type TelemetryClient,
10
10
  type UpDownCounter,
11
+ createUpDownCounterWithDefault,
11
12
  } from '@aztec/telemetry-client';
12
13
 
13
14
  export type MonitorCallback = (proofType: ProvingRequestType) => number;
@@ -31,17 +32,20 @@ export class ProvingBrokerInstrumentation {
31
32
 
32
33
  this.activeJobs = meter.createObservableGauge(Metrics.PROVING_QUEUE_ACTIVE_JOBS);
33
34
 
34
- this.resolvedJobs = meter.createUpDownCounter(Metrics.PROVING_QUEUE_RESOLVED_JOBS);
35
+ const provingJobTypes = Object.values(ProvingRequestType).filter(v => typeof v === 'string');
36
+ const provingJobAttrs = { [Attributes.PROVING_JOB_TYPE]: provingJobTypes };
35
37
 
36
- this.rejectedJobs = meter.createUpDownCounter(Metrics.PROVING_QUEUE_REJECTED_JOBS);
38
+ this.resolvedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RESOLVED_JOBS, provingJobAttrs);
37
39
 
38
- this.retriedJobs = meter.createUpDownCounter(Metrics.PROVING_QUEUE_RETRIED_JOBS);
40
+ this.rejectedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_REJECTED_JOBS, provingJobAttrs);
39
41
 
40
- this.timedOutJobs = meter.createUpDownCounter(Metrics.PROVING_QUEUE_TIMED_OUT_JOBS);
42
+ this.retriedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RETRIED_JOBS, provingJobAttrs);
41
43
 
42
- this.cachedJobs = meter.createUpDownCounter(Metrics.PROVING_QUEUE_CACHED_JOBS);
44
+ this.timedOutJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_TIMED_OUT_JOBS, provingJobAttrs);
43
45
 
44
- this.totalJobs = meter.createUpDownCounter(Metrics.PROVING_QUEUE_TOTAL_JOBS);
46
+ this.cachedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_CACHED_JOBS, provingJobAttrs);
47
+
48
+ this.totalJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_TOTAL_JOBS, provingJobAttrs);
45
49
 
46
50
  this.jobWait = meter.createHistogram(Metrics.PROVING_QUEUE_JOB_WAIT);
47
51
 
@@ -1,7 +1,7 @@
1
1
  import { EpochNumber } from '@aztec/foundation/branded-types';
2
2
  import { randomBytes } from '@aztec/foundation/crypto/random';
3
3
  import { AbortError } from '@aztec/foundation/error';
4
- import { createLogger } from '@aztec/foundation/log';
4
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
5
5
  import type {
6
6
  ProvingJobId,
7
7
  ProvingJobInputs,
@@ -21,6 +21,7 @@ export class ProvingJobController {
21
21
  private promise?: Promise<void>;
22
22
  private abortController = new AbortController();
23
23
  private result?: ProvingJobResultsMap[ProvingRequestType] | Error;
24
+ private log: Logger;
24
25
 
25
26
  constructor(
26
27
  private jobId: ProvingJobId,
@@ -29,8 +30,13 @@ export class ProvingJobController {
29
30
  private startedAt: number,
30
31
  private circuitProver: ServerCircuitProver,
31
32
  private onComplete: () => void,
32
- private log = createLogger('prover-client:proving-agent:job-controller-' + randomBytes(4).toString('hex')),
33
- ) {}
33
+ bindings?: LoggerBindings,
34
+ ) {
35
+ this.log = createLogger('prover-client:proving-agent:job-controller', {
36
+ instanceId: randomBytes(4).toString('hex'),
37
+ ...bindings,
38
+ });
39
+ }
34
40
 
35
41
  public start(): void {
36
42
  if (this.status !== ProvingJobControllerStatus.IDLE) {