@aztec/validator-client 4.0.4 → 4.1.0-rc.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,WAAW,EACX,gBAAgB,EAEhB,qBAAqB,EACrB,UAAU,EACX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAIhF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAmD,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE/F,OAAO,EAAoC,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,+BAA+B,EAAW,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEhH,OAAO,KAAK,EACV,qCAAqC,EACrC,WAAW,EACX,SAAS,EACT,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,mBAAmB,EAAiC,MAAM,yBAAyB,CAAC;AAClG,OAAO,EACL,KAAK,aA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EK,mBAAmB,CACvB,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,IAAI,GACb,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAiElC;YAEa,iBAAiB;CAwBhC"}
package/dest/validator.js CHANGED
@@ -9,6 +9,7 @@ import { sleep } from '@aztec/foundation/sleep';
9
9
  import { DateProvider } from '@aztec/foundation/timer';
10
10
  import { AuthRequest, AuthResponse, BlockProposalValidator, ReqRespSubProtocol } from '@aztec/p2p';
11
11
  import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
12
+ import { validateCheckpoint } from '@aztec/stdlib/checkpoint';
12
13
  import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
13
14
  import { accumulateCheckpointOutHashes } from '@aztec/stdlib/messaging';
14
15
  import { AttestationTimeoutError } from '@aztec/stdlib/validators';
@@ -54,10 +55,11 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
54
55
  /** Tracks the last checkpoint proposal we created. */ lastProposedCheckpoint;
55
56
  lastEpochForCommitteeUpdateLoop;
56
57
  epochCacheUpdateLoop;
58
+ /** Tracks the last epoch in which each attester successfully submitted at least one attestation. */ lastAttestedEpochByAttester;
57
59
  proposersOfInvalidBlocks;
58
60
  /** Tracks the last checkpoint proposal we attested to, to prevent equivocation. */ lastAttestedProposal;
59
61
  constructor(keyStore, epochCache, p2pClient, blockProposalHandler, blockSource, checkpointsBuilder, worldState, l1ToL2MessageSource, config, blobClient, haSigner, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator')){
60
- super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.blockProposalHandler = blockProposalHandler, this.blockSource = blockSource, this.checkpointsBuilder = checkpointsBuilder, this.worldState = worldState, this.l1ToL2MessageSource = l1ToL2MessageSource, this.config = config, this.blobClient = blobClient, this.haSigner = haSigner, this.dateProvider = dateProvider, this.hasRegisteredHandlers = false, this.proposersOfInvalidBlocks = new Set();
62
+ super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.blockProposalHandler = blockProposalHandler, this.blockSource = blockSource, this.checkpointsBuilder = checkpointsBuilder, this.worldState = worldState, this.l1ToL2MessageSource = l1ToL2MessageSource, this.config = config, this.blobClient = blobClient, this.haSigner = haSigner, this.dateProvider = dateProvider, this.hasRegisteredHandlers = false, this.lastAttestedEpochByAttester = new Map(), this.proposersOfInvalidBlocks = new Set();
61
63
  // Create child logger with fisherman prefix if in fisherman mode
62
64
  this.log = config.fishermanMode ? log.createChild('[FISHERMAN]') : log;
63
65
  this.tracer = telemetry.getTracer('Validator');
@@ -96,6 +98,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
96
98
  this.log.trace(`No committee found for slot`);
97
99
  return;
98
100
  }
101
+ this.metrics.setCurrentEpoch(epoch);
99
102
  if (epoch !== this.lastEpochForCommitteeUpdateLoop) {
100
103
  const me = this.getValidatorAddresses();
101
104
  const committeeSet = new Set(committee.map((v)=>v.toString()));
@@ -115,7 +118,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
115
118
  const metrics = new ValidatorMetrics(telemetry);
116
119
  const blockProposalValidator = new BlockProposalValidator(epochCache, {
117
120
  txsPermitted: !config.disableTransactions,
118
- maxTxsPerBlock: config.maxTxsPerBlock
121
+ maxTxsPerBlock: config.validateMaxTxsPerBlock
119
122
  });
120
123
  const blockProposalHandler = new BlockProposalHandler(checkpointsBuilder, worldState, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, epochCache, config, metrics, dateProvider, telemetry);
121
124
  const nodeKeystoreAdapter = NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager);
@@ -330,12 +333,10 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
330
333
  const proposalInfo = {
331
334
  slotNumber,
332
335
  archive: proposal.archive.toString(),
333
- proposer: proposer.toString(),
334
- txCount: proposal.txHashes.length
336
+ proposer: proposer.toString()
335
337
  };
336
338
  this.log.info(`Received checkpoint proposal for slot ${slotNumber}`, {
337
339
  ...proposalInfo,
338
- txHashes: proposal.txHashes.map((t)=>t.toString()),
339
340
  fishermanMode: this.config.fishermanMode || false
340
341
  });
341
342
  // Validate the checkpoint proposal before attesting (unless skipCheckpointProposalValidation is set)
@@ -365,6 +366,16 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
365
366
  fishermanMode: this.config.fishermanMode || false
366
367
  });
367
368
  this.metrics.incSuccessfulAttestations(inCommittee.length);
369
+ // Track epoch participation per attester: count each (attester, epoch) pair at most once
370
+ const proposalEpoch = getEpochAtSlot(slotNumber, this.epochCache.getL1Constants());
371
+ for (const attester of inCommittee){
372
+ const key = attester.toString();
373
+ const lastEpoch = this.lastAttestedEpochByAttester.get(key);
374
+ if (lastEpoch === undefined || proposalEpoch > lastEpoch) {
375
+ this.lastAttestedEpochByAttester.set(key, proposalEpoch);
376
+ this.metrics.incAttestedEpochCount(attester);
377
+ }
378
+ }
368
379
  // Determine which validators should attest
369
380
  let attestors;
370
381
  if (partOfCommittee) {
@@ -535,6 +546,22 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
535
546
  reason: 'out_hash_mismatch'
536
547
  };
537
548
  }
549
+ // Final round of validations on the checkpoint, just in case.
550
+ try {
551
+ validateCheckpoint(computedCheckpoint, {
552
+ rollupManaLimit: this.checkpointsBuilder.getConfig().rollupManaLimit,
553
+ maxDABlockGas: this.config.validateMaxDABlockGas,
554
+ maxL2BlockGas: this.config.validateMaxL2BlockGas,
555
+ maxTxsPerBlock: this.config.validateMaxTxsPerBlock,
556
+ maxTxsPerCheckpoint: this.config.validateMaxTxsPerCheckpoint
557
+ });
558
+ } catch (err) {
559
+ this.log.warn(`Checkpoint validation failed: ${err}`, proposalInfo);
560
+ return {
561
+ isValid: false,
562
+ reason: 'checkpoint_validation_failed'
563
+ };
564
+ }
538
565
  this.log.verbose(`Checkpoint proposal validation successful for slot ${slot}`, proposalInfo);
539
566
  return {
540
567
  isValid: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/validator-client",
3
- "version": "4.0.4",
3
+ "version": "4.1.0-rc.2",
4
4
  "main": "dest/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -64,30 +64,30 @@
64
64
  ]
65
65
  },
66
66
  "dependencies": {
67
- "@aztec/blob-client": "4.0.4",
68
- "@aztec/blob-lib": "4.0.4",
69
- "@aztec/constants": "4.0.4",
70
- "@aztec/epoch-cache": "4.0.4",
71
- "@aztec/ethereum": "4.0.4",
72
- "@aztec/foundation": "4.0.4",
73
- "@aztec/node-keystore": "4.0.4",
74
- "@aztec/noir-protocol-circuits-types": "4.0.4",
75
- "@aztec/p2p": "4.0.4",
76
- "@aztec/protocol-contracts": "4.0.4",
77
- "@aztec/prover-client": "4.0.4",
78
- "@aztec/simulator": "4.0.4",
79
- "@aztec/slasher": "4.0.4",
80
- "@aztec/stdlib": "4.0.4",
81
- "@aztec/telemetry-client": "4.0.4",
82
- "@aztec/validator-ha-signer": "4.0.4",
67
+ "@aztec/blob-client": "4.1.0-rc.2",
68
+ "@aztec/blob-lib": "4.1.0-rc.2",
69
+ "@aztec/constants": "4.1.0-rc.2",
70
+ "@aztec/epoch-cache": "4.1.0-rc.2",
71
+ "@aztec/ethereum": "4.1.0-rc.2",
72
+ "@aztec/foundation": "4.1.0-rc.2",
73
+ "@aztec/node-keystore": "4.1.0-rc.2",
74
+ "@aztec/noir-protocol-circuits-types": "4.1.0-rc.2",
75
+ "@aztec/p2p": "4.1.0-rc.2",
76
+ "@aztec/protocol-contracts": "4.1.0-rc.2",
77
+ "@aztec/prover-client": "4.1.0-rc.2",
78
+ "@aztec/simulator": "4.1.0-rc.2",
79
+ "@aztec/slasher": "4.1.0-rc.2",
80
+ "@aztec/stdlib": "4.1.0-rc.2",
81
+ "@aztec/telemetry-client": "4.1.0-rc.2",
82
+ "@aztec/validator-ha-signer": "4.1.0-rc.2",
83
83
  "koa": "^2.16.1",
84
84
  "koa-router": "^13.1.1",
85
85
  "tslib": "^2.4.0",
86
86
  "viem": "npm:@aztec/viem@2.38.2"
87
87
  },
88
88
  "devDependencies": {
89
- "@aztec/archiver": "4.0.4",
90
- "@aztec/world-state": "4.0.4",
89
+ "@aztec/archiver": "4.1.0-rc.2",
90
+ "@aztec/world-state": "4.1.0-rc.2",
91
91
  "@electric-sql/pglite": "^0.3.14",
92
92
  "@jest/globals": "^30.0.0",
93
93
  "@types/jest": "^30.0.0",
@@ -1,6 +1,7 @@
1
1
  import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
2
  import type { EpochCache } from '@aztec/epoch-cache';
3
3
  import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
4
+ import { pick } from '@aztec/foundation/collection';
4
5
  import { Fr } from '@aztec/foundation/curves/bn254';
5
6
  import { TimeoutError } from '@aztec/foundation/error';
6
7
  import { createLogger } from '@aztec/foundation/log';
@@ -10,6 +11,7 @@ import type { P2P, PeerId } from '@aztec/p2p';
10
11
  import { BlockProposalValidator } from '@aztec/p2p/msg_validators';
11
12
  import type { BlockData, L2Block, L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
12
13
  import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
14
+ import { Gas } from '@aztec/stdlib/gas';
13
15
  import type { ITxProvider, ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
14
16
  import { type L1ToL2MessageSource, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
15
17
  import type { BlockProposal } from '@aztec/stdlib/p2p';
@@ -87,25 +89,28 @@ export class BlockProposalHandler {
87
89
  this.tracer = telemetry.getTracer('BlockProposalHandler');
88
90
  }
89
91
 
90
- registerForReexecution(p2pClient: P2P): BlockProposalHandler {
91
- // Non-validator handler that re-executes for monitoring but does not attest.
92
+ register(p2pClient: P2P, shouldReexecute: boolean): BlockProposalHandler {
93
+ // Non-validator handler that processes or re-executes for monitoring but does not attest.
92
94
  // Returns boolean indicating whether the proposal was valid.
93
95
  const handler = async (proposal: BlockProposal, proposalSender: PeerId): Promise<boolean> => {
94
96
  try {
95
- const result = await this.handleBlockProposal(proposal, proposalSender, true);
97
+ const { slotNumber, blockNumber } = proposal;
98
+ const result = await this.handleBlockProposal(proposal, proposalSender, shouldReexecute);
96
99
  if (result.isValid) {
97
- this.log.info(`Non-validator reexecution completed for slot ${proposal.slotNumber}`, {
100
+ this.log.info(`Non-validator block proposal ${blockNumber} at slot ${slotNumber} handled`, {
98
101
  blockNumber: result.blockNumber,
102
+ slotNumber,
99
103
  reexecutionTimeMs: result.reexecutionResult?.reexecutionTimeMs,
100
104
  totalManaUsed: result.reexecutionResult?.totalManaUsed,
101
105
  numTxs: result.reexecutionResult?.block?.body?.txEffects?.length ?? 0,
106
+ reexecuted: shouldReexecute,
102
107
  });
103
108
  return true;
104
109
  } else {
105
- this.log.warn(`Non-validator reexecution failed for slot ${proposal.slotNumber}`, {
106
- blockNumber: result.blockNumber,
107
- reason: result.reason,
108
- });
110
+ this.log.warn(
111
+ `Non-validator block proposal ${blockNumber} at slot ${slotNumber} failed processing with ${result.reason}`,
112
+ { blockNumber: result.blockNumber, slotNumber, reason: result.reason },
113
+ );
109
114
  return false;
110
115
  }
111
116
  } catch (error) {
@@ -184,6 +189,15 @@ export class BlockProposalHandler {
184
189
  deadline: this.getReexecutionDeadline(slotNumber, config),
185
190
  });
186
191
 
192
+ // If reexecution is disabled, bail. We are just interested in triggering tx collection.
193
+ if (!shouldReexecute) {
194
+ this.log.info(
195
+ `Received valid block ${blockNumber} proposal at index ${proposal.indexWithinCheckpoint} on slot ${slotNumber}`,
196
+ proposalInfo,
197
+ );
198
+ return { isValid: true, blockNumber };
199
+ }
200
+
187
201
  // Compute the checkpoint number for this block and validate checkpoint consistency
188
202
  const checkpointResult = this.computeCheckpointNumber(proposal, parentBlock, proposalInfo);
189
203
  if (checkpointResult.reason) {
@@ -210,30 +224,28 @@ export class BlockProposalHandler {
210
224
  return { isValid: false, blockNumber, reason: 'txs_not_available' };
211
225
  }
212
226
 
227
+ // Collect the out hashes of all the checkpoints before this one in the same epoch
228
+ const epoch = getEpochAtSlot(slotNumber, this.epochCache.getL1Constants());
229
+ const previousCheckpointOutHashes = (await this.blockSource.getCheckpointsDataForEpoch(epoch))
230
+ .filter(c => c.checkpointNumber < checkpointNumber)
231
+ .map(c => c.checkpointOutHash);
232
+
213
233
  // Try re-executing the transactions in the proposal if needed
214
234
  let reexecutionResult;
215
- if (shouldReexecute) {
216
- // Collect the out hashes of all the checkpoints before this one in the same epoch
217
- const epoch = getEpochAtSlot(slotNumber, this.epochCache.getL1Constants());
218
- const previousCheckpointOutHashes = (await this.blockSource.getCheckpointsDataForEpoch(epoch))
219
- .filter(c => c.checkpointNumber < checkpointNumber)
220
- .map(c => c.checkpointOutHash);
221
-
222
- try {
223
- this.log.verbose(`Re-executing transactions in the proposal`, proposalInfo);
224
- reexecutionResult = await this.reexecuteTransactions(
225
- proposal,
226
- blockNumber,
227
- checkpointNumber,
228
- txs,
229
- l1ToL2Messages,
230
- previousCheckpointOutHashes,
231
- );
232
- } catch (error) {
233
- this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
234
- const reason = this.getReexecuteFailureReason(error);
235
- return { isValid: false, blockNumber, reason, reexecutionResult };
236
- }
235
+ try {
236
+ this.log.verbose(`Re-executing transactions in the proposal`, proposalInfo);
237
+ reexecutionResult = await this.reexecuteTransactions(
238
+ proposal,
239
+ blockNumber,
240
+ checkpointNumber,
241
+ txs,
242
+ l1ToL2Messages,
243
+ previousCheckpointOutHashes,
244
+ );
245
+ } catch (error) {
246
+ this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
247
+ const reason = this.getReexecuteFailureReason(error);
248
+ return { isValid: false, blockNumber, reason, reexecutionResult };
237
249
  }
238
250
 
239
251
  // If we succeeded, push this block into the archiver (unless disabled)
@@ -242,8 +254,8 @@ export class BlockProposalHandler {
242
254
  }
243
255
 
244
256
  this.log.info(
245
- `Successfully processed block ${blockNumber} proposal at index ${proposal.indexWithinCheckpoint} on slot ${slotNumber}`,
246
- proposalInfo,
257
+ `Successfully re-executed block ${blockNumber} proposal at index ${proposal.indexWithinCheckpoint} on slot ${slotNumber}`,
258
+ { ...proposalInfo, ...pick(reexecutionResult, 'reexecutionTimeMs', 'totalManaUsed') },
247
259
  );
248
260
 
249
261
  return { isValid: true, blockNumber, reexecutionResult };
@@ -480,18 +492,25 @@ export class BlockProposalHandler {
480
492
 
481
493
  // Build the new block
482
494
  const deadline = this.getReexecutionDeadline(slot, config);
495
+ const maxBlockGas =
496
+ this.config.validateMaxL2BlockGas !== undefined || this.config.validateMaxDABlockGas !== undefined
497
+ ? new Gas(this.config.validateMaxDABlockGas ?? Infinity, this.config.validateMaxL2BlockGas ?? Infinity)
498
+ : undefined;
483
499
  const result = await checkpointBuilder.buildBlock(txs, blockNumber, blockHeader.globalVariables.timestamp, {
484
500
  deadline,
485
501
  expectedEndState: blockHeader.state,
502
+ maxTransactions: this.config.validateMaxTxsPerBlock,
503
+ maxBlockGas,
486
504
  });
487
505
 
488
506
  const { block, failedTxs } = result;
489
507
  const numFailedTxs = failedTxs.length;
490
508
 
491
- this.log.verbose(`Transaction re-execution complete for slot ${slot}`, {
509
+ this.log.verbose(`Block proposal ${blockNumber} at slot ${slot} transaction re-execution complete`, {
492
510
  numFailedTxs,
493
511
  numProposalTxs: txHashes.length,
494
512
  numProcessedTxs: block.body.txEffects.length,
513
+ blockNumber,
495
514
  slot,
496
515
  });
497
516
 
@@ -1,5 +1,7 @@
1
+ import { NUM_CHECKPOINT_END_MARKER_FIELDS, getNumBlockEndBlobFields } from '@aztec/blob-lib/encoding';
2
+ import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB, MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
1
3
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
- import { merge, pick } from '@aztec/foundation/collection';
4
+ import { merge, pick, sum } from '@aztec/foundation/collection';
3
5
  import { Fr } from '@aztec/foundation/curves/bn254';
4
6
  import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
5
7
  import { bufferToHex } from '@aztec/foundation/string';
@@ -65,6 +67,7 @@ export class CheckpointBuilder implements ICheckpointBlockBuilder {
65
67
 
66
68
  /**
67
69
  * Builds a single block within this checkpoint.
70
+ * Automatically caps gas and blob field limits based on checkpoint-level budgets and prior blocks.
68
71
  */
69
72
  async buildBlock(
70
73
  pendingTxs: Iterable<Tx> | AsyncIterable<Tx>,
@@ -94,8 +97,14 @@ export class CheckpointBuilder implements ICheckpointBlockBuilder {
94
97
  });
95
98
  const { processor, validator } = await this.makeBlockBuilderDeps(globalVariables, this.fork);
96
99
 
97
- const [publicProcessorDuration, [processedTxs, failedTxs, usedTxs, _, usedTxBlobFields]] = await elapsed(() =>
98
- processor.process(pendingTxs, opts, validator),
100
+ // Cap gas limits amd available blob fields by remaining checkpoint-level budgets
101
+ const cappedOpts: PublicProcessorLimits & { expectedEndState?: StateReference } = {
102
+ ...opts,
103
+ ...this.capLimitsByCheckpointBudgets(opts),
104
+ };
105
+
106
+ const [publicProcessorDuration, [processedTxs, failedTxs, usedTxs]] = await elapsed(() =>
107
+ processor.process(pendingTxs, cappedOpts, validator),
99
108
  );
100
109
 
101
110
  // Throw if we didn't collect a single valid tx and we're not allowed to build empty blocks
@@ -109,9 +118,6 @@ export class CheckpointBuilder implements ICheckpointBlockBuilder {
109
118
  expectedEndState: opts.expectedEndState,
110
119
  });
111
120
 
112
- // How much public gas was processed
113
- const publicGas = processedTxs.reduce((acc, tx) => acc.add(tx.gasUsed.publicGas), Gas.empty());
114
-
115
121
  this.log.debug('Built block within checkpoint', {
116
122
  header: block.header.toInspect(),
117
123
  processedTxs: processedTxs.map(tx => tx.hash.toString()),
@@ -120,12 +126,10 @@ export class CheckpointBuilder implements ICheckpointBlockBuilder {
120
126
 
121
127
  return {
122
128
  block,
123
- publicGas,
124
129
  publicProcessorDuration,
125
130
  numTxs: processedTxs.length,
126
131
  failedTxs,
127
132
  usedTxs,
128
- usedTxBlobFields,
129
133
  };
130
134
  }
131
135
 
@@ -147,8 +151,66 @@ export class CheckpointBuilder implements ICheckpointBlockBuilder {
147
151
  return this.checkpointBuilder.clone().completeCheckpoint();
148
152
  }
149
153
 
154
+ /**
155
+ * Caps per-block gas and blob field limits by remaining checkpoint-level budgets.
156
+ * Computes remaining L2 gas (mana), DA gas, and blob fields from blocks already added to the checkpoint,
157
+ * then returns opts with maxBlockGas and maxBlobFields capped accordingly.
158
+ */
159
+ protected capLimitsByCheckpointBudgets(
160
+ opts: PublicProcessorLimits,
161
+ ): Pick<PublicProcessorLimits, 'maxBlockGas' | 'maxBlobFields' | 'maxTransactions'> {
162
+ const existingBlocks = this.checkpointBuilder.getBlocks();
163
+
164
+ // Remaining L2 gas (mana)
165
+ // IMPORTANT: This assumes mana is computed solely based on L2 gas used in transactions.
166
+ // This may change in the future.
167
+ const usedMana = sum(existingBlocks.map(b => b.header.totalManaUsed.toNumber()));
168
+ const remainingMana = this.config.rollupManaLimit - usedMana;
169
+
170
+ // Remaining DA gas
171
+ const usedDAGas = sum(existingBlocks.map(b => b.computeDAGasUsed())) ?? 0;
172
+ const remainingDAGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT - usedDAGas;
173
+
174
+ // Remaining blob fields (block blob fields include both tx data and block-end overhead)
175
+ const usedBlobFields = sum(existingBlocks.map(b => b.toBlobFields().length));
176
+ const totalBlobCapacity = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB - NUM_CHECKPOINT_END_MARKER_FIELDS;
177
+ const isFirstBlock = existingBlocks.length === 0;
178
+ const blockEndOverhead = getNumBlockEndBlobFields(isFirstBlock);
179
+ const maxBlobFieldsForTxs = totalBlobCapacity - usedBlobFields - blockEndOverhead;
180
+
181
+ // Cap L2 gas by remaining checkpoint mana
182
+ const cappedL2Gas = Math.min(opts.maxBlockGas?.l2Gas ?? remainingMana, remainingMana);
183
+
184
+ // Cap DA gas by remaining checkpoint DA gas budget
185
+ const cappedDAGas = Math.min(opts.maxBlockGas?.daGas ?? remainingDAGas, remainingDAGas);
186
+
187
+ // Cap blob fields by remaining checkpoint blob capacity
188
+ const cappedBlobFields =
189
+ opts.maxBlobFields !== undefined ? Math.min(opts.maxBlobFields, maxBlobFieldsForTxs) : maxBlobFieldsForTxs;
190
+
191
+ // Cap transaction count by remaining checkpoint tx budget
192
+ let cappedMaxTransactions: number | undefined;
193
+ if (this.config.maxTxsPerCheckpoint !== undefined) {
194
+ const usedTxs = sum(existingBlocks.map(b => b.body.txEffects.length));
195
+ const remainingTxs = Math.max(0, this.config.maxTxsPerCheckpoint - usedTxs);
196
+ cappedMaxTransactions =
197
+ opts.maxTransactions !== undefined ? Math.min(opts.maxTransactions, remainingTxs) : remainingTxs;
198
+ } else {
199
+ cappedMaxTransactions = opts.maxTransactions;
200
+ }
201
+
202
+ return {
203
+ maxBlockGas: new Gas(cappedDAGas, cappedL2Gas),
204
+ maxBlobFields: cappedBlobFields,
205
+ maxTransactions: cappedMaxTransactions,
206
+ };
207
+ }
208
+
150
209
  protected async makeBlockBuilderDeps(globalVariables: GlobalVariables, fork: MerkleTreeWriteOperations) {
151
- const txPublicSetupAllowList = this.config.txPublicSetupAllowList ?? (await getDefaultAllowedSetupFunctions());
210
+ const txPublicSetupAllowList = [
211
+ ...(await getDefaultAllowedSetupFunctions()),
212
+ ...(this.config.txPublicSetupAllowListExtend ?? []),
213
+ ];
152
214
  const contractsDB = new PublicContractsDB(this.contractDataSource, this.log.getBindings());
153
215
  const guardedFork = new GuardedMerkleTreeOperations(fork);
154
216
 
package/src/config.ts CHANGED
@@ -77,6 +77,26 @@ export const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientCo
77
77
  description: 'Agree to attest to equivocated checkpoint proposals (for testing purposes only)',
78
78
  ...booleanConfigHelper(false),
79
79
  },
80
+ validateMaxL2BlockGas: {
81
+ env: 'VALIDATOR_MAX_L2_BLOCK_GAS',
82
+ description: 'Maximum L2 block gas for validation. Proposals exceeding this limit are rejected.',
83
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
84
+ },
85
+ validateMaxDABlockGas: {
86
+ env: 'VALIDATOR_MAX_DA_BLOCK_GAS',
87
+ description: 'Maximum DA block gas for validation. Proposals exceeding this limit are rejected.',
88
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
89
+ },
90
+ validateMaxTxsPerBlock: {
91
+ env: 'VALIDATOR_MAX_TX_PER_BLOCK',
92
+ description: 'Maximum transactions per block for validation. Proposals exceeding this limit are rejected.',
93
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
94
+ },
95
+ validateMaxTxsPerCheckpoint: {
96
+ env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
97
+ description: 'Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected.',
98
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
99
+ },
80
100
  ...validatorHASignerConfigMappings,
81
101
  };
82
102
 
@@ -150,16 +150,10 @@ export class ValidationService {
150
150
  );
151
151
 
152
152
  // TODO(spy/ha): Use checkpointNumber instead of blockNumber once CheckpointHeader includes it.
153
- // Currently using lastBlock.blockNumber as a proxy for checkpoint identification in HA signing.
153
+ // CheckpointProposalCore doesn't have lastBlock info, so use 0 as a proxy.
154
154
  // blockNumber is NOT used for the primary key so it's safe to use here.
155
155
  // See CheckpointHeader TODO and SigningContext types documentation.
156
- let blockNumber: BlockNumber;
157
- try {
158
- blockNumber = proposal.blockNumber;
159
- } catch {
160
- // Checkpoint proposal may not have lastBlock, use 0 as fallback
161
- blockNumber = BlockNumber(0);
162
- }
156
+ const blockNumber = BlockNumber(0);
163
157
  const context: SigningContext = {
164
158
  slot: proposal.slotNumber,
165
159
  blockNumber,
package/src/factory.ts CHANGED
@@ -29,7 +29,7 @@ export function createBlockProposalHandler(
29
29
  const metrics = new ValidatorMetrics(deps.telemetry);
30
30
  const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
31
31
  txsPermitted: !config.disableTransactions,
32
- maxTxsPerBlock: config.maxTxsPerBlock,
32
+ maxTxsPerBlock: config.validateMaxTxsPerBlock,
33
33
  });
34
34
  return new BlockProposalHandler(
35
35
  deps.checkpointsBuilder,
package/src/metrics.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { EpochNumber } from '@aztec/foundation/branded-types';
2
+ import type { EthAddress } from '@aztec/foundation/eth-address';
1
3
  import type { BlockProposal } from '@aztec/stdlib/p2p';
2
4
  import {
3
5
  Attributes,
@@ -16,6 +18,8 @@ export class ValidatorMetrics {
16
18
  private successfulAttestationsCount: UpDownCounter;
17
19
  private failedAttestationsBadProposalCount: UpDownCounter;
18
20
  private failedAttestationsNodeIssueCount: UpDownCounter;
21
+ private currentEpoch: Gauge;
22
+ private attestedEpochCount: UpDownCounter;
19
23
 
20
24
  private reexMana: Histogram;
21
25
  private reexTx: Histogram;
@@ -64,6 +68,10 @@ export class ValidatorMetrics {
64
68
  },
65
69
  );
66
70
 
71
+ this.currentEpoch = meter.createGauge(Metrics.VALIDATOR_CURRENT_EPOCH);
72
+
73
+ this.attestedEpochCount = createUpDownCounterWithDefault(meter, Metrics.VALIDATOR_ATTESTED_EPOCH_COUNT);
74
+
67
75
  this.reexMana = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_MANA);
68
76
 
69
77
  this.reexTx = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_TX_COUNT);
@@ -110,4 +118,14 @@ export class ValidatorMetrics {
110
118
  [Attributes.IS_COMMITTEE_MEMBER]: inCommittee,
111
119
  });
112
120
  }
121
+
122
+ /** Update the gauge tracking the current epoch number (proxy for total epochs elapsed). */
123
+ public setCurrentEpoch(epoch: EpochNumber) {
124
+ this.currentEpoch.record(Number(epoch));
125
+ }
126
+
127
+ /** Increment the count of epochs in which the given attester submitted at least one attestation. */
128
+ public incAttestedEpochCount(attester: EthAddress) {
129
+ this.attestedEpochCount.add(1, { [Attributes.ATTESTER_ADDRESS]: attester.toString() });
130
+ }
113
131
  }
package/src/validator.ts CHANGED
@@ -24,6 +24,7 @@ import { AuthRequest, AuthResponse, BlockProposalValidator, ReqRespSubProtocol }
24
24
  import { OffenseType, WANT_TO_SLASH_EVENT, type Watcher, type WatcherEmitter } from '@aztec/slasher';
25
25
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
26
26
  import type { CommitteeAttestationsAndSigners, L2Block, L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
27
+ import { validateCheckpoint } from '@aztec/stdlib/checkpoint';
27
28
  import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
28
29
  import type {
29
30
  CreateCheckpointProposalLastBlockData,
@@ -89,6 +90,8 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
89
90
 
90
91
  private lastEpochForCommitteeUpdateLoop: EpochNumber | undefined;
91
92
  private epochCacheUpdateLoop: RunningPromise;
93
+ /** Tracks the last epoch in which each attester successfully submitted at least one attestation. */
94
+ private lastAttestedEpochByAttester: Map<string, EpochNumber> = new Map();
92
95
 
93
96
  private proposersOfInvalidBlocks: Set<string> = new Set();
94
97
 
@@ -160,6 +163,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
160
163
  this.log.trace(`No committee found for slot`);
161
164
  return;
162
165
  }
166
+ this.metrics.setCurrentEpoch(epoch);
163
167
  if (epoch !== this.lastEpochForCommitteeUpdateLoop) {
164
168
  const me = this.getValidatorAddresses();
165
169
  const committeeSet = new Set(committee.map(v => v.toString()));
@@ -197,7 +201,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
197
201
  const metrics = new ValidatorMetrics(telemetry);
198
202
  const blockProposalValidator = new BlockProposalValidator(epochCache, {
199
203
  txsPermitted: !config.disableTransactions,
200
- maxTxsPerBlock: config.maxTxsPerBlock,
204
+ maxTxsPerBlock: config.validateMaxTxsPerBlock,
201
205
  });
202
206
  const blockProposalHandler = new BlockProposalHandler(
203
207
  checkpointsBuilder,
@@ -516,11 +520,9 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
516
520
  slotNumber,
517
521
  archive: proposal.archive.toString(),
518
522
  proposer: proposer.toString(),
519
- txCount: proposal.txHashes.length,
520
523
  };
521
524
  this.log.info(`Received checkpoint proposal for slot ${slotNumber}`, {
522
525
  ...proposalInfo,
523
- txHashes: proposal.txHashes.map(t => t.toString()),
524
526
  fishermanMode: this.config.fishermanMode || false,
525
527
  });
526
528
 
@@ -556,6 +558,17 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
556
558
 
557
559
  this.metrics.incSuccessfulAttestations(inCommittee.length);
558
560
 
561
+ // Track epoch participation per attester: count each (attester, epoch) pair at most once
562
+ const proposalEpoch = getEpochAtSlot(slotNumber, this.epochCache.getL1Constants());
563
+ for (const attester of inCommittee) {
564
+ const key = attester.toString();
565
+ const lastEpoch = this.lastAttestedEpochByAttester.get(key);
566
+ if (lastEpoch === undefined || proposalEpoch > lastEpoch) {
567
+ this.lastAttestedEpochByAttester.set(key, proposalEpoch);
568
+ this.metrics.incAttestedEpochCount(attester);
569
+ }
570
+ }
571
+
559
572
  // Determine which validators should attest
560
573
  let attestors: EthAddress[];
561
574
  if (partOfCommittee) {
@@ -752,6 +765,20 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
752
765
  return { isValid: false, reason: 'out_hash_mismatch' };
753
766
  }
754
767
 
768
+ // Final round of validations on the checkpoint, just in case.
769
+ try {
770
+ validateCheckpoint(computedCheckpoint, {
771
+ rollupManaLimit: this.checkpointsBuilder.getConfig().rollupManaLimit,
772
+ maxDABlockGas: this.config.validateMaxDABlockGas,
773
+ maxL2BlockGas: this.config.validateMaxL2BlockGas,
774
+ maxTxsPerBlock: this.config.validateMaxTxsPerBlock,
775
+ maxTxsPerCheckpoint: this.config.validateMaxTxsPerCheckpoint,
776
+ });
777
+ } catch (err) {
778
+ this.log.warn(`Checkpoint validation failed: ${err}`, proposalInfo);
779
+ return { isValid: false, reason: 'checkpoint_validation_failed' };
780
+ }
781
+
755
782
  this.log.verbose(`Checkpoint proposal validation successful for slot ${slot}`, proposalInfo);
756
783
  return { isValid: true };
757
784
  } finally {