@aztec/validator-client 0.0.1-commit.fcb71a6 → 0.0.1-commit.ff7989d6c

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 (69) hide show
  1. package/README.md +285 -0
  2. package/dest/block_proposal_handler.d.ts +21 -11
  3. package/dest/block_proposal_handler.d.ts.map +1 -1
  4. package/dest/block_proposal_handler.js +327 -85
  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 +175 -0
  8. package/dest/config.d.ts +1 -1
  9. package/dest/config.d.ts.map +1 -1
  10. package/dest/config.js +16 -8
  11. package/dest/duties/validation_service.d.ts +41 -12
  12. package/dest/duties/validation_service.d.ts.map +1 -1
  13. package/dest/duties/validation_service.js +109 -26
  14. package/dest/factory.d.ts +13 -10
  15. package/dest/factory.d.ts.map +1 -1
  16. package/dest/factory.js +2 -2
  17. package/dest/index.d.ts +3 -1
  18. package/dest/index.d.ts.map +1 -1
  19. package/dest/index.js +2 -0
  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 +2 -1
  24. package/dest/key_store/index.d.ts.map +1 -1
  25. package/dest/key_store/index.js +1 -0
  26. package/dest/key_store/interface.d.ts +36 -6
  27. package/dest/key_store/interface.d.ts.map +1 -1
  28. package/dest/key_store/local_key_store.d.ts +10 -5
  29. package/dest/key_store/local_key_store.d.ts.map +1 -1
  30. package/dest/key_store/local_key_store.js +8 -4
  31. package/dest/key_store/node_keystore_adapter.d.ts +18 -5
  32. package/dest/key_store/node_keystore_adapter.d.ts.map +1 -1
  33. package/dest/key_store/node_keystore_adapter.js +18 -4
  34. package/dest/key_store/web3signer_key_store.d.ts +10 -5
  35. package/dest/key_store/web3signer_key_store.d.ts.map +1 -1
  36. package/dest/key_store/web3signer_key_store.js +8 -4
  37. package/dest/metrics.d.ts +4 -3
  38. package/dest/metrics.d.ts.map +1 -1
  39. package/dest/metrics.js +34 -30
  40. package/dest/tx_validator/index.d.ts +3 -0
  41. package/dest/tx_validator/index.d.ts.map +1 -0
  42. package/dest/tx_validator/index.js +2 -0
  43. package/dest/tx_validator/nullifier_cache.d.ts +14 -0
  44. package/dest/tx_validator/nullifier_cache.d.ts.map +1 -0
  45. package/dest/tx_validator/nullifier_cache.js +24 -0
  46. package/dest/tx_validator/tx_validator_factory.d.ts +19 -0
  47. package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -0
  48. package/dest/tx_validator/tx_validator_factory.js +54 -0
  49. package/dest/validator.d.ts +73 -24
  50. package/dest/validator.d.ts.map +1 -1
  51. package/dest/validator.js +452 -91
  52. package/package.json +21 -13
  53. package/src/block_proposal_handler.ts +246 -57
  54. package/src/checkpoint_builder.ts +321 -0
  55. package/src/config.ts +15 -7
  56. package/src/duties/validation_service.ts +160 -31
  57. package/src/factory.ts +17 -11
  58. package/src/index.ts +2 -0
  59. package/src/key_store/ha_key_store.ts +269 -0
  60. package/src/key_store/index.ts +1 -0
  61. package/src/key_store/interface.ts +44 -5
  62. package/src/key_store/local_key_store.ts +13 -4
  63. package/src/key_store/node_keystore_adapter.ts +27 -4
  64. package/src/key_store/web3signer_key_store.ts +17 -4
  65. package/src/metrics.ts +45 -33
  66. package/src/tx_validator/index.ts +2 -0
  67. package/src/tx_validator/nullifier_cache.ts +30 -0
  68. package/src/tx_validator/tx_validator_factory.ts +154 -0
  69. package/src/validator.ts +615 -120
@@ -1,3 +1,68 @@
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
+ }
1
66
  import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
67
  import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
3
68
  import { Fr } from '@aztec/foundation/curves/bn254';
@@ -5,29 +70,31 @@ import { TimeoutError } from '@aztec/foundation/error';
5
70
  import { createLogger } from '@aztec/foundation/log';
6
71
  import { retryUntil } from '@aztec/foundation/retry';
7
72
  import { DateProvider, Timer } from '@aztec/foundation/timer';
8
- import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
73
+ import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
9
74
  import { computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
10
- import { ConsensusPayload } from '@aztec/stdlib/p2p';
11
- import { GlobalVariables } from '@aztec/stdlib/tx';
12
75
  import { ReExFailedTxsError, ReExStateMismatchError, ReExTimeoutError, TransactionsNotAvailableError } from '@aztec/stdlib/validators';
13
76
  import { getTelemetryClient } from '@aztec/telemetry-client';
14
77
  export class BlockProposalHandler {
15
- blockBuilder;
78
+ checkpointsBuilder;
79
+ worldState;
16
80
  blockSource;
17
81
  l1ToL2MessageSource;
18
82
  txProvider;
19
83
  blockProposalValidator;
84
+ epochCache;
20
85
  config;
21
86
  metrics;
22
87
  dateProvider;
23
88
  log;
24
89
  tracer;
25
- constructor(blockBuilder, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, config, metrics, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator:block-proposal-handler')){
26
- this.blockBuilder = blockBuilder;
90
+ constructor(checkpointsBuilder, worldState, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, epochCache, config, metrics, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator:block-proposal-handler')){
91
+ this.checkpointsBuilder = checkpointsBuilder;
92
+ this.worldState = worldState;
27
93
  this.blockSource = blockSource;
28
94
  this.l1ToL2MessageSource = l1ToL2MessageSource;
29
95
  this.txProvider = txProvider;
30
96
  this.blockProposalValidator = blockProposalValidator;
97
+ this.epochCache = epochCache;
31
98
  this.config = config;
32
99
  this.metrics = metrics;
33
100
  this.dateProvider = dateProvider;
@@ -38,6 +105,8 @@ export class BlockProposalHandler {
38
105
  this.tracer = telemetry.getTracer('BlockProposalHandler');
39
106
  }
40
107
  registerForReexecution(p2pClient) {
108
+ // Non-validator handler that re-executes for monitoring but does not attest.
109
+ // Returns boolean indicating whether the proposal was valid.
41
110
  const handler = async (proposal, proposalSender)=>{
42
111
  try {
43
112
  const result = await this.handleBlockProposal(proposal, proposalSender, true);
@@ -48,16 +117,18 @@ export class BlockProposalHandler {
48
117
  totalManaUsed: result.reexecutionResult?.totalManaUsed,
49
118
  numTxs: result.reexecutionResult?.block?.body?.txEffects?.length ?? 0
50
119
  });
120
+ return true;
51
121
  } else {
52
122
  this.log.warn(`Non-validator reexecution failed for slot ${proposal.slotNumber}`, {
53
123
  blockNumber: result.blockNumber,
54
124
  reason: result.reason
55
125
  });
126
+ return false;
56
127
  }
57
128
  } catch (error) {
58
129
  this.log.error('Error processing block proposal in non-validator handler', error);
130
+ return false;
59
131
  }
60
- return undefined; // Non-validator nodes don't return attestations
61
132
  };
62
133
  p2pClient.registerBlockProposalHandler(handler);
63
134
  return this;
@@ -65,7 +136,7 @@ export class BlockProposalHandler {
65
136
  async handleBlockProposal(proposal, proposalSender, shouldReexecute) {
66
137
  const slotNumber = proposal.slotNumber;
67
138
  const proposer = proposal.getSender();
68
- const config = this.blockBuilder.getConfig();
139
+ const config = this.checkpointsBuilder.getConfig();
69
140
  // Reject proposals with invalid signatures
70
141
  if (!proposer) {
71
142
  this.log.warn(`Received proposal with invalid signature for slot ${slotNumber}`);
@@ -84,8 +155,8 @@ export class BlockProposalHandler {
84
155
  });
85
156
  // Check that the proposal is from the current proposer, or the next proposer
86
157
  // This should have been handled by the p2p layer, but we double check here out of caution
87
- const invalidProposal = await this.blockProposalValidator.validate(proposal);
88
- if (invalidProposal) {
158
+ const validationResult = await this.blockProposalValidator.validate(proposal);
159
+ if (validationResult.result !== 'accept') {
89
160
  this.log.warn(`Proposal is not valid, skipping processing`, proposalInfo);
90
161
  return {
91
162
  isValid: false,
@@ -93,18 +164,18 @@ export class BlockProposalHandler {
93
164
  };
94
165
  }
95
166
  // Check that the parent proposal is a block we know, otherwise reexecution would fail
96
- const parentBlockHeader = await this.getParentBlock(proposal);
97
- if (parentBlockHeader === undefined) {
167
+ const parentBlock = await this.getParentBlock(proposal);
168
+ if (parentBlock === undefined) {
98
169
  this.log.warn(`Parent block for proposal not found, skipping processing`, proposalInfo);
99
170
  return {
100
171
  isValid: false,
101
172
  reason: 'parent_block_not_found'
102
173
  };
103
174
  }
104
- // Check that the parent block's slot is less than the proposal's slot (should not happen, but we check anyway)
105
- if (parentBlockHeader !== 'genesis' && parentBlockHeader.getSlot() >= slotNumber) {
106
- this.log.warn(`Parent block slot is greater than or equal to proposal slot, skipping processing`, {
107
- parentBlockSlot: parentBlockHeader.getSlot().toString(),
175
+ // Check that the parent block's slot is not greater than the proposal's slot.
176
+ if (parentBlock !== 'genesis' && parentBlock.header.getSlot() > slotNumber) {
177
+ this.log.warn(`Parent block slot is greater than proposal slot, skipping processing`, {
178
+ parentBlockSlot: parentBlock.header.getSlot().toString(),
108
179
  proposalSlot: slotNumber.toString(),
109
180
  ...proposalInfo
110
181
  });
@@ -114,7 +185,7 @@ export class BlockProposalHandler {
114
185
  };
115
186
  }
116
187
  // Compute the block number based on the parent block
117
- const blockNumber = parentBlockHeader === 'genesis' ? BlockNumber(INITIAL_L2_BLOCK_NUM) : BlockNumber(parentBlockHeader.getBlockNumber() + 1);
188
+ const blockNumber = parentBlock === 'genesis' ? BlockNumber(INITIAL_L2_BLOCK_NUM) : BlockNumber(parentBlock.header.getBlockNumber() + 1);
118
189
  // Check that this block number does not exist already
119
190
  const existingBlock = await this.blockSource.getBlockHeader(blockNumber);
120
191
  if (existingBlock) {
@@ -131,10 +202,20 @@ export class BlockProposalHandler {
131
202
  pinnedPeer: proposalSender,
132
203
  deadline: this.getReexecutionDeadline(slotNumber, config)
133
204
  });
205
+ // Compute the checkpoint number for this block and validate checkpoint consistency
206
+ const checkpointResult = this.computeCheckpointNumber(proposal, parentBlock, proposalInfo);
207
+ if (checkpointResult.reason) {
208
+ return {
209
+ isValid: false,
210
+ blockNumber,
211
+ reason: checkpointResult.reason
212
+ };
213
+ }
214
+ const checkpointNumber = checkpointResult.checkpointNumber;
134
215
  // Check that I have the same set of l1ToL2Messages as the proposal
135
- const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(CheckpointNumber.fromBlockNumber(blockNumber));
216
+ const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(checkpointNumber);
136
217
  const computedInHash = computeInHashFromL1ToL2Messages(l1ToL2Messages);
137
- const proposalInHash = proposal.payload.header.contentCommitment.inHash;
218
+ const proposalInHash = proposal.inHash;
138
219
  if (!computedInHash.equals(proposalInHash)) {
139
220
  this.log.warn(`L1 to L2 messages in hash mismatch, skipping processing`, {
140
221
  proposalInHash: proposalInHash.toString(),
@@ -162,9 +243,12 @@ export class BlockProposalHandler {
162
243
  // Try re-executing the transactions in the proposal if needed
163
244
  let reexecutionResult;
164
245
  if (shouldReexecute) {
246
+ // Collect the out hashes of all the checkpoints before this one in the same epoch
247
+ const epoch = getEpochAtSlot(slotNumber, this.epochCache.getL1Constants());
248
+ const previousCheckpointOutHashes = (await this.blockSource.getCheckpointsDataForEpoch(epoch)).filter((c)=>c.checkpointNumber < checkpointNumber).map((c)=>c.checkpointOutHash);
165
249
  try {
166
250
  this.log.verbose(`Re-executing transactions in the proposal`, proposalInfo);
167
- reexecutionResult = await this.reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages);
251
+ reexecutionResult = await this.reexecuteTransactions(proposal, blockNumber, checkpointNumber, txs, l1ToL2Messages, previousCheckpointOutHashes);
168
252
  } catch (error) {
169
253
  this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
170
254
  const reason = this.getReexecuteFailureReason(error);
@@ -176,7 +260,11 @@ export class BlockProposalHandler {
176
260
  };
177
261
  }
178
262
  }
179
- this.log.info(`Successfully processed proposal for slot ${slotNumber}`, proposalInfo);
263
+ // If we succeeded, push this block into the archiver (unless disabled)
264
+ if (reexecutionResult?.block && this.config.skipPushProposedBlocksToArchiver === false) {
265
+ await this.blockSource.addBlock(reexecutionResult?.block);
266
+ }
267
+ this.log.info(`Successfully processed block ${blockNumber} proposal at index ${proposal.indexWithinCheckpoint} on slot ${slotNumber}`, proposalInfo);
180
268
  return {
181
269
  isValid: true,
182
270
  blockNumber,
@@ -184,9 +272,9 @@ export class BlockProposalHandler {
184
272
  };
185
273
  }
186
274
  async getParentBlock(proposal) {
187
- const parentArchive = proposal.payload.header.lastArchiveRoot;
275
+ const parentArchive = proposal.blockHeader.lastArchive.root;
188
276
  const slot = proposal.slotNumber;
189
- const config = this.blockBuilder.getConfig();
277
+ const config = this.checkpointsBuilder.getConfig();
190
278
  const { genesisArchiveRoot } = await this.blockSource.getGenesisValues();
191
279
  if (parentArchive.equals(genesisArchiveRoot)) {
192
280
  return 'genesis';
@@ -195,7 +283,7 @@ export class BlockProposalHandler {
195
283
  const currentTime = this.dateProvider.now();
196
284
  const timeoutDurationMs = deadline.getTime() - currentTime;
197
285
  try {
198
- 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));
286
+ return await this.blockSource.getBlockDataByArchive(parentArchive) ?? (timeoutDurationMs <= 0 ? undefined : await retryUntil(()=>this.blockSource.syncImmediate().then(()=>this.blockSource.getBlockDataByArchive(parentArchive)), 'force archiver sync', timeoutDurationMs / 1000, 0.5));
199
287
  } catch (err) {
200
288
  if (err instanceof TimeoutError) {
201
289
  this.log.debug(`Timed out getting parent block by archive root`, {
@@ -209,10 +297,137 @@ export class BlockProposalHandler {
209
297
  return undefined;
210
298
  }
211
299
  }
300
+ computeCheckpointNumber(proposal, parentBlock, proposalInfo) {
301
+ if (parentBlock === 'genesis') {
302
+ // First block is in checkpoint 1
303
+ if (proposal.indexWithinCheckpoint !== 0) {
304
+ this.log.warn(`First block proposal has non-zero indexWithinCheckpoint`, proposalInfo);
305
+ return {
306
+ reason: 'invalid_proposal'
307
+ };
308
+ }
309
+ return {
310
+ checkpointNumber: CheckpointNumber.INITIAL
311
+ };
312
+ }
313
+ if (proposal.indexWithinCheckpoint === 0) {
314
+ // If this is the first block in a new checkpoint, increment the checkpoint number
315
+ if (!(proposal.blockHeader.getSlot() > parentBlock.header.getSlot())) {
316
+ this.log.warn(`Slot should be greater than parent block slot for first block in checkpoint`, proposalInfo);
317
+ return {
318
+ reason: 'invalid_proposal'
319
+ };
320
+ }
321
+ return {
322
+ checkpointNumber: CheckpointNumber(parentBlock.checkpointNumber + 1)
323
+ };
324
+ }
325
+ // Otherwise it should follow the previous block in the same checkpoint
326
+ if (proposal.indexWithinCheckpoint !== parentBlock.indexWithinCheckpoint + 1) {
327
+ this.log.warn(`Non-sequential indexWithinCheckpoint`, proposalInfo);
328
+ return {
329
+ reason: 'invalid_proposal'
330
+ };
331
+ }
332
+ if (proposal.blockHeader.getSlot() !== parentBlock.header.getSlot()) {
333
+ this.log.warn(`Slot should be equal to parent block slot for non-first block in checkpoint`, proposalInfo);
334
+ return {
335
+ reason: 'invalid_proposal'
336
+ };
337
+ }
338
+ // For non-first blocks in a checkpoint, validate global variables match parent (except blockNumber)
339
+ const validationResult = this.validateNonFirstBlockInCheckpoint(proposal, parentBlock, proposalInfo);
340
+ if (validationResult) {
341
+ return validationResult;
342
+ }
343
+ return {
344
+ checkpointNumber: parentBlock.checkpointNumber
345
+ };
346
+ }
347
+ /**
348
+ * Validates that a non-first block in a checkpoint has consistent global variables with its parent.
349
+ * For blocks with indexWithinCheckpoint > 0, all global variables except blockNumber must match the parent.
350
+ * @returns A failure result if validation fails, undefined if validation passes
351
+ */ validateNonFirstBlockInCheckpoint(proposal, parentBlock, proposalInfo) {
352
+ const proposalGlobals = proposal.blockHeader.globalVariables;
353
+ const parentGlobals = parentBlock.header.globalVariables;
354
+ // All global variables except blockNumber should match the parent
355
+ // blockNumber naturally increments between blocks
356
+ if (!proposalGlobals.chainId.equals(parentGlobals.chainId)) {
357
+ this.log.warn(`Non-first block in checkpoint has mismatched chainId`, {
358
+ ...proposalInfo,
359
+ proposalChainId: proposalGlobals.chainId.toString(),
360
+ parentChainId: parentGlobals.chainId.toString()
361
+ });
362
+ return {
363
+ reason: 'global_variables_mismatch'
364
+ };
365
+ }
366
+ if (!proposalGlobals.version.equals(parentGlobals.version)) {
367
+ this.log.warn(`Non-first block in checkpoint has mismatched version`, {
368
+ ...proposalInfo,
369
+ proposalVersion: proposalGlobals.version.toString(),
370
+ parentVersion: parentGlobals.version.toString()
371
+ });
372
+ return {
373
+ reason: 'global_variables_mismatch'
374
+ };
375
+ }
376
+ if (proposalGlobals.slotNumber !== parentGlobals.slotNumber) {
377
+ this.log.warn(`Non-first block in checkpoint has mismatched slotNumber`, {
378
+ ...proposalInfo,
379
+ proposalSlotNumber: proposalGlobals.slotNumber,
380
+ parentSlotNumber: parentGlobals.slotNumber
381
+ });
382
+ return {
383
+ reason: 'global_variables_mismatch'
384
+ };
385
+ }
386
+ if (proposalGlobals.timestamp !== parentGlobals.timestamp) {
387
+ this.log.warn(`Non-first block in checkpoint has mismatched timestamp`, {
388
+ ...proposalInfo,
389
+ proposalTimestamp: proposalGlobals.timestamp.toString(),
390
+ parentTimestamp: parentGlobals.timestamp.toString()
391
+ });
392
+ return {
393
+ reason: 'global_variables_mismatch'
394
+ };
395
+ }
396
+ if (!proposalGlobals.coinbase.equals(parentGlobals.coinbase)) {
397
+ this.log.warn(`Non-first block in checkpoint has mismatched coinbase`, {
398
+ ...proposalInfo,
399
+ proposalCoinbase: proposalGlobals.coinbase.toString(),
400
+ parentCoinbase: parentGlobals.coinbase.toString()
401
+ });
402
+ return {
403
+ reason: 'global_variables_mismatch'
404
+ };
405
+ }
406
+ if (!proposalGlobals.feeRecipient.equals(parentGlobals.feeRecipient)) {
407
+ this.log.warn(`Non-first block in checkpoint has mismatched feeRecipient`, {
408
+ ...proposalInfo,
409
+ proposalFeeRecipient: proposalGlobals.feeRecipient.toString(),
410
+ parentFeeRecipient: parentGlobals.feeRecipient.toString()
411
+ });
412
+ return {
413
+ reason: 'global_variables_mismatch'
414
+ };
415
+ }
416
+ if (!proposalGlobals.gasFees.equals(parentGlobals.gasFees)) {
417
+ this.log.warn(`Non-first block in checkpoint has mismatched gasFees`, {
418
+ ...proposalInfo,
419
+ proposalGasFees: proposalGlobals.gasFees.toInspect(),
420
+ parentGasFees: parentGlobals.gasFees.toInspect()
421
+ });
422
+ return {
423
+ reason: 'global_variables_mismatch'
424
+ };
425
+ }
426
+ return undefined;
427
+ }
212
428
  getReexecutionDeadline(slot, config) {
213
429
  const nextSlotTimestampSeconds = Number(getTimestampForSlot(SlotNumber(slot + 1), config));
214
- const msNeededForPropagationAndPublishing = this.config.validatorReexecuteDeadlineMs;
215
- return new Date(nextSlotTimestampSeconds * 1000 - msNeededForPropagationAndPublishing);
430
+ return new Date(nextSlotTimestampSeconds * 1000);
216
431
  }
217
432
  getReexecuteFailureReason(err) {
218
433
  if (err instanceof ReExStateMismatchError) {
@@ -225,66 +440,93 @@ export class BlockProposalHandler {
225
440
  return 'unknown_error';
226
441
  }
227
442
  }
228
- async reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages) {
229
- const { header } = proposal.payload;
230
- const { txHashes } = proposal;
231
- // If we do not have all of the transactions, then we should fail
232
- if (txs.length !== txHashes.length) {
233
- const foundTxHashes = txs.map((tx)=>tx.getTxHash());
234
- const missingTxHashes = txHashes.filter((txHash)=>!foundTxHashes.includes(txHash));
235
- throw new TransactionsNotAvailableError(missingTxHashes);
236
- }
237
- // Use the sequencer's block building logic to re-execute the transactions
238
- const timer = new Timer();
239
- const config = this.blockBuilder.getConfig();
240
- // We source most global variables from the proposal
241
- const globalVariables = GlobalVariables.from({
242
- slotNumber: proposal.payload.header.slotNumber,
243
- coinbase: proposal.payload.header.coinbase,
244
- feeRecipient: proposal.payload.header.feeRecipient,
245
- gasFees: proposal.payload.header.gasFees,
246
- blockNumber,
247
- timestamp: header.timestamp,
248
- chainId: new Fr(config.l1ChainId),
249
- version: new Fr(config.rollupVersion)
250
- });
251
- const { block, failedTxs } = await this.blockBuilder.buildBlock(txs, l1ToL2Messages, globalVariables, {
252
- deadline: this.getReexecutionDeadline(proposal.payload.header.slotNumber, config)
253
- });
254
- const numFailedTxs = failedTxs.length;
255
- const slot = proposal.slotNumber;
256
- this.log.verbose(`Transaction re-execution complete for slot ${slot}`, {
257
- numFailedTxs,
258
- numProposalTxs: txHashes.length,
259
- numProcessedTxs: block.body.txEffects.length,
260
- slot
261
- });
262
- if (numFailedTxs > 0) {
263
- this.metrics?.recordFailedReexecution(proposal);
264
- throw new ReExFailedTxsError(numFailedTxs);
265
- }
266
- if (block.body.txEffects.length !== txHashes.length) {
267
- this.metrics?.recordFailedReexecution(proposal);
268
- throw new ReExTimeoutError();
269
- }
270
- // Throw a ReExStateMismatchError error if state updates do not match
271
- const blockPayload = ConsensusPayload.fromBlock(block);
272
- if (!blockPayload.equals(proposal.payload)) {
273
- this.log.warn(`Re-execution state mismatch for slot ${slot}`, {
274
- expected: blockPayload.toInspect(),
275
- actual: proposal.payload.toInspect()
443
+ async reexecuteTransactions(proposal, blockNumber, checkpointNumber, txs, l1ToL2Messages, previousCheckpointOutHashes) {
444
+ const env = {
445
+ stack: [],
446
+ error: void 0,
447
+ hasError: false
448
+ };
449
+ try {
450
+ const { blockHeader, txHashes } = proposal;
451
+ // If we do not have all of the transactions, then we should fail
452
+ if (txs.length !== txHashes.length) {
453
+ const foundTxHashes = txs.map((tx)=>tx.getTxHash());
454
+ const missingTxHashes = txHashes.filter((txHash)=>!foundTxHashes.includes(txHash));
455
+ throw new TransactionsNotAvailableError(missingTxHashes);
456
+ }
457
+ const timer = new Timer();
458
+ const slot = proposal.slotNumber;
459
+ const config = this.checkpointsBuilder.getConfig();
460
+ // Get prior blocks in this checkpoint (same slot before current block)
461
+ const allBlocksInSlot = await this.blockSource.getBlocksForSlot(slot);
462
+ const priorBlocks = allBlocksInSlot.filter((b)=>b.number < blockNumber && b.header.getSlot() === slot);
463
+ // Fork before the block to be built
464
+ const parentBlockNumber = BlockNumber(blockNumber - 1);
465
+ await this.worldState.syncImmediate(parentBlockNumber);
466
+ const fork = _ts_add_disposable_resource(env, await this.worldState.fork(parentBlockNumber), true);
467
+ // Build checkpoint constants from proposal (excludes blockNumber which is per-block)
468
+ const constants = {
469
+ chainId: new Fr(config.l1ChainId),
470
+ version: new Fr(config.rollupVersion),
471
+ slotNumber: slot,
472
+ timestamp: blockHeader.globalVariables.timestamp,
473
+ coinbase: blockHeader.globalVariables.coinbase,
474
+ feeRecipient: blockHeader.globalVariables.feeRecipient,
475
+ gasFees: blockHeader.globalVariables.gasFees
476
+ };
477
+ // Create checkpoint builder with prior blocks
478
+ const checkpointBuilder = await this.checkpointsBuilder.openCheckpoint(checkpointNumber, constants, 0n, l1ToL2Messages, previousCheckpointOutHashes, fork, priorBlocks, this.log.getBindings());
479
+ // Build the new block
480
+ const deadline = this.getReexecutionDeadline(slot, config);
481
+ const result = await checkpointBuilder.buildBlock(txs, blockNumber, blockHeader.globalVariables.timestamp, {
482
+ deadline,
483
+ expectedEndState: blockHeader.state
276
484
  });
277
- this.metrics?.recordFailedReexecution(proposal);
278
- throw new ReExStateMismatchError(proposal.archive, block.archive.root);
485
+ const { block, failedTxs } = result;
486
+ const numFailedTxs = failedTxs.length;
487
+ this.log.verbose(`Transaction re-execution complete for slot ${slot}`, {
488
+ numFailedTxs,
489
+ numProposalTxs: txHashes.length,
490
+ numProcessedTxs: block.body.txEffects.length,
491
+ slot
492
+ });
493
+ if (numFailedTxs > 0) {
494
+ this.metrics?.recordFailedReexecution(proposal);
495
+ throw new ReExFailedTxsError(numFailedTxs);
496
+ }
497
+ if (block.body.txEffects.length !== txHashes.length) {
498
+ this.metrics?.recordFailedReexecution(proposal);
499
+ throw new ReExTimeoutError();
500
+ }
501
+ // Throw a ReExStateMismatchError error if state updates do not match
502
+ // Compare the full block structure (archive and header) from the built block with the proposal
503
+ const archiveMatches = proposal.archive.equals(block.archive.root);
504
+ const headerMatches = proposal.blockHeader.equals(block.header);
505
+ if (!archiveMatches || !headerMatches) {
506
+ this.log.warn(`Re-execution state mismatch for slot ${slot}`, {
507
+ expectedArchive: block.archive.root.toString(),
508
+ actualArchive: proposal.archive.toString(),
509
+ expectedHeader: block.header.toInspect(),
510
+ actualHeader: proposal.blockHeader.toInspect()
511
+ });
512
+ this.metrics?.recordFailedReexecution(proposal);
513
+ throw new ReExStateMismatchError(proposal.archive, block.archive.root);
514
+ }
515
+ const reexecutionTimeMs = timer.ms();
516
+ const totalManaUsed = block.header.totalManaUsed.toNumber() / 1e6;
517
+ this.metrics?.recordReex(reexecutionTimeMs, txs.length, totalManaUsed);
518
+ return {
519
+ block,
520
+ failedTxs,
521
+ reexecutionTimeMs,
522
+ totalManaUsed
523
+ };
524
+ } catch (e) {
525
+ env.error = e;
526
+ env.hasError = true;
527
+ } finally{
528
+ const result = _ts_dispose_resources(env);
529
+ if (result) await result;
279
530
  }
280
- const reexecutionTimeMs = timer.ms();
281
- const totalManaUsed = block.header.totalManaUsed.toNumber() / 1e6;
282
- this.metrics?.recordReex(reexecutionTimeMs, txs.length, totalManaUsed);
283
- return {
284
- block,
285
- failedTxs,
286
- reexecutionTimeMs,
287
- totalManaUsed
288
- };
289
531
  }
290
532
  }
@@ -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, feeAssetPriceModifier: bigint, 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, feeAssetPriceModifier: bigint, 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2twb2ludF9idWlsZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY2hlY2twb2ludF9idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVoRixPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdD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