@aztec/aztec-node 0.0.1-commit.9593d84 → 0.0.1-commit.96bb3f7
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 +5 -2
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +7 -1
- 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 +5 -16
- package/dest/aztec-node/server.d.ts +49 -52
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +509 -72
- package/dest/sentinel/sentinel.d.ts +5 -4
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +32 -27
- package/package.json +26 -27
- package/src/aztec-node/config.ts +12 -8
- package/src/aztec-node/node_metrics.ts +5 -23
- package/src/aztec-node/server.ts +180 -109
- package/src/sentinel/sentinel.ts +41 -32
|
@@ -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 {
|
|
376
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
10
377
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
11
378
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
12
|
-
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';
|
|
13
383
|
import { compactArray, pick } 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,15 +390,16 @@ 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 { createL1TxUtilsWithBlobsFromEthSigner } from '@aztec/node-lib/factories';
|
|
393
|
+
import { createForwarderL1TxUtilsFromEthSigner, createL1TxUtilsWithBlobsFromEthSigner } from '@aztec/node-lib/factories';
|
|
24
394
|
import { createP2PClient, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
25
395
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
26
|
-
import { BlockBuilder, GlobalVariableBuilder, SequencerClient
|
|
396
|
+
import { BlockBuilder, GlobalVariableBuilder, SequencerClient } from '@aztec/sequencer-client';
|
|
27
397
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
28
398
|
import { AttestationsBlockWatcher, EpochPruneWatcher, createSlasher } from '@aztec/slasher';
|
|
29
|
-
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
399
|
+
import { CollectionLimitsConfig, PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
30
400
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
31
401
|
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
402
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
32
403
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
33
404
|
import { AztecNodeAdminConfigSchema } from '@aztec/stdlib/interfaces/client';
|
|
34
405
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
@@ -38,12 +409,15 @@ import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@az
|
|
|
38
409
|
import { PublicSimulationOutput, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
39
410
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
40
411
|
import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
41
|
-
import { NodeKeystoreAdapter, ValidatorClient, createBlockProposalHandler, createValidatorClient } from '@aztec/validator-client';
|
|
412
|
+
import { FullNodeCheckpointsBuilder as CheckpointsBuilder, FullNodeCheckpointsBuilder, NodeKeystoreAdapter, ValidatorClient, createBlockProposalHandler, createValidatorClient, createValidatorForAcceptingTxs } from '@aztec/validator-client';
|
|
42
413
|
import { createWorldStateSynchronizer } from '@aztec/world-state';
|
|
43
414
|
import { createPublicClient, fallback, http } from 'viem';
|
|
44
415
|
import { createSentinel } from '../sentinel/factory.js';
|
|
45
416
|
import { createKeyStoreForValidator } from './config.js';
|
|
46
417
|
import { NodeMetrics } from './node_metrics.js';
|
|
418
|
+
_dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
419
|
+
[Attributes.TX_HASH]: tx.getTxHash().toString()
|
|
420
|
+
}));
|
|
47
421
|
/**
|
|
48
422
|
* The aztec node.
|
|
49
423
|
*/ export class AztecNodeService {
|
|
@@ -66,11 +440,21 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
66
440
|
proofVerifier;
|
|
67
441
|
telemetry;
|
|
68
442
|
log;
|
|
443
|
+
blobClient;
|
|
444
|
+
static{
|
|
445
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
446
|
+
[
|
|
447
|
+
_dec,
|
|
448
|
+
2,
|
|
449
|
+
"simulatePublicCalls"
|
|
450
|
+
]
|
|
451
|
+
], []));
|
|
452
|
+
}
|
|
69
453
|
metrics;
|
|
70
454
|
// Prevent two snapshot operations to happen simultaneously
|
|
71
455
|
isUploadingSnapshot;
|
|
72
456
|
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')){
|
|
457
|
+
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource, worldStateSynchronizer, sequencer, slasherClient, validatorsSentinel, epochPruneWatcher, l1ChainId, version, globalVariableBuilder, epochCache, packageVersion, proofVerifier, telemetry = getTelemetryClient(), log = createLogger('node'), blobClient){
|
|
74
458
|
this.config = config;
|
|
75
459
|
this.p2pClient = p2pClient;
|
|
76
460
|
this.blockSource = blockSource;
|
|
@@ -90,7 +474,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
90
474
|
this.proofVerifier = proofVerifier;
|
|
91
475
|
this.telemetry = telemetry;
|
|
92
476
|
this.log = log;
|
|
93
|
-
this.
|
|
477
|
+
this.blobClient = blobClient;
|
|
478
|
+
this.isUploadingSnapshot = (_initProto(this), false);
|
|
94
479
|
this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
|
|
95
480
|
this.tracer = telemetry.getTracer('AztecNodeService');
|
|
96
481
|
this.log.info(`Aztec Node version: ${this.packageVersion}`);
|
|
@@ -115,9 +500,6 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
115
500
|
const packageVersion = getPackageVersion() ?? '';
|
|
116
501
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
117
502
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
118
|
-
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config, {
|
|
119
|
-
logger: createLogger('node:blob-sink:client')
|
|
120
|
-
});
|
|
121
503
|
const ethereumChain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
122
504
|
// Build a key store from file if given or from environment otherwise
|
|
123
505
|
let keyStoreManager;
|
|
@@ -148,7 +530,9 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
148
530
|
}
|
|
149
531
|
const publicClient = createPublicClient({
|
|
150
532
|
chain: ethereumChain.chainInfo,
|
|
151
|
-
transport: fallback(config.l1RpcUrls.map((url)=>http(url
|
|
533
|
+
transport: fallback(config.l1RpcUrls.map((url)=>http(url, {
|
|
534
|
+
batch: false
|
|
535
|
+
}))),
|
|
152
536
|
pollingInterval: config.viemPollingIntervalMS
|
|
153
537
|
});
|
|
154
538
|
const l1ContractsAddresses = await RegistryContract.collectAddresses(publicClient, config.l1Contracts.registryAddress, config.rollupVersion ?? 'canonical');
|
|
@@ -167,13 +551,14 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
167
551
|
if (config.rollupVersion !== Number(rollupVersionFromRollup)) {
|
|
168
552
|
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
553
|
}
|
|
554
|
+
const blobClient = await createBlobClientWithFileStores(config, createLogger('node:blob-client:client'));
|
|
170
555
|
// attempt snapshot sync if possible
|
|
171
556
|
await trySnapshotSync(config, log);
|
|
172
557
|
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, {
|
|
173
558
|
dateProvider
|
|
174
559
|
});
|
|
175
560
|
const archiver = await createArchiver(config, {
|
|
176
|
-
|
|
561
|
+
blobClient,
|
|
177
562
|
epochCache,
|
|
178
563
|
telemetry,
|
|
179
564
|
dateProvider
|
|
@@ -182,7 +567,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
182
567
|
});
|
|
183
568
|
// now create the merkle trees and the world state synchronizer
|
|
184
569
|
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, options.prefilledPublicData, telemetry);
|
|
185
|
-
const circuitVerifier = config.realProofs ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier(config.proverTestVerificationDelayMs);
|
|
570
|
+
const circuitVerifier = config.realProofs || config.debugForceTxProofVerification ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier(config.proverTestVerificationDelayMs);
|
|
186
571
|
if (!config.realProofs) {
|
|
187
572
|
log.warn(`Aztec node is accepting fake proofs`);
|
|
188
573
|
}
|
|
@@ -191,23 +576,32 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
191
576
|
const p2pClient = await createP2PClient(P2PClientType.Full, config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, dateProvider, telemetry, deps.p2pClientDeps);
|
|
192
577
|
// We should really not be modifying the config object
|
|
193
578
|
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
|
|
579
|
+
// Create BlockBuilder for EpochPruneWatcher (slasher functionality)
|
|
194
580
|
const blockBuilder = new BlockBuilder({
|
|
195
581
|
...config,
|
|
196
582
|
l1GenesisTime,
|
|
197
583
|
slotDuration: Number(slotDuration)
|
|
198
584
|
}, worldStateSynchronizer, archiver, dateProvider, telemetry);
|
|
585
|
+
// Create FullNodeCheckpointsBuilder for validator and non-validator block proposal handling
|
|
586
|
+
const validatorCheckpointsBuilder = new FullNodeCheckpointsBuilder({
|
|
587
|
+
...config,
|
|
588
|
+
l1GenesisTime,
|
|
589
|
+
slotDuration: Number(slotDuration)
|
|
590
|
+
}, archiver, dateProvider, telemetry);
|
|
199
591
|
// We'll accumulate sentinel watchers here
|
|
200
592
|
const watchers = [];
|
|
201
593
|
// Create validator client if required
|
|
202
594
|
const validatorClient = createValidatorClient(config, {
|
|
595
|
+
checkpointsBuilder: validatorCheckpointsBuilder,
|
|
596
|
+
worldState: worldStateSynchronizer,
|
|
203
597
|
p2pClient,
|
|
204
598
|
telemetry,
|
|
205
599
|
dateProvider,
|
|
206
600
|
epochCache,
|
|
207
|
-
blockBuilder,
|
|
208
601
|
blockSource: archiver,
|
|
209
602
|
l1ToL2MessageSource: archiver,
|
|
210
|
-
keyStoreManager
|
|
603
|
+
keyStoreManager,
|
|
604
|
+
blobClient
|
|
211
605
|
});
|
|
212
606
|
// If we have a validator client, register it as a source of offenses for the slasher,
|
|
213
607
|
// and have it register callbacks on the p2p client *before* we start it, otherwise messages
|
|
@@ -223,7 +617,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
223
617
|
if (!validatorClient && config.alwaysReexecuteBlockProposals) {
|
|
224
618
|
log.info('Setting up block proposal reexecution for monitoring');
|
|
225
619
|
createBlockProposalHandler(config, {
|
|
226
|
-
|
|
620
|
+
checkpointsBuilder: validatorCheckpointsBuilder,
|
|
621
|
+
worldState: worldStateSynchronizer,
|
|
227
622
|
epochCache,
|
|
228
623
|
blockSource: archiver,
|
|
229
624
|
l1ToL2MessageSource: archiver,
|
|
@@ -262,13 +657,20 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
262
657
|
// Validator enabled, create/start relevant service
|
|
263
658
|
let sequencer;
|
|
264
659
|
let slasherClient;
|
|
265
|
-
if (!config.disableValidator) {
|
|
660
|
+
if (!config.disableValidator && validatorClient) {
|
|
266
661
|
// We create a slasher only if we have a sequencer, since all slashing actions go through the sequencer publisher
|
|
267
662
|
// as they are executed when the node is selected as proposer.
|
|
268
663
|
const validatorAddresses = keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager).getAddresses() : [];
|
|
269
664
|
slasherClient = await createSlasher(config, config.l1Contracts, getPublicClient(config), watchers, dateProvider, epochCache, validatorAddresses, undefined);
|
|
270
665
|
await slasherClient.start();
|
|
271
|
-
const l1TxUtils = await
|
|
666
|
+
const l1TxUtils = config.publisherForwarderAddress ? await createForwarderL1TxUtilsFromEthSigner(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), config.publisherForwarderAddress, {
|
|
667
|
+
...config,
|
|
668
|
+
scope: 'sequencer'
|
|
669
|
+
}, {
|
|
670
|
+
telemetry,
|
|
671
|
+
logger: log.createChild('l1-tx-utils'),
|
|
672
|
+
dateProvider
|
|
673
|
+
}) : await createL1TxUtilsWithBlobsFromEthSigner(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), {
|
|
272
674
|
...config,
|
|
273
675
|
scope: 'sequencer'
|
|
274
676
|
}, {
|
|
@@ -277,6 +679,11 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
277
679
|
dateProvider
|
|
278
680
|
});
|
|
279
681
|
// Create and start the sequencer client
|
|
682
|
+
const checkpointsBuilder = new CheckpointsBuilder({
|
|
683
|
+
...config,
|
|
684
|
+
l1GenesisTime,
|
|
685
|
+
slotDuration: Number(slotDuration)
|
|
686
|
+
}, archiver, dateProvider, telemetry);
|
|
280
687
|
sequencer = await SequencerClient.new(config, {
|
|
281
688
|
...deps,
|
|
282
689
|
epochCache,
|
|
@@ -285,12 +692,12 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
285
692
|
p2pClient,
|
|
286
693
|
worldStateSynchronizer,
|
|
287
694
|
slasherClient,
|
|
288
|
-
|
|
695
|
+
checkpointsBuilder,
|
|
289
696
|
l2BlockSource: archiver,
|
|
290
697
|
l1ToL2MessageSource: archiver,
|
|
291
698
|
telemetry,
|
|
292
699
|
dateProvider,
|
|
293
|
-
|
|
700
|
+
blobClient,
|
|
294
701
|
nodeKeyStore: keyStoreManager
|
|
295
702
|
});
|
|
296
703
|
}
|
|
@@ -300,7 +707,13 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
300
707
|
} else if (sequencer) {
|
|
301
708
|
log.warn(`Sequencer created but not started`);
|
|
302
709
|
}
|
|
303
|
-
|
|
710
|
+
const globalVariableBuilder = new GlobalVariableBuilder({
|
|
711
|
+
...config,
|
|
712
|
+
rollupVersion: BigInt(config.rollupVersion),
|
|
713
|
+
l1GenesisTime,
|
|
714
|
+
slotDuration: Number(slotDuration)
|
|
715
|
+
});
|
|
716
|
+
return new AztecNodeService(config, p2pClient, archiver, archiver, archiver, archiver, worldStateSynchronizer, sequencer, slasherClient, validatorsSentinel, epochPruneWatcher, ethereumChain.chainInfo.id, config.rollupVersion, globalVariableBuilder, epochCache, packageVersion, proofVerifier, telemetry, log, blobClient);
|
|
304
717
|
}
|
|
305
718
|
/**
|
|
306
719
|
* Returns the sequencer client instance.
|
|
@@ -389,11 +802,29 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
389
802
|
async getPublishedBlocks(from, limit) {
|
|
390
803
|
return await this.blockSource.getPublishedBlocks(from, limit) ?? [];
|
|
391
804
|
}
|
|
805
|
+
async getPublishedCheckpoints(from, limit) {
|
|
806
|
+
return await this.blockSource.getPublishedCheckpoints(from, limit) ?? [];
|
|
807
|
+
}
|
|
808
|
+
async getL2BlocksNew(from, limit) {
|
|
809
|
+
return await this.blockSource.getL2BlocksNew(from, limit) ?? [];
|
|
810
|
+
}
|
|
811
|
+
async getCheckpointedBlocks(from, limit, proven) {
|
|
812
|
+
return await this.blockSource.getCheckpointedBlocks(from, limit, proven) ?? [];
|
|
813
|
+
}
|
|
392
814
|
/**
|
|
393
|
-
* Method to fetch the current
|
|
394
|
-
* @returns The current
|
|
395
|
-
*/ async
|
|
396
|
-
return await this.globalVariableBuilder.
|
|
815
|
+
* Method to fetch the current min L2 fees.
|
|
816
|
+
* @returns The current min L2 fees.
|
|
817
|
+
*/ async getCurrentMinFees() {
|
|
818
|
+
return await this.globalVariableBuilder.getCurrentMinFees();
|
|
819
|
+
}
|
|
820
|
+
async getMaxPriorityFees() {
|
|
821
|
+
for await (const tx of this.p2pClient.iteratePendingTxs()){
|
|
822
|
+
return tx.getGasSettings().maxPriorityFeesPerGas;
|
|
823
|
+
}
|
|
824
|
+
return GasFees.from({
|
|
825
|
+
feePerDaGas: 0n,
|
|
826
|
+
feePerL2Gas: 0n
|
|
827
|
+
});
|
|
397
828
|
}
|
|
398
829
|
/**
|
|
399
830
|
* Method to fetch the latest block number synchronized by the node.
|
|
@@ -428,22 +859,11 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
428
859
|
getContract(address) {
|
|
429
860
|
return this.contractDataSource.getContract(address);
|
|
430
861
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
* @param from - The block number from which to begin retrieving logs.
|
|
434
|
-
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
435
|
-
* @returns An array of private logs from the specified range of blocks.
|
|
436
|
-
*/ getPrivateLogs(from, limit) {
|
|
437
|
-
return this.logsSource.getPrivateLogs(from, limit);
|
|
862
|
+
getPrivateLogsByTags(tags) {
|
|
863
|
+
return this.logsSource.getPrivateLogsByTags(tags);
|
|
438
864
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
* @param tags - The tags to filter the logs by.
|
|
442
|
-
* @param logsPerTag - The maximum number of logs to return for each tag. By default no limit is set
|
|
443
|
-
* @returns For each received tag, an array of matching logs is returned. An empty array implies no logs match
|
|
444
|
-
* that tag.
|
|
445
|
-
*/ getLogsByTags(tags, logsPerTag) {
|
|
446
|
-
return this.logsSource.getLogsByTags(tags, logsPerTag);
|
|
865
|
+
getPublicLogsByTagsFromContract(contractAddress, tags) {
|
|
866
|
+
return this.logsSource.getPublicLogsByTagsFromContract(contractAddress, tags);
|
|
447
867
|
}
|
|
448
868
|
/**
|
|
449
869
|
* Gets public logs based on the provided filter.
|
|
@@ -512,10 +932,17 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
512
932
|
await tryStop(this.p2pClient);
|
|
513
933
|
await tryStop(this.worldStateSynchronizer);
|
|
514
934
|
await tryStop(this.blockSource);
|
|
935
|
+
await tryStop(this.blobClient);
|
|
515
936
|
await tryStop(this.telemetry);
|
|
516
937
|
this.log.info(`Stopped Aztec Node`);
|
|
517
938
|
}
|
|
518
939
|
/**
|
|
940
|
+
* Returns the blob client used by this node.
|
|
941
|
+
* @internal - Exposed for testing purposes only.
|
|
942
|
+
*/ getBlobClient() {
|
|
943
|
+
return this.blobClient;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
519
946
|
* Method to retrieve pending txs.
|
|
520
947
|
* @param limit - The number of items to returns
|
|
521
948
|
* @param after - The last known pending tx. Used for pagination
|
|
@@ -567,7 +994,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
567
994
|
// Now we obtain the block hashes from the archive tree by calling await `committedDb.getLeafValue(treeId, index)`
|
|
568
995
|
// (note that block number corresponds to the leaf index in the archive tree).
|
|
569
996
|
const blockHashes = await Promise.all(uniqueBlockNumbers.map((blockNumber)=>{
|
|
570
|
-
return committedDb.getLeafValue(MerkleTreeId.ARCHIVE, blockNumber);
|
|
997
|
+
return committedDb.getLeafValue(MerkleTreeId.ARCHIVE, BigInt(blockNumber));
|
|
571
998
|
}));
|
|
572
999
|
// If any of the block hashes are undefined, we throw an error.
|
|
573
1000
|
for(let i = 0; i < uniqueBlockNumbers.length; i++){
|
|
@@ -575,7 +1002,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
575
1002
|
throw new Error(`Block hash is undefined for block number ${uniqueBlockNumbers[i]}`);
|
|
576
1003
|
}
|
|
577
1004
|
}
|
|
578
|
-
// Create
|
|
1005
|
+
// Create DataInBlock objects by combining indices, blockNumbers and blockHashes and return them.
|
|
579
1006
|
return maybeIndices.map((index, i)=>{
|
|
580
1007
|
if (index === undefined) {
|
|
581
1008
|
return undefined;
|
|
@@ -590,7 +1017,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
590
1017
|
return undefined;
|
|
591
1018
|
}
|
|
592
1019
|
return {
|
|
593
|
-
l2BlockNumber: Number(blockNumber),
|
|
1020
|
+
l2BlockNumber: BlockNumber(Number(blockNumber)),
|
|
594
1021
|
l2BlockHash: L2BlockHash.fromField(blockHash),
|
|
595
1022
|
data: index
|
|
596
1023
|
};
|
|
@@ -649,7 +1076,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
649
1076
|
}
|
|
650
1077
|
async getL1ToL2MessageBlock(l1ToL2Message) {
|
|
651
1078
|
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
652
|
-
return messageIndex ? InboxLeaf.
|
|
1079
|
+
return messageIndex ? BlockNumber.fromCheckpointNumber(InboxLeaf.checkpointNumberFromIndex(messageIndex)) : undefined;
|
|
653
1080
|
}
|
|
654
1081
|
/**
|
|
655
1082
|
* Returns whether an L1 to L2 message is synced by archiver and if it's ready to be included in a block.
|
|
@@ -660,12 +1087,25 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
660
1087
|
return messageIndex !== undefined;
|
|
661
1088
|
}
|
|
662
1089
|
/**
|
|
663
|
-
* Returns all the L2 to L1 messages in
|
|
664
|
-
* @param
|
|
665
|
-
* @returns The L2 to L1 messages (
|
|
666
|
-
*/ async getL2ToL1Messages(
|
|
667
|
-
|
|
668
|
-
|
|
1090
|
+
* Returns all the L2 to L1 messages in an epoch.
|
|
1091
|
+
* @param epoch - The epoch at which to get the data.
|
|
1092
|
+
* @returns The L2 to L1 messages (empty array if the epoch is not found).
|
|
1093
|
+
*/ async getL2ToL1Messages(epoch) {
|
|
1094
|
+
// Assumes `getBlocksForEpoch` returns blocks in ascending order of block number.
|
|
1095
|
+
const blocks = await this.blockSource.getBlocksForEpoch(epoch);
|
|
1096
|
+
const blocksInCheckpoints = [];
|
|
1097
|
+
let previousSlotNumber = SlotNumber.ZERO;
|
|
1098
|
+
let checkpointIndex = -1;
|
|
1099
|
+
for (const block of blocks){
|
|
1100
|
+
const slotNumber = block.header.globalVariables.slotNumber;
|
|
1101
|
+
if (slotNumber !== previousSlotNumber) {
|
|
1102
|
+
checkpointIndex++;
|
|
1103
|
+
blocksInCheckpoints.push([]);
|
|
1104
|
+
previousSlotNumber = slotNumber;
|
|
1105
|
+
}
|
|
1106
|
+
blocksInCheckpoints[checkpointIndex].push(block);
|
|
1107
|
+
}
|
|
1108
|
+
return blocksInCheckpoints.map((blocks)=>blocks.map((block)=>block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs)));
|
|
669
1109
|
}
|
|
670
1110
|
/**
|
|
671
1111
|
* Returns a sibling path for a leaf in the committed blocks tree.
|
|
@@ -767,7 +1207,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
767
1207
|
* Returns the currently committed block header, or the initial header if no blocks have been produced.
|
|
768
1208
|
* @returns The current committed block header.
|
|
769
1209
|
*/ async getBlockHeader(blockNumber = 'latest') {
|
|
770
|
-
return blockNumber ===
|
|
1210
|
+
return blockNumber === BlockNumber.ZERO || blockNumber === 'latest' && await this.blockSource.getBlockNumber() === BlockNumber.ZERO ? this.worldStateSynchronizer.getCommitted().getInitialHeader() : this.blockSource.getBlockHeader(blockNumber === 'latest' ? blockNumber : blockNumber);
|
|
771
1211
|
}
|
|
772
1212
|
/**
|
|
773
1213
|
* Get a block header specified by its hash.
|
|
@@ -795,7 +1235,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
795
1235
|
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
796
1236
|
}
|
|
797
1237
|
const txHash = tx.getTxHash();
|
|
798
|
-
const blockNumber = await this.blockSource.getBlockNumber() + 1;
|
|
1238
|
+
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
799
1239
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
800
1240
|
const coinbase = EthAddress.ZERO;
|
|
801
1241
|
const feeRecipient = AztecAddress.ZERO;
|
|
@@ -813,8 +1253,10 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
813
1253
|
collectDebugLogs: true,
|
|
814
1254
|
collectHints: false,
|
|
815
1255
|
collectCallMetadata: true,
|
|
816
|
-
|
|
817
|
-
|
|
1256
|
+
collectStatistics: false,
|
|
1257
|
+
collectionLimits: CollectionLimitsConfig.from({
|
|
1258
|
+
maxDebugLogMemoryReads: this.config.rpcSimulatePublicMaxDebugLogMemoryReads
|
|
1259
|
+
})
|
|
818
1260
|
});
|
|
819
1261
|
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, config);
|
|
820
1262
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
@@ -839,14 +1281,14 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
839
1281
|
const verifier = isSimulation ? undefined : this.proofVerifier;
|
|
840
1282
|
// We accept transactions if they are not expired by the next slot (checked based on the IncludeByTimestamp field)
|
|
841
1283
|
const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
842
|
-
const blockNumber = await this.blockSource.getBlockNumber() + 1;
|
|
1284
|
+
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
843
1285
|
const validator = createValidatorForAcceptingTxs(db, this.contractDataSource, verifier, {
|
|
844
1286
|
timestamp: nextSlotTimestamp,
|
|
845
1287
|
blockNumber,
|
|
846
1288
|
l1ChainId: this.l1ChainId,
|
|
847
1289
|
rollupVersion: this.version,
|
|
848
1290
|
setupAllowList: this.config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions(),
|
|
849
|
-
gasFees: await this.
|
|
1291
|
+
gasFees: await this.getCurrentMinFees(),
|
|
850
1292
|
skipFeeEnforcement,
|
|
851
1293
|
txsPermitted: !this.config.disableTransactions
|
|
852
1294
|
});
|
|
@@ -909,7 +1351,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
909
1351
|
throw new Error(`Archiver initial sync not complete. Cannot start snapshot.`);
|
|
910
1352
|
}
|
|
911
1353
|
// And it has an L2 block hash
|
|
912
|
-
const l2BlockHash = await archiver.getL2Tips().then((tips)=>tips.
|
|
1354
|
+
const l2BlockHash = await archiver.getL2Tips().then((tips)=>tips.proposed.hash);
|
|
913
1355
|
if (!l2BlockHash) {
|
|
914
1356
|
this.metrics.recordSnapshotError();
|
|
915
1357
|
throw new Error(`Archiver has no latest L2 block hash downloaded. Cannot start snapshot.`);
|
|
@@ -936,7 +1378,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
936
1378
|
if (!('rollbackTo' in archiver)) {
|
|
937
1379
|
throw new Error('Archiver implementation does not support rollbacks.');
|
|
938
1380
|
}
|
|
939
|
-
const finalizedBlock = await archiver.getL2Tips().then((tips)=>tips.finalized.number);
|
|
1381
|
+
const finalizedBlock = await archiver.getL2Tips().then((tips)=>tips.finalized.block.number);
|
|
940
1382
|
if (targetBlock < finalizedBlock) {
|
|
941
1383
|
if (force) {
|
|
942
1384
|
this.log.warn(`Clearing world state database to allow rolling back behind finalized block ${finalizedBlock}`);
|
|
@@ -999,7 +1441,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
999
1441
|
if (typeof blockNumber === 'number' && blockNumber < INITIAL_L2_BLOCK_NUM - 1) {
|
|
1000
1442
|
throw new Error('Invalid block number to get world state for: ' + blockNumber);
|
|
1001
1443
|
}
|
|
1002
|
-
let blockSyncedTo =
|
|
1444
|
+
let blockSyncedTo = BlockNumber.ZERO;
|
|
1003
1445
|
try {
|
|
1004
1446
|
// Attempt to sync the world state if necessary
|
|
1005
1447
|
blockSyncedTo = await this.#syncWorldState();
|
|
@@ -1022,11 +1464,6 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
1022
1464
|
* @returns A promise that fulfils once the world state is synced
|
|
1023
1465
|
*/ async #syncWorldState() {
|
|
1024
1466
|
const blockSourceHeight = await this.blockSource.getBlockNumber();
|
|
1025
|
-
return this.worldStateSynchronizer.syncImmediate(blockSourceHeight);
|
|
1467
|
+
return await this.worldStateSynchronizer.syncImmediate(blockSourceHeight);
|
|
1026
1468
|
}
|
|
1027
1469
|
}
|
|
1028
|
-
_ts_decorate([
|
|
1029
|
-
trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
1030
|
-
[Attributes.TX_HASH]: tx.getTxHash().toString()
|
|
1031
|
-
}))
|
|
1032
|
-
], AztecNodeService.prototype, "simulatePublicCalls", null);
|