@aztec/prover-client 0.78.1 → 0.79.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.
@@ -16,10 +16,11 @@ export declare class ProvingJobController {
16
16
  private startedAt;
17
17
  private circuitProver;
18
18
  private onComplete;
19
+ private log;
19
20
  private status;
20
21
  private promise?;
21
22
  private abortController;
22
- constructor(jobId: ProvingJobId, inputs: ProvingJobInputs, epochNumber: number, startedAt: number, circuitProver: ServerCircuitProver, onComplete: ProvingJobCompletionCallback);
23
+ constructor(jobId: ProvingJobId, inputs: ProvingJobInputs, epochNumber: number, startedAt: number, circuitProver: ServerCircuitProver, onComplete: ProvingJobCompletionCallback, log?: import("@aztec/foundation/log").Logger);
23
24
  start(): void;
24
25
  getStatus(): ProvingJobControllerStatus;
25
26
  abort(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"proving_job_controller.d.ts","sourceRoot":"","sources":["../../src/proving_broker/proving_job_controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,UAAU,4BAA4B,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB;IACtF,CACE,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,GAAG,SAAS,EACxB,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,GAC1C,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,qBAAa,oBAAoB;IAM7B,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,UAAU;IAVpB,OAAO,CAAC,MAAM,CAA+D;IAC7E,OAAO,CAAC,OAAO,CAAC,CAAgB;IAChC,OAAO,CAAC,eAAe,CAAyB;gBAGtC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,mBAAmB,EAClC,UAAU,EAAE,4BAA4B;IAG3C,KAAK,IAAI,IAAI;IAmCb,SAAS,IAAI,0BAA0B;IAIvC,KAAK,IAAI,IAAI;IASb,QAAQ,IAAI,YAAY;IAIxB,YAAY,IAAI,MAAM;IAItB,gBAAgB,IAAI,MAAM;YAInB,aAAa;CA0D5B"}
1
+ {"version":3,"file":"proving_job_controller.d.ts","sourceRoot":"","sources":["../../src/proving_broker/proving_job_controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,UAAU,4BAA4B,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB;IACtF,CACE,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,GAAG,SAAS,EACxB,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,GAC1C,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,qBAAa,oBAAoB;IAM7B,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,GAAG;IAXb,OAAO,CAAC,MAAM,CAA+D;IAC7E,OAAO,CAAC,OAAO,CAAC,CAAgB;IAChC,OAAO,CAAC,eAAe,CAAyB;gBAGtC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,mBAAmB,EAClC,UAAU,EAAE,4BAA4B,EACxC,GAAG,yCAA6D;IAGnE,KAAK,IAAI,IAAI;IA+Db,SAAS,IAAI,0BAA0B;IAIvC,KAAK,IAAI,IAAI;IAgBb,QAAQ,IAAI,YAAY;IAIxB,YAAY,IAAI,MAAM;IAItB,gBAAgB,IAAI,MAAM;YAInB,aAAa;CA0D5B"}
@@ -1,3 +1,4 @@
1
+ import { createLogger } from '@aztec/foundation/log';
1
2
  import { ProvingRequestType } from '@aztec/stdlib/proofs';
2
3
  export var ProvingJobControllerStatus = /*#__PURE__*/ function(ProvingJobControllerStatus) {
3
4
  ProvingJobControllerStatus["IDLE"] = "idle";
@@ -13,42 +14,68 @@ export class ProvingJobController {
13
14
  startedAt;
14
15
  circuitProver;
15
16
  onComplete;
17
+ log;
16
18
  status;
17
19
  promise;
18
20
  abortController;
19
- constructor(jobId, inputs, epochNumber, startedAt, circuitProver, onComplete){
21
+ constructor(jobId, inputs, epochNumber, startedAt, circuitProver, onComplete, log = createLogger('prover-client:proving-agent:job-controller')){
20
22
  this.jobId = jobId;
21
23
  this.inputs = inputs;
22
24
  this.epochNumber = epochNumber;
23
25
  this.startedAt = startedAt;
24
26
  this.circuitProver = circuitProver;
25
27
  this.onComplete = onComplete;
28
+ this.log = log;
26
29
  this.status = "idle";
27
30
  this.abortController = new AbortController();
28
31
  }
29
32
  start() {
30
33
  if (this.status !== "idle") {
34
+ this.log.verbose(`Job controller for jobId=${this.jobId} not starting because it is not idle currentStatus=${this.status}`, {
35
+ currentStatus: this.status,
36
+ jobId: this.jobId
37
+ });
31
38
  return;
32
39
  }
33
40
  this.status = "proving";
41
+ this.log.verbose(`Job controller started jobId=${this.jobId}`, {
42
+ jobId: this.jobId
43
+ });
34
44
  this.promise = this.generateProof().then((result)=>{
35
45
  if (this.status === "aborted") {
46
+ this.log.warn(`Job controller for jobId=${this.jobId} completed successfully but job was aborted`, {
47
+ currentStatus: this.status,
48
+ jobId: this.jobId
49
+ });
36
50
  return;
37
51
  }
38
52
  this.status = "done";
53
+ this.log.verbose(`Job controller for jobId=${this.jobId} completed successfully`, {
54
+ jobId: this.jobId
55
+ });
39
56
  return this.onComplete(this.jobId, this.inputs.type, undefined, result);
40
57
  }, (error)=>{
41
58
  if (this.status === "aborted") {
59
+ this.log.warn(`Job controller for jobId=${this.jobId} finished with an error but job was aborted`, {
60
+ currentStatus: this.status,
61
+ jobId: this.jobId
62
+ });
42
63
  return;
43
64
  }
44
65
  if (error.name === 'AbortError') {
45
66
  // Ignore abort errors
46
67
  return;
47
68
  }
69
+ this.log.verbose(`Job controller for jobId=${this.jobId} finished with an error`, {
70
+ jobId: this.jobId,
71
+ err: error
72
+ });
48
73
  this.status = "done";
49
74
  return this.onComplete(this.jobId, this.inputs.type, error, undefined);
50
- }).catch((_)=>{
51
- // ignore completion errors
75
+ }).catch((err)=>{
76
+ this.log.error(`Job constroller failed to send result for jobId=${this.jobId}: ${err}`, err, {
77
+ jobId: this.jobId
78
+ });
52
79
  });
53
80
  }
54
81
  getStatus() {
@@ -56,10 +83,17 @@ export class ProvingJobController {
56
83
  }
57
84
  abort() {
58
85
  if (this.status !== "proving") {
86
+ this.log.warn(`Tried to abort job controller for jobId=${this.jobId} but it is not running`, {
87
+ currentStatus: this.status,
88
+ jobId: this.jobId
89
+ });
59
90
  return;
60
91
  }
61
92
  this.status = "aborted";
62
93
  this.abortController.abort();
94
+ this.log.verbose(`Aborted job controller for jobId=${this.jobId}`, {
95
+ jobId: this.jobId
96
+ });
63
97
  }
64
98
  getJobId() {
65
99
  return this.jobId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/prover-client",
3
- "version": "0.78.1",
3
+ "version": "0.79.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -66,29 +66,29 @@
66
66
  ]
67
67
  },
68
68
  "dependencies": {
69
- "@aztec/bb-prover": "0.78.1",
70
- "@aztec/blob-lib": "0.78.1",
71
- "@aztec/constants": "0.78.1",
72
- "@aztec/ethereum": "0.78.1",
73
- "@aztec/foundation": "0.78.1",
74
- "@aztec/kv-store": "0.78.1",
75
- "@aztec/noir-protocol-circuits-types": "0.78.1",
76
- "@aztec/protocol-contracts": "0.78.1",
77
- "@aztec/simulator": "0.78.1",
78
- "@aztec/stdlib": "0.78.1",
79
- "@aztec/telemetry-client": "0.78.1",
80
- "@aztec/world-state": "0.78.1",
69
+ "@aztec/bb-prover": "0.79.0",
70
+ "@aztec/blob-lib": "0.79.0",
71
+ "@aztec/constants": "0.79.0",
72
+ "@aztec/ethereum": "0.79.0",
73
+ "@aztec/foundation": "0.79.0",
74
+ "@aztec/kv-store": "0.79.0",
75
+ "@aztec/noir-protocol-circuits-types": "0.79.0",
76
+ "@aztec/noir-types": "0.79.0",
77
+ "@aztec/protocol-contracts": "0.79.0",
78
+ "@aztec/simulator": "0.79.0",
79
+ "@aztec/stdlib": "0.79.0",
80
+ "@aztec/telemetry-client": "0.79.0",
81
+ "@aztec/world-state": "0.79.0",
81
82
  "@google-cloud/storage": "^7.15.0",
82
83
  "@iarna/toml": "^2.2.5",
83
84
  "commander": "^12.1.0",
84
85
  "lodash.chunk": "^4.2.0",
85
86
  "source-map-support": "^0.5.21",
86
87
  "tslib": "^2.4.0",
87
- "zod": "^3.23.8",
88
- "@aztec/noir-types": "0.78.1"
88
+ "zod": "^3.23.8"
89
89
  },
90
90
  "devDependencies": {
91
- "@aztec/noir-contracts.js": "0.78.1",
91
+ "@aztec/noir-contracts.js": "0.79.0",
92
92
  "@jest/globals": "^29.5.0",
93
93
  "@types/jest": "^29.5.0",
94
94
  "@types/memdown": "^3.0.0",
@@ -1,3 +1,4 @@
1
+ import { createLogger } from '@aztec/foundation/log';
1
2
  import type {
2
3
  ProvingJobId,
3
4
  ProvingJobInputs,
@@ -34,26 +35,48 @@ export class ProvingJobController {
34
35
  private startedAt: number,
35
36
  private circuitProver: ServerCircuitProver,
36
37
  private onComplete: ProvingJobCompletionCallback,
38
+ private log = createLogger('prover-client:proving-agent:job-controller'),
37
39
  ) {}
38
40
 
39
41
  public start(): void {
40
42
  if (this.status !== ProvingJobControllerStatus.IDLE) {
43
+ this.log.verbose(
44
+ `Job controller for jobId=${this.jobId} not starting because it is not idle currentStatus=${this.status}`,
45
+ {
46
+ currentStatus: this.status,
47
+ jobId: this.jobId,
48
+ },
49
+ );
41
50
  return;
42
51
  }
43
52
 
44
53
  this.status = ProvingJobControllerStatus.PROVING;
54
+ this.log.verbose(`Job controller started jobId=${this.jobId}`, {
55
+ jobId: this.jobId,
56
+ });
45
57
 
46
58
  this.promise = this.generateProof()
47
59
  .then(
48
60
  result => {
49
61
  if (this.status === ProvingJobControllerStatus.ABORTED) {
62
+ this.log.warn(`Job controller for jobId=${this.jobId} completed successfully but job was aborted`, {
63
+ currentStatus: this.status,
64
+ jobId: this.jobId,
65
+ });
50
66
  return;
51
67
  }
52
68
  this.status = ProvingJobControllerStatus.DONE;
69
+ this.log.verbose(`Job controller for jobId=${this.jobId} completed successfully`, {
70
+ jobId: this.jobId,
71
+ });
53
72
  return this.onComplete(this.jobId, this.inputs.type, undefined, result);
54
73
  },
55
74
  error => {
56
75
  if (this.status === ProvingJobControllerStatus.ABORTED) {
76
+ this.log.warn(`Job controller for jobId=${this.jobId} finished with an error but job was aborted`, {
77
+ currentStatus: this.status,
78
+ jobId: this.jobId,
79
+ });
57
80
  return;
58
81
  }
59
82
 
@@ -62,12 +85,19 @@ export class ProvingJobController {
62
85
  return;
63
86
  }
64
87
 
88
+ this.log.verbose(`Job controller for jobId=${this.jobId} finished with an error`, {
89
+ jobId: this.jobId,
90
+ err: error,
91
+ });
92
+
65
93
  this.status = ProvingJobControllerStatus.DONE;
66
94
  return this.onComplete(this.jobId, this.inputs.type, error, undefined);
67
95
  },
68
96
  )
69
- .catch(_ => {
70
- // ignore completion errors
97
+ .catch(err => {
98
+ this.log.error(`Job constroller failed to send result for jobId=${this.jobId}: ${err}`, err, {
99
+ jobId: this.jobId,
100
+ });
71
101
  });
72
102
  }
73
103
 
@@ -77,11 +107,18 @@ export class ProvingJobController {
77
107
 
78
108
  public abort(): void {
79
109
  if (this.status !== ProvingJobControllerStatus.PROVING) {
110
+ this.log.warn(`Tried to abort job controller for jobId=${this.jobId} but it is not running`, {
111
+ currentStatus: this.status,
112
+ jobId: this.jobId,
113
+ });
80
114
  return;
81
115
  }
82
116
 
83
117
  this.status = ProvingJobControllerStatus.ABORTED;
84
118
  this.abortController.abort();
119
+ this.log.verbose(`Aborted job controller for jobId=${this.jobId}`, {
120
+ jobId: this.jobId,
121
+ });
85
122
  }
86
123
 
87
124
  public getJobId(): ProvingJobId {