@aztec/prover-client 0.0.1-commit.3d8f95d → 0.0.1-commit.3e3d0c9cd

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 (47) hide show
  1. package/dest/light/lightweight_checkpoint_builder.d.ts +10 -5
  2. package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
  3. package/dest/light/lightweight_checkpoint_builder.js +41 -18
  4. package/dest/mocks/test_context.js +6 -3
  5. package/dest/orchestrator/block-building-helpers.d.ts +4 -4
  6. package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
  7. package/dest/orchestrator/block-building-helpers.js +2 -2
  8. package/dest/orchestrator/block-proving-state.d.ts +4 -1
  9. package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
  10. package/dest/orchestrator/block-proving-state.js +7 -0
  11. package/dest/orchestrator/checkpoint-proving-state.d.ts +3 -3
  12. package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
  13. package/dest/orchestrator/checkpoint-proving-state.js +3 -3
  14. package/dest/orchestrator/epoch-proving-state.d.ts +2 -2
  15. package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
  16. package/dest/orchestrator/orchestrator.d.ts +5 -3
  17. package/dest/orchestrator/orchestrator.d.ts.map +1 -1
  18. package/dest/orchestrator/orchestrator.js +64 -57
  19. package/dest/prover-client/prover-client.d.ts +2 -2
  20. package/dest/prover-client/prover-client.d.ts.map +1 -1
  21. package/dest/prover-client/prover-client.js +1 -1
  22. package/dest/proving_broker/broker_prover_facade.d.ts +1 -1
  23. package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
  24. package/dest/proving_broker/broker_prover_facade.js +3 -3
  25. package/dest/proving_broker/config.d.ts +2 -2
  26. package/dest/proving_broker/config.d.ts.map +1 -1
  27. package/dest/proving_broker/config.js +1 -1
  28. package/dest/proving_broker/proving_broker.d.ts +1 -1
  29. package/dest/proving_broker/proving_broker.d.ts.map +1 -1
  30. package/dest/proving_broker/proving_broker.js +7 -3
  31. package/dest/proving_broker/proving_broker_instrumentation.d.ts +3 -1
  32. package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
  33. package/dest/proving_broker/proving_broker_instrumentation.js +7 -0
  34. package/dest/test/mock_prover.d.ts +1 -1
  35. package/package.json +17 -18
  36. package/src/light/lightweight_checkpoint_builder.ts +42 -19
  37. package/src/mocks/test_context.ts +3 -3
  38. package/src/orchestrator/block-building-helpers.ts +2 -2
  39. package/src/orchestrator/block-proving-state.ts +9 -0
  40. package/src/orchestrator/checkpoint-proving-state.ts +4 -4
  41. package/src/orchestrator/epoch-proving-state.ts +1 -1
  42. package/src/orchestrator/orchestrator.ts +72 -63
  43. package/src/prover-client/prover-client.ts +2 -1
  44. package/src/proving_broker/broker_prover_facade.ts +9 -4
  45. package/src/proving_broker/config.ts +1 -1
  46. package/src/proving_broker/proving_broker.ts +7 -2
  47. package/src/proving_broker/proving_broker_instrumentation.ts +9 -0
@@ -54,6 +54,7 @@ export class ProverClient implements EpochProverManager {
54
54
  facade,
55
55
  this.config.proverId,
56
56
  this.config.cancelJobsOnStop,
57
+ this.config.enqueueConcurrency,
57
58
  this.telemetry,
58
59
  bindings,
59
60
  );
@@ -156,7 +157,7 @@ export class ProverClient implements EpochProverManager {
156
157
  }
157
158
 
158
159
  export function buildServerCircuitProver(
159
- config: ActualProverConfig & ACVMConfig & BBConfig,
160
+ config: Omit<ActualProverConfig, 'enqueueConcurrency'> & ACVMConfig & BBConfig,
160
161
  telemetry: TelemetryClient,
161
162
  ): Promise<ServerCircuitProver> {
162
163
  if (config.realProofs) {
@@ -5,7 +5,6 @@ import type {
5
5
  RECURSIVE_PROOF_LENGTH,
6
6
  } from '@aztec/constants';
7
7
  import { EpochNumber } from '@aztec/foundation/branded-types';
8
- import { sha256 } from '@aztec/foundation/crypto/sha256';
9
8
  import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
10
9
  import { type PromiseWithResolvers, RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise';
11
10
  import { truncate } from '@aztec/foundation/string';
@@ -46,6 +45,8 @@ import type {
46
45
  TxRollupPublicInputs,
47
46
  } from '@aztec/stdlib/rollup';
48
47
 
48
+ import { createHash } from 'node:crypto';
49
+
49
50
  import { InlineProofStore, type ProofStore } from './proof_store/index.js';
50
51
 
51
52
  // Perform a snapshot sync every 30 seconds
@@ -659,8 +660,12 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
659
660
  );
660
661
  }
661
662
 
662
- private generateId(type: ProvingRequestType, inputs: { toBuffer(): Buffer }, epochNumber = EpochNumber.ZERO) {
663
- const inputsHash = sha256(inputs.toBuffer());
664
- return makeProvingJobId(epochNumber, type, inputsHash.toString('hex'));
663
+ private generateId(
664
+ type: ProvingRequestType,
665
+ inputs: { toBuffer(): Buffer },
666
+ epochNumber = EpochNumber.ZERO,
667
+ ): ProvingJobId {
668
+ const inputsHash = createHash('sha256').update(inputs.toBuffer()).digest('hex');
669
+ return makeProvingJobId(epochNumber, type, inputsHash);
665
670
  }
666
671
  }
@@ -6,8 +6,8 @@ import {
6
6
  numberConfigHelper,
7
7
  } from '@aztec/foundation/config';
8
8
  import { pickConfigMappings } from '@aztec/foundation/config';
9
- import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
10
9
  import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
10
+ import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
11
11
  import { ProvingRequestType } from '@aztec/stdlib/proofs';
12
12
 
13
13
  import { z } from 'zod';
@@ -314,7 +314,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Pr
314
314
  // notify listeners of the cancellation
315
315
  if (!this.resultsCache.has(id)) {
316
316
  this.logger.info(`Cancelling job id=${id}`, { provingJobId: id });
317
- await this.#reportProvingJobError(id, 'Aborted', false);
317
+ await this.#reportProvingJobError(id, 'Aborted', false, undefined, true);
318
318
  }
319
319
  }
320
320
 
@@ -395,6 +395,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Pr
395
395
  err: string,
396
396
  retry = false,
397
397
  filter?: ProvingJobFilter,
398
+ aborted = false,
398
399
  ): Promise<GetProvingJobResponse | undefined> {
399
400
  const info = this.inProgress.get(id);
400
401
  const item = this.jobsCache.get(id);
@@ -455,7 +456,11 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Pr
455
456
  this.promises.get(id)!.resolve(result);
456
457
  this.completedJobNotifications.push(id);
457
458
 
458
- this.instrumentation.incRejectedJobs(item.type);
459
+ if (aborted) {
460
+ this.instrumentation.incAbortedJobs(item.type);
461
+ } else {
462
+ this.instrumentation.incRejectedJobs(item.type);
463
+ }
459
464
  if (info) {
460
465
  const duration = this.msTimeSource() - info.startedAt;
461
466
  this.instrumentation.recordJobDuration(item.type, duration);
@@ -18,6 +18,7 @@ export class ProvingBrokerInstrumentation {
18
18
  private activeJobs: ObservableGauge;
19
19
  private resolvedJobs: UpDownCounter;
20
20
  private rejectedJobs: UpDownCounter;
21
+ private abortedJobs: UpDownCounter;
21
22
  private timedOutJobs: UpDownCounter;
22
23
  private cachedJobs: UpDownCounter;
23
24
  private totalJobs: UpDownCounter;
@@ -39,6 +40,8 @@ export class ProvingBrokerInstrumentation {
39
40
 
40
41
  this.rejectedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_REJECTED_JOBS, provingJobAttrs);
41
42
 
43
+ this.abortedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_ABORTED_JOBS, provingJobAttrs);
44
+
42
45
  this.retriedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RETRIED_JOBS, provingJobAttrs);
43
46
 
44
47
  this.timedOutJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_TIMED_OUT_JOBS, provingJobAttrs);
@@ -72,6 +75,12 @@ export class ProvingBrokerInstrumentation {
72
75
  });
73
76
  }
74
77
 
78
+ incAbortedJobs(proofType: ProvingRequestType) {
79
+ this.abortedJobs.add(1, {
80
+ [Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType],
81
+ });
82
+ }
83
+
75
84
  incRetriedJobs(proofType: ProvingRequestType) {
76
85
  this.retriedJobs.add(1, {
77
86
  [Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType],