@aztec/prover-client 4.0.0-nightly.20260107 → 4.0.0-nightly.20260108
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.
- package/dest/prover-client/prover-client.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +1 -1
- package/dest/proving_broker/proving_agent.d.ts +3 -8
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +1 -391
- package/dest/proving_broker/proving_broker.d.ts +1 -1
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +3 -386
- package/dest/proving_broker/proving_broker_database/persisted.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +389 -1
- package/package.json +15 -15
- package/src/prover-client/prover-client.ts +1 -9
- package/src/proving_broker/proving_agent.ts +1 -17
- package/src/proving_broker/proving_broker.ts +1 -8
- package/src/proving_broker/proving_broker_database/persisted.ts +15 -1
- package/dest/proving_broker/proving_agent_instrumentation.d.ts +0 -8
- package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +0 -1
- package/dest/proving_broker/proving_agent_instrumentation.js +0 -16
- package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
|
@@ -1,10 +1,383 @@
|
|
|
1
|
+
function applyDecs2203RFactory() {
|
|
2
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
3
|
+
return function addInitializer(initializer) {
|
|
4
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
5
|
+
assertCallable(initializer, "An initializer");
|
|
6
|
+
initializers.push(initializer);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
10
|
+
var kindStr;
|
|
11
|
+
switch(kind){
|
|
12
|
+
case 1:
|
|
13
|
+
kindStr = "accessor";
|
|
14
|
+
break;
|
|
15
|
+
case 2:
|
|
16
|
+
kindStr = "method";
|
|
17
|
+
break;
|
|
18
|
+
case 3:
|
|
19
|
+
kindStr = "getter";
|
|
20
|
+
break;
|
|
21
|
+
case 4:
|
|
22
|
+
kindStr = "setter";
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
kindStr = "field";
|
|
26
|
+
}
|
|
27
|
+
var ctx = {
|
|
28
|
+
kind: kindStr,
|
|
29
|
+
name: isPrivate ? "#" + name : name,
|
|
30
|
+
static: isStatic,
|
|
31
|
+
private: isPrivate,
|
|
32
|
+
metadata: metadata
|
|
33
|
+
};
|
|
34
|
+
var decoratorFinishedRef = {
|
|
35
|
+
v: false
|
|
36
|
+
};
|
|
37
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
38
|
+
var get, set;
|
|
39
|
+
if (kind === 0) {
|
|
40
|
+
if (isPrivate) {
|
|
41
|
+
get = desc.get;
|
|
42
|
+
set = desc.set;
|
|
43
|
+
} else {
|
|
44
|
+
get = function() {
|
|
45
|
+
return this[name];
|
|
46
|
+
};
|
|
47
|
+
set = function(v) {
|
|
48
|
+
this[name] = v;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
} else if (kind === 2) {
|
|
52
|
+
get = function() {
|
|
53
|
+
return desc.value;
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
if (kind === 1 || kind === 3) {
|
|
57
|
+
get = function() {
|
|
58
|
+
return desc.get.call(this);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (kind === 1 || kind === 4) {
|
|
62
|
+
set = function(v) {
|
|
63
|
+
desc.set.call(this, v);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
ctx.access = get && set ? {
|
|
68
|
+
get: get,
|
|
69
|
+
set: set
|
|
70
|
+
} : get ? {
|
|
71
|
+
get: get
|
|
72
|
+
} : {
|
|
73
|
+
set: set
|
|
74
|
+
};
|
|
75
|
+
try {
|
|
76
|
+
return dec(value, ctx);
|
|
77
|
+
} finally{
|
|
78
|
+
decoratorFinishedRef.v = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
82
|
+
if (decoratorFinishedRef.v) {
|
|
83
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function assertCallable(fn, hint) {
|
|
87
|
+
if (typeof fn !== "function") {
|
|
88
|
+
throw new TypeError(hint + " must be a function");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function assertValidReturnValue(kind, value) {
|
|
92
|
+
var type = typeof value;
|
|
93
|
+
if (kind === 1) {
|
|
94
|
+
if (type !== "object" || value === null) {
|
|
95
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
96
|
+
}
|
|
97
|
+
if (value.get !== undefined) {
|
|
98
|
+
assertCallable(value.get, "accessor.get");
|
|
99
|
+
}
|
|
100
|
+
if (value.set !== undefined) {
|
|
101
|
+
assertCallable(value.set, "accessor.set");
|
|
102
|
+
}
|
|
103
|
+
if (value.init !== undefined) {
|
|
104
|
+
assertCallable(value.init, "accessor.init");
|
|
105
|
+
}
|
|
106
|
+
} else if (type !== "function") {
|
|
107
|
+
var hint;
|
|
108
|
+
if (kind === 0) {
|
|
109
|
+
hint = "field";
|
|
110
|
+
} else if (kind === 10) {
|
|
111
|
+
hint = "class";
|
|
112
|
+
} else {
|
|
113
|
+
hint = "method";
|
|
114
|
+
}
|
|
115
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
119
|
+
var decs = decInfo[0];
|
|
120
|
+
var desc, init, value;
|
|
121
|
+
if (isPrivate) {
|
|
122
|
+
if (kind === 0 || kind === 1) {
|
|
123
|
+
desc = {
|
|
124
|
+
get: decInfo[3],
|
|
125
|
+
set: decInfo[4]
|
|
126
|
+
};
|
|
127
|
+
} else if (kind === 3) {
|
|
128
|
+
desc = {
|
|
129
|
+
get: decInfo[3]
|
|
130
|
+
};
|
|
131
|
+
} else if (kind === 4) {
|
|
132
|
+
desc = {
|
|
133
|
+
set: decInfo[3]
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
desc = {
|
|
137
|
+
value: decInfo[3]
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
} else if (kind !== 0) {
|
|
141
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
142
|
+
}
|
|
143
|
+
if (kind === 1) {
|
|
144
|
+
value = {
|
|
145
|
+
get: desc.get,
|
|
146
|
+
set: desc.set
|
|
147
|
+
};
|
|
148
|
+
} else if (kind === 2) {
|
|
149
|
+
value = desc.value;
|
|
150
|
+
} else if (kind === 3) {
|
|
151
|
+
value = desc.get;
|
|
152
|
+
} else if (kind === 4) {
|
|
153
|
+
value = desc.set;
|
|
154
|
+
}
|
|
155
|
+
var newValue, get, set;
|
|
156
|
+
if (typeof decs === "function") {
|
|
157
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
158
|
+
if (newValue !== void 0) {
|
|
159
|
+
assertValidReturnValue(kind, newValue);
|
|
160
|
+
if (kind === 0) {
|
|
161
|
+
init = newValue;
|
|
162
|
+
} else if (kind === 1) {
|
|
163
|
+
init = newValue.init;
|
|
164
|
+
get = newValue.get || value.get;
|
|
165
|
+
set = newValue.set || value.set;
|
|
166
|
+
value = {
|
|
167
|
+
get: get,
|
|
168
|
+
set: set
|
|
169
|
+
};
|
|
170
|
+
} else {
|
|
171
|
+
value = newValue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
for(var i = decs.length - 1; i >= 0; i--){
|
|
176
|
+
var dec = decs[i];
|
|
177
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
178
|
+
if (newValue !== void 0) {
|
|
179
|
+
assertValidReturnValue(kind, newValue);
|
|
180
|
+
var newInit;
|
|
181
|
+
if (kind === 0) {
|
|
182
|
+
newInit = newValue;
|
|
183
|
+
} else if (kind === 1) {
|
|
184
|
+
newInit = newValue.init;
|
|
185
|
+
get = newValue.get || value.get;
|
|
186
|
+
set = newValue.set || value.set;
|
|
187
|
+
value = {
|
|
188
|
+
get: get,
|
|
189
|
+
set: set
|
|
190
|
+
};
|
|
191
|
+
} else {
|
|
192
|
+
value = newValue;
|
|
193
|
+
}
|
|
194
|
+
if (newInit !== void 0) {
|
|
195
|
+
if (init === void 0) {
|
|
196
|
+
init = newInit;
|
|
197
|
+
} else if (typeof init === "function") {
|
|
198
|
+
init = [
|
|
199
|
+
init,
|
|
200
|
+
newInit
|
|
201
|
+
];
|
|
202
|
+
} else {
|
|
203
|
+
init.push(newInit);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (kind === 0 || kind === 1) {
|
|
210
|
+
if (init === void 0) {
|
|
211
|
+
init = function(instance, init) {
|
|
212
|
+
return init;
|
|
213
|
+
};
|
|
214
|
+
} else if (typeof init !== "function") {
|
|
215
|
+
var ownInitializers = init;
|
|
216
|
+
init = function(instance, init) {
|
|
217
|
+
var value = init;
|
|
218
|
+
for(var i = 0; i < ownInitializers.length; i++){
|
|
219
|
+
value = ownInitializers[i].call(instance, value);
|
|
220
|
+
}
|
|
221
|
+
return value;
|
|
222
|
+
};
|
|
223
|
+
} else {
|
|
224
|
+
var originalInitializer = init;
|
|
225
|
+
init = function(instance, init) {
|
|
226
|
+
return originalInitializer.call(instance, init);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
ret.push(init);
|
|
230
|
+
}
|
|
231
|
+
if (kind !== 0) {
|
|
232
|
+
if (kind === 1) {
|
|
233
|
+
desc.get = value.get;
|
|
234
|
+
desc.set = value.set;
|
|
235
|
+
} else if (kind === 2) {
|
|
236
|
+
desc.value = value;
|
|
237
|
+
} else if (kind === 3) {
|
|
238
|
+
desc.get = value;
|
|
239
|
+
} else if (kind === 4) {
|
|
240
|
+
desc.set = value;
|
|
241
|
+
}
|
|
242
|
+
if (isPrivate) {
|
|
243
|
+
if (kind === 1) {
|
|
244
|
+
ret.push(function(instance, args) {
|
|
245
|
+
return value.get.call(instance, args);
|
|
246
|
+
});
|
|
247
|
+
ret.push(function(instance, args) {
|
|
248
|
+
return value.set.call(instance, args);
|
|
249
|
+
});
|
|
250
|
+
} else if (kind === 2) {
|
|
251
|
+
ret.push(value);
|
|
252
|
+
} else {
|
|
253
|
+
ret.push(function(instance, args) {
|
|
254
|
+
return value.call(instance, args);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
Object.defineProperty(base, name, desc);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function applyMemberDecs(Class, decInfos, metadata) {
|
|
263
|
+
var ret = [];
|
|
264
|
+
var protoInitializers;
|
|
265
|
+
var staticInitializers;
|
|
266
|
+
var existingProtoNonFields = new Map();
|
|
267
|
+
var existingStaticNonFields = new Map();
|
|
268
|
+
for(var i = 0; i < decInfos.length; i++){
|
|
269
|
+
var decInfo = decInfos[i];
|
|
270
|
+
if (!Array.isArray(decInfo)) continue;
|
|
271
|
+
var kind = decInfo[1];
|
|
272
|
+
var name = decInfo[2];
|
|
273
|
+
var isPrivate = decInfo.length > 3;
|
|
274
|
+
var isStatic = kind >= 5;
|
|
275
|
+
var base;
|
|
276
|
+
var initializers;
|
|
277
|
+
if (isStatic) {
|
|
278
|
+
base = Class;
|
|
279
|
+
kind = kind - 5;
|
|
280
|
+
staticInitializers = staticInitializers || [];
|
|
281
|
+
initializers = staticInitializers;
|
|
282
|
+
} else {
|
|
283
|
+
base = Class.prototype;
|
|
284
|
+
protoInitializers = protoInitializers || [];
|
|
285
|
+
initializers = protoInitializers;
|
|
286
|
+
}
|
|
287
|
+
if (kind !== 0 && !isPrivate) {
|
|
288
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
289
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
290
|
+
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
|
|
291
|
+
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
292
|
+
} else if (!existingKind && kind > 2) {
|
|
293
|
+
existingNonFields.set(name, kind);
|
|
294
|
+
} else {
|
|
295
|
+
existingNonFields.set(name, true);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
299
|
+
}
|
|
300
|
+
pushInitializers(ret, protoInitializers);
|
|
301
|
+
pushInitializers(ret, staticInitializers);
|
|
302
|
+
return ret;
|
|
303
|
+
}
|
|
304
|
+
function pushInitializers(ret, initializers) {
|
|
305
|
+
if (initializers) {
|
|
306
|
+
ret.push(function(instance) {
|
|
307
|
+
for(var i = 0; i < initializers.length; i++){
|
|
308
|
+
initializers[i].call(instance);
|
|
309
|
+
}
|
|
310
|
+
return instance;
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
315
|
+
if (classDecs.length > 0) {
|
|
316
|
+
var initializers = [];
|
|
317
|
+
var newClass = targetClass;
|
|
318
|
+
var name = targetClass.name;
|
|
319
|
+
for(var i = classDecs.length - 1; i >= 0; i--){
|
|
320
|
+
var decoratorFinishedRef = {
|
|
321
|
+
v: false
|
|
322
|
+
};
|
|
323
|
+
try {
|
|
324
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
325
|
+
kind: "class",
|
|
326
|
+
name: name,
|
|
327
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
328
|
+
metadata
|
|
329
|
+
});
|
|
330
|
+
} finally{
|
|
331
|
+
decoratorFinishedRef.v = true;
|
|
332
|
+
}
|
|
333
|
+
if (nextNewClass !== undefined) {
|
|
334
|
+
assertValidReturnValue(10, nextNewClass);
|
|
335
|
+
newClass = nextNewClass;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return [
|
|
339
|
+
defineMetadata(newClass, metadata),
|
|
340
|
+
function() {
|
|
341
|
+
for(var i = 0; i < initializers.length; i++){
|
|
342
|
+
initializers[i].call(newClass);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function defineMetadata(Class, metadata) {
|
|
349
|
+
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
350
|
+
configurable: true,
|
|
351
|
+
enumerable: true,
|
|
352
|
+
value: metadata
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
356
|
+
if (parentClass !== void 0) {
|
|
357
|
+
var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
358
|
+
}
|
|
359
|
+
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
360
|
+
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
361
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
362
|
+
return {
|
|
363
|
+
e: e,
|
|
364
|
+
get c () {
|
|
365
|
+
return applyClassDecs(targetClass, classDecs, metadata);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
371
|
+
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
372
|
+
}
|
|
373
|
+
var _dec, _initProto;
|
|
1
374
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
375
|
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
376
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
377
|
import { BatchQueue } from '@aztec/foundation/queue';
|
|
5
378
|
import { openVersionedStoreAt } from '@aztec/kv-store/lmdb-v2';
|
|
6
379
|
import { ProvingJob, ProvingJobSettledResult, getEpochFromProvingJobId } from '@aztec/stdlib/interfaces/server';
|
|
7
|
-
import { Attributes, LmdbMetrics, getTelemetryClient } from '@aztec/telemetry-client';
|
|
380
|
+
import { Attributes, LmdbMetrics, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
8
381
|
import { mkdir, readdir } from 'fs/promises';
|
|
9
382
|
import { join } from 'path';
|
|
10
383
|
class SingleEpochDatabase {
|
|
@@ -62,19 +435,34 @@ class SingleEpochDatabase {
|
|
|
62
435
|
return this.store.close();
|
|
63
436
|
}
|
|
64
437
|
}
|
|
438
|
+
_dec = trackSpan('KVBrokerDatabase.deleteAllProvingJobsOlderThanEpoch', (epochNumber)=>({
|
|
439
|
+
[Attributes.EPOCH_NUMBER]: epochNumber
|
|
440
|
+
}));
|
|
65
441
|
export class KVBrokerDatabase {
|
|
66
442
|
epochs;
|
|
67
443
|
config;
|
|
68
444
|
logger;
|
|
445
|
+
static{
|
|
446
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
447
|
+
[
|
|
448
|
+
_dec,
|
|
449
|
+
2,
|
|
450
|
+
"deleteAllProvingJobsOlderThanEpoch"
|
|
451
|
+
]
|
|
452
|
+
], []));
|
|
453
|
+
}
|
|
69
454
|
metrics;
|
|
70
455
|
batchQueue;
|
|
456
|
+
tracer;
|
|
71
457
|
constructor(epochs, config, client = getTelemetryClient(), logger){
|
|
72
458
|
this.epochs = epochs;
|
|
73
459
|
this.config = config;
|
|
74
460
|
this.logger = logger;
|
|
461
|
+
_initProto(this);
|
|
75
462
|
this.metrics = new LmdbMetrics(client.getMeter('KVBrokerDatabase'), {
|
|
76
463
|
[Attributes.DB_DATA_TYPE]: 'prover-broker'
|
|
77
464
|
}, ()=>this.estimateSize());
|
|
465
|
+
this.tracer = client.getTracer('KVBrokerDatabase');
|
|
78
466
|
this.batchQueue = new BatchQueue((items, key)=>this.commitWrites(items, key), config.proverBrokerBatchSize, config.proverBrokerBatchIntervalMs, createLogger('proving-client:proving-broker-database:batch-queue'));
|
|
79
467
|
}
|
|
80
468
|
// exposed for testing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "4.0.0-nightly.
|
|
3
|
+
"version": "4.0.0-nightly.20260108",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -69,19 +69,19 @@
|
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aztec/bb-prover": "4.0.0-nightly.
|
|
73
|
-
"@aztec/blob-lib": "4.0.0-nightly.
|
|
74
|
-
"@aztec/constants": "4.0.0-nightly.
|
|
75
|
-
"@aztec/ethereum": "4.0.0-nightly.
|
|
76
|
-
"@aztec/foundation": "4.0.0-nightly.
|
|
77
|
-
"@aztec/kv-store": "4.0.0-nightly.
|
|
78
|
-
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.
|
|
79
|
-
"@aztec/noir-types": "4.0.0-nightly.
|
|
80
|
-
"@aztec/protocol-contracts": "4.0.0-nightly.
|
|
81
|
-
"@aztec/simulator": "4.0.0-nightly.
|
|
82
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
83
|
-
"@aztec/telemetry-client": "4.0.0-nightly.
|
|
84
|
-
"@aztec/world-state": "4.0.0-nightly.
|
|
72
|
+
"@aztec/bb-prover": "4.0.0-nightly.20260108",
|
|
73
|
+
"@aztec/blob-lib": "4.0.0-nightly.20260108",
|
|
74
|
+
"@aztec/constants": "4.0.0-nightly.20260108",
|
|
75
|
+
"@aztec/ethereum": "4.0.0-nightly.20260108",
|
|
76
|
+
"@aztec/foundation": "4.0.0-nightly.20260108",
|
|
77
|
+
"@aztec/kv-store": "4.0.0-nightly.20260108",
|
|
78
|
+
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260108",
|
|
79
|
+
"@aztec/noir-types": "4.0.0-nightly.20260108",
|
|
80
|
+
"@aztec/protocol-contracts": "4.0.0-nightly.20260108",
|
|
81
|
+
"@aztec/simulator": "4.0.0-nightly.20260108",
|
|
82
|
+
"@aztec/stdlib": "4.0.0-nightly.20260108",
|
|
83
|
+
"@aztec/telemetry-client": "4.0.0-nightly.20260108",
|
|
84
|
+
"@aztec/world-state": "4.0.0-nightly.20260108",
|
|
85
85
|
"@google-cloud/storage": "^7.15.0",
|
|
86
86
|
"@iarna/toml": "^2.2.5",
|
|
87
87
|
"commander": "^12.1.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"zod": "^3.23.8"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@aztec/noir-contracts.js": "4.0.0-nightly.
|
|
94
|
+
"@aztec/noir-contracts.js": "4.0.0-nightly.20260108",
|
|
95
95
|
"@jest/globals": "^30.0.0",
|
|
96
96
|
"@types/jest": "^30.0.0",
|
|
97
97
|
"@types/node": "^22.15.17",
|
|
@@ -130,15 +130,7 @@ export class ProverClient implements EpochProverManager {
|
|
|
130
130
|
const prover = await buildServerCircuitProver(this.config, this.telemetry);
|
|
131
131
|
this.agents = times(
|
|
132
132
|
this.config.proverAgentCount,
|
|
133
|
-
() =>
|
|
134
|
-
new ProvingAgent(
|
|
135
|
-
this.agentClient!,
|
|
136
|
-
proofStore,
|
|
137
|
-
prover,
|
|
138
|
-
[],
|
|
139
|
-
this.config.proverAgentPollIntervalMs,
|
|
140
|
-
this.telemetry,
|
|
141
|
-
),
|
|
133
|
+
() => new ProvingAgent(this.agentClient!, proofStore, prover, [], this.config.proverAgentPollIntervalMs),
|
|
142
134
|
);
|
|
143
135
|
|
|
144
136
|
await Promise.all(this.agents.map(agent => agent.start()));
|
|
@@ -13,27 +13,16 @@ import type {
|
|
|
13
13
|
ServerCircuitProver,
|
|
14
14
|
} from '@aztec/stdlib/interfaces/server';
|
|
15
15
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
16
|
-
import {
|
|
17
|
-
type TelemetryClient,
|
|
18
|
-
type Traceable,
|
|
19
|
-
type Tracer,
|
|
20
|
-
getTelemetryClient,
|
|
21
|
-
trackSpan,
|
|
22
|
-
} from '@aztec/telemetry-client';
|
|
23
16
|
|
|
24
17
|
import type { ProofStore } from './proof_store/index.js';
|
|
25
|
-
import { ProvingAgentInstrumentation } from './proving_agent_instrumentation.js';
|
|
26
18
|
import { ProvingJobController, ProvingJobControllerStatus } from './proving_job_controller.js';
|
|
27
19
|
|
|
28
20
|
/**
|
|
29
21
|
* A helper class that encapsulates a circuit prover and connects it to a job source.
|
|
30
22
|
*/
|
|
31
|
-
export class ProvingAgent
|
|
23
|
+
export class ProvingAgent {
|
|
32
24
|
private currentJobController?: ProvingJobController;
|
|
33
25
|
private runningPromise: RunningPromise;
|
|
34
|
-
private instrumentation: ProvingAgentInstrumentation;
|
|
35
|
-
|
|
36
|
-
public readonly tracer: Tracer;
|
|
37
26
|
|
|
38
27
|
constructor(
|
|
39
28
|
/** The source of proving jobs */
|
|
@@ -46,12 +35,8 @@ export class ProvingAgent implements Traceable {
|
|
|
46
35
|
private proofAllowList: Array<ProvingRequestType> = [],
|
|
47
36
|
/** How long to wait between jobs */
|
|
48
37
|
private pollIntervalMs = 1000,
|
|
49
|
-
/** A telemetry client through which to emit metrics */
|
|
50
|
-
client: TelemetryClient = getTelemetryClient(),
|
|
51
38
|
private log = createLogger('prover-client:proving-agent'),
|
|
52
39
|
) {
|
|
53
|
-
this.tracer = client.getTracer('ProvingAgent');
|
|
54
|
-
this.instrumentation = new ProvingAgentInstrumentation(client);
|
|
55
40
|
this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.pollIntervalMs);
|
|
56
41
|
}
|
|
57
42
|
|
|
@@ -85,7 +70,6 @@ export class ProvingAgent implements Traceable {
|
|
|
85
70
|
return this.runningPromise.isRunning() ? { status: 'running' } : { status: 'stopped' };
|
|
86
71
|
}
|
|
87
72
|
|
|
88
|
-
@trackSpan('ProvingAgent.safeWork')
|
|
89
73
|
private async work() {
|
|
90
74
|
// every tick we need to take one of the following actions:
|
|
91
75
|
// 1. send a hearbeat to the broker that we're working on some job
|
|
@@ -16,13 +16,7 @@ import {
|
|
|
16
16
|
tryStop,
|
|
17
17
|
} from '@aztec/stdlib/interfaces/server';
|
|
18
18
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
19
|
-
import {
|
|
20
|
-
type TelemetryClient,
|
|
21
|
-
type Traceable,
|
|
22
|
-
type Tracer,
|
|
23
|
-
getTelemetryClient,
|
|
24
|
-
trackSpan,
|
|
25
|
-
} from '@aztec/telemetry-client';
|
|
19
|
+
import { type TelemetryClient, type Traceable, type Tracer, getTelemetryClient } from '@aztec/telemetry-client';
|
|
26
20
|
|
|
27
21
|
import assert from 'assert';
|
|
28
22
|
|
|
@@ -565,7 +559,6 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer, Tr
|
|
|
565
559
|
return this.#getProvingJob(filter);
|
|
566
560
|
}
|
|
567
561
|
|
|
568
|
-
@trackSpan('ProvingBroker.cleanupPass')
|
|
569
562
|
private async cleanupPass() {
|
|
570
563
|
this.cleanupStaleJobs();
|
|
571
564
|
this.reEnqueueExpiredJobs();
|
|
@@ -11,7 +11,14 @@ import {
|
|
|
11
11
|
ProvingJobSettledResult,
|
|
12
12
|
getEpochFromProvingJobId,
|
|
13
13
|
} from '@aztec/stdlib/interfaces/server';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
Attributes,
|
|
16
|
+
LmdbMetrics,
|
|
17
|
+
type TelemetryClient,
|
|
18
|
+
type Tracer,
|
|
19
|
+
getTelemetryClient,
|
|
20
|
+
trackSpan,
|
|
21
|
+
} from '@aztec/telemetry-client';
|
|
15
22
|
|
|
16
23
|
import { mkdir, readdir } from 'fs/promises';
|
|
17
24
|
import { join } from 'path';
|
|
@@ -78,6 +85,8 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
78
85
|
|
|
79
86
|
private batchQueue: BatchQueue<ProvingJob | [ProvingJobId, ProvingJobSettledResult], number>;
|
|
80
87
|
|
|
88
|
+
public readonly tracer: Tracer;
|
|
89
|
+
|
|
81
90
|
private constructor(
|
|
82
91
|
private epochs: Map<number, SingleEpochDatabase>,
|
|
83
92
|
private config: ProverBrokerConfig,
|
|
@@ -92,6 +101,8 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
92
101
|
() => this.estimateSize(),
|
|
93
102
|
);
|
|
94
103
|
|
|
104
|
+
this.tracer = client.getTracer('KVBrokerDatabase');
|
|
105
|
+
|
|
95
106
|
this.batchQueue = new BatchQueue(
|
|
96
107
|
(items, key) => this.commitWrites(items, key),
|
|
97
108
|
config.proverBrokerBatchSize,
|
|
@@ -165,6 +176,9 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
|
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
178
|
|
|
179
|
+
@trackSpan('KVBrokerDatabase.deleteAllProvingJobsOlderThanEpoch', epochNumber => ({
|
|
180
|
+
[Attributes.EPOCH_NUMBER]: epochNumber,
|
|
181
|
+
}))
|
|
168
182
|
async deleteAllProvingJobsOlderThanEpoch(epochNumber: EpochNumber): Promise<void> {
|
|
169
183
|
const oldEpochs = Array.from(this.epochs.keys()).filter(e => e < Number(epochNumber));
|
|
170
184
|
for (const old of oldEpochs) {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Timer } from '@aztec/foundation/timer';
|
|
2
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
3
|
-
export declare class ProvingAgentInstrumentation {
|
|
4
|
-
private idleTime;
|
|
5
|
-
constructor(client: TelemetryClient, name?: string);
|
|
6
|
-
recordIdleTime(msOrTimer: Timer | number): void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmluZ19hZ2VudF9pbnN0cnVtZW50YXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcm92aW5nX2Jyb2tlci9wcm92aW5nX2FnZW50X2luc3RydW1lbnRhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNyRCxPQUFPLEVBQTJCLEtBQUssZUFBZSxFQUFhLE1BQU0seUJBQXlCLENBQUM7QUFFbkcscUJBQWEsMkJBQTJCO0lBQ3RDLE9BQU8sQ0FBQyxRQUFRLENBQVk7SUFFNUIsWUFBWSxNQUFNLEVBQUUsZUFBZSxFQUFFLElBQUksU0FBaUIsRUFRekQ7SUFFRCxjQUFjLENBQUMsU0FBUyxFQUFFLEtBQUssR0FBRyxNQUFNLFFBR3ZDO0NBQ0YifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proving_agent_instrumentation.d.ts","sourceRoot":"","sources":["../../src/proving_broker/proving_agent_instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAA2B,KAAK,eAAe,EAAa,MAAM,yBAAyB,CAAC;AAEnG,qBAAa,2BAA2B;IACtC,OAAO,CAAC,QAAQ,CAAY;IAE5B,YAAY,MAAM,EAAE,eAAe,EAAE,IAAI,SAAiB,EAQzD;IAED,cAAc,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,QAGvC;CACF"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Metrics, ValueType } from '@aztec/telemetry-client';
|
|
2
|
-
export class ProvingAgentInstrumentation {
|
|
3
|
-
idleTime;
|
|
4
|
-
constructor(client, name = 'ProvingAgent'){
|
|
5
|
-
const meter = client.getMeter(name);
|
|
6
|
-
this.idleTime = meter.createHistogram(Metrics.PROVING_AGENT_IDLE, {
|
|
7
|
-
description: 'Records how long an agent was idle',
|
|
8
|
-
unit: 's',
|
|
9
|
-
valueType: ValueType.DOUBLE
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
recordIdleTime(msOrTimer) {
|
|
13
|
-
const duration = typeof msOrTimer === 'number' ? msOrTimer : msOrTimer.ms();
|
|
14
|
-
this.idleTime.record(duration / 1000);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Timer } from '@aztec/foundation/timer';
|
|
2
|
-
import { type Histogram, Metrics, type TelemetryClient, ValueType } from '@aztec/telemetry-client';
|
|
3
|
-
|
|
4
|
-
export class ProvingAgentInstrumentation {
|
|
5
|
-
private idleTime: Histogram;
|
|
6
|
-
|
|
7
|
-
constructor(client: TelemetryClient, name = 'ProvingAgent') {
|
|
8
|
-
const meter = client.getMeter(name);
|
|
9
|
-
|
|
10
|
-
this.idleTime = meter.createHistogram(Metrics.PROVING_AGENT_IDLE, {
|
|
11
|
-
description: 'Records how long an agent was idle',
|
|
12
|
-
unit: 's',
|
|
13
|
-
valueType: ValueType.DOUBLE,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
recordIdleTime(msOrTimer: Timer | number) {
|
|
18
|
-
const duration = typeof msOrTimer === 'number' ? msOrTimer : msOrTimer.ms();
|
|
19
|
-
this.idleTime.record(duration / 1000);
|
|
20
|
-
}
|
|
21
|
-
}
|