@aztec/validator-client 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107

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.
Files changed (43) hide show
  1. package/dest/block_proposal_handler.d.ts +53 -0
  2. package/dest/block_proposal_handler.d.ts.map +1 -0
  3. package/dest/block_proposal_handler.js +290 -0
  4. package/dest/config.d.ts +1 -1
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +10 -0
  7. package/dest/duties/validation_service.d.ts +11 -6
  8. package/dest/duties/validation_service.d.ts.map +1 -1
  9. package/dest/duties/validation_service.js +19 -7
  10. package/dest/factory.d.ts +16 -5
  11. package/dest/factory.d.ts.map +1 -1
  12. package/dest/factory.js +11 -1
  13. package/dest/index.d.ts +2 -1
  14. package/dest/index.d.ts.map +1 -1
  15. package/dest/index.js +1 -0
  16. package/dest/key_store/index.d.ts +1 -1
  17. package/dest/key_store/interface.d.ts +1 -1
  18. package/dest/key_store/local_key_store.d.ts +1 -1
  19. package/dest/key_store/local_key_store.d.ts.map +1 -1
  20. package/dest/key_store/local_key_store.js +1 -1
  21. package/dest/key_store/node_keystore_adapter.d.ts +1 -1
  22. package/dest/key_store/node_keystore_adapter.d.ts.map +1 -1
  23. package/dest/key_store/node_keystore_adapter.js +2 -4
  24. package/dest/key_store/web3signer_key_store.d.ts +1 -7
  25. package/dest/key_store/web3signer_key_store.d.ts.map +1 -1
  26. package/dest/key_store/web3signer_key_store.js +7 -8
  27. package/dest/metrics.d.ts +7 -5
  28. package/dest/metrics.d.ts.map +1 -1
  29. package/dest/metrics.js +25 -12
  30. package/dest/validator.d.ts +28 -27
  31. package/dest/validator.d.ts.map +1 -1
  32. package/dest/validator.js +579 -198
  33. package/package.json +17 -15
  34. package/src/block_proposal_handler.ts +346 -0
  35. package/src/config.ts +12 -0
  36. package/src/duties/validation_service.ts +30 -12
  37. package/src/factory.ts +37 -4
  38. package/src/index.ts +1 -0
  39. package/src/key_store/local_key_store.ts +1 -1
  40. package/src/key_store/node_keystore_adapter.ts +3 -4
  41. package/src/key_store/web3signer_key_store.ts +7 -10
  42. package/src/metrics.ts +34 -13
  43. package/src/validator.ts +281 -271
package/dest/validator.js CHANGED
@@ -1,67 +1,455 @@
1
- import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ function applyDecs2203RFactory() {
2
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
3
+ return function addInitializer(initializer) {
4
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
5
+ assertCallable(initializer, "An initializer");
6
+ initializers.push(initializer);
7
+ };
8
+ }
9
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
10
+ var kindStr;
11
+ switch(kind){
12
+ case 1:
13
+ kindStr = "accessor";
14
+ break;
15
+ case 2:
16
+ kindStr = "method";
17
+ break;
18
+ case 3:
19
+ kindStr = "getter";
20
+ break;
21
+ case 4:
22
+ kindStr = "setter";
23
+ break;
24
+ default:
25
+ kindStr = "field";
26
+ }
27
+ var ctx = {
28
+ kind: kindStr,
29
+ name: isPrivate ? "#" + name : name,
30
+ static: isStatic,
31
+ private: isPrivate,
32
+ metadata: metadata
33
+ };
34
+ var decoratorFinishedRef = {
35
+ v: false
36
+ };
37
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
38
+ var get, set;
39
+ if (kind === 0) {
40
+ if (isPrivate) {
41
+ get = desc.get;
42
+ set = desc.set;
43
+ } else {
44
+ get = function() {
45
+ return this[name];
46
+ };
47
+ set = function(v) {
48
+ this[name] = v;
49
+ };
50
+ }
51
+ } else if (kind === 2) {
52
+ get = function() {
53
+ return desc.value;
54
+ };
55
+ } else {
56
+ if (kind === 1 || kind === 3) {
57
+ get = function() {
58
+ return desc.get.call(this);
59
+ };
60
+ }
61
+ if (kind === 1 || kind === 4) {
62
+ set = function(v) {
63
+ desc.set.call(this, v);
64
+ };
65
+ }
66
+ }
67
+ ctx.access = get && set ? {
68
+ get: get,
69
+ set: set
70
+ } : get ? {
71
+ get: get
72
+ } : {
73
+ set: set
74
+ };
75
+ try {
76
+ return dec(value, ctx);
77
+ } finally{
78
+ decoratorFinishedRef.v = true;
79
+ }
80
+ }
81
+ function assertNotFinished(decoratorFinishedRef, fnName) {
82
+ if (decoratorFinishedRef.v) {
83
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
84
+ }
85
+ }
86
+ function assertCallable(fn, hint) {
87
+ if (typeof fn !== "function") {
88
+ throw new TypeError(hint + " must be a function");
89
+ }
90
+ }
91
+ function assertValidReturnValue(kind, value) {
92
+ var type = typeof value;
93
+ if (kind === 1) {
94
+ if (type !== "object" || value === null) {
95
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
96
+ }
97
+ if (value.get !== undefined) {
98
+ assertCallable(value.get, "accessor.get");
99
+ }
100
+ if (value.set !== undefined) {
101
+ assertCallable(value.set, "accessor.set");
102
+ }
103
+ if (value.init !== undefined) {
104
+ assertCallable(value.init, "accessor.init");
105
+ }
106
+ } else if (type !== "function") {
107
+ var hint;
108
+ if (kind === 0) {
109
+ hint = "field";
110
+ } else if (kind === 10) {
111
+ hint = "class";
112
+ } else {
113
+ hint = "method";
114
+ }
115
+ throw new TypeError(hint + " decorators must return a function or void 0");
116
+ }
117
+ }
118
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
119
+ var decs = decInfo[0];
120
+ var desc, init, value;
121
+ if (isPrivate) {
122
+ if (kind === 0 || kind === 1) {
123
+ desc = {
124
+ get: decInfo[3],
125
+ set: decInfo[4]
126
+ };
127
+ } else if (kind === 3) {
128
+ desc = {
129
+ get: decInfo[3]
130
+ };
131
+ } else if (kind === 4) {
132
+ desc = {
133
+ set: decInfo[3]
134
+ };
135
+ } else {
136
+ desc = {
137
+ value: decInfo[3]
138
+ };
139
+ }
140
+ } else if (kind !== 0) {
141
+ desc = Object.getOwnPropertyDescriptor(base, name);
142
+ }
143
+ if (kind === 1) {
144
+ value = {
145
+ get: desc.get,
146
+ set: desc.set
147
+ };
148
+ } else if (kind === 2) {
149
+ value = desc.value;
150
+ } else if (kind === 3) {
151
+ value = desc.get;
152
+ } else if (kind === 4) {
153
+ value = desc.set;
154
+ }
155
+ var newValue, get, set;
156
+ if (typeof decs === "function") {
157
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
158
+ if (newValue !== void 0) {
159
+ assertValidReturnValue(kind, newValue);
160
+ if (kind === 0) {
161
+ init = newValue;
162
+ } else if (kind === 1) {
163
+ init = newValue.init;
164
+ get = newValue.get || value.get;
165
+ set = newValue.set || value.set;
166
+ value = {
167
+ get: get,
168
+ set: set
169
+ };
170
+ } else {
171
+ value = newValue;
172
+ }
173
+ }
174
+ } else {
175
+ for(var i = decs.length - 1; i >= 0; i--){
176
+ var dec = decs[i];
177
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
178
+ if (newValue !== void 0) {
179
+ assertValidReturnValue(kind, newValue);
180
+ var newInit;
181
+ if (kind === 0) {
182
+ newInit = newValue;
183
+ } else if (kind === 1) {
184
+ newInit = newValue.init;
185
+ get = newValue.get || value.get;
186
+ set = newValue.set || value.set;
187
+ value = {
188
+ get: get,
189
+ set: set
190
+ };
191
+ } else {
192
+ value = newValue;
193
+ }
194
+ if (newInit !== void 0) {
195
+ if (init === void 0) {
196
+ init = newInit;
197
+ } else if (typeof init === "function") {
198
+ init = [
199
+ init,
200
+ newInit
201
+ ];
202
+ } else {
203
+ init.push(newInit);
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ if (kind === 0 || kind === 1) {
210
+ if (init === void 0) {
211
+ init = function(instance, init) {
212
+ return init;
213
+ };
214
+ } else if (typeof init !== "function") {
215
+ var ownInitializers = init;
216
+ init = function(instance, init) {
217
+ var value = init;
218
+ for(var i = 0; i < ownInitializers.length; i++){
219
+ value = ownInitializers[i].call(instance, value);
220
+ }
221
+ return value;
222
+ };
223
+ } else {
224
+ var originalInitializer = init;
225
+ init = function(instance, init) {
226
+ return originalInitializer.call(instance, init);
227
+ };
228
+ }
229
+ ret.push(init);
230
+ }
231
+ if (kind !== 0) {
232
+ if (kind === 1) {
233
+ desc.get = value.get;
234
+ desc.set = value.set;
235
+ } else if (kind === 2) {
236
+ desc.value = value;
237
+ } else if (kind === 3) {
238
+ desc.get = value;
239
+ } else if (kind === 4) {
240
+ desc.set = value;
241
+ }
242
+ if (isPrivate) {
243
+ if (kind === 1) {
244
+ ret.push(function(instance, args) {
245
+ return value.get.call(instance, args);
246
+ });
247
+ ret.push(function(instance, args) {
248
+ return value.set.call(instance, args);
249
+ });
250
+ } else if (kind === 2) {
251
+ ret.push(value);
252
+ } else {
253
+ ret.push(function(instance, args) {
254
+ return value.call(instance, args);
255
+ });
256
+ }
257
+ } else {
258
+ Object.defineProperty(base, name, desc);
259
+ }
260
+ }
261
+ }
262
+ function applyMemberDecs(Class, decInfos, metadata) {
263
+ var ret = [];
264
+ var protoInitializers;
265
+ var staticInitializers;
266
+ var existingProtoNonFields = new Map();
267
+ var existingStaticNonFields = new Map();
268
+ for(var i = 0; i < decInfos.length; i++){
269
+ var decInfo = decInfos[i];
270
+ if (!Array.isArray(decInfo)) continue;
271
+ var kind = decInfo[1];
272
+ var name = decInfo[2];
273
+ var isPrivate = decInfo.length > 3;
274
+ var isStatic = kind >= 5;
275
+ var base;
276
+ var initializers;
277
+ if (isStatic) {
278
+ base = Class;
279
+ kind = kind - 5;
280
+ staticInitializers = staticInitializers || [];
281
+ initializers = staticInitializers;
282
+ } else {
283
+ base = Class.prototype;
284
+ protoInitializers = protoInitializers || [];
285
+ initializers = protoInitializers;
286
+ }
287
+ if (kind !== 0 && !isPrivate) {
288
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
289
+ var existingKind = existingNonFields.get(name) || 0;
290
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
291
+ throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
292
+ } else if (!existingKind && kind > 2) {
293
+ existingNonFields.set(name, kind);
294
+ } else {
295
+ existingNonFields.set(name, true);
296
+ }
297
+ }
298
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
299
+ }
300
+ pushInitializers(ret, protoInitializers);
301
+ pushInitializers(ret, staticInitializers);
302
+ return ret;
303
+ }
304
+ function pushInitializers(ret, initializers) {
305
+ if (initializers) {
306
+ ret.push(function(instance) {
307
+ for(var i = 0; i < initializers.length; i++){
308
+ initializers[i].call(instance);
309
+ }
310
+ return instance;
311
+ });
312
+ }
313
+ }
314
+ function applyClassDecs(targetClass, classDecs, metadata) {
315
+ if (classDecs.length > 0) {
316
+ var initializers = [];
317
+ var newClass = targetClass;
318
+ var name = targetClass.name;
319
+ for(var i = classDecs.length - 1; i >= 0; i--){
320
+ var decoratorFinishedRef = {
321
+ v: false
322
+ };
323
+ try {
324
+ var nextNewClass = classDecs[i](newClass, {
325
+ kind: "class",
326
+ name: name,
327
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
328
+ metadata
329
+ });
330
+ } finally{
331
+ decoratorFinishedRef.v = true;
332
+ }
333
+ if (nextNewClass !== undefined) {
334
+ assertValidReturnValue(10, nextNewClass);
335
+ newClass = nextNewClass;
336
+ }
337
+ }
338
+ return [
339
+ defineMetadata(newClass, metadata),
340
+ function() {
341
+ for(var i = 0; i < initializers.length; i++){
342
+ initializers[i].call(newClass);
343
+ }
344
+ }
345
+ ];
346
+ }
347
+ }
348
+ function defineMetadata(Class, metadata) {
349
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
350
+ configurable: true,
351
+ enumerable: true,
352
+ value: metadata
353
+ });
354
+ }
355
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
356
+ if (parentClass !== void 0) {
357
+ var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
358
+ }
359
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
360
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
361
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
362
+ return {
363
+ e: e,
364
+ get c () {
365
+ return applyClassDecs(targetClass, classDecs, metadata);
366
+ }
367
+ };
368
+ };
369
+ }
370
+ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
371
+ return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
372
+ }
373
+ var _dec, _initProto;
374
+ import { getBlobsPerL1Block } from '@aztec/blob-lib';
3
375
  import { createLogger } from '@aztec/foundation/log';
4
- import { retryUntil } from '@aztec/foundation/retry';
5
376
  import { RunningPromise } from '@aztec/foundation/running-promise';
6
377
  import { sleep } from '@aztec/foundation/sleep';
7
- import { DateProvider, Timer } from '@aztec/foundation/timer';
8
- import { AuthRequest, AuthResponse, ReqRespSubProtocol } from '@aztec/p2p';
9
- import { BlockProposalValidator } from '@aztec/p2p/msg_validators';
10
- import { computeInHashFromL1ToL2Messages } from '@aztec/prover-client/helpers';
378
+ import { DateProvider } from '@aztec/foundation/timer';
379
+ import { AuthRequest, AuthResponse, BlockProposalValidator, ReqRespSubProtocol } from '@aztec/p2p';
11
380
  import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
12
- import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
13
- import { GlobalVariables } from '@aztec/stdlib/tx';
14
- import { AttestationTimeoutError, ReExFailedTxsError, ReExStateMismatchError, ReExTimeoutError, TransactionsNotAvailableError } from '@aztec/stdlib/validators';
15
- import { getTelemetryClient } from '@aztec/telemetry-client';
381
+ import { AttestationTimeoutError } from '@aztec/stdlib/validators';
382
+ import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
16
383
  import { EventEmitter } from 'events';
384
+ import { BlockProposalHandler } from './block_proposal_handler.js';
17
385
  import { ValidationService } from './duties/validation_service.js';
18
386
  import { NodeKeystoreAdapter } from './key_store/node_keystore_adapter.js';
19
387
  import { ValidatorMetrics } from './metrics.js';
20
388
  // We maintain a set of proposers who have proposed invalid blocks.
21
389
  // Just cap the set to avoid unbounded growth.
22
390
  const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
391
+ // What errors from the block proposal handler result in slashing
392
+ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
393
+ 'state_mismatch',
394
+ 'failed_txs'
395
+ ];
396
+ _dec = trackSpan('validator.attestToProposal', (proposal, proposalSender)=>({
397
+ [Attributes.BLOCK_HASH]: proposal.payload.header.hash.toString(),
398
+ [Attributes.PEER_ID]: proposalSender.toString()
399
+ }));
23
400
  /**
24
401
  * Validator Client
25
402
  */ export class ValidatorClient extends EventEmitter {
26
- blockBuilder;
27
403
  keyStore;
28
404
  epochCache;
29
405
  p2pClient;
30
- blockSource;
31
- l1ToL2MessageSource;
32
- txProvider;
406
+ blockProposalHandler;
33
407
  config;
408
+ blobClient;
34
409
  dateProvider;
35
- log;
410
+ static{
411
+ ({ e: [_initProto] } = _apply_decs_2203_r(this, [
412
+ [
413
+ _dec,
414
+ 2,
415
+ "attestToProposal"
416
+ ]
417
+ ], []));
418
+ }
36
419
  tracer;
37
420
  validationService;
38
421
  metrics;
422
+ log;
423
+ // Whether it has already registered handlers on the p2p client
424
+ hasRegisteredHandlers;
39
425
  // Used to check if we are sending the same proposal twice
40
426
  previousProposal;
41
427
  lastEpochForCommitteeUpdateLoop;
42
428
  epochCacheUpdateLoop;
43
- blockProposalValidator;
44
429
  proposersOfInvalidBlocks;
45
- constructor(blockBuilder, keyStore, epochCache, p2pClient, blockSource, l1ToL2MessageSource, txProvider, config, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator')){
46
- super(), this.blockBuilder = blockBuilder, this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.blockSource = blockSource, this.l1ToL2MessageSource = l1ToL2MessageSource, this.txProvider = txProvider, this.config = config, this.dateProvider = dateProvider, this.log = log, this.proposersOfInvalidBlocks = new Set();
430
+ constructor(keyStore, epochCache, p2pClient, blockProposalHandler, config, blobClient, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator')){
431
+ super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.blockProposalHandler = blockProposalHandler, this.config = config, this.blobClient = blobClient, this.dateProvider = dateProvider, this.hasRegisteredHandlers = (_initProto(this), false), this.proposersOfInvalidBlocks = new Set();
432
+ // Create child logger with fisherman prefix if in fisherman mode
433
+ this.log = config.fishermanMode ? log.createChild('[FISHERMAN]') : log;
47
434
  this.tracer = telemetry.getTracer('Validator');
48
435
  this.metrics = new ValidatorMetrics(telemetry);
49
- this.validationService = new ValidationService(keyStore);
50
- this.blockProposalValidator = new BlockProposalValidator(epochCache);
436
+ this.validationService = new ValidationService(keyStore, this.log.createChild('validation-service'));
51
437
  // Refresh epoch cache every second to trigger alert if participation in committee changes
52
- this.epochCacheUpdateLoop = new RunningPromise(this.handleEpochCommitteeUpdate.bind(this), log, 1000);
438
+ this.epochCacheUpdateLoop = new RunningPromise(this.handleEpochCommitteeUpdate.bind(this), this.log, 1000);
53
439
  const myAddresses = this.getValidatorAddresses();
54
440
  this.log.verbose(`Initialized validator with addresses: ${myAddresses.map((a)=>a.toString()).join(', ')}`);
55
441
  }
56
- static validateKeyStoreConfiguration(keyStoreManager) {
442
+ static validateKeyStoreConfiguration(keyStoreManager, logger) {
57
443
  const validatorKeyStore = NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager);
58
444
  const validatorAddresses = validatorKeyStore.getAddresses();
59
445
  // Verify that we can retrieve all required data from the key store
60
446
  for (const address of validatorAddresses){
61
447
  // Functions throw if required data is not available
448
+ let coinbase;
449
+ let feeRecipient;
62
450
  try {
63
- validatorKeyStore.getCoinbaseAddress(address);
64
- validatorKeyStore.getFeeRecipient(address);
451
+ coinbase = validatorKeyStore.getCoinbaseAddress(address);
452
+ feeRecipient = validatorKeyStore.getFeeRecipient(address);
65
453
  } catch (error) {
66
454
  throw new Error(`Failed to retrieve required data for validator address ${address}, error: ${error}`);
67
455
  }
@@ -69,6 +457,7 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
69
457
  if (!publisherAddresses.length) {
70
458
  throw new Error(`No publisher addresses found for validator address ${address}`);
71
459
  }
460
+ logger?.debug(`Validator ${address.toString()} configured with coinbase ${coinbase.toString()}, feeRecipient ${feeRecipient.toString()} and publishers ${publisherAddresses.map((x)=>x.toString()).join()}`);
72
461
  }
73
462
  }
74
463
  async handleEpochCommitteeUpdate() {
@@ -93,15 +482,25 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
93
482
  this.log.error(`Error updating epoch committee`, err);
94
483
  }
95
484
  }
96
- static new(config, blockBuilder, epochCache, p2pClient, blockSource, l1ToL2MessageSource, txProvider, keyStoreManager, dateProvider = new DateProvider(), telemetry = getTelemetryClient()) {
97
- const validator = new ValidatorClient(blockBuilder, NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager), epochCache, p2pClient, blockSource, l1ToL2MessageSource, txProvider, config, dateProvider, telemetry);
98
- // TODO(PhilWindle): This seems like it could/should be done inside start()
99
- validator.registerBlockProposalHandler();
485
+ static new(config, blockBuilder, epochCache, p2pClient, blockSource, l1ToL2MessageSource, txProvider, keyStoreManager, blobClient, dateProvider = new DateProvider(), telemetry = getTelemetryClient()) {
486
+ const metrics = new ValidatorMetrics(telemetry);
487
+ const blockProposalValidator = new BlockProposalValidator(epochCache, {
488
+ txsPermitted: !config.disableTransactions
489
+ });
490
+ const blockProposalHandler = new BlockProposalHandler(blockBuilder, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, config, metrics, dateProvider, telemetry);
491
+ const validator = new ValidatorClient(NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager), epochCache, p2pClient, blockProposalHandler, config, blobClient, dateProvider, telemetry);
100
492
  return validator;
101
493
  }
102
494
  getValidatorAddresses() {
103
495
  return this.keyStore.getAddresses().filter((addr)=>!this.config.disabledValidators.some((disabled)=>disabled.equals(addr)));
104
496
  }
497
+ getBlockProposalHandler() {
498
+ return this.blockProposalHandler;
499
+ }
500
+ // Proxy method for backwards compatibility with tests
501
+ reExecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages) {
502
+ return this.blockProposalHandler.reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages);
503
+ }
105
504
  signWithAddress(addr, msg) {
106
505
  return this.keyStore.signTypedDataWithAddress(addr, msg);
107
506
  }
@@ -121,31 +520,42 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
121
520
  };
122
521
  }
123
522
  async start() {
124
- // Sync the committee from the smart contract
125
- // https://github.com/AztecProtocol/aztec-packages/issues/7962
523
+ if (this.epochCacheUpdateLoop.isRunning()) {
524
+ this.log.warn(`Validator client already started`);
525
+ return;
526
+ }
527
+ await this.registerHandlers();
126
528
  const myAddresses = this.getValidatorAddresses();
127
529
  const inCommittee = await this.epochCache.filterInCommittee('now', myAddresses);
530
+ this.log.info(`Started validator with addresses: ${myAddresses.map((a)=>a.toString()).join(', ')}`);
128
531
  if (inCommittee.length > 0) {
129
- this.log.info(`Started validator with addresses in current validator committee: ${inCommittee.map((a)=>a.toString()).join(', ')}`);
130
- } else {
131
- this.log.info(`Started validator with addresses: ${myAddresses.map((a)=>a.toString()).join(', ')}`);
532
+ this.log.info(`Addresses in current validator committee: ${inCommittee.map((a)=>a.toString()).join(', ')}`);
132
533
  }
133
534
  this.epochCacheUpdateLoop.start();
134
- this.p2pClient.registerThisValidatorAddresses(myAddresses);
135
- await this.p2pClient.addReqRespSubProtocol(ReqRespSubProtocol.AUTH, this.handleAuthRequest.bind(this));
136
535
  return Promise.resolve();
137
536
  }
138
537
  async stop() {
139
538
  await this.epochCacheUpdateLoop.stop();
140
539
  }
141
- registerBlockProposalHandler() {
142
- const handler = (block, proposalSender)=>this.attestToProposal(block, proposalSender);
143
- this.p2pClient.registerBlockProposalHandler(handler);
540
+ /** Register handlers on the p2p client */ async registerHandlers() {
541
+ if (!this.hasRegisteredHandlers) {
542
+ this.hasRegisteredHandlers = true;
543
+ this.log.debug(`Registering validator handlers for p2p client`);
544
+ const handler = (block, proposalSender)=>this.attestToProposal(block, proposalSender);
545
+ this.p2pClient.registerBlockProposalHandler(handler);
546
+ const myAddresses = this.getValidatorAddresses();
547
+ this.p2pClient.registerThisValidatorAddresses(myAddresses);
548
+ await this.p2pClient.addReqRespSubProtocol(ReqRespSubProtocol.AUTH, this.handleAuthRequest.bind(this));
549
+ }
144
550
  }
145
551
  async attestToProposal(proposal, proposalSender) {
146
- const slotNumber = proposal.slotNumber.toBigInt();
147
- const blockNumber = proposal.blockNumber;
552
+ const slotNumber = proposal.slotNumber;
148
553
  const proposer = proposal.getSender();
554
+ // Reject proposals with invalid signatures
555
+ if (!proposer) {
556
+ this.log.warn(`Received proposal with invalid signature for slot ${slotNumber}`);
557
+ return undefined;
558
+ }
149
559
  // Check that I have any address in current committee before attesting
150
560
  const inCommittee = await this.epochCache.filterInCommittee(slotNumber, this.getValidatorAddresses());
151
561
  const partOfCommittee = inCommittee.length > 0;
@@ -155,164 +565,97 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
155
565
  };
156
566
  this.log.info(`Received proposal for slot ${slotNumber}`, {
157
567
  ...proposalInfo,
158
- txHashes: proposal.txHashes.map((txHash)=>txHash.toString())
159
- });
160
- // Collect txs from the proposal. Note that we do this before checking if we have an address in the
161
- // current committee, since we want to collect txs anyway to facilitate propagation.
162
- const { txs, missingTxs } = await this.txProvider.getTxsForBlockProposal(proposal, {
163
- pinnedPeer: proposalSender,
164
- deadline: this.getReexecutionDeadline(proposal, this.blockBuilder.getConfig())
568
+ txHashes: proposal.txHashes.map((t)=>t.toString()),
569
+ fishermanMode: this.config.fishermanMode || false
165
570
  });
166
- // Check that I have any address in current committee before attesting
167
- if (!partOfCommittee) {
168
- this.log.verbose(`No validator in the current committee, skipping attestation`, proposalInfo);
571
+ // Reexecute txs if we are part of the committee so we can attest, or if slashing is enabled so we can slash
572
+ // invalid proposals even when not in the committee, or if we are configured to always reexecute for monitoring purposes.
573
+ // In fisherman mode, we always reexecute to validate proposals.
574
+ const { validatorReexecute, slashBroadcastedInvalidBlockPenalty, alwaysReexecuteBlockProposals, fishermanMode } = this.config;
575
+ const shouldReexecute = fishermanMode || slashBroadcastedInvalidBlockPenalty > 0n && validatorReexecute || partOfCommittee && validatorReexecute || alwaysReexecuteBlockProposals || this.blobClient.canUpload();
576
+ const validationResult = await this.blockProposalHandler.handleBlockProposal(proposal, proposalSender, !!shouldReexecute);
577
+ if (!validationResult.isValid) {
578
+ this.log.warn(`Proposal validation failed: ${validationResult.reason}`, proposalInfo);
579
+ const reason = validationResult.reason || 'unknown';
580
+ // Classify failure reason: bad proposal vs node issue
581
+ const badProposalReasons = [
582
+ 'invalid_proposal',
583
+ 'state_mismatch',
584
+ 'failed_txs',
585
+ 'in_hash_mismatch',
586
+ 'parent_block_wrong_slot'
587
+ ];
588
+ if (badProposalReasons.includes(reason)) {
589
+ this.metrics.incFailedAttestationsBadProposal(1, reason, partOfCommittee);
590
+ } else {
591
+ // Node issues so we can't attest
592
+ this.metrics.incFailedAttestationsNodeIssue(1, reason, partOfCommittee);
593
+ }
594
+ // Slash invalid block proposals (can happen even when not in committee)
595
+ if (validationResult.reason && SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT.includes(validationResult.reason) && slashBroadcastedInvalidBlockPenalty > 0n) {
596
+ this.log.warn(`Slashing proposer for invalid block proposal`, proposalInfo);
597
+ this.slashInvalidBlock(proposal);
598
+ }
169
599
  return undefined;
170
600
  }
171
- // Check that the proposal is from the current proposer, or the next proposer.
172
- // Q: Should this be moved to the block proposal validator, so we disregard proposals from anyone?
173
- const invalidProposal = await this.blockProposalValidator.validate(proposal);
174
- if (invalidProposal) {
175
- this.log.warn(`Proposal is not valid, skipping attestation`, proposalInfo);
176
- if (partOfCommittee) {
177
- this.metrics.incFailedAttestations(1, 'invalid_proposal');
178
- }
601
+ // Check that I have any address in current committee before attesting
602
+ // In fisherman mode, we still create attestations for validation even if not in committee
603
+ if (!partOfCommittee && !this.config.fishermanMode) {
604
+ this.log.verbose(`No validator in the current committee, skipping attestation`, proposalInfo);
179
605
  return undefined;
180
606
  }
181
- // Check that the parent proposal is a block we know, otherwise reexecution would fail.
182
- // Q: Should we move this to the block proposal validator? If there, then p2p would check it
183
- // before re-broadcasting it. This means that proposals built on top of an L1-reorg'ed-out block
184
- // would not be rebroadcasted. But it also means that nodes that have not fully synced would
185
- // not rebroadcast the proposal.
186
- if (blockNumber > INITIAL_L2_BLOCK_NUM) {
187
- const config = this.blockBuilder.getConfig();
188
- const deadline = this.getReexecutionDeadline(proposal, config);
189
- const currentTime = this.dateProvider.now();
190
- const timeoutDurationMs = deadline.getTime() - currentTime;
191
- const parentBlock = timeoutDurationMs <= 0 ? undefined : await retryUntil(async ()=>{
192
- const block = await this.blockSource.getBlock(blockNumber - 1);
193
- if (block) {
194
- return block;
195
- }
196
- await this.blockSource.syncImmediate();
197
- return await this.blockSource.getBlock(blockNumber - 1);
198
- }, 'Force Archiver Sync', timeoutDurationMs / 1000, 0.5);
199
- if (parentBlock === undefined) {
200
- this.log.warn(`Parent block for ${blockNumber} not found, skipping attestation`, proposalInfo);
201
- if (partOfCommittee) {
202
- this.metrics.incFailedAttestations(1, 'parent_block_not_found');
203
- }
204
- return undefined;
205
- }
206
- if (!proposal.payload.header.lastArchiveRoot.equals(parentBlock.archive.root)) {
207
- this.log.warn(`Parent block archive root for proposal does not match, skipping attestation`, {
208
- proposalLastArchiveRoot: proposal.payload.header.lastArchiveRoot.toString(),
209
- parentBlockArchiveRoot: parentBlock.archive.root.toString(),
210
- ...proposalInfo
211
- });
212
- if (partOfCommittee) {
213
- this.metrics.incFailedAttestations(1, 'parent_block_does_not_match');
607
+ // Provided all of the above checks pass, we can attest to the proposal
608
+ this.log.info(`${partOfCommittee ? 'Attesting to' : 'Validated'} proposal for slot ${slotNumber}`, {
609
+ ...proposalInfo,
610
+ inCommittee: partOfCommittee,
611
+ fishermanMode: this.config.fishermanMode || false
612
+ });
613
+ this.metrics.incSuccessfulAttestations(inCommittee.length);
614
+ // Upload blobs to filestore after successful re-execution (fire-and-forget)
615
+ if (validationResult.reexecutionResult?.block && this.blobClient.canUpload()) {
616
+ void Promise.resolve().then(async ()=>{
617
+ try {
618
+ const blobFields = validationResult.reexecutionResult.block.getCheckpointBlobFields();
619
+ const blobs = getBlobsPerL1Block(blobFields);
620
+ await this.blobClient.sendBlobsToFilestore(blobs);
621
+ this.log.debug(`Uploaded ${blobs.length} blobs to filestore from re-execution`, proposalInfo);
622
+ } catch (err) {
623
+ this.log.warn(`Failed to upload blobs from re-execution`, err);
214
624
  }
215
- return undefined;
216
- }
217
- }
218
- // Check that I have the same set of l1ToL2Messages as the proposal
219
- // Q: Same as above, should this be part of p2p validation?
220
- const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(blockNumber);
221
- const computedInHash = await computeInHashFromL1ToL2Messages(l1ToL2Messages);
222
- const proposalInHash = proposal.payload.header.contentCommitment.inHash;
223
- if (!computedInHash.equals(proposalInHash)) {
224
- this.log.warn(`L1 to L2 messages in hash mismatch, skipping attestation`, {
225
- proposalInHash: proposalInHash.toString(),
226
- computedInHash: computedInHash.toString(),
227
- ...proposalInfo
228
625
  });
229
- if (partOfCommittee) {
230
- this.metrics.incFailedAttestations(1, 'in_hash_mismatch');
231
- }
626
+ }
627
+ // If the above function does not throw an error, then we can attest to the proposal
628
+ // Determine which validators should attest
629
+ let attestors;
630
+ if (partOfCommittee) {
631
+ attestors = inCommittee;
632
+ } else if (this.config.fishermanMode) {
633
+ // In fisherman mode, create attestations for validation purposes even if not in committee. These won't be broadcast.
634
+ attestors = this.getValidatorAddresses();
635
+ } else {
636
+ attestors = [];
637
+ }
638
+ // Only create attestations if we have attestors
639
+ if (attestors.length === 0) {
232
640
  return undefined;
233
641
  }
234
- // Check that all of the transactions in the proposal are available in the tx pool before attesting
235
- if (missingTxs.length > 0) {
236
- this.log.warn(`Missing ${missingTxs.length} txs to attest to proposal`, {
642
+ if (this.config.fishermanMode) {
643
+ // bail out early and don't save attestations to the pool in fisherman mode
644
+ this.log.info(`Creating attestations for proposal for slot ${slotNumber}`, {
237
645
  ...proposalInfo,
238
- missingTxs
646
+ attestors: attestors.map((a)=>a.toString())
239
647
  });
240
- if (partOfCommittee) {
241
- this.metrics.incFailedAttestations(1, 'TransactionsNotAvailableError');
242
- }
243
648
  return undefined;
244
649
  }
245
- // Try re-executing the transactions in the proposal
246
- try {
247
- this.log.verbose(`Processing attestation for slot ${slotNumber}`, proposalInfo);
248
- if (this.config.validatorReexecute) {
249
- this.log.verbose(`Re-executing transactions in the proposal before attesting`);
250
- await this.reExecuteTransactions(proposal, txs, l1ToL2Messages);
251
- }
252
- } catch (error) {
253
- this.metrics.incFailedAttestations(1, error instanceof Error ? error.name : 'unknown');
254
- this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
255
- if (error instanceof ReExStateMismatchError && this.config.slashBroadcastedInvalidBlockPenalty > 0n) {
256
- this.log.warn(`Slashing proposer for invalid block proposal`, proposalInfo);
257
- this.slashInvalidBlock(proposal);
258
- }
259
- return undefined;
260
- }
261
- // Provided all of the above checks pass, we can attest to the proposal
262
- this.log.info(`Attesting to proposal for slot ${slotNumber}`, proposalInfo);
263
- this.metrics.incAttestations(inCommittee.length);
264
- // If the above function does not throw an error, then we can attest to the proposal
265
- return this.doAttestToProposal(proposal, inCommittee);
266
- }
267
- getReexecutionDeadline(proposal, config) {
268
- const nextSlotTimestampSeconds = Number(getTimestampForSlot(proposal.slotNumber.toBigInt() + 1n, config));
269
- const msNeededForPropagationAndPublishing = this.config.validatorReexecuteDeadlineMs;
270
- return new Date(nextSlotTimestampSeconds * 1000 - msNeededForPropagationAndPublishing);
271
- }
272
- /**
273
- * Re-execute the transactions in the proposal and check that the state updates match the header state
274
- * @param proposal - The proposal to re-execute
275
- */ async reExecuteTransactions(proposal, txs, l1ToL2Messages) {
276
- const { header } = proposal.payload;
277
- const { txHashes } = proposal;
278
- // If we do not have all of the transactions, then we should fail
279
- if (txs.length !== txHashes.length) {
280
- const foundTxHashes = txs.map((tx)=>tx.getTxHash());
281
- const missingTxHashes = txHashes.filter((txHash)=>!foundTxHashes.includes(txHash));
282
- throw new TransactionsNotAvailableError(missingTxHashes);
283
- }
284
- // Use the sequencer's block building logic to re-execute the transactions
285
- const timer = new Timer();
286
- const config = this.blockBuilder.getConfig();
287
- const globalVariables = GlobalVariables.from({
288
- ...proposal.payload.header,
289
- blockNumber: proposal.blockNumber,
290
- timestamp: header.timestamp,
291
- chainId: new Fr(config.l1ChainId),
292
- version: new Fr(config.rollupVersion)
293
- });
294
- const { block, failedTxs } = await this.blockBuilder.buildBlock(txs, l1ToL2Messages, globalVariables, {
295
- deadline: this.getReexecutionDeadline(proposal, config)
296
- });
297
- this.log.verbose(`Transaction re-execution complete`);
298
- const numFailedTxs = failedTxs.length;
299
- if (numFailedTxs > 0) {
300
- this.metrics.recordFailedReexecution(proposal);
301
- throw new ReExFailedTxsError(numFailedTxs);
302
- }
303
- if (block.body.txEffects.length !== txHashes.length) {
304
- this.metrics.recordFailedReexecution(proposal);
305
- throw new ReExTimeoutError();
306
- }
307
- // This function will throw an error if state updates do not match
308
- if (!block.archive.root.equals(proposal.archive)) {
309
- this.metrics.recordFailedReexecution(proposal);
310
- throw new ReExStateMismatchError(proposal.archive, block.archive.root, proposal.payload.stateReference, block.header.state);
311
- }
312
- this.metrics.recordReex(timer.ms(), txs.length, block.header.totalManaUsed.toNumber() / 1e6);
650
+ return this.createBlockAttestationsFromProposal(proposal, attestors);
313
651
  }
314
652
  slashInvalidBlock(proposal) {
315
653
  const proposer = proposal.getSender();
654
+ // Skip if signature is invalid (shouldn't happen since we validate earlier)
655
+ if (!proposer) {
656
+ this.log.warn(`Cannot slash proposal with invalid signature`);
657
+ return;
658
+ }
316
659
  // Trim the set if it's too big.
317
660
  if (this.proposersOfInvalidBlocks.size > MAX_PROPOSERS_OF_INVALID_BLOCKS) {
318
661
  // remove oldest proposer. `values` is guaranteed to be in insertion order.
@@ -324,33 +667,54 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
324
667
  validator: proposer,
325
668
  amount: this.config.slashBroadcastedInvalidBlockPenalty,
326
669
  offenseType: OffenseType.BROADCASTED_INVALID_BLOCK_PROPOSAL,
327
- epochOrSlot: proposal.slotNumber.toBigInt()
670
+ epochOrSlot: BigInt(proposal.slotNumber)
328
671
  }
329
672
  ]);
330
673
  }
331
- async createBlockProposal(blockNumber, header, archive, stateReference, txs, proposerAddress, options) {
332
- if (this.previousProposal?.slotNumber.equals(header.slotNumber)) {
333
- this.log.verbose(`Already made a proposal for the same slot, skipping proposal`);
334
- return Promise.resolve(undefined);
335
- }
336
- const newProposal = await this.validationService.createBlockProposal(blockNumber, header, archive, stateReference, txs, proposerAddress, options);
674
+ // TODO(palla/mbps): Block proposal should not require a checkpoint proposal
675
+ async createBlockProposal(blockNumber, header, archive, txs, proposerAddress, options) {
676
+ // TODO(palla/mbps): Prevent double proposals properly
677
+ // if (this.previousProposal?.slotNumber === header.slotNumber) {
678
+ // this.log.verbose(`Already made a proposal for the same slot, skipping proposal`);
679
+ // return Promise.resolve(undefined);
680
+ // }
681
+ this.log.info(`Assembling block proposal for block ${blockNumber} slot ${header.slotNumber}`);
682
+ const newProposal = await this.validationService.createBlockProposal(header, archive, txs, proposerAddress, {
683
+ ...options,
684
+ broadcastInvalidBlockProposal: this.config.broadcastInvalidBlockProposal
685
+ });
337
686
  this.previousProposal = newProposal;
338
687
  return newProposal;
339
688
  }
689
+ // TODO(palla/mbps): Effectively create a checkpoint proposal different from a block proposal
690
+ createCheckpointProposal(header, archive, txs, proposerAddress, options) {
691
+ this.log.info(`Assembling checkpoint proposal for slot ${header.slotNumber}`);
692
+ return this.createBlockProposal(0, header, archive, txs, proposerAddress, options);
693
+ }
340
694
  async broadcastBlockProposal(proposal) {
341
695
  await this.p2pClient.broadcastProposal(proposal);
342
696
  }
697
+ async signAttestationsAndSigners(attestationsAndSigners, proposer) {
698
+ return await this.validationService.signAttestationsAndSigners(attestationsAndSigners, proposer);
699
+ }
343
700
  async collectOwnAttestations(proposal) {
344
- const slot = proposal.payload.header.slotNumber.toBigInt();
701
+ const slot = proposal.payload.header.slotNumber;
345
702
  const inCommittee = await this.epochCache.filterInCommittee(slot, this.getValidatorAddresses());
346
703
  this.log.debug(`Collecting ${inCommittee.length} self-attestations for slot ${slot}`, {
347
704
  inCommittee
348
705
  });
349
- return this.doAttestToProposal(proposal, inCommittee);
706
+ const attestations = await this.createBlockAttestationsFromProposal(proposal, inCommittee);
707
+ // We broadcast our own attestations to our peers so, in case our block does not get mined on L1,
708
+ // other nodes can see that our validators did attest to this block proposal, and do not slash us
709
+ // due to inactivity for missed attestations.
710
+ void this.p2pClient.broadcastAttestations(attestations).catch((err)=>{
711
+ this.log.error(`Failed to broadcast self-attestations for slot ${slot}`, err);
712
+ });
713
+ return attestations;
350
714
  }
351
715
  async collectAttestations(proposal, required, deadline) {
352
716
  // Wait and poll the p2pClient's attestation pool for this block until we have enough attestations
353
- const slot = proposal.payload.header.slotNumber.toBigInt();
717
+ const slot = proposal.payload.header.slotNumber;
354
718
  this.log.debug(`Collecting ${required} attestations for slot ${slot} with deadline ${deadline.toISOString()}`);
355
719
  if (+deadline < this.dateProvider.now()) {
356
720
  this.log.error(`Deadline ${deadline.toISOString()} for collecting ${required} attestations for slot ${slot} is in the past`);
@@ -361,11 +725,28 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
361
725
  const myAddresses = this.getValidatorAddresses();
362
726
  let attestations = [];
363
727
  while(true){
364
- const collectedAttestations = await this.p2pClient.getAttestationsForSlot(slot, proposalId);
728
+ // Filter out attestations with a mismatching payload. This should NOT happen since we have verified
729
+ // the proposer signature (ie our own) before accepting the attestation into the pool via the p2p client.
730
+ const collectedAttestations = (await this.p2pClient.getAttestationsForSlot(slot, proposalId)).filter((attestation)=>{
731
+ if (!attestation.payload.equals(proposal.payload)) {
732
+ this.log.warn(`Received attestation for slot ${slot} with mismatched payload from ${attestation.getSender()?.toString()}`, {
733
+ attestationPayload: attestation.payload,
734
+ proposalPayload: proposal.payload
735
+ });
736
+ return false;
737
+ }
738
+ return true;
739
+ });
740
+ // Log new attestations we collected
365
741
  const oldSenders = attestations.map((attestation)=>attestation.getSender());
366
742
  for (const collected of collectedAttestations){
367
743
  const collectedSender = collected.getSender();
368
- if (!myAddresses.some((address)=>address.equals(collectedSender)) && !oldSenders.some((sender)=>sender.equals(collectedSender))) {
744
+ // Skip attestations with invalid signatures
745
+ if (!collectedSender) {
746
+ this.log.warn(`Skipping attestation with invalid signature for slot ${slot}`);
747
+ continue;
748
+ }
749
+ if (!myAddresses.some((address)=>address.equals(collectedSender)) && !oldSenders.some((sender)=>sender?.equals(collectedSender))) {
369
750
  this.log.debug(`Received attestation for slot ${slot} from ${collectedSender.toString()}`);
370
751
  }
371
752
  }
@@ -378,11 +759,11 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
378
759
  this.log.error(`Timeout ${deadline.toISOString()} waiting for ${required} attestations for slot ${slot}`);
379
760
  throw new AttestationTimeoutError(attestations.length, required, slot);
380
761
  }
381
- this.log.debug(`Collected ${attestations.length} attestations so far`);
762
+ this.log.debug(`Collected ${attestations.length} of ${required} attestations so far`);
382
763
  await sleep(this.config.attestationPollingIntervalMs);
383
764
  }
384
765
  }
385
- async doAttestToProposal(proposal, attestors = []) {
766
+ async createBlockAttestationsFromProposal(proposal, attestors = []) {
386
767
  const attestations = await this.validationService.attestToProposal(proposal, attestors);
387
768
  await this.p2pClient.addAttestations(attestations);
388
769
  return attestations;
@@ -405,4 +786,4 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
405
786
  const authResponse = new AuthResponse(statusMessage, signature);
406
787
  return authResponse.toBuffer();
407
788
  }
408
- } // Conversion helpers moved into NodeKeystoreAdapter.
789
+ }