@aztec/validator-client 0.0.0-test.1 → 0.0.1-commit.023c3e5

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 (78) hide show
  1. package/README.md +282 -0
  2. package/dest/block_proposal_handler.d.ts +63 -0
  3. package/dest/block_proposal_handler.d.ts.map +1 -0
  4. package/dest/block_proposal_handler.js +546 -0
  5. package/dest/checkpoint_builder.d.ts +66 -0
  6. package/dest/checkpoint_builder.d.ts.map +1 -0
  7. package/dest/checkpoint_builder.js +173 -0
  8. package/dest/config.d.ts +3 -14
  9. package/dest/config.d.ts.map +1 -1
  10. package/dest/config.js +41 -8
  11. package/dest/duties/validation_service.d.ts +50 -13
  12. package/dest/duties/validation_service.d.ts.map +1 -1
  13. package/dest/duties/validation_service.js +123 -17
  14. package/dest/factory.d.ts +28 -6
  15. package/dest/factory.d.ts.map +1 -1
  16. package/dest/factory.js +13 -6
  17. package/dest/index.d.ts +6 -2
  18. package/dest/index.d.ts.map +1 -1
  19. package/dest/index.js +5 -1
  20. package/dest/key_store/ha_key_store.d.ts +99 -0
  21. package/dest/key_store/ha_key_store.d.ts.map +1 -0
  22. package/dest/key_store/ha_key_store.js +208 -0
  23. package/dest/key_store/index.d.ts +4 -1
  24. package/dest/key_store/index.d.ts.map +1 -1
  25. package/dest/key_store/index.js +3 -0
  26. package/dest/key_store/interface.d.ts +85 -6
  27. package/dest/key_store/interface.d.ts.map +1 -1
  28. package/dest/key_store/interface.js +3 -3
  29. package/dest/key_store/local_key_store.d.ts +46 -11
  30. package/dest/key_store/local_key_store.d.ts.map +1 -1
  31. package/dest/key_store/local_key_store.js +68 -17
  32. package/dest/key_store/node_keystore_adapter.d.ts +151 -0
  33. package/dest/key_store/node_keystore_adapter.d.ts.map +1 -0
  34. package/dest/key_store/node_keystore_adapter.js +330 -0
  35. package/dest/key_store/web3signer_key_store.d.ts +66 -0
  36. package/dest/key_store/web3signer_key_store.d.ts.map +1 -0
  37. package/dest/key_store/web3signer_key_store.js +156 -0
  38. package/dest/metrics.d.ts +13 -5
  39. package/dest/metrics.d.ts.map +1 -1
  40. package/dest/metrics.js +63 -22
  41. package/dest/tx_validator/index.d.ts +3 -0
  42. package/dest/tx_validator/index.d.ts.map +1 -0
  43. package/dest/tx_validator/index.js +2 -0
  44. package/dest/tx_validator/nullifier_cache.d.ts +14 -0
  45. package/dest/tx_validator/nullifier_cache.d.ts.map +1 -0
  46. package/dest/tx_validator/nullifier_cache.js +24 -0
  47. package/dest/tx_validator/tx_validator_factory.d.ts +19 -0
  48. package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -0
  49. package/dest/tx_validator/tx_validator_factory.js +54 -0
  50. package/dest/validator.d.ts +73 -58
  51. package/dest/validator.d.ts.map +1 -1
  52. package/dest/validator.js +559 -166
  53. package/package.json +37 -21
  54. package/src/block_proposal_handler.ts +555 -0
  55. package/src/checkpoint_builder.ts +314 -0
  56. package/src/config.ts +52 -22
  57. package/src/duties/validation_service.ts +193 -19
  58. package/src/factory.ts +65 -11
  59. package/src/index.ts +5 -1
  60. package/src/key_store/ha_key_store.ts +269 -0
  61. package/src/key_store/index.ts +3 -0
  62. package/src/key_store/interface.ts +100 -5
  63. package/src/key_store/local_key_store.ts +77 -18
  64. package/src/key_store/node_keystore_adapter.ts +398 -0
  65. package/src/key_store/web3signer_key_store.ts +205 -0
  66. package/src/metrics.ts +86 -23
  67. package/src/tx_validator/index.ts +2 -0
  68. package/src/tx_validator/nullifier_cache.ts +30 -0
  69. package/src/tx_validator/tx_validator_factory.ts +154 -0
  70. package/src/validator.ts +757 -221
  71. package/dest/errors/index.d.ts +0 -2
  72. package/dest/errors/index.d.ts.map +0 -1
  73. package/dest/errors/index.js +0 -1
  74. package/dest/errors/validator.error.d.ts +0 -29
  75. package/dest/errors/validator.error.d.ts.map +0 -1
  76. package/dest/errors/validator.error.js +0 -45
  77. package/src/errors/index.ts +0 -1
  78. package/src/errors/validator.error.ts +0 -55
@@ -0,0 +1,546 @@
1
+ function _ts_add_disposable_resource(env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() {
16
+ try {
17
+ inner.call(this);
18
+ } catch (e) {
19
+ return Promise.reject(e);
20
+ }
21
+ };
22
+ env.stack.push({
23
+ value: value,
24
+ dispose: dispose,
25
+ async: async
26
+ });
27
+ } else if (async) {
28
+ env.stack.push({
29
+ async: true
30
+ });
31
+ }
32
+ return value;
33
+ }
34
+ function _ts_dispose_resources(env) {
35
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
36
+ var e = new Error(message);
37
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
38
+ };
39
+ return (_ts_dispose_resources = function _ts_dispose_resources(env) {
40
+ function fail(e) {
41
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
42
+ env.hasError = true;
43
+ }
44
+ var r, s = 0;
45
+ function next() {
46
+ while(r = env.stack.pop()){
47
+ try {
48
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
49
+ if (r.dispose) {
50
+ var result = r.dispose.call(r.value);
51
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
52
+ fail(e);
53
+ return next();
54
+ });
55
+ } else s |= 1;
56
+ } catch (e) {
57
+ fail(e);
58
+ }
59
+ }
60
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
61
+ if (env.hasError) throw env.error;
62
+ }
63
+ return next();
64
+ })(env);
65
+ }
66
+ import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
67
+ import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
68
+ import { chunkBy } from '@aztec/foundation/collection';
69
+ import { Fr } from '@aztec/foundation/curves/bn254';
70
+ import { TimeoutError } from '@aztec/foundation/error';
71
+ import { createLogger } from '@aztec/foundation/log';
72
+ import { retryUntil } from '@aztec/foundation/retry';
73
+ import { DateProvider, Timer } from '@aztec/foundation/timer';
74
+ import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
75
+ import { computeCheckpointOutHash, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
76
+ import { ReExFailedTxsError, ReExStateMismatchError, ReExTimeoutError, TransactionsNotAvailableError } from '@aztec/stdlib/validators';
77
+ import { getTelemetryClient } from '@aztec/telemetry-client';
78
+ export class BlockProposalHandler {
79
+ checkpointsBuilder;
80
+ worldState;
81
+ blockSource;
82
+ l1ToL2MessageSource;
83
+ txProvider;
84
+ blockProposalValidator;
85
+ epochCache;
86
+ config;
87
+ metrics;
88
+ dateProvider;
89
+ log;
90
+ tracer;
91
+ constructor(checkpointsBuilder, worldState, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, epochCache, config, metrics, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator:block-proposal-handler')){
92
+ this.checkpointsBuilder = checkpointsBuilder;
93
+ this.worldState = worldState;
94
+ this.blockSource = blockSource;
95
+ this.l1ToL2MessageSource = l1ToL2MessageSource;
96
+ this.txProvider = txProvider;
97
+ this.blockProposalValidator = blockProposalValidator;
98
+ this.epochCache = epochCache;
99
+ this.config = config;
100
+ this.metrics = metrics;
101
+ this.dateProvider = dateProvider;
102
+ this.log = log;
103
+ if (config.fishermanMode) {
104
+ this.log = this.log.createChild('[FISHERMAN]');
105
+ }
106
+ this.tracer = telemetry.getTracer('BlockProposalHandler');
107
+ }
108
+ registerForReexecution(p2pClient) {
109
+ // Non-validator handler that re-executes for monitoring but does not attest.
110
+ // Returns boolean indicating whether the proposal was valid.
111
+ const handler = async (proposal, proposalSender)=>{
112
+ try {
113
+ const result = await this.handleBlockProposal(proposal, proposalSender, true);
114
+ if (result.isValid) {
115
+ this.log.info(`Non-validator reexecution completed for slot ${proposal.slotNumber}`, {
116
+ blockNumber: result.blockNumber,
117
+ reexecutionTimeMs: result.reexecutionResult?.reexecutionTimeMs,
118
+ totalManaUsed: result.reexecutionResult?.totalManaUsed,
119
+ numTxs: result.reexecutionResult?.block?.body?.txEffects?.length ?? 0
120
+ });
121
+ return true;
122
+ } else {
123
+ this.log.warn(`Non-validator reexecution failed for slot ${proposal.slotNumber}`, {
124
+ blockNumber: result.blockNumber,
125
+ reason: result.reason
126
+ });
127
+ return false;
128
+ }
129
+ } catch (error) {
130
+ this.log.error('Error processing block proposal in non-validator handler', error);
131
+ return false;
132
+ }
133
+ };
134
+ p2pClient.registerBlockProposalHandler(handler);
135
+ return this;
136
+ }
137
+ async handleBlockProposal(proposal, proposalSender, shouldReexecute) {
138
+ const slotNumber = proposal.slotNumber;
139
+ const proposer = proposal.getSender();
140
+ const config = this.checkpointsBuilder.getConfig();
141
+ // Reject proposals with invalid signatures
142
+ if (!proposer) {
143
+ this.log.warn(`Received proposal with invalid signature for slot ${slotNumber}`);
144
+ return {
145
+ isValid: false,
146
+ reason: 'invalid_proposal'
147
+ };
148
+ }
149
+ const proposalInfo = {
150
+ ...proposal.toBlockInfo(),
151
+ proposer: proposer.toString()
152
+ };
153
+ this.log.info(`Processing proposal for slot ${slotNumber}`, {
154
+ ...proposalInfo,
155
+ txHashes: proposal.txHashes.map((t)=>t.toString())
156
+ });
157
+ // Check that the proposal is from the current proposer, or the next proposer
158
+ // This should have been handled by the p2p layer, but we double check here out of caution
159
+ const validationResult = await this.blockProposalValidator.validate(proposal);
160
+ if (validationResult.result !== 'accept') {
161
+ this.log.warn(`Proposal is not valid, skipping processing`, proposalInfo);
162
+ return {
163
+ isValid: false,
164
+ reason: 'invalid_proposal'
165
+ };
166
+ }
167
+ // Check that the parent proposal is a block we know, otherwise reexecution would fail
168
+ const parentBlockHeader = await this.getParentBlock(proposal);
169
+ if (parentBlockHeader === undefined) {
170
+ this.log.warn(`Parent block for proposal not found, skipping processing`, proposalInfo);
171
+ return {
172
+ isValid: false,
173
+ reason: 'parent_block_not_found'
174
+ };
175
+ }
176
+ // Check that the parent block's slot is not greater than the proposal's slot.
177
+ if (parentBlockHeader !== 'genesis' && parentBlockHeader.getSlot() > slotNumber) {
178
+ this.log.warn(`Parent block slot is greater than proposal slot, skipping processing`, {
179
+ parentBlockSlot: parentBlockHeader.getSlot().toString(),
180
+ proposalSlot: slotNumber.toString(),
181
+ ...proposalInfo
182
+ });
183
+ return {
184
+ isValid: false,
185
+ reason: 'parent_block_wrong_slot'
186
+ };
187
+ }
188
+ // Compute the block number based on the parent block
189
+ const blockNumber = parentBlockHeader === 'genesis' ? BlockNumber(INITIAL_L2_BLOCK_NUM) : BlockNumber(parentBlockHeader.getBlockNumber() + 1);
190
+ // Check that this block number does not exist already
191
+ const existingBlock = await this.blockSource.getBlockHeader(blockNumber);
192
+ if (existingBlock) {
193
+ this.log.warn(`Block number ${blockNumber} already exists, skipping processing`, proposalInfo);
194
+ return {
195
+ isValid: false,
196
+ blockNumber,
197
+ reason: 'block_number_already_exists'
198
+ };
199
+ }
200
+ // Collect txs from the proposal. We start doing this as early as possible,
201
+ // and we do it even if we don't plan to re-execute the txs, so that we have them if another node needs them.
202
+ const { txs, missingTxs } = await this.txProvider.getTxsForBlockProposal(proposal, blockNumber, {
203
+ pinnedPeer: proposalSender,
204
+ deadline: this.getReexecutionDeadline(slotNumber, config)
205
+ });
206
+ // Compute the checkpoint number for this block and validate checkpoint consistency
207
+ const checkpointResult = await this.computeCheckpointNumber(proposal, parentBlockHeader, proposalInfo);
208
+ if (checkpointResult.reason) {
209
+ return {
210
+ isValid: false,
211
+ blockNumber,
212
+ reason: checkpointResult.reason
213
+ };
214
+ }
215
+ const checkpointNumber = checkpointResult.checkpointNumber;
216
+ // Check that I have the same set of l1ToL2Messages as the proposal
217
+ const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(checkpointNumber);
218
+ const computedInHash = computeInHashFromL1ToL2Messages(l1ToL2Messages);
219
+ const proposalInHash = proposal.inHash;
220
+ if (!computedInHash.equals(proposalInHash)) {
221
+ this.log.warn(`L1 to L2 messages in hash mismatch, skipping processing`, {
222
+ proposalInHash: proposalInHash.toString(),
223
+ computedInHash: computedInHash.toString(),
224
+ ...proposalInfo
225
+ });
226
+ return {
227
+ isValid: false,
228
+ blockNumber,
229
+ reason: 'in_hash_mismatch'
230
+ };
231
+ }
232
+ // Check that all of the transactions in the proposal are available
233
+ if (missingTxs.length > 0) {
234
+ this.log.warn(`Missing ${missingTxs.length} txs to process proposal`, {
235
+ ...proposalInfo,
236
+ missingTxs
237
+ });
238
+ return {
239
+ isValid: false,
240
+ blockNumber,
241
+ reason: 'txs_not_available'
242
+ };
243
+ }
244
+ // Try re-executing the transactions in the proposal if needed
245
+ let reexecutionResult;
246
+ if (shouldReexecute) {
247
+ // Compute the previous checkpoint out hashes for the epoch.
248
+ // TODO(leila/mbps): There can be a more efficient way to get the previous checkpoint out
249
+ // hashes without having to fetch all the blocks.
250
+ const epoch = getEpochAtSlot(slotNumber, this.epochCache.getL1Constants());
251
+ const checkpointedBlocks = (await this.blockSource.getCheckpointedBlocksForEpoch(epoch)).filter((b)=>b.block.number < blockNumber).sort((a, b)=>a.block.number - b.block.number);
252
+ const blocksByCheckpoint = chunkBy(checkpointedBlocks, (b)=>b.checkpointNumber);
253
+ const previousCheckpointOutHashes = blocksByCheckpoint.map((checkpointBlocks)=>computeCheckpointOutHash(checkpointBlocks.map((b)=>b.block.body.txEffects.map((tx)=>tx.l2ToL1Msgs))));
254
+ try {
255
+ this.log.verbose(`Re-executing transactions in the proposal`, proposalInfo);
256
+ reexecutionResult = await this.reexecuteTransactions(proposal, blockNumber, checkpointNumber, txs, l1ToL2Messages, previousCheckpointOutHashes);
257
+ } catch (error) {
258
+ this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
259
+ const reason = this.getReexecuteFailureReason(error);
260
+ return {
261
+ isValid: false,
262
+ blockNumber,
263
+ reason,
264
+ reexecutionResult
265
+ };
266
+ }
267
+ }
268
+ // If we succeeded, push this block into the archiver (unless disabled)
269
+ if (reexecutionResult?.block && this.config.skipPushProposedBlocksToArchiver === false) {
270
+ await this.blockSource.addBlock(reexecutionResult?.block);
271
+ }
272
+ this.log.info(`Successfully processed block ${blockNumber} proposal at index ${proposal.indexWithinCheckpoint} on slot ${slotNumber}`, proposalInfo);
273
+ return {
274
+ isValid: true,
275
+ blockNumber,
276
+ reexecutionResult
277
+ };
278
+ }
279
+ async getParentBlock(proposal) {
280
+ const parentArchive = proposal.blockHeader.lastArchive.root;
281
+ const slot = proposal.slotNumber;
282
+ const config = this.checkpointsBuilder.getConfig();
283
+ const { genesisArchiveRoot } = await this.blockSource.getGenesisValues();
284
+ if (parentArchive.equals(genesisArchiveRoot)) {
285
+ return 'genesis';
286
+ }
287
+ const deadline = this.getReexecutionDeadline(slot, config);
288
+ const currentTime = this.dateProvider.now();
289
+ const timeoutDurationMs = deadline.getTime() - currentTime;
290
+ try {
291
+ return await this.blockSource.getBlockHeaderByArchive(parentArchive) ?? (timeoutDurationMs <= 0 ? undefined : await retryUntil(()=>this.blockSource.syncImmediate().then(()=>this.blockSource.getBlockHeaderByArchive(parentArchive)), 'force archiver sync', timeoutDurationMs / 1000, 0.5));
292
+ } catch (err) {
293
+ if (err instanceof TimeoutError) {
294
+ this.log.debug(`Timed out getting parent block by archive root`, {
295
+ parentArchive
296
+ });
297
+ } else {
298
+ this.log.error('Error getting parent block by archive root', err, {
299
+ parentArchive
300
+ });
301
+ }
302
+ return undefined;
303
+ }
304
+ }
305
+ async computeCheckpointNumber(proposal, parentBlockHeader, proposalInfo) {
306
+ if (parentBlockHeader === 'genesis') {
307
+ // First block is in checkpoint 1
308
+ if (proposal.indexWithinCheckpoint !== 0) {
309
+ this.log.warn(`First block proposal has non-zero indexWithinCheckpoint`, proposalInfo);
310
+ return {
311
+ reason: 'invalid_proposal'
312
+ };
313
+ }
314
+ return {
315
+ checkpointNumber: CheckpointNumber.INITIAL
316
+ };
317
+ }
318
+ // Get the parent block to find its checkpoint number
319
+ // TODO(palla/mbps): The block header should include the checkpoint number to avoid this lookup,
320
+ // or at least the L2BlockSource should return a different struct that includes it.
321
+ const parentBlockNumber = parentBlockHeader.getBlockNumber();
322
+ const parentBlock = await this.blockSource.getL2Block(parentBlockNumber);
323
+ if (!parentBlock) {
324
+ this.log.warn(`Parent block ${parentBlockNumber} not found in archiver`, proposalInfo);
325
+ return {
326
+ reason: 'invalid_proposal'
327
+ };
328
+ }
329
+ if (proposal.indexWithinCheckpoint === 0) {
330
+ // If this is the first block in a new checkpoint, increment the checkpoint number
331
+ if (!(proposal.blockHeader.getSlot() > parentBlockHeader.getSlot())) {
332
+ this.log.warn(`Slot should be greater than parent block slot for first block in checkpoint`, proposalInfo);
333
+ return {
334
+ reason: 'invalid_proposal'
335
+ };
336
+ }
337
+ return {
338
+ checkpointNumber: CheckpointNumber(parentBlock.checkpointNumber + 1)
339
+ };
340
+ }
341
+ // Otherwise it should follow the previous block in the same checkpoint
342
+ if (proposal.indexWithinCheckpoint !== parentBlock.indexWithinCheckpoint + 1) {
343
+ this.log.warn(`Non-sequential indexWithinCheckpoint`, proposalInfo);
344
+ return {
345
+ reason: 'invalid_proposal'
346
+ };
347
+ }
348
+ if (proposal.blockHeader.getSlot() !== parentBlockHeader.getSlot()) {
349
+ this.log.warn(`Slot should be equal to parent block slot for non-first block in checkpoint`, proposalInfo);
350
+ return {
351
+ reason: 'invalid_proposal'
352
+ };
353
+ }
354
+ // For non-first blocks in a checkpoint, validate global variables match parent (except blockNumber)
355
+ const validationResult = this.validateNonFirstBlockInCheckpoint(proposal, parentBlock, proposalInfo);
356
+ if (validationResult) {
357
+ return validationResult;
358
+ }
359
+ return {
360
+ checkpointNumber: parentBlock.checkpointNumber
361
+ };
362
+ }
363
+ /**
364
+ * Validates that a non-first block in a checkpoint has consistent global variables with its parent.
365
+ * For blocks with indexWithinCheckpoint > 0, all global variables except blockNumber must match the parent.
366
+ * @returns A failure result if validation fails, undefined if validation passes
367
+ */ validateNonFirstBlockInCheckpoint(proposal, parentBlock, proposalInfo) {
368
+ const proposalGlobals = proposal.blockHeader.globalVariables;
369
+ const parentGlobals = parentBlock.header.globalVariables;
370
+ // All global variables except blockNumber should match the parent
371
+ // blockNumber naturally increments between blocks
372
+ if (!proposalGlobals.chainId.equals(parentGlobals.chainId)) {
373
+ this.log.warn(`Non-first block in checkpoint has mismatched chainId`, {
374
+ ...proposalInfo,
375
+ proposalChainId: proposalGlobals.chainId.toString(),
376
+ parentChainId: parentGlobals.chainId.toString()
377
+ });
378
+ return {
379
+ reason: 'global_variables_mismatch'
380
+ };
381
+ }
382
+ if (!proposalGlobals.version.equals(parentGlobals.version)) {
383
+ this.log.warn(`Non-first block in checkpoint has mismatched version`, {
384
+ ...proposalInfo,
385
+ proposalVersion: proposalGlobals.version.toString(),
386
+ parentVersion: parentGlobals.version.toString()
387
+ });
388
+ return {
389
+ reason: 'global_variables_mismatch'
390
+ };
391
+ }
392
+ if (proposalGlobals.slotNumber !== parentGlobals.slotNumber) {
393
+ this.log.warn(`Non-first block in checkpoint has mismatched slotNumber`, {
394
+ ...proposalInfo,
395
+ proposalSlotNumber: proposalGlobals.slotNumber,
396
+ parentSlotNumber: parentGlobals.slotNumber
397
+ });
398
+ return {
399
+ reason: 'global_variables_mismatch'
400
+ };
401
+ }
402
+ if (proposalGlobals.timestamp !== parentGlobals.timestamp) {
403
+ this.log.warn(`Non-first block in checkpoint has mismatched timestamp`, {
404
+ ...proposalInfo,
405
+ proposalTimestamp: proposalGlobals.timestamp.toString(),
406
+ parentTimestamp: parentGlobals.timestamp.toString()
407
+ });
408
+ return {
409
+ reason: 'global_variables_mismatch'
410
+ };
411
+ }
412
+ if (!proposalGlobals.coinbase.equals(parentGlobals.coinbase)) {
413
+ this.log.warn(`Non-first block in checkpoint has mismatched coinbase`, {
414
+ ...proposalInfo,
415
+ proposalCoinbase: proposalGlobals.coinbase.toString(),
416
+ parentCoinbase: parentGlobals.coinbase.toString()
417
+ });
418
+ return {
419
+ reason: 'global_variables_mismatch'
420
+ };
421
+ }
422
+ if (!proposalGlobals.feeRecipient.equals(parentGlobals.feeRecipient)) {
423
+ this.log.warn(`Non-first block in checkpoint has mismatched feeRecipient`, {
424
+ ...proposalInfo,
425
+ proposalFeeRecipient: proposalGlobals.feeRecipient.toString(),
426
+ parentFeeRecipient: parentGlobals.feeRecipient.toString()
427
+ });
428
+ return {
429
+ reason: 'global_variables_mismatch'
430
+ };
431
+ }
432
+ if (!proposalGlobals.gasFees.equals(parentGlobals.gasFees)) {
433
+ this.log.warn(`Non-first block in checkpoint has mismatched gasFees`, {
434
+ ...proposalInfo,
435
+ proposalGasFees: proposalGlobals.gasFees.toInspect(),
436
+ parentGasFees: parentGlobals.gasFees.toInspect()
437
+ });
438
+ return {
439
+ reason: 'global_variables_mismatch'
440
+ };
441
+ }
442
+ return undefined;
443
+ }
444
+ getReexecutionDeadline(slot, config) {
445
+ const nextSlotTimestampSeconds = Number(getTimestampForSlot(SlotNumber(slot + 1), config));
446
+ return new Date(nextSlotTimestampSeconds * 1000);
447
+ }
448
+ getReexecuteFailureReason(err) {
449
+ if (err instanceof ReExStateMismatchError) {
450
+ return 'state_mismatch';
451
+ } else if (err instanceof ReExFailedTxsError) {
452
+ return 'failed_txs';
453
+ } else if (err instanceof ReExTimeoutError) {
454
+ return 'timeout';
455
+ } else {
456
+ return 'unknown_error';
457
+ }
458
+ }
459
+ async reexecuteTransactions(proposal, blockNumber, checkpointNumber, txs, l1ToL2Messages, previousCheckpointOutHashes) {
460
+ const env = {
461
+ stack: [],
462
+ error: void 0,
463
+ hasError: false
464
+ };
465
+ try {
466
+ const { blockHeader, txHashes } = proposal;
467
+ // If we do not have all of the transactions, then we should fail
468
+ if (txs.length !== txHashes.length) {
469
+ const foundTxHashes = txs.map((tx)=>tx.getTxHash());
470
+ const missingTxHashes = txHashes.filter((txHash)=>!foundTxHashes.includes(txHash));
471
+ throw new TransactionsNotAvailableError(missingTxHashes);
472
+ }
473
+ const timer = new Timer();
474
+ const slot = proposal.slotNumber;
475
+ const config = this.checkpointsBuilder.getConfig();
476
+ // Get prior blocks in this checkpoint (same slot before current block)
477
+ const allBlocksInSlot = await this.blockSource.getBlocksForSlot(slot);
478
+ const priorBlocks = allBlocksInSlot.filter((b)=>b.number < blockNumber && b.header.getSlot() === slot);
479
+ // Fork before the block to be built
480
+ const parentBlockNumber = BlockNumber(blockNumber - 1);
481
+ await this.worldState.syncImmediate(parentBlockNumber);
482
+ const fork = _ts_add_disposable_resource(env, await this.worldState.fork(parentBlockNumber), false);
483
+ // Build checkpoint constants from proposal (excludes blockNumber and timestamp which are per-block)
484
+ const constants = {
485
+ chainId: new Fr(config.l1ChainId),
486
+ version: new Fr(config.rollupVersion),
487
+ slotNumber: slot,
488
+ coinbase: blockHeader.globalVariables.coinbase,
489
+ feeRecipient: blockHeader.globalVariables.feeRecipient,
490
+ gasFees: blockHeader.globalVariables.gasFees
491
+ };
492
+ // Create checkpoint builder with prior blocks
493
+ const checkpointBuilder = await this.checkpointsBuilder.openCheckpoint(checkpointNumber, constants, l1ToL2Messages, previousCheckpointOutHashes, fork, priorBlocks, this.log.getBindings());
494
+ // Build the new block
495
+ const deadline = this.getReexecutionDeadline(slot, config);
496
+ const result = await checkpointBuilder.buildBlock(txs, blockNumber, blockHeader.globalVariables.timestamp, {
497
+ deadline,
498
+ expectedEndState: blockHeader.state
499
+ });
500
+ const { block, failedTxs } = result;
501
+ const numFailedTxs = failedTxs.length;
502
+ this.log.verbose(`Transaction re-execution complete for slot ${slot}`, {
503
+ numFailedTxs,
504
+ numProposalTxs: txHashes.length,
505
+ numProcessedTxs: block.body.txEffects.length,
506
+ slot
507
+ });
508
+ if (numFailedTxs > 0) {
509
+ this.metrics?.recordFailedReexecution(proposal);
510
+ throw new ReExFailedTxsError(numFailedTxs);
511
+ }
512
+ if (block.body.txEffects.length !== txHashes.length) {
513
+ this.metrics?.recordFailedReexecution(proposal);
514
+ throw new ReExTimeoutError();
515
+ }
516
+ // Throw a ReExStateMismatchError error if state updates do not match
517
+ // Compare the full block structure (archive and header) from the built block with the proposal
518
+ const archiveMatches = proposal.archive.equals(block.archive.root);
519
+ const headerMatches = proposal.blockHeader.equals(block.header);
520
+ if (!archiveMatches || !headerMatches) {
521
+ this.log.warn(`Re-execution state mismatch for slot ${slot}`, {
522
+ expectedArchive: block.archive.root.toString(),
523
+ actualArchive: proposal.archive.toString(),
524
+ expectedHeader: block.header.toInspect(),
525
+ actualHeader: proposal.blockHeader.toInspect()
526
+ });
527
+ this.metrics?.recordFailedReexecution(proposal);
528
+ throw new ReExStateMismatchError(proposal.archive, block.archive.root);
529
+ }
530
+ const reexecutionTimeMs = timer.ms();
531
+ const totalManaUsed = block.header.totalManaUsed.toNumber() / 1e6;
532
+ this.metrics?.recordReex(reexecutionTimeMs, txs.length, totalManaUsed);
533
+ return {
534
+ block,
535
+ failedTxs,
536
+ reexecutionTimeMs,
537
+ totalManaUsed
538
+ };
539
+ } catch (e) {
540
+ env.error = e;
541
+ env.hasError = true;
542
+ } finally{
543
+ _ts_dispose_resources(env);
544
+ }
545
+ }
546
+ }
@@ -0,0 +1,66 @@
1
+ import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { type LoggerBindings } from '@aztec/foundation/log';
4
+ import { DateProvider } from '@aztec/foundation/timer';
5
+ import { LightweightCheckpointBuilder } from '@aztec/prover-client/light';
6
+ import { PublicProcessor } from '@aztec/simulator/server';
7
+ import { L2Block } from '@aztec/stdlib/block';
8
+ import { Checkpoint } from '@aztec/stdlib/checkpoint';
9
+ import type { ContractDataSource } from '@aztec/stdlib/contract';
10
+ import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
11
+ import { type BuildBlockInCheckpointResult, type FullNodeBlockBuilderConfig, type ICheckpointBlockBuilder, type ICheckpointsBuilder, type MerkleTreeWriteOperations, type PublicProcessorLimits, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
12
+ import { type CheckpointGlobalVariables, GlobalVariables, StateReference, Tx } from '@aztec/stdlib/tx';
13
+ import { type TelemetryClient } from '@aztec/telemetry-client';
14
+ export type { BuildBlockInCheckpointResult } from '@aztec/stdlib/interfaces/server';
15
+ /**
16
+ * Builder for a single checkpoint. Handles building blocks within the checkpoint
17
+ * and completing it.
18
+ */
19
+ export declare class CheckpointBuilder implements ICheckpointBlockBuilder {
20
+ private checkpointBuilder;
21
+ private fork;
22
+ private config;
23
+ private contractDataSource;
24
+ private dateProvider;
25
+ private telemetryClient;
26
+ private log;
27
+ constructor(checkpointBuilder: LightweightCheckpointBuilder, fork: MerkleTreeWriteOperations, config: FullNodeBlockBuilderConfig, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient: TelemetryClient, bindings?: LoggerBindings);
28
+ getConstantData(): CheckpointGlobalVariables;
29
+ /**
30
+ * Builds a single block within this checkpoint.
31
+ */
32
+ buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts?: PublicProcessorLimits & {
33
+ expectedEndState?: StateReference;
34
+ }): Promise<BuildBlockInCheckpointResult>;
35
+ /** Completes the checkpoint and returns it. */
36
+ completeCheckpoint(): Promise<Checkpoint>;
37
+ /** Gets the checkpoint currently in progress. */
38
+ getCheckpoint(): Promise<Checkpoint>;
39
+ protected makeBlockBuilderDeps(globalVariables: GlobalVariables, fork: MerkleTreeWriteOperations): Promise<{
40
+ processor: PublicProcessor;
41
+ validator: import("@aztec/stdlib/interfaces/server").PublicProcessorValidator;
42
+ }>;
43
+ }
44
+ /** Factory for creating checkpoint builders. */
45
+ export declare class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
46
+ private config;
47
+ private worldState;
48
+ private contractDataSource;
49
+ private dateProvider;
50
+ private telemetryClient;
51
+ private log;
52
+ constructor(config: FullNodeBlockBuilderConfig & Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>, worldState: WorldStateSynchronizer, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient?: TelemetryClient);
53
+ getConfig(): FullNodeBlockBuilderConfig;
54
+ updateConfig(config: Partial<FullNodeBlockBuilderConfig>): void;
55
+ /**
56
+ * Starts a new checkpoint and returns a CheckpointBuilder to build blocks within it.
57
+ */
58
+ startCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], fork: MerkleTreeWriteOperations, bindings?: LoggerBindings): Promise<CheckpointBuilder>;
59
+ /**
60
+ * Opens a checkpoint, either starting fresh or resuming from existing blocks.
61
+ */
62
+ openCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], fork: MerkleTreeWriteOperations, existingBlocks?: L2Block[], bindings?: LoggerBindings): Promise<CheckpointBuilder>;
63
+ /** Returns a fork of the world state at the given block number. */
64
+ getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
65
+ }
66
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2twb2ludF9idWlsZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY2hlY2twb2ludF9idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVoRixPQUFPLEVBQ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