@aztec/prover-node 0.0.1-commit.fcb71a6 → 0.0.1-commit.fffb133c
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/actions/download-epoch-proving-job.d.ts +1 -1
- package/dest/actions/rerun-epoch-proving-job.d.ts +3 -2
- package/dest/actions/rerun-epoch-proving-job.d.ts.map +1 -1
- package/dest/actions/rerun-epoch-proving-job.js +3 -1
- package/dest/factory.d.ts +1 -3
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +12 -11
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/job/epoch-proving-job.d.ts +1 -1
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +390 -16
- package/dest/metrics.d.ts +1 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +18 -100
- package/dest/monitors/epoch-monitor.d.ts +1 -1
- package/dest/monitors/epoch-monitor.d.ts.map +1 -1
- package/dest/monitors/epoch-monitor.js +1 -10
- package/dest/prover-node-publisher.d.ts +1 -1
- package/dest/prover-node-publisher.d.ts.map +1 -1
- package/dest/prover-node-publisher.js +6 -6
- package/dest/prover-node.d.ts +2 -2
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +398 -20
- package/package.json +23 -23
- package/src/actions/rerun-epoch-proving-job.ts +3 -2
- package/src/factory.ts +21 -13
- package/src/index.ts +1 -0
- package/src/job/epoch-proving-job.ts +8 -5
- package/src/metrics.ts +17 -84
- package/src/monitors/epoch-monitor.ts +1 -8
- package/src/prover-node-publisher.ts +6 -5
- package/src/prover-node.ts +1 -1
package/dest/prover-node.js
CHANGED
|
@@ -1,9 +1,376 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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);
|
|
6
372
|
}
|
|
373
|
+
var _dec, _dec1, _initProto;
|
|
7
374
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
8
375
|
import { assertRequired, compact, pick, sum } from '@aztec/foundation/collection';
|
|
9
376
|
import { memoize } from '@aztec/foundation/decorators';
|
|
@@ -16,6 +383,11 @@ import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-clie
|
|
|
16
383
|
import { uploadEpochProofFailure } from './actions/upload-epoch-proof-failure.js';
|
|
17
384
|
import { EpochProvingJob } from './job/epoch-proving-job.js';
|
|
18
385
|
import { ProverNodeJobMetrics, ProverNodeRewardsMetrics } from './metrics.js';
|
|
386
|
+
_dec = trackSpan('ProverNode.createProvingJob', (epochNumber)=>({
|
|
387
|
+
[Attributes.EPOCH_NUMBER]: epochNumber
|
|
388
|
+
})), _dec1 = trackSpan('ProverNode.gatherEpochData', (epochNumber)=>({
|
|
389
|
+
[Attributes.EPOCH_NUMBER]: epochNumber
|
|
390
|
+
}));
|
|
19
391
|
/**
|
|
20
392
|
* An Aztec Prover Node is a standalone process that monitors the unfinalized chain on L1 for unproven epochs,
|
|
21
393
|
* fetches their txs from the p2p network or external nodes, re-executes their public functions, creates a rollup
|
|
@@ -32,6 +404,25 @@ import { ProverNodeJobMetrics, ProverNodeRewardsMetrics } from './metrics.js';
|
|
|
32
404
|
rollupContract;
|
|
33
405
|
l1Metrics;
|
|
34
406
|
telemetryClient;
|
|
407
|
+
static{
|
|
408
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
409
|
+
[
|
|
410
|
+
_dec,
|
|
411
|
+
2,
|
|
412
|
+
"createProvingJob"
|
|
413
|
+
],
|
|
414
|
+
[
|
|
415
|
+
memoize,
|
|
416
|
+
2,
|
|
417
|
+
"getL1Constants"
|
|
418
|
+
],
|
|
419
|
+
[
|
|
420
|
+
_dec1,
|
|
421
|
+
2,
|
|
422
|
+
"gatherEpochData"
|
|
423
|
+
]
|
|
424
|
+
], []));
|
|
425
|
+
}
|
|
35
426
|
log;
|
|
36
427
|
dateProvider;
|
|
37
428
|
jobs;
|
|
@@ -52,7 +443,7 @@ import { ProverNodeJobMetrics, ProverNodeRewardsMetrics } from './metrics.js';
|
|
|
52
443
|
this.rollupContract = rollupContract;
|
|
53
444
|
this.l1Metrics = l1Metrics;
|
|
54
445
|
this.telemetryClient = telemetryClient;
|
|
55
|
-
this.log = createLogger('prover-node');
|
|
446
|
+
this.log = (_initProto(this), createLogger('prover-node'));
|
|
56
447
|
this.dateProvider = new DateProvider();
|
|
57
448
|
this.jobs = new Map();
|
|
58
449
|
this.config = {
|
|
@@ -238,7 +629,7 @@ import { ProverNodeJobMetrics, ProverNodeRewardsMetrics } from './metrics.js';
|
|
|
238
629
|
const l1ToL2Messages = await this.gatherMessages(epochNumber, checkpoints);
|
|
239
630
|
const [firstBlock] = checkpoints[0].blocks;
|
|
240
631
|
const previousBlockHeader = await this.gatherPreviousBlockHeader(epochNumber, firstBlock.number - 1);
|
|
241
|
-
const [lastPublishedCheckpoint] = await this.l2BlockSource.
|
|
632
|
+
const [lastPublishedCheckpoint] = await this.l2BlockSource.getCheckpoints(checkpoints.at(-1).number, 1);
|
|
242
633
|
const attestations = lastPublishedCheckpoint?.attestations ?? [];
|
|
243
634
|
return {
|
|
244
635
|
checkpoints,
|
|
@@ -311,19 +702,6 @@ import { ProverNodeJobMetrics, ProverNodeRewardsMetrics } from './metrics.js';
|
|
|
311
702
|
}
|
|
312
703
|
}
|
|
313
704
|
}
|
|
314
|
-
_ts_decorate([
|
|
315
|
-
trackSpan('ProverNode.createProvingJob', (epochNumber)=>({
|
|
316
|
-
[Attributes.EPOCH_NUMBER]: epochNumber
|
|
317
|
-
}))
|
|
318
|
-
], ProverNode.prototype, "createProvingJob", null);
|
|
319
|
-
_ts_decorate([
|
|
320
|
-
memoize
|
|
321
|
-
], ProverNode.prototype, "getL1Constants", null);
|
|
322
|
-
_ts_decorate([
|
|
323
|
-
trackSpan('ProverNode.gatherEpochData', (epochNumber)=>({
|
|
324
|
-
[Attributes.EPOCH_NUMBER]: epochNumber
|
|
325
|
-
}))
|
|
326
|
-
], ProverNode.prototype, "gatherEpochData", null);
|
|
327
705
|
class EmptyEpochError extends Error {
|
|
328
706
|
constructor(epochNumber){
|
|
329
707
|
super(`No blocks found for epoch ${epochNumber}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-node",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.fffb133c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -56,27 +56,27 @@
|
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
60
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
61
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
62
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
63
|
-
"@aztec/constants": "0.0.1-commit.
|
|
64
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
65
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
66
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
67
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
68
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
69
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
70
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
71
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
72
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
73
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
74
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
75
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
76
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
77
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
78
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
79
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
59
|
+
"@aztec/archiver": "0.0.1-commit.fffb133c",
|
|
60
|
+
"@aztec/bb-prover": "0.0.1-commit.fffb133c",
|
|
61
|
+
"@aztec/blob-client": "0.0.1-commit.fffb133c",
|
|
62
|
+
"@aztec/blob-lib": "0.0.1-commit.fffb133c",
|
|
63
|
+
"@aztec/constants": "0.0.1-commit.fffb133c",
|
|
64
|
+
"@aztec/epoch-cache": "0.0.1-commit.fffb133c",
|
|
65
|
+
"@aztec/ethereum": "0.0.1-commit.fffb133c",
|
|
66
|
+
"@aztec/foundation": "0.0.1-commit.fffb133c",
|
|
67
|
+
"@aztec/kv-store": "0.0.1-commit.fffb133c",
|
|
68
|
+
"@aztec/l1-artifacts": "0.0.1-commit.fffb133c",
|
|
69
|
+
"@aztec/node-keystore": "0.0.1-commit.fffb133c",
|
|
70
|
+
"@aztec/node-lib": "0.0.1-commit.fffb133c",
|
|
71
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.fffb133c",
|
|
72
|
+
"@aztec/p2p": "0.0.1-commit.fffb133c",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.fffb133c",
|
|
74
|
+
"@aztec/prover-client": "0.0.1-commit.fffb133c",
|
|
75
|
+
"@aztec/sequencer-client": "0.0.1-commit.fffb133c",
|
|
76
|
+
"@aztec/simulator": "0.0.1-commit.fffb133c",
|
|
77
|
+
"@aztec/stdlib": "0.0.1-commit.fffb133c",
|
|
78
|
+
"@aztec/telemetry-client": "0.0.1-commit.fffb133c",
|
|
79
|
+
"@aztec/world-state": "0.0.1-commit.fffb133c",
|
|
80
80
|
"source-map-support": "^0.5.21",
|
|
81
81
|
"tslib": "^2.4.0",
|
|
82
82
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@types/jest": "^30.0.0",
|
|
87
87
|
"@types/node": "^22.15.17",
|
|
88
88
|
"@types/source-map-support": "^0.5.10",
|
|
89
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
89
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
90
90
|
"jest": "^30.0.0",
|
|
91
91
|
"jest-mock-extended": "^4.0.0",
|
|
92
92
|
"ts-node": "^10.9.1",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createArchiverStore } from '@aztec/archiver';
|
|
2
|
+
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
2
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
4
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
4
5
|
import { type ProverClientConfig, createProverClient } from '@aztec/prover-client';
|
|
@@ -21,7 +22,7 @@ import { ProverNodeJobMetrics } from '../metrics.js';
|
|
|
21
22
|
export async function rerunEpochProvingJob(
|
|
22
23
|
localPath: string,
|
|
23
24
|
log: Logger,
|
|
24
|
-
config: DataStoreConfig & ProverBrokerConfig & ProverClientConfig,
|
|
25
|
+
config: DataStoreConfig & ProverBrokerConfig & ProverClientConfig & Pick<L1ContractsConfig, 'aztecEpochDuration'>,
|
|
25
26
|
) {
|
|
26
27
|
const jobData = deserializeEpochProvingJobData(readFileSync(localPath));
|
|
27
28
|
log.info(`Loaded proving job data for epoch ${jobData.epochNumber}`);
|
|
@@ -29,7 +30,7 @@ export async function rerunEpochProvingJob(
|
|
|
29
30
|
const telemetry = getTelemetryClient();
|
|
30
31
|
const metrics = new ProverNodeJobMetrics(telemetry.getMeter('prover-job'), telemetry.getTracer('prover-job'));
|
|
31
32
|
const worldState = await createWorldState(config);
|
|
32
|
-
const archiver = await createArchiverStore(config);
|
|
33
|
+
const archiver = await createArchiverStore(config, { epochDuration: config.aztecEpochDuration });
|
|
33
34
|
const publicProcessorFactory = new PublicProcessorFactory(archiver);
|
|
34
35
|
|
|
35
36
|
const publisher = { submitEpochProof: () => Promise.resolve(true) };
|
package/src/factory.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
2
2
|
import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
3
|
-
import {
|
|
3
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
4
4
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
5
5
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
6
6
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
@@ -12,7 +12,10 @@ import { DateProvider } from '@aztec/foundation/timer';
|
|
|
12
12
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
13
13
|
import { type KeyStoreConfig, KeystoreManager, loadKeystores, mergeKeystores } from '@aztec/node-keystore';
|
|
14
14
|
import { trySnapshotSync } from '@aztec/node-lib/actions';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
createForwarderL1TxUtilsFromEthSigner,
|
|
17
|
+
createL1TxUtilsFromEthSignerWithStore,
|
|
18
|
+
} from '@aztec/node-lib/factories';
|
|
16
19
|
import { NodeRpcTxSource, createP2PClient } from '@aztec/p2p';
|
|
17
20
|
import { type ProverClientConfig, createProverClient } from '@aztec/prover-client';
|
|
18
21
|
import { createAndStartProvingBroker } from '@aztec/prover-client/broker';
|
|
@@ -36,7 +39,6 @@ export type ProverNodeDeps = {
|
|
|
36
39
|
aztecNodeTxProvider?: Pick<AztecNode, 'getTxsByHash'>;
|
|
37
40
|
archiver?: Archiver;
|
|
38
41
|
publisherFactory?: ProverPublisherFactory;
|
|
39
|
-
blobClient?: BlobClientInterface;
|
|
40
42
|
broker?: ProvingJobBroker;
|
|
41
43
|
l1TxUtils?: L1TxUtils;
|
|
42
44
|
dateProvider?: DateProvider;
|
|
@@ -53,8 +55,7 @@ export async function createProverNode(
|
|
|
53
55
|
const config = { ...userConfig };
|
|
54
56
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
55
57
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
56
|
-
const blobClient =
|
|
57
|
-
deps.blobClient ?? createBlobClient(config, { logger: createLogger('prover-node:blob-client:client') });
|
|
58
|
+
const blobClient = await createBlobClientWithFileStores(config, createLogger('prover-node:blob-client:client'));
|
|
58
59
|
const log = deps.log ?? createLogger('prover-node');
|
|
59
60
|
|
|
60
61
|
// Build a key store from file if given or from environment otherwise
|
|
@@ -108,9 +109,8 @@ export async function createProverNode(
|
|
|
108
109
|
(await createArchiver(config, { blobClient, epochCache, telemetry, dateProvider }, { blockUntilSync: true }));
|
|
109
110
|
log.verbose(`Created archiver and synced to block ${await archiver.getBlockNumber()}`);
|
|
110
111
|
|
|
111
|
-
const worldStateConfig = { ...config, worldStateProvenBlocksOnly: false };
|
|
112
112
|
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
113
|
-
|
|
113
|
+
config,
|
|
114
114
|
archiver,
|
|
115
115
|
options.prefilledPublicData,
|
|
116
116
|
telemetry,
|
|
@@ -134,12 +134,20 @@ export async function createProverNode(
|
|
|
134
134
|
|
|
135
135
|
const l1TxUtils = deps.l1TxUtils
|
|
136
136
|
? [deps.l1TxUtils]
|
|
137
|
-
:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
: config.publisherForwarderAddress
|
|
138
|
+
? await createForwarderL1TxUtilsFromEthSigner(
|
|
139
|
+
publicClient,
|
|
140
|
+
proverSigners.signers,
|
|
141
|
+
config.publisherForwarderAddress,
|
|
142
|
+
{ ...config, scope: 'prover' },
|
|
143
|
+
{ telemetry, logger: log.createChild('l1-tx-utils'), dateProvider },
|
|
144
|
+
)
|
|
145
|
+
: await createL1TxUtilsFromEthSignerWithStore(
|
|
146
|
+
publicClient,
|
|
147
|
+
proverSigners.signers,
|
|
148
|
+
{ ...config, scope: 'prover' },
|
|
149
|
+
{ telemetry, logger: log.createChild('l1-tx-utils'), dateProvider },
|
|
150
|
+
);
|
|
143
151
|
|
|
144
152
|
const publisherFactory =
|
|
145
153
|
deps.publisherFactory ??
|
package/src/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
|
11
11
|
import { buildFinalBlobChallenges } from '@aztec/prover-client/helpers';
|
|
12
12
|
import type { PublicProcessor, PublicProcessorFactory } from '@aztec/simulator/server';
|
|
13
13
|
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
14
|
-
import type {
|
|
14
|
+
import type { L2Block, L2BlockSource } from '@aztec/stdlib/block';
|
|
15
15
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
16
16
|
import {
|
|
17
17
|
type EpochProver,
|
|
@@ -362,11 +362,14 @@ export class EpochProvingJob implements Traceable {
|
|
|
362
362
|
const intervalMs = Math.ceil((await l2BlockSource.getL1Constants()).ethereumSlotDuration / 2) * 1000;
|
|
363
363
|
this.epochCheckPromise = new RunningPromise(
|
|
364
364
|
async () => {
|
|
365
|
-
const
|
|
366
|
-
const blockHashes = await Promise.all(
|
|
365
|
+
const blockHeaders = await l2BlockSource.getCheckpointedBlockHeadersForEpoch(this.epochNumber);
|
|
366
|
+
const blockHashes = await Promise.all(blockHeaders.map(async header => (await header.hash()).toField()));
|
|
367
367
|
const thisBlocks = this.checkpoints.flatMap(checkpoint => checkpoint.blocks);
|
|
368
368
|
const thisBlockHashes = await Promise.all(thisBlocks.map(block => block.hash()));
|
|
369
|
-
if (
|
|
369
|
+
if (
|
|
370
|
+
blockHeaders.length !== thisBlocks.length ||
|
|
371
|
+
!blockHashes.every((block, i) => block.equals(thisBlockHashes[i]))
|
|
372
|
+
) {
|
|
370
373
|
this.log.warn('Epoch blocks changed underfoot', {
|
|
371
374
|
uuid: this.uuid,
|
|
372
375
|
epochNumber: this.epochNumber,
|
|
@@ -388,7 +391,7 @@ export class EpochProvingJob implements Traceable {
|
|
|
388
391
|
return [this.data.previousBlockHeader, ...lastBlocks.map(block => block.header).slice(0, -1)];
|
|
389
392
|
}
|
|
390
393
|
|
|
391
|
-
private getTxs(block:
|
|
394
|
+
private getTxs(block: L2Block): Tx[] {
|
|
392
395
|
return block.body.txEffects.map(txEffect => this.txs.get(txEffect.txHash.toString())!);
|
|
393
396
|
}
|
|
394
397
|
|