@aztec/aztec-node 0.0.1-commit.9593d84 → 0.0.1-commit.967fc6998
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/aztec-node/config.d.ts +11 -5
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +17 -3
- package/dest/aztec-node/node_metrics.d.ts +1 -1
- package/dest/aztec-node/node_metrics.d.ts.map +1 -1
- package/dest/aztec-node/node_metrics.js +9 -16
- package/dest/aztec-node/server.d.ts +67 -124
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +840 -261
- package/dest/sentinel/factory.d.ts +1 -1
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +1 -1
- package/dest/sentinel/sentinel.d.ts +6 -5
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +82 -51
- package/dest/sentinel/store.d.ts +2 -2
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +11 -7
- package/package.json +30 -28
- package/src/aztec-node/config.ts +34 -14
- package/src/aztec-node/node_metrics.ts +6 -17
- package/src/aztec-node/server.ts +586 -344
- package/src/sentinel/factory.ts +1 -6
- package/src/sentinel/sentinel.ts +94 -52
- package/src/sentinel/store.ts +12 -12
|
@@ -1,18 +1,388 @@
|
|
|
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
|
+
};
|
|
6
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;
|
|
7
374
|
import { createArchiver } from '@aztec/archiver';
|
|
8
375
|
import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
376
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
377
|
+
import { Blob } from '@aztec/blob-lib';
|
|
11
378
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
379
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
380
|
+
import { getPublicClient } from '@aztec/ethereum/client';
|
|
381
|
+
import { RegistryContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
382
|
+
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
383
|
+
import { compactArray, pick, unique } from '@aztec/foundation/collection';
|
|
384
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
14
385
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
15
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
16
386
|
import { BadRequestError } from '@aztec/foundation/json-rpc';
|
|
17
387
|
import { createLogger } from '@aztec/foundation/log';
|
|
18
388
|
import { count } from '@aztec/foundation/string';
|
|
@@ -20,30 +390,36 @@ import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
|
20
390
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
21
391
|
import { KeystoreManager, loadKeystores, mergeKeystores } from '@aztec/node-keystore';
|
|
22
392
|
import { trySnapshotSync, uploadSnapshot } from '@aztec/node-lib/actions';
|
|
23
|
-
import {
|
|
24
|
-
import { createP2PClient, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
393
|
+
import { createForwarderL1TxUtilsFromSigners, createL1TxUtilsFromSigners } from '@aztec/node-lib/factories';
|
|
394
|
+
import { createP2PClient, createTxValidatorForAcceptingTxsOverRPC, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
25
395
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
26
|
-
import {
|
|
396
|
+
import { createProverNode } from '@aztec/prover-node';
|
|
397
|
+
import { createKeyStoreForProver } from '@aztec/prover-node/config';
|
|
398
|
+
import { GlobalVariableBuilder, SequencerClient } from '@aztec/sequencer-client';
|
|
27
399
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
28
400
|
import { AttestationsBlockWatcher, EpochPruneWatcher, createSlasher } from '@aztec/slasher';
|
|
29
|
-
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
401
|
+
import { CollectionLimitsConfig, PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
30
402
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
31
|
-
import {
|
|
403
|
+
import { BlockHash, L2Block } from '@aztec/stdlib/block';
|
|
404
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
32
405
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
33
406
|
import { AztecNodeAdminConfigSchema } from '@aztec/stdlib/interfaces/client';
|
|
34
407
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
408
|
+
import { InMemoryDebugLogStore, NullDebugLogStore } from '@aztec/stdlib/logs';
|
|
35
409
|
import { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
36
|
-
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
37
410
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
38
411
|
import { PublicSimulationOutput, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
39
412
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
40
413
|
import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
41
|
-
import { NodeKeystoreAdapter, ValidatorClient, createBlockProposalHandler, createValidatorClient } from '@aztec/validator-client';
|
|
414
|
+
import { FullNodeCheckpointsBuilder as CheckpointsBuilder, FullNodeCheckpointsBuilder, NodeKeystoreAdapter, ValidatorClient, createBlockProposalHandler, createValidatorClient } from '@aztec/validator-client';
|
|
42
415
|
import { createWorldStateSynchronizer } from '@aztec/world-state';
|
|
43
416
|
import { createPublicClient, fallback, http } from 'viem';
|
|
44
417
|
import { createSentinel } from '../sentinel/factory.js';
|
|
45
418
|
import { createKeyStoreForValidator } from './config.js';
|
|
46
419
|
import { NodeMetrics } from './node_metrics.js';
|
|
420
|
+
_dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
421
|
+
[Attributes.TX_HASH]: tx.getTxHash().toString()
|
|
422
|
+
}));
|
|
47
423
|
/**
|
|
48
424
|
* The aztec node.
|
|
49
425
|
*/ export class AztecNodeService {
|
|
@@ -55,6 +431,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
55
431
|
l1ToL2MessageSource;
|
|
56
432
|
worldStateSynchronizer;
|
|
57
433
|
sequencer;
|
|
434
|
+
proverNode;
|
|
58
435
|
slasherClient;
|
|
59
436
|
validatorsSentinel;
|
|
60
437
|
epochPruneWatcher;
|
|
@@ -66,11 +443,25 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
66
443
|
proofVerifier;
|
|
67
444
|
telemetry;
|
|
68
445
|
log;
|
|
446
|
+
blobClient;
|
|
447
|
+
validatorClient;
|
|
448
|
+
keyStoreManager;
|
|
449
|
+
debugLogStore;
|
|
450
|
+
static{
|
|
451
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
452
|
+
[
|
|
453
|
+
_dec,
|
|
454
|
+
2,
|
|
455
|
+
"simulatePublicCalls"
|
|
456
|
+
]
|
|
457
|
+
], []));
|
|
458
|
+
}
|
|
69
459
|
metrics;
|
|
460
|
+
initialHeaderHashPromise;
|
|
70
461
|
// Prevent two snapshot operations to happen simultaneously
|
|
71
462
|
isUploadingSnapshot;
|
|
72
463
|
tracer;
|
|
73
|
-
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource, worldStateSynchronizer, sequencer, slasherClient, validatorsSentinel, epochPruneWatcher, l1ChainId, version, globalVariableBuilder, epochCache, packageVersion, proofVerifier, telemetry = getTelemetryClient(), log = createLogger('node')){
|
|
464
|
+
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource, worldStateSynchronizer, sequencer, proverNode, slasherClient, validatorsSentinel, epochPruneWatcher, l1ChainId, version, globalVariableBuilder, epochCache, packageVersion, proofVerifier, telemetry = getTelemetryClient(), log = createLogger('node'), blobClient, validatorClient, keyStoreManager, debugLogStore = new NullDebugLogStore()){
|
|
74
465
|
this.config = config;
|
|
75
466
|
this.p2pClient = p2pClient;
|
|
76
467
|
this.blockSource = blockSource;
|
|
@@ -79,6 +470,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
79
470
|
this.l1ToL2MessageSource = l1ToL2MessageSource;
|
|
80
471
|
this.worldStateSynchronizer = worldStateSynchronizer;
|
|
81
472
|
this.sequencer = sequencer;
|
|
473
|
+
this.proverNode = proverNode;
|
|
82
474
|
this.slasherClient = slasherClient;
|
|
83
475
|
this.validatorsSentinel = validatorsSentinel;
|
|
84
476
|
this.epochPruneWatcher = epochPruneWatcher;
|
|
@@ -90,11 +482,22 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
90
482
|
this.proofVerifier = proofVerifier;
|
|
91
483
|
this.telemetry = telemetry;
|
|
92
484
|
this.log = log;
|
|
485
|
+
this.blobClient = blobClient;
|
|
486
|
+
this.validatorClient = validatorClient;
|
|
487
|
+
this.keyStoreManager = keyStoreManager;
|
|
488
|
+
this.debugLogStore = debugLogStore;
|
|
489
|
+
this.initialHeaderHashPromise = (_initProto(this), undefined);
|
|
93
490
|
this.isUploadingSnapshot = false;
|
|
94
491
|
this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
|
|
95
492
|
this.tracer = telemetry.getTracer('AztecNodeService');
|
|
96
493
|
this.log.info(`Aztec Node version: ${this.packageVersion}`);
|
|
97
494
|
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config.l1Contracts);
|
|
495
|
+
// A defensive check that protects us against introducing a bug in the complex `createAndSync` function. We must
|
|
496
|
+
// never have debugLogStore enabled when not in test mode because then we would be accumulating debug logs in
|
|
497
|
+
// memory which could be a DoS vector on the sequencer (since no fees are paid for debug logs).
|
|
498
|
+
if (debugLogStore.isEnabled && config.realProofs) {
|
|
499
|
+
throw new Error('debugLogStore should never be enabled when realProofs are set');
|
|
500
|
+
}
|
|
98
501
|
}
|
|
99
502
|
async getWorldStateSyncStatus() {
|
|
100
503
|
const status = await this.worldStateSynchronizer.status();
|
|
@@ -115,20 +518,28 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
115
518
|
const packageVersion = getPackageVersion() ?? '';
|
|
116
519
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
117
520
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
118
|
-
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config, {
|
|
119
|
-
logger: createLogger('node:blob-sink:client')
|
|
120
|
-
});
|
|
121
521
|
const ethereumChain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
122
|
-
// Build a key store from file if given or from environment otherwise
|
|
522
|
+
// Build a key store from file if given or from environment otherwise.
|
|
523
|
+
// We keep the raw KeyStore available so we can merge with prover keys if enableProverNode is set.
|
|
123
524
|
let keyStoreManager;
|
|
124
525
|
const keyStoreProvided = config.keyStoreDirectory !== undefined && config.keyStoreDirectory.length > 0;
|
|
125
526
|
if (keyStoreProvided) {
|
|
126
527
|
const keyStores = loadKeystores(config.keyStoreDirectory);
|
|
127
528
|
keyStoreManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
128
529
|
} else {
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
530
|
+
const rawKeyStores = [];
|
|
531
|
+
const validatorKeyStore = createKeyStoreForValidator(config);
|
|
532
|
+
if (validatorKeyStore) {
|
|
533
|
+
rawKeyStores.push(validatorKeyStore);
|
|
534
|
+
}
|
|
535
|
+
if (config.enableProverNode) {
|
|
536
|
+
const proverKeyStore = createKeyStoreForProver(config);
|
|
537
|
+
if (proverKeyStore) {
|
|
538
|
+
rawKeyStores.push(proverKeyStore);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (rawKeyStores.length > 0) {
|
|
542
|
+
keyStoreManager = new KeystoreManager(rawKeyStores.length === 1 ? rawKeyStores[0] : mergeKeystores(rawKeyStores));
|
|
132
543
|
}
|
|
133
544
|
}
|
|
134
545
|
await keyStoreManager?.validateSigners();
|
|
@@ -137,8 +548,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
137
548
|
if (keyStoreManager === undefined) {
|
|
138
549
|
throw new Error('Failed to create key store, a requirement for running a validator');
|
|
139
550
|
}
|
|
140
|
-
if (!keyStoreProvided) {
|
|
141
|
-
log.warn(
|
|
551
|
+
if (!keyStoreProvided && process.env.NODE_ENV !== 'test') {
|
|
552
|
+
log.warn("Keystore created from env: it's recommended to use a file-based key store for production");
|
|
142
553
|
}
|
|
143
554
|
ValidatorClient.validateKeyStoreConfiguration(keyStoreManager, log);
|
|
144
555
|
}
|
|
@@ -148,7 +559,9 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
148
559
|
}
|
|
149
560
|
const publicClient = createPublicClient({
|
|
150
561
|
chain: ethereumChain.chainInfo,
|
|
151
|
-
transport: fallback(config.l1RpcUrls.map((url)=>http(url
|
|
562
|
+
transport: fallback(config.l1RpcUrls.map((url)=>http(url, {
|
|
563
|
+
batch: false
|
|
564
|
+
}))),
|
|
152
565
|
pollingInterval: config.viemPollingIntervalMS
|
|
153
566
|
});
|
|
154
567
|
const l1ContractsAddresses = await RegistryContract.collectAddresses(publicClient, config.l1Contracts.registryAddress, config.rollupVersion ?? 'canonical');
|
|
@@ -167,13 +580,14 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
167
580
|
if (config.rollupVersion !== Number(rollupVersionFromRollup)) {
|
|
168
581
|
log.warn(`Registry looked up and returned a rollup with version (${config.rollupVersion}), but this does not match with version detected from the rollup directly: (${rollupVersionFromRollup}).`);
|
|
169
582
|
}
|
|
583
|
+
const blobClient = await createBlobClientWithFileStores(config, log.createChild('blob-client'));
|
|
170
584
|
// attempt snapshot sync if possible
|
|
171
585
|
await trySnapshotSync(config, log);
|
|
172
586
|
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, {
|
|
173
587
|
dateProvider
|
|
174
588
|
});
|
|
175
589
|
const archiver = await createArchiver(config, {
|
|
176
|
-
|
|
590
|
+
blobClient,
|
|
177
591
|
epochCache,
|
|
178
592
|
telemetry,
|
|
179
593
|
dateProvider
|
|
@@ -182,74 +596,93 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
182
596
|
});
|
|
183
597
|
// now create the merkle trees and the world state synchronizer
|
|
184
598
|
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, options.prefilledPublicData, telemetry);
|
|
185
|
-
const circuitVerifier = config.realProofs ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier(config.proverTestVerificationDelayMs);
|
|
599
|
+
const circuitVerifier = config.realProofs || config.debugForceTxProofVerification ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier(config.proverTestVerificationDelayMs);
|
|
600
|
+
let debugLogStore;
|
|
186
601
|
if (!config.realProofs) {
|
|
187
602
|
log.warn(`Aztec node is accepting fake proofs`);
|
|
603
|
+
debugLogStore = new InMemoryDebugLogStore();
|
|
604
|
+
log.info('Aztec node started in test mode (realProofs set to false) hence debug logs from public functions will be collected and served');
|
|
605
|
+
} else {
|
|
606
|
+
debugLogStore = new NullDebugLogStore();
|
|
188
607
|
}
|
|
189
608
|
const proofVerifier = new QueuedIVCVerifier(config, circuitVerifier);
|
|
609
|
+
const proverOnly = config.enableProverNode && config.disableValidator;
|
|
610
|
+
if (proverOnly) {
|
|
611
|
+
log.info('Starting in prover-only mode: skipping validator, sequencer, sentinel, and slasher subsystems');
|
|
612
|
+
}
|
|
190
613
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
191
|
-
const p2pClient = await createP2PClient(
|
|
614
|
+
const p2pClient = await createP2PClient(config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, dateProvider, telemetry, deps.p2pClientDeps);
|
|
192
615
|
// We should really not be modifying the config object
|
|
193
616
|
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
|
|
194
|
-
|
|
617
|
+
// We'll accumulate sentinel watchers here
|
|
618
|
+
const watchers = [];
|
|
619
|
+
// Create FullNodeCheckpointsBuilder for block proposal handling and tx validation
|
|
620
|
+
const validatorCheckpointsBuilder = new FullNodeCheckpointsBuilder({
|
|
195
621
|
...config,
|
|
196
622
|
l1GenesisTime,
|
|
197
623
|
slotDuration: Number(slotDuration)
|
|
198
624
|
}, worldStateSynchronizer, archiver, dateProvider, telemetry);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
blockSource: archiver,
|
|
209
|
-
l1ToL2MessageSource: archiver,
|
|
210
|
-
keyStoreManager
|
|
211
|
-
});
|
|
212
|
-
// If we have a validator client, register it as a source of offenses for the slasher,
|
|
213
|
-
// and have it register callbacks on the p2p client *before* we start it, otherwise messages
|
|
214
|
-
// like attestations or auths will fail.
|
|
215
|
-
if (validatorClient) {
|
|
216
|
-
watchers.push(validatorClient);
|
|
217
|
-
if (!options.dontStartSequencer) {
|
|
218
|
-
await validatorClient.registerHandlers();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
// If there's no validator client but alwaysReexecuteBlockProposals is enabled,
|
|
222
|
-
// create a BlockProposalHandler to reexecute block proposals for monitoring
|
|
223
|
-
if (!validatorClient && config.alwaysReexecuteBlockProposals) {
|
|
224
|
-
log.info('Setting up block proposal reexecution for monitoring');
|
|
225
|
-
createBlockProposalHandler(config, {
|
|
226
|
-
blockBuilder,
|
|
625
|
+
let validatorClient;
|
|
626
|
+
if (!proverOnly) {
|
|
627
|
+
// Create validator client if required
|
|
628
|
+
validatorClient = await createValidatorClient(config, {
|
|
629
|
+
checkpointsBuilder: validatorCheckpointsBuilder,
|
|
630
|
+
worldState: worldStateSynchronizer,
|
|
631
|
+
p2pClient,
|
|
632
|
+
telemetry,
|
|
633
|
+
dateProvider,
|
|
227
634
|
epochCache,
|
|
228
635
|
blockSource: archiver,
|
|
229
636
|
l1ToL2MessageSource: archiver,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
637
|
+
keyStoreManager,
|
|
638
|
+
blobClient
|
|
639
|
+
});
|
|
640
|
+
// If we have a validator client, register it as a source of offenses for the slasher,
|
|
641
|
+
// and have it register callbacks on the p2p client *before* we start it, otherwise messages
|
|
642
|
+
// like attestations or auths will fail.
|
|
643
|
+
if (validatorClient) {
|
|
644
|
+
watchers.push(validatorClient);
|
|
645
|
+
if (!options.dontStartSequencer) {
|
|
646
|
+
await validatorClient.registerHandlers();
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// If there's no validator client but alwaysReexecuteBlockProposals is enabled,
|
|
650
|
+
// create a BlockProposalHandler to reexecute block proposals for monitoring
|
|
651
|
+
if (!validatorClient && config.alwaysReexecuteBlockProposals) {
|
|
652
|
+
log.info('Setting up block proposal reexecution for monitoring');
|
|
653
|
+
createBlockProposalHandler(config, {
|
|
654
|
+
checkpointsBuilder: validatorCheckpointsBuilder,
|
|
655
|
+
worldState: worldStateSynchronizer,
|
|
656
|
+
epochCache,
|
|
657
|
+
blockSource: archiver,
|
|
658
|
+
l1ToL2MessageSource: archiver,
|
|
659
|
+
p2pClient,
|
|
660
|
+
dateProvider,
|
|
661
|
+
telemetry
|
|
662
|
+
}).registerForReexecution(p2pClient);
|
|
663
|
+
}
|
|
234
664
|
}
|
|
235
665
|
// Start world state and wait for it to sync to the archiver.
|
|
236
666
|
await worldStateSynchronizer.start();
|
|
237
667
|
// Start p2p. Note that it depends on world state to be running.
|
|
238
668
|
await p2pClient.start();
|
|
239
|
-
|
|
240
|
-
if (validatorsSentinel && config.slashInactivityPenalty > 0n) {
|
|
241
|
-
watchers.push(validatorsSentinel);
|
|
242
|
-
}
|
|
669
|
+
let validatorsSentinel;
|
|
243
670
|
let epochPruneWatcher;
|
|
244
|
-
if (config.slashPrunePenalty > 0n || config.slashDataWithholdingPenalty > 0n) {
|
|
245
|
-
epochPruneWatcher = new EpochPruneWatcher(archiver, archiver, epochCache, p2pClient.getTxProvider(), blockBuilder, config);
|
|
246
|
-
watchers.push(epochPruneWatcher);
|
|
247
|
-
}
|
|
248
|
-
// We assume we want to slash for invalid attestations unless all max penalties are set to 0
|
|
249
671
|
let attestationsBlockWatcher;
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
|
|
672
|
+
if (!proverOnly) {
|
|
673
|
+
validatorsSentinel = await createSentinel(epochCache, archiver, p2pClient, config);
|
|
674
|
+
if (validatorsSentinel && config.slashInactivityPenalty > 0n) {
|
|
675
|
+
watchers.push(validatorsSentinel);
|
|
676
|
+
}
|
|
677
|
+
if (config.slashPrunePenalty > 0n || config.slashDataWithholdingPenalty > 0n) {
|
|
678
|
+
epochPruneWatcher = new EpochPruneWatcher(archiver, archiver, epochCache, p2pClient.getTxProvider(), validatorCheckpointsBuilder, config);
|
|
679
|
+
watchers.push(epochPruneWatcher);
|
|
680
|
+
}
|
|
681
|
+
// We assume we want to slash for invalid attestations unless all max penalties are set to 0
|
|
682
|
+
if (config.slashProposeInvalidAttestationsPenalty > 0n || config.slashAttestDescendantOfInvalidPenalty > 0n) {
|
|
683
|
+
attestationsBlockWatcher = new AttestationsBlockWatcher(archiver, epochCache, config);
|
|
684
|
+
watchers.push(attestationsBlockWatcher);
|
|
685
|
+
}
|
|
253
686
|
}
|
|
254
687
|
// Start p2p-related services once the archiver has completed sync
|
|
255
688
|
void archiver.waitForInitialSync().then(async ()=>{
|
|
@@ -262,21 +695,35 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
262
695
|
// Validator enabled, create/start relevant service
|
|
263
696
|
let sequencer;
|
|
264
697
|
let slasherClient;
|
|
265
|
-
if (!config.disableValidator) {
|
|
698
|
+
if (!config.disableValidator && validatorClient) {
|
|
266
699
|
// We create a slasher only if we have a sequencer, since all slashing actions go through the sequencer publisher
|
|
267
700
|
// as they are executed when the node is selected as proposer.
|
|
268
701
|
const validatorAddresses = keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager).getAddresses() : [];
|
|
269
702
|
slasherClient = await createSlasher(config, config.l1Contracts, getPublicClient(config), watchers, dateProvider, epochCache, validatorAddresses, undefined);
|
|
270
703
|
await slasherClient.start();
|
|
271
|
-
const l1TxUtils = await
|
|
704
|
+
const l1TxUtils = config.sequencerPublisherForwarderAddress ? await createForwarderL1TxUtilsFromSigners(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), config.sequencerPublisherForwarderAddress, {
|
|
705
|
+
...config,
|
|
706
|
+
scope: 'sequencer'
|
|
707
|
+
}, {
|
|
708
|
+
telemetry,
|
|
709
|
+
logger: log.createChild('l1-tx-utils'),
|
|
710
|
+
dateProvider,
|
|
711
|
+
kzg: Blob.getViemKzgInstance()
|
|
712
|
+
}) : await createL1TxUtilsFromSigners(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), {
|
|
272
713
|
...config,
|
|
273
714
|
scope: 'sequencer'
|
|
274
715
|
}, {
|
|
275
716
|
telemetry,
|
|
276
717
|
logger: log.createChild('l1-tx-utils'),
|
|
277
|
-
dateProvider
|
|
718
|
+
dateProvider,
|
|
719
|
+
kzg: Blob.getViemKzgInstance()
|
|
278
720
|
});
|
|
279
721
|
// Create and start the sequencer client
|
|
722
|
+
const checkpointsBuilder = new CheckpointsBuilder({
|
|
723
|
+
...config,
|
|
724
|
+
l1GenesisTime,
|
|
725
|
+
slotDuration: Number(slotDuration)
|
|
726
|
+
}, worldStateSynchronizer, archiver, dateProvider, telemetry, debugLogStore);
|
|
280
727
|
sequencer = await SequencerClient.new(config, {
|
|
281
728
|
...deps,
|
|
282
729
|
epochCache,
|
|
@@ -285,12 +732,12 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
285
732
|
p2pClient,
|
|
286
733
|
worldStateSynchronizer,
|
|
287
734
|
slasherClient,
|
|
288
|
-
|
|
735
|
+
checkpointsBuilder,
|
|
289
736
|
l2BlockSource: archiver,
|
|
290
737
|
l1ToL2MessageSource: archiver,
|
|
291
738
|
telemetry,
|
|
292
739
|
dateProvider,
|
|
293
|
-
|
|
740
|
+
blobClient,
|
|
294
741
|
nodeKeyStore: keyStoreManager
|
|
295
742
|
});
|
|
296
743
|
}
|
|
@@ -300,7 +747,35 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
300
747
|
} else if (sequencer) {
|
|
301
748
|
log.warn(`Sequencer created but not started`);
|
|
302
749
|
}
|
|
303
|
-
|
|
750
|
+
// Create prover node subsystem if enabled
|
|
751
|
+
let proverNode;
|
|
752
|
+
if (config.enableProverNode) {
|
|
753
|
+
proverNode = await createProverNode(config, {
|
|
754
|
+
...deps.proverNodeDeps,
|
|
755
|
+
telemetry,
|
|
756
|
+
dateProvider,
|
|
757
|
+
archiver,
|
|
758
|
+
worldStateSynchronizer,
|
|
759
|
+
p2pClient,
|
|
760
|
+
epochCache,
|
|
761
|
+
blobClient,
|
|
762
|
+
keyStoreManager
|
|
763
|
+
});
|
|
764
|
+
if (!options.dontStartProverNode) {
|
|
765
|
+
await proverNode.start();
|
|
766
|
+
log.info(`Prover node subsystem started`);
|
|
767
|
+
} else {
|
|
768
|
+
log.info(`Prover node subsystem created but not started`);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
const globalVariableBuilder = new GlobalVariableBuilder({
|
|
772
|
+
...config,
|
|
773
|
+
rollupVersion: BigInt(config.rollupVersion),
|
|
774
|
+
l1GenesisTime,
|
|
775
|
+
slotDuration: Number(slotDuration)
|
|
776
|
+
});
|
|
777
|
+
const node = new AztecNodeService(config, p2pClient, archiver, archiver, archiver, archiver, worldStateSynchronizer, sequencer, proverNode, slasherClient, validatorsSentinel, epochPruneWatcher, ethereumChain.chainInfo.id, config.rollupVersion, globalVariableBuilder, epochCache, packageVersion, proofVerifier, telemetry, log, blobClient, validatorClient, keyStoreManager, debugLogStore);
|
|
778
|
+
return node;
|
|
304
779
|
}
|
|
305
780
|
/**
|
|
306
781
|
* Returns the sequencer client instance.
|
|
@@ -308,6 +783,9 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
308
783
|
*/ getSequencer() {
|
|
309
784
|
return this.sequencer;
|
|
310
785
|
}
|
|
786
|
+
/** Returns the prover node subsystem, if enabled. */ getProverNode() {
|
|
787
|
+
return this.proverNode;
|
|
788
|
+
}
|
|
311
789
|
getBlockSource() {
|
|
312
790
|
return this.blockSource;
|
|
313
791
|
}
|
|
@@ -350,33 +828,46 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
350
828
|
rollupVersion,
|
|
351
829
|
enr,
|
|
352
830
|
l1ContractAddresses: contractAddresses,
|
|
353
|
-
protocolContractAddresses: protocolContractAddresses
|
|
831
|
+
protocolContractAddresses: protocolContractAddresses,
|
|
832
|
+
realProofs: !!this.config.realProofs
|
|
354
833
|
};
|
|
355
834
|
return nodeInfo;
|
|
356
835
|
}
|
|
357
836
|
/**
|
|
358
|
-
* Get a block specified by its number.
|
|
359
|
-
* @param
|
|
837
|
+
* Get a block specified by its block number, block hash, or 'latest'.
|
|
838
|
+
* @param block - The block parameter (block number, block hash, or 'latest').
|
|
360
839
|
* @returns The requested block.
|
|
361
|
-
*/ async getBlock(
|
|
362
|
-
|
|
363
|
-
|
|
840
|
+
*/ async getBlock(block) {
|
|
841
|
+
if (BlockHash.isBlockHash(block)) {
|
|
842
|
+
return this.getBlockByHash(block);
|
|
843
|
+
}
|
|
844
|
+
const blockNumber = block === 'latest' ? await this.getBlockNumber() : block;
|
|
845
|
+
if (blockNumber === BlockNumber.ZERO) {
|
|
846
|
+
return this.buildInitialBlock();
|
|
847
|
+
}
|
|
848
|
+
return await this.blockSource.getL2Block(blockNumber);
|
|
364
849
|
}
|
|
365
850
|
/**
|
|
366
851
|
* Get a block specified by its hash.
|
|
367
852
|
* @param blockHash - The block hash being requested.
|
|
368
853
|
* @returns The requested block.
|
|
369
854
|
*/ async getBlockByHash(blockHash) {
|
|
370
|
-
const
|
|
371
|
-
|
|
855
|
+
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
856
|
+
if (blockHash.equals(initialBlockHash)) {
|
|
857
|
+
return this.buildInitialBlock();
|
|
858
|
+
}
|
|
859
|
+
return await this.blockSource.getL2BlockByHash(blockHash);
|
|
860
|
+
}
|
|
861
|
+
buildInitialBlock() {
|
|
862
|
+
const initialHeader = this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
863
|
+
return L2Block.empty(initialHeader);
|
|
372
864
|
}
|
|
373
865
|
/**
|
|
374
866
|
* Get a block specified by its archive root.
|
|
375
867
|
* @param archive - The archive root being requested.
|
|
376
868
|
* @returns The requested block.
|
|
377
869
|
*/ async getBlockByArchive(archive) {
|
|
378
|
-
|
|
379
|
-
return publishedBlock?.block;
|
|
870
|
+
return await this.blockSource.getL2BlockByArchive(archive);
|
|
380
871
|
}
|
|
381
872
|
/**
|
|
382
873
|
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
@@ -384,16 +875,28 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
384
875
|
* @param limit - The maximum number of blocks to obtain.
|
|
385
876
|
* @returns The blocks requested.
|
|
386
877
|
*/ async getBlocks(from, limit) {
|
|
387
|
-
return await this.blockSource.getBlocks(from, limit) ?? [];
|
|
878
|
+
return await this.blockSource.getBlocks(from, BlockNumber(limit)) ?? [];
|
|
879
|
+
}
|
|
880
|
+
async getCheckpoints(from, limit) {
|
|
881
|
+
return await this.blockSource.getCheckpoints(from, limit) ?? [];
|
|
388
882
|
}
|
|
389
|
-
async
|
|
390
|
-
return await this.blockSource.
|
|
883
|
+
async getCheckpointedBlocks(from, limit) {
|
|
884
|
+
return await this.blockSource.getCheckpointedBlocks(from, limit) ?? [];
|
|
391
885
|
}
|
|
392
886
|
/**
|
|
393
|
-
* Method to fetch the current
|
|
394
|
-
* @returns The current
|
|
395
|
-
*/ async
|
|
396
|
-
return await this.globalVariableBuilder.
|
|
887
|
+
* Method to fetch the current min L2 fees.
|
|
888
|
+
* @returns The current min L2 fees.
|
|
889
|
+
*/ async getCurrentMinFees() {
|
|
890
|
+
return await this.globalVariableBuilder.getCurrentMinFees();
|
|
891
|
+
}
|
|
892
|
+
async getMaxPriorityFees() {
|
|
893
|
+
for await (const tx of this.p2pClient.iteratePendingTxs()){
|
|
894
|
+
return tx.getGasSettings().maxPriorityFeesPerGas;
|
|
895
|
+
}
|
|
896
|
+
return GasFees.from({
|
|
897
|
+
feePerDaGas: 0n,
|
|
898
|
+
feePerL2Gas: 0n
|
|
899
|
+
});
|
|
397
900
|
}
|
|
398
901
|
/**
|
|
399
902
|
* Method to fetch the latest block number synchronized by the node.
|
|
@@ -404,6 +907,9 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
404
907
|
async getProvenBlockNumber() {
|
|
405
908
|
return await this.blockSource.getProvenBlockNumber();
|
|
406
909
|
}
|
|
910
|
+
async getCheckpointedBlockNumber() {
|
|
911
|
+
return await this.blockSource.getCheckpointedL2BlockNumber();
|
|
912
|
+
}
|
|
407
913
|
/**
|
|
408
914
|
* Method to fetch the version of the package.
|
|
409
915
|
* @returns The node package version
|
|
@@ -428,22 +934,29 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
428
934
|
getContract(address) {
|
|
429
935
|
return this.contractDataSource.getContract(address);
|
|
430
936
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
937
|
+
async getPrivateLogsByTags(tags, page, referenceBlock) {
|
|
938
|
+
if (referenceBlock) {
|
|
939
|
+
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
940
|
+
if (!referenceBlock.equals(initialBlockHash)) {
|
|
941
|
+
const header = await this.blockSource.getBlockHeaderByHash(referenceBlock);
|
|
942
|
+
if (!header) {
|
|
943
|
+
throw new Error(`Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
return this.logsSource.getPrivateLogsByTags(tags, page);
|
|
948
|
+
}
|
|
949
|
+
async getPublicLogsByTagsFromContract(contractAddress, tags, page, referenceBlock) {
|
|
950
|
+
if (referenceBlock) {
|
|
951
|
+
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
952
|
+
if (!referenceBlock.equals(initialBlockHash)) {
|
|
953
|
+
const header = await this.blockSource.getBlockHeaderByHash(referenceBlock);
|
|
954
|
+
if (!header) {
|
|
955
|
+
throw new Error(`Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
return this.logsSource.getPublicLogsByTagsFromContract(contractAddress, tags, page);
|
|
447
960
|
}
|
|
448
961
|
/**
|
|
449
962
|
* Gets public logs based on the provided filter.
|
|
@@ -478,24 +991,33 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
478
991
|
throw new Error(`Invalid tx: ${reason}`);
|
|
479
992
|
}
|
|
480
993
|
await this.p2pClient.sendTx(tx);
|
|
481
|
-
|
|
482
|
-
this.
|
|
994
|
+
const duration = timer.ms();
|
|
995
|
+
this.metrics.receivedTx(duration, true);
|
|
996
|
+
this.log.info(`Received tx ${txHash} in ${duration}ms`, {
|
|
483
997
|
txHash
|
|
484
998
|
});
|
|
485
999
|
}
|
|
486
1000
|
async getTxReceipt(txHash) {
|
|
487
|
-
|
|
488
|
-
//
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
txReceipt = new TxReceipt(txHash, TxStatus.PENDING, '');
|
|
493
|
-
}
|
|
1001
|
+
// Check the tx pool status first. If the tx is known to the pool (pending or mined), we'll use that
|
|
1002
|
+
// as a fallback if we don't find a settled receipt in the archiver.
|
|
1003
|
+
const txPoolStatus = await this.p2pClient.getTxStatus(txHash);
|
|
1004
|
+
const isKnownToPool = txPoolStatus === 'pending' || txPoolStatus === 'mined';
|
|
1005
|
+
// Then get the actual tx from the archiver, which tracks every tx in a mined block.
|
|
494
1006
|
const settledTxReceipt = await this.blockSource.getSettledTxReceipt(txHash);
|
|
1007
|
+
let receipt;
|
|
495
1008
|
if (settledTxReceipt) {
|
|
496
|
-
|
|
1009
|
+
receipt = settledTxReceipt;
|
|
1010
|
+
} else if (isKnownToPool) {
|
|
1011
|
+
// If the tx is in the pool but not in the archiver, it's pending.
|
|
1012
|
+
// This handles race conditions between archiver and p2p, where the archiver
|
|
1013
|
+
// has pruned the block in which a tx was mined, but p2p has not caught up yet.
|
|
1014
|
+
receipt = new TxReceipt(txHash, TxStatus.PENDING, undefined, undefined);
|
|
1015
|
+
} else {
|
|
1016
|
+
// Otherwise, if we don't know the tx, we consider it dropped.
|
|
1017
|
+
receipt = new TxReceipt(txHash, TxStatus.DROPPED, undefined, 'Tx dropped by P2P node');
|
|
497
1018
|
}
|
|
498
|
-
|
|
1019
|
+
this.debugLogStore.decorateReceiptWithLogs(txHash.toString(), receipt);
|
|
1020
|
+
return receipt;
|
|
499
1021
|
}
|
|
500
1022
|
getTxEffect(txHash) {
|
|
501
1023
|
return this.blockSource.getTxEffect(txHash);
|
|
@@ -509,13 +1031,21 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
509
1031
|
await tryStop(this.slasherClient);
|
|
510
1032
|
await tryStop(this.proofVerifier);
|
|
511
1033
|
await tryStop(this.sequencer);
|
|
1034
|
+
await tryStop(this.proverNode);
|
|
512
1035
|
await tryStop(this.p2pClient);
|
|
513
1036
|
await tryStop(this.worldStateSynchronizer);
|
|
514
1037
|
await tryStop(this.blockSource);
|
|
1038
|
+
await tryStop(this.blobClient);
|
|
515
1039
|
await tryStop(this.telemetry);
|
|
516
1040
|
this.log.info(`Stopped Aztec Node`);
|
|
517
1041
|
}
|
|
518
1042
|
/**
|
|
1043
|
+
* Returns the blob client used by this node.
|
|
1044
|
+
* @internal - Exposed for testing purposes only.
|
|
1045
|
+
*/ getBlobClient() {
|
|
1046
|
+
return this.blobClient;
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
519
1049
|
* Method to retrieve pending txs.
|
|
520
1050
|
* @param limit - The number of items to returns
|
|
521
1051
|
* @param after - The last known pending tx. Used for pagination
|
|
@@ -540,15 +1070,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
540
1070
|
*/ async getTxsByHash(txHashes) {
|
|
541
1071
|
return compactArray(await Promise.all(txHashes.map((txHash)=>this.getTxByHash(txHash))));
|
|
542
1072
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
* the leaves were inserted.
|
|
546
|
-
* @param blockNumber - The block number at which to get the data or 'latest' for latest data.
|
|
547
|
-
* @param treeId - The tree to search in.
|
|
548
|
-
* @param leafValues - The values to search for.
|
|
549
|
-
* @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
|
|
550
|
-
*/ async findLeavesIndexes(blockNumber, treeId, leafValues) {
|
|
551
|
-
const committedDb = await this.#getWorldState(blockNumber);
|
|
1073
|
+
async findLeavesIndexes(referenceBlock, treeId, leafValues) {
|
|
1074
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
552
1075
|
const maybeIndices = await committedDb.findLeafIndices(treeId, leafValues.map((x)=>x.toBuffer()));
|
|
553
1076
|
// We filter out undefined values
|
|
554
1077
|
const indices = maybeIndices.filter((x)=>x !== undefined);
|
|
@@ -567,7 +1090,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
567
1090
|
// Now we obtain the block hashes from the archive tree by calling await `committedDb.getLeafValue(treeId, index)`
|
|
568
1091
|
// (note that block number corresponds to the leaf index in the archive tree).
|
|
569
1092
|
const blockHashes = await Promise.all(uniqueBlockNumbers.map((blockNumber)=>{
|
|
570
|
-
return committedDb.getLeafValue(MerkleTreeId.ARCHIVE, blockNumber);
|
|
1093
|
+
return committedDb.getLeafValue(MerkleTreeId.ARCHIVE, BigInt(blockNumber));
|
|
571
1094
|
}));
|
|
572
1095
|
// If any of the block hashes are undefined, we throw an error.
|
|
573
1096
|
for(let i = 0; i < uniqueBlockNumbers.length; i++){
|
|
@@ -575,7 +1098,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
575
1098
|
throw new Error(`Block hash is undefined for block number ${uniqueBlockNumbers[i]}`);
|
|
576
1099
|
}
|
|
577
1100
|
}
|
|
578
|
-
// Create
|
|
1101
|
+
// Create DataInBlock objects by combining indices, blockNumbers and blockHashes and return them.
|
|
579
1102
|
return maybeIndices.map((index, i)=>{
|
|
580
1103
|
if (index === undefined) {
|
|
581
1104
|
return undefined;
|
|
@@ -590,51 +1113,28 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
590
1113
|
return undefined;
|
|
591
1114
|
}
|
|
592
1115
|
return {
|
|
593
|
-
l2BlockNumber: Number(blockNumber),
|
|
594
|
-
l2BlockHash:
|
|
1116
|
+
l2BlockNumber: BlockNumber(Number(blockNumber)),
|
|
1117
|
+
l2BlockHash: new BlockHash(blockHash),
|
|
595
1118
|
data: index
|
|
596
1119
|
};
|
|
597
1120
|
});
|
|
598
1121
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
* @param blockNumber - The block number at which to get the data.
|
|
602
|
-
* @param leafIndex - The index of the leaf for which the sibling path is required.
|
|
603
|
-
* @returns The sibling path for the leaf index.
|
|
604
|
-
*/ async getNullifierSiblingPath(blockNumber, leafIndex) {
|
|
605
|
-
const committedDb = await this.#getWorldState(blockNumber);
|
|
606
|
-
return committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, leafIndex);
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* Returns a sibling path for the given index in the data tree.
|
|
610
|
-
* @param blockNumber - The block number at which to get the data.
|
|
611
|
-
* @param leafIndex - The index of the leaf for which the sibling path is required.
|
|
612
|
-
* @returns The sibling path for the leaf index.
|
|
613
|
-
*/ async getNoteHashSiblingPath(blockNumber, leafIndex) {
|
|
614
|
-
const committedDb = await this.#getWorldState(blockNumber);
|
|
615
|
-
return committedDb.getSiblingPath(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
|
|
616
|
-
}
|
|
617
|
-
async getArchiveMembershipWitness(blockNumber, archive) {
|
|
618
|
-
const committedDb = await this.#getWorldState(blockNumber);
|
|
1122
|
+
async getBlockHashMembershipWitness(referenceBlock, blockHash) {
|
|
1123
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
619
1124
|
const [pathAndIndex] = await committedDb.findSiblingPaths(MerkleTreeId.ARCHIVE, [
|
|
620
|
-
|
|
1125
|
+
blockHash
|
|
621
1126
|
]);
|
|
622
1127
|
return pathAndIndex === undefined ? undefined : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
623
1128
|
}
|
|
624
|
-
async getNoteHashMembershipWitness(
|
|
625
|
-
const committedDb = await this.#getWorldState(
|
|
1129
|
+
async getNoteHashMembershipWitness(referenceBlock, noteHash) {
|
|
1130
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
626
1131
|
const [pathAndIndex] = await committedDb.findSiblingPaths(MerkleTreeId.NOTE_HASH_TREE, [
|
|
627
1132
|
noteHash
|
|
628
1133
|
]);
|
|
629
1134
|
return pathAndIndex === undefined ? undefined : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
630
1135
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
* @param blockNumber - The block number at which to get the data.
|
|
634
|
-
* @param l1ToL2Message - The l1ToL2Message to get the index / sibling path for.
|
|
635
|
-
* @returns A tuple of the index and the sibling path of the L1ToL2Message (undefined if not found).
|
|
636
|
-
*/ async getL1ToL2MessageMembershipWitness(blockNumber, l1ToL2Message) {
|
|
637
|
-
const db = await this.#getWorldState(blockNumber);
|
|
1136
|
+
async getL1ToL2MessageMembershipWitness(referenceBlock, l1ToL2Message) {
|
|
1137
|
+
const db = await this.#getWorldState(referenceBlock);
|
|
638
1138
|
const [witness] = await db.findSiblingPaths(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, [
|
|
639
1139
|
l1ToL2Message
|
|
640
1140
|
]);
|
|
@@ -649,7 +1149,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
649
1149
|
}
|
|
650
1150
|
async getL1ToL2MessageBlock(l1ToL2Message) {
|
|
651
1151
|
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
652
|
-
return messageIndex ? InboxLeaf.
|
|
1152
|
+
return messageIndex ? BlockNumber.fromCheckpointNumber(InboxLeaf.checkpointNumberFromIndex(messageIndex)) : undefined;
|
|
653
1153
|
}
|
|
654
1154
|
/**
|
|
655
1155
|
* Returns whether an L1 to L2 message is synced by archiver and if it's ready to be included in a block.
|
|
@@ -660,38 +1160,29 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
660
1160
|
return messageIndex !== undefined;
|
|
661
1161
|
}
|
|
662
1162
|
/**
|
|
663
|
-
* Returns all the L2 to L1 messages in
|
|
664
|
-
* @param
|
|
665
|
-
* @returns The L2 to L1 messages (
|
|
666
|
-
*/ async getL2ToL1Messages(
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
* @returns The sibling path.
|
|
684
|
-
*/ async getPublicDataSiblingPath(blockNumber, leafIndex) {
|
|
685
|
-
const committedDb = await this.#getWorldState(blockNumber);
|
|
686
|
-
return committedDb.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, leafIndex);
|
|
1163
|
+
* Returns all the L2 to L1 messages in an epoch.
|
|
1164
|
+
* @param epoch - The epoch at which to get the data.
|
|
1165
|
+
* @returns The L2 to L1 messages (empty array if the epoch is not found).
|
|
1166
|
+
*/ async getL2ToL1Messages(epoch) {
|
|
1167
|
+
// Assumes `getCheckpointedBlocksForEpoch` returns blocks in ascending order of block number.
|
|
1168
|
+
const checkpointedBlocks = await this.blockSource.getCheckpointedBlocksForEpoch(epoch);
|
|
1169
|
+
const blocksInCheckpoints = [];
|
|
1170
|
+
let previousSlotNumber = SlotNumber.ZERO;
|
|
1171
|
+
let checkpointIndex = -1;
|
|
1172
|
+
for (const checkpointedBlock of checkpointedBlocks){
|
|
1173
|
+
const block = checkpointedBlock.block;
|
|
1174
|
+
const slotNumber = block.header.globalVariables.slotNumber;
|
|
1175
|
+
if (slotNumber !== previousSlotNumber) {
|
|
1176
|
+
checkpointIndex++;
|
|
1177
|
+
blocksInCheckpoints.push([]);
|
|
1178
|
+
previousSlotNumber = slotNumber;
|
|
1179
|
+
}
|
|
1180
|
+
blocksInCheckpoints[checkpointIndex].push(block);
|
|
1181
|
+
}
|
|
1182
|
+
return blocksInCheckpoints.map((blocks)=>blocks.map((block)=>block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs)));
|
|
687
1183
|
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
* @param blockNumber - The block number at which to get the index.
|
|
691
|
-
* @param nullifier - Nullifier we try to find witness for.
|
|
692
|
-
* @returns The nullifier membership witness (if found).
|
|
693
|
-
*/ async getNullifierMembershipWitness(blockNumber, nullifier) {
|
|
694
|
-
const db = await this.#getWorldState(blockNumber);
|
|
1184
|
+
async getNullifierMembershipWitness(referenceBlock, nullifier) {
|
|
1185
|
+
const db = await this.#getWorldState(referenceBlock);
|
|
695
1186
|
const [witness] = await db.findSiblingPaths(MerkleTreeId.NULLIFIER_TREE, [
|
|
696
1187
|
nullifier.toBuffer()
|
|
697
1188
|
]);
|
|
@@ -707,7 +1198,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
707
1198
|
}
|
|
708
1199
|
/**
|
|
709
1200
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
710
|
-
* @param
|
|
1201
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data
|
|
1202
|
+
* (which contains the root of the nullifier tree in which we are searching for the nullifier).
|
|
711
1203
|
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
712
1204
|
* @returns The low nullifier membership witness (if found).
|
|
713
1205
|
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
@@ -718,8 +1210,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
718
1210
|
* the nullifier already exists in the tree. This is because the `getPreviousValueIndex` function returns the
|
|
719
1211
|
* index of the nullifier itself when it already exists in the tree.
|
|
720
1212
|
* TODO: This is a confusing behavior and we should eventually address that.
|
|
721
|
-
*/ async getLowNullifierMembershipWitness(
|
|
722
|
-
const committedDb = await this.#getWorldState(
|
|
1213
|
+
*/ async getLowNullifierMembershipWitness(referenceBlock, nullifier) {
|
|
1214
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
723
1215
|
const findResult = await committedDb.getPreviousValueIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBigInt());
|
|
724
1216
|
if (!findResult) {
|
|
725
1217
|
return undefined;
|
|
@@ -732,8 +1224,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
732
1224
|
const siblingPath = await committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, BigInt(index));
|
|
733
1225
|
return new NullifierMembershipWitness(BigInt(index), preimageData, siblingPath);
|
|
734
1226
|
}
|
|
735
|
-
async getPublicDataWitness(
|
|
736
|
-
const committedDb = await this.#getWorldState(
|
|
1227
|
+
async getPublicDataWitness(referenceBlock, leafSlot) {
|
|
1228
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
737
1229
|
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
738
1230
|
if (!lowLeafResult) {
|
|
739
1231
|
return undefined;
|
|
@@ -743,18 +1235,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
743
1235
|
return new PublicDataWitness(lowLeafResult.index, preimage, path);
|
|
744
1236
|
}
|
|
745
1237
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
*
|
|
749
|
-
* @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
|
|
750
|
-
* Aztec's version of `eth_getStorageAt`.
|
|
751
|
-
*
|
|
752
|
-
* @param contract - Address of the contract to query.
|
|
753
|
-
* @param slot - Slot to query.
|
|
754
|
-
* @param blockNumber - The block number at which to get the data or 'latest'.
|
|
755
|
-
* @returns Storage value at the given contract slot.
|
|
756
|
-
*/ async getPublicStorageAt(blockNumber, contract, slot) {
|
|
757
|
-
const committedDb = await this.#getWorldState(blockNumber);
|
|
1238
|
+
async getPublicStorageAt(referenceBlock, contract, slot) {
|
|
1239
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
758
1240
|
const leafSlot = await computePublicDataTreeLeafSlot(contract, slot);
|
|
759
1241
|
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
760
1242
|
if (!lowLeafResult || !lowLeafResult.alreadyPresent) {
|
|
@@ -763,18 +1245,22 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
763
1245
|
const preimage = await committedDb.getLeafPreimage(MerkleTreeId.PUBLIC_DATA_TREE, lowLeafResult.index);
|
|
764
1246
|
return preimage.leaf.value;
|
|
765
1247
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
1248
|
+
async getBlockHeader(block = 'latest') {
|
|
1249
|
+
if (BlockHash.isBlockHash(block)) {
|
|
1250
|
+
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
1251
|
+
if (block.equals(initialBlockHash)) {
|
|
1252
|
+
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1253
|
+
return this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
1254
|
+
}
|
|
1255
|
+
return this.blockSource.getBlockHeaderByHash(block);
|
|
1256
|
+
} else {
|
|
1257
|
+
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1258
|
+
const blockNumber = block === 'latest' ? await this.getBlockNumber() : block;
|
|
1259
|
+
if (blockNumber === BlockNumber.ZERO) {
|
|
1260
|
+
return this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
1261
|
+
}
|
|
1262
|
+
return this.blockSource.getBlockHeader(block);
|
|
1263
|
+
}
|
|
778
1264
|
}
|
|
779
1265
|
/**
|
|
780
1266
|
* Get a block header specified by its archive root.
|
|
@@ -783,6 +1269,12 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
783
1269
|
*/ async getBlockHeaderByArchive(archive) {
|
|
784
1270
|
return await this.blockSource.getBlockHeaderByArchive(archive);
|
|
785
1271
|
}
|
|
1272
|
+
getBlockData(number) {
|
|
1273
|
+
return this.blockSource.getBlockData(number);
|
|
1274
|
+
}
|
|
1275
|
+
getBlockDataByArchive(archive) {
|
|
1276
|
+
return this.blockSource.getBlockDataByArchive(archive);
|
|
1277
|
+
}
|
|
786
1278
|
/**
|
|
787
1279
|
* Simulates the public part of a transaction with the current state.
|
|
788
1280
|
* @param tx - The transaction to simulate.
|
|
@@ -795,17 +1287,20 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
795
1287
|
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
796
1288
|
}
|
|
797
1289
|
const txHash = tx.getTxHash();
|
|
798
|
-
const
|
|
1290
|
+
const latestBlockNumber = await this.blockSource.getBlockNumber();
|
|
1291
|
+
const blockNumber = BlockNumber.add(latestBlockNumber, 1);
|
|
799
1292
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
800
1293
|
const coinbase = EthAddress.ZERO;
|
|
801
1294
|
const feeRecipient = AztecAddress.ZERO;
|
|
802
1295
|
const newGlobalVariables = await this.globalVariableBuilder.buildGlobalVariables(blockNumber, coinbase, feeRecipient);
|
|
803
|
-
const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, new DateProvider(), this.telemetry);
|
|
1296
|
+
const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, new DateProvider(), this.telemetry, this.log.getBindings());
|
|
804
1297
|
this.log.verbose(`Simulating public calls for tx ${txHash}`, {
|
|
805
1298
|
globalVariables: newGlobalVariables.toInspect(),
|
|
806
1299
|
txHash,
|
|
807
1300
|
blockNumber
|
|
808
1301
|
});
|
|
1302
|
+
// Ensure world-state has caught up with the latest block we loaded from the archiver
|
|
1303
|
+
await this.worldStateSynchronizer.syncImmediate(latestBlockNumber);
|
|
809
1304
|
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
810
1305
|
try {
|
|
811
1306
|
const config = PublicSimulatorConfig.from({
|
|
@@ -813,12 +1308,14 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
813
1308
|
collectDebugLogs: true,
|
|
814
1309
|
collectHints: false,
|
|
815
1310
|
collectCallMetadata: true,
|
|
816
|
-
|
|
817
|
-
|
|
1311
|
+
collectStatistics: false,
|
|
1312
|
+
collectionLimits: CollectionLimitsConfig.from({
|
|
1313
|
+
maxDebugLogMemoryReads: this.config.rpcSimulatePublicMaxDebugLogMemoryReads
|
|
1314
|
+
})
|
|
818
1315
|
});
|
|
819
1316
|
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, config);
|
|
820
1317
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
821
|
-
const [processedTxs, failedTxs, _usedTxs, returns] = await processor.process([
|
|
1318
|
+
const [processedTxs, failedTxs, _usedTxs, returns, _blobFields, debugLogs] = await processor.process([
|
|
822
1319
|
tx
|
|
823
1320
|
]);
|
|
824
1321
|
// REFACTOR: Consider returning the error rather than throwing
|
|
@@ -829,7 +1326,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
829
1326
|
throw failedTxs[0].error;
|
|
830
1327
|
}
|
|
831
1328
|
const [processedTx] = processedTxs;
|
|
832
|
-
return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed);
|
|
1329
|
+
return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed, debugLogs);
|
|
833
1330
|
} finally{
|
|
834
1331
|
await merkleTreeFork.close();
|
|
835
1332
|
}
|
|
@@ -837,19 +1334,19 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
837
1334
|
async isValidTx(tx, { isSimulation, skipFeeEnforcement } = {}) {
|
|
838
1335
|
const db = this.worldStateSynchronizer.getCommitted();
|
|
839
1336
|
const verifier = isSimulation ? undefined : this.proofVerifier;
|
|
840
|
-
// We accept transactions if they are not expired by the next slot (checked based on the
|
|
1337
|
+
// We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field)
|
|
841
1338
|
const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
842
|
-
const blockNumber = await this.blockSource.getBlockNumber() + 1;
|
|
843
|
-
const validator =
|
|
1339
|
+
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
1340
|
+
const validator = createTxValidatorForAcceptingTxsOverRPC(db, this.contractDataSource, verifier, {
|
|
844
1341
|
timestamp: nextSlotTimestamp,
|
|
845
1342
|
blockNumber,
|
|
846
1343
|
l1ChainId: this.l1ChainId,
|
|
847
1344
|
rollupVersion: this.version,
|
|
848
1345
|
setupAllowList: this.config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions(),
|
|
849
|
-
gasFees: await this.
|
|
1346
|
+
gasFees: await this.getCurrentMinFees(),
|
|
850
1347
|
skipFeeEnforcement,
|
|
851
1348
|
txsPermitted: !this.config.disableTransactions
|
|
852
|
-
});
|
|
1349
|
+
}, this.log.getBindings());
|
|
853
1350
|
return await validator.validateTx(tx);
|
|
854
1351
|
}
|
|
855
1352
|
getConfig() {
|
|
@@ -909,7 +1406,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
909
1406
|
throw new Error(`Archiver initial sync not complete. Cannot start snapshot.`);
|
|
910
1407
|
}
|
|
911
1408
|
// And it has an L2 block hash
|
|
912
|
-
const l2BlockHash = await archiver.getL2Tips().then((tips)=>tips.
|
|
1409
|
+
const l2BlockHash = await archiver.getL2Tips().then((tips)=>tips.proposed.hash);
|
|
913
1410
|
if (!l2BlockHash) {
|
|
914
1411
|
this.metrics.recordSnapshotError();
|
|
915
1412
|
throw new Error(`Archiver has no latest L2 block hash downloaded. Cannot start snapshot.`);
|
|
@@ -936,7 +1433,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
936
1433
|
if (!('rollbackTo' in archiver)) {
|
|
937
1434
|
throw new Error('Archiver implementation does not support rollbacks.');
|
|
938
1435
|
}
|
|
939
|
-
const finalizedBlock = await archiver.getL2Tips().then((tips)=>tips.finalized.number);
|
|
1436
|
+
const finalizedBlock = await archiver.getL2Tips().then((tips)=>tips.finalized.block.number);
|
|
940
1437
|
if (targetBlock < finalizedBlock) {
|
|
941
1438
|
if (force) {
|
|
942
1439
|
this.log.warn(`Clearing world state database to allow rolling back behind finalized block ${finalizedBlock}`);
|
|
@@ -991,30 +1488,117 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
991
1488
|
return this.slasherClient.gatherOffensesForRound(round === 'current' ? undefined : BigInt(round));
|
|
992
1489
|
}
|
|
993
1490
|
}
|
|
1491
|
+
async reloadKeystore() {
|
|
1492
|
+
if (!this.config.keyStoreDirectory?.length) {
|
|
1493
|
+
throw new BadRequestError('Cannot reload keystore: node is not using a file-based keystore. ' + 'Set KEY_STORE_DIRECTORY to use file-based keystores.');
|
|
1494
|
+
}
|
|
1495
|
+
if (!this.validatorClient) {
|
|
1496
|
+
throw new BadRequestError('Cannot reload keystore: validator is not enabled.');
|
|
1497
|
+
}
|
|
1498
|
+
this.log.info('Reloading keystore from disk');
|
|
1499
|
+
// Re-read and validate keystore files
|
|
1500
|
+
const keyStores = loadKeystores(this.config.keyStoreDirectory);
|
|
1501
|
+
const newManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
1502
|
+
await newManager.validateSigners();
|
|
1503
|
+
ValidatorClient.validateKeyStoreConfiguration(newManager, this.log);
|
|
1504
|
+
// Validate that every validator's publisher keys overlap with the L1 signers
|
|
1505
|
+
// that were initialized at startup. Publishers cannot be hot-reloaded, so a
|
|
1506
|
+
// validator with a publisher key that doesn't match any existing L1 signer
|
|
1507
|
+
// would silently fail on every proposer slot.
|
|
1508
|
+
if (this.keyStoreManager && this.sequencer) {
|
|
1509
|
+
const oldAdapter = NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager);
|
|
1510
|
+
const availablePublishers = new Set(oldAdapter.getAttesterAddresses().flatMap((a)=>oldAdapter.getPublisherAddresses(a).map((p)=>p.toString().toLowerCase())));
|
|
1511
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1512
|
+
for (const attester of newAdapter.getAttesterAddresses()){
|
|
1513
|
+
const pubs = newAdapter.getPublisherAddresses(attester);
|
|
1514
|
+
if (pubs.length > 0 && !pubs.some((p)=>availablePublishers.has(p.toString().toLowerCase()))) {
|
|
1515
|
+
throw new BadRequestError(`Cannot reload keystore: validator ${attester} has publisher keys ` + `[${pubs.map((p)=>p.toString()).join(', ')}] but none match the L1 signers initialized at startup ` + `[${[
|
|
1516
|
+
...availablePublishers
|
|
1517
|
+
].join(', ')}]. Publishers cannot be hot-reloaded — ` + `use an existing publisher key or restart the node.`);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
// Build adapters for old and new keystores to compute diff
|
|
1522
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1523
|
+
const newAddresses = newAdapter.getAttesterAddresses();
|
|
1524
|
+
const oldAddresses = this.keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager).getAttesterAddresses() : [];
|
|
1525
|
+
const oldSet = new Set(oldAddresses.map((a)=>a.toString()));
|
|
1526
|
+
const newSet = new Set(newAddresses.map((a)=>a.toString()));
|
|
1527
|
+
const added = newAddresses.filter((a)=>!oldSet.has(a.toString()));
|
|
1528
|
+
const removed = oldAddresses.filter((a)=>!newSet.has(a.toString()));
|
|
1529
|
+
if (added.length > 0) {
|
|
1530
|
+
this.log.info(`Keystore reload: adding attester keys: ${added.map((a)=>a.toString()).join(', ')}`);
|
|
1531
|
+
}
|
|
1532
|
+
if (removed.length > 0) {
|
|
1533
|
+
this.log.info(`Keystore reload: removing attester keys: ${removed.map((a)=>a.toString()).join(', ')}`);
|
|
1534
|
+
}
|
|
1535
|
+
if (added.length === 0 && removed.length === 0) {
|
|
1536
|
+
this.log.info('Keystore reload: attester keys unchanged');
|
|
1537
|
+
}
|
|
1538
|
+
// Update the validator client (coinbase, feeRecipient, attester keys)
|
|
1539
|
+
this.validatorClient.reloadKeystore(newManager);
|
|
1540
|
+
// Update the publisher factory's keystore so newly-added validators
|
|
1541
|
+
// can be matched to existing publisher keys when proposing blocks.
|
|
1542
|
+
if (this.sequencer) {
|
|
1543
|
+
this.sequencer.updatePublisherNodeKeyStore(newAdapter);
|
|
1544
|
+
}
|
|
1545
|
+
// Update slasher's "don't-slash-self" list with new validator addresses
|
|
1546
|
+
if (this.slasherClient && !this.config.slashSelfAllowed) {
|
|
1547
|
+
const slashValidatorsNever = unique([
|
|
1548
|
+
...this.config.slashValidatorsNever ?? [],
|
|
1549
|
+
...newAddresses
|
|
1550
|
+
].map((a)=>a.toString())).map(EthAddress.fromString);
|
|
1551
|
+
this.slasherClient.updateConfig({
|
|
1552
|
+
slashValidatorsNever
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
this.keyStoreManager = newManager;
|
|
1556
|
+
this.log.info('Keystore reloaded: coinbase, feeRecipient, and attester keys updated');
|
|
1557
|
+
}
|
|
1558
|
+
#getInitialHeaderHash() {
|
|
1559
|
+
if (!this.initialHeaderHashPromise) {
|
|
1560
|
+
this.initialHeaderHashPromise = this.worldStateSynchronizer.getCommitted().getInitialHeader().hash();
|
|
1561
|
+
}
|
|
1562
|
+
return this.initialHeaderHashPromise;
|
|
1563
|
+
}
|
|
994
1564
|
/**
|
|
995
1565
|
* Returns an instance of MerkleTreeOperations having first ensured the world state is fully synched
|
|
996
|
-
* @param
|
|
1566
|
+
* @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
997
1567
|
* @returns An instance of a committed MerkleTreeOperations
|
|
998
|
-
*/ async #getWorldState(
|
|
999
|
-
|
|
1000
|
-
throw new Error('Invalid block number to get world state for: ' + blockNumber);
|
|
1001
|
-
}
|
|
1002
|
-
let blockSyncedTo = 0;
|
|
1568
|
+
*/ async #getWorldState(block) {
|
|
1569
|
+
let blockSyncedTo = BlockNumber.ZERO;
|
|
1003
1570
|
try {
|
|
1004
1571
|
// Attempt to sync the world state if necessary
|
|
1005
1572
|
blockSyncedTo = await this.#syncWorldState();
|
|
1006
1573
|
} catch (err) {
|
|
1007
1574
|
this.log.error(`Error getting world state: ${err}`);
|
|
1008
1575
|
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
this.log.debug(`Using committed db for block ${blockNumber}, world state synced upto ${blockSyncedTo}`);
|
|
1576
|
+
if (block === 'latest') {
|
|
1577
|
+
this.log.debug(`Using committed db for block 'latest', world state synced upto ${blockSyncedTo}`);
|
|
1012
1578
|
return this.worldStateSynchronizer.getCommitted();
|
|
1013
|
-
}
|
|
1579
|
+
}
|
|
1580
|
+
if (BlockHash.isBlockHash(block)) {
|
|
1581
|
+
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
1582
|
+
if (block.equals(initialBlockHash)) {
|
|
1583
|
+
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1584
|
+
return this.worldStateSynchronizer.getSnapshot(BlockNumber.ZERO);
|
|
1585
|
+
}
|
|
1586
|
+
const header = await this.blockSource.getBlockHeaderByHash(block);
|
|
1587
|
+
if (!header) {
|
|
1588
|
+
throw new Error(`Block hash ${block.toString()} not found when querying world state. If the node API has been queried with anchor block hash possibly a reorg has occurred.`);
|
|
1589
|
+
}
|
|
1590
|
+
const blockNumber = header.getBlockNumber();
|
|
1591
|
+
this.log.debug(`Using snapshot for block ${blockNumber}, world state synced upto ${blockSyncedTo}`);
|
|
1592
|
+
return this.worldStateSynchronizer.getSnapshot(blockNumber);
|
|
1593
|
+
}
|
|
1594
|
+
// Block number provided
|
|
1595
|
+
{
|
|
1596
|
+
const blockNumber = block;
|
|
1597
|
+
if (blockNumber > blockSyncedTo) {
|
|
1598
|
+
throw new Error(`Queried block ${block} not yet synced by the node (node is synced upto ${blockSyncedTo}).`);
|
|
1599
|
+
}
|
|
1014
1600
|
this.log.debug(`Using snapshot for block ${blockNumber}, world state synced upto ${blockSyncedTo}`);
|
|
1015
1601
|
return this.worldStateSynchronizer.getSnapshot(blockNumber);
|
|
1016
|
-
} else {
|
|
1017
|
-
throw new Error(`Block ${blockNumber} not yet synced`);
|
|
1018
1602
|
}
|
|
1019
1603
|
}
|
|
1020
1604
|
/**
|
|
@@ -1022,11 +1606,6 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
1022
1606
|
* @returns A promise that fulfils once the world state is synced
|
|
1023
1607
|
*/ async #syncWorldState() {
|
|
1024
1608
|
const blockSourceHeight = await this.blockSource.getBlockNumber();
|
|
1025
|
-
return this.worldStateSynchronizer.syncImmediate(blockSourceHeight);
|
|
1609
|
+
return await this.worldStateSynchronizer.syncImmediate(blockSourceHeight);
|
|
1026
1610
|
}
|
|
1027
1611
|
}
|
|
1028
|
-
_ts_decorate([
|
|
1029
|
-
trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
1030
|
-
[Attributes.TX_HASH]: tx.getTxHash().toString()
|
|
1031
|
-
}))
|
|
1032
|
-
], AztecNodeService.prototype, "simulatePublicCalls", null);
|