@aztec/validator-client 0.0.0-test.1 → 0.0.1-commit.001888fc

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 (66) hide show
  1. package/README.md +328 -0
  2. package/dest/block_proposal_handler.d.ts +64 -0
  3. package/dest/block_proposal_handler.d.ts.map +1 -0
  4. package/dest/block_proposal_handler.js +606 -0
  5. package/dest/checkpoint_builder.d.ts +77 -0
  6. package/dest/checkpoint_builder.d.ts.map +1 -0
  7. package/dest/checkpoint_builder.js +250 -0
  8. package/dest/config.d.ts +3 -14
  9. package/dest/config.d.ts.map +1 -1
  10. package/dest/config.js +66 -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 +117 -17
  14. package/dest/factory.d.ts +28 -6
  15. package/dest/factory.d.ts.map +1 -1
  16. package/dest/factory.js +14 -6
  17. package/dest/index.d.ts +5 -2
  18. package/dest/index.d.ts.map +1 -1
  19. package/dest/index.js +4 -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 +21 -5
  39. package/dest/metrics.d.ts.map +1 -1
  40. package/dest/metrics.js +75 -22
  41. package/dest/validator.d.ts +101 -59
  42. package/dest/validator.d.ts.map +1 -1
  43. package/dest/validator.js +723 -168
  44. package/package.json +37 -21
  45. package/src/block_proposal_handler.ts +624 -0
  46. package/src/checkpoint_builder.ts +412 -0
  47. package/src/config.ts +77 -22
  48. package/src/duties/validation_service.ts +194 -19
  49. package/src/factory.ts +66 -11
  50. package/src/index.ts +4 -1
  51. package/src/key_store/ha_key_store.ts +269 -0
  52. package/src/key_store/index.ts +3 -0
  53. package/src/key_store/interface.ts +100 -5
  54. package/src/key_store/local_key_store.ts +77 -18
  55. package/src/key_store/node_keystore_adapter.ts +398 -0
  56. package/src/key_store/web3signer_key_store.ts +205 -0
  57. package/src/metrics.ts +104 -23
  58. package/src/validator.ts +961 -219
  59. package/dest/errors/index.d.ts +0 -2
  60. package/dest/errors/index.d.ts.map +0 -1
  61. package/dest/errors/index.js +0 -1
  62. package/dest/errors/validator.error.d.ts +0 -29
  63. package/dest/errors/validator.error.d.ts.map +0 -1
  64. package/dest/errors/validator.error.js +0 -45
  65. package/src/errors/index.ts +0 -1
  66. package/src/errors/validator.error.ts +0 -55
@@ -0,0 +1,77 @@
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 DebugLogStore } from '@aztec/stdlib/logs';
13
+ import { type CheckpointGlobalVariables, GlobalVariables, StateReference, Tx } from '@aztec/stdlib/tx';
14
+ import { type TelemetryClient } from '@aztec/telemetry-client';
15
+ export type { BuildBlockInCheckpointResult } from '@aztec/stdlib/interfaces/server';
16
+ /**
17
+ * Builder for a single checkpoint. Handles building blocks within the checkpoint
18
+ * and completing it.
19
+ */
20
+ export declare class CheckpointBuilder implements ICheckpointBlockBuilder {
21
+ private checkpointBuilder;
22
+ private fork;
23
+ private config;
24
+ private contractDataSource;
25
+ private dateProvider;
26
+ private telemetryClient;
27
+ private debugLogStore;
28
+ private log;
29
+ constructor(checkpointBuilder: LightweightCheckpointBuilder, fork: MerkleTreeWriteOperations, config: FullNodeBlockBuilderConfig, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient: TelemetryClient, bindings?: LoggerBindings, debugLogStore?: DebugLogStore);
30
+ getConstantData(): CheckpointGlobalVariables;
31
+ /**
32
+ * Builds a single block within this checkpoint.
33
+ * Automatically caps gas and blob field limits based on checkpoint-level budgets and prior blocks.
34
+ */
35
+ buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts?: PublicProcessorLimits & {
36
+ expectedEndState?: StateReference;
37
+ minValidTxs?: number;
38
+ }): Promise<BuildBlockInCheckpointResult>;
39
+ /** Completes the checkpoint and returns it. */
40
+ completeCheckpoint(): Promise<Checkpoint>;
41
+ /** Gets the checkpoint currently in progress. */
42
+ getCheckpoint(): Promise<Checkpoint>;
43
+ /**
44
+ * Caps per-block gas and blob field limits by remaining checkpoint-level budgets.
45
+ * Computes remaining L2 gas (mana), DA gas, and blob fields from blocks already added to the checkpoint,
46
+ * then returns opts with maxBlockGas and maxBlobFields capped accordingly.
47
+ */
48
+ protected capLimitsByCheckpointBudgets(opts: PublicProcessorLimits): Pick<PublicProcessorLimits, 'maxBlockGas' | 'maxBlobFields' | 'maxTransactions'>;
49
+ protected makeBlockBuilderDeps(globalVariables: GlobalVariables, fork: MerkleTreeWriteOperations): Promise<{
50
+ processor: PublicProcessor;
51
+ validator: import("@aztec/stdlib/interfaces/server").PublicProcessorValidator;
52
+ }>;
53
+ }
54
+ /** Factory for creating checkpoint builders. */
55
+ export declare class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
56
+ private config;
57
+ private worldState;
58
+ private contractDataSource;
59
+ private dateProvider;
60
+ private telemetryClient;
61
+ private debugLogStore;
62
+ private log;
63
+ constructor(config: FullNodeBlockBuilderConfig & Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>, worldState: WorldStateSynchronizer, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient?: TelemetryClient, debugLogStore?: DebugLogStore);
64
+ getConfig(): FullNodeBlockBuilderConfig;
65
+ updateConfig(config: Partial<FullNodeBlockBuilderConfig>): void;
66
+ /**
67
+ * Starts a new checkpoint and returns a CheckpointBuilder to build blocks within it.
68
+ */
69
+ startCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, feeAssetPriceModifier: bigint, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], fork: MerkleTreeWriteOperations, bindings?: LoggerBindings): Promise<CheckpointBuilder>;
70
+ /**
71
+ * Opens a checkpoint, either starting fresh or resuming from existing blocks.
72
+ */
73
+ openCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, feeAssetPriceModifier: bigint, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], fork: MerkleTreeWriteOperations, existingBlocks?: L2Block[], bindings?: LoggerBindings): Promise<CheckpointBuilder>;
74
+ /** Returns a fork of the world state at the given block number. */
75
+ getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
76
+ }
77
+ //# source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C,EAC9F,UAAU,EAAE,sBAAsB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,eAAe,GAAE,eAAsC,EACvD,aAAa,GAAE,aAAuC,EAG/D;IAEM,SAAS,IAAI,0BAA0B,CAE7C;IAEM,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,0BAA0B,CAAC,QAE9D;IAED;;OAEG;IACG,eAAe,CACnB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,yBAAyB,EACpC,qBAAqB,EAAE,MAAM,EAC7B,cAAc,EAAE,EAAE,EAAE,EACpB,2BAA2B,EAAE,EAAE,EAAE,EACjC,IAAI,EAAE,yBAAyB,EAC/B,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAiC5B;IAED;;OAEG;IACG,cAAc,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,yBAAyB,EACpC,qBAAqB,EAAE,MAAM,EAC7B,cAAc,EAAE,EAAE,EAAE,EACpB,2BAA2B,EAAE,EAAE,EAAE,EACjC,IAAI,EAAE,yBAAyB,EAC/B,cAAc,GAAE,OAAO,EAAO,EAC9B,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA+C5B;IAED,mEAAmE;IACnE,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAEpE;CACF"}
@@ -0,0 +1,250 @@
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';
3
+ import { merge, pick, sum } from '@aztec/foundation/collection';
4
+ import { createLogger } from '@aztec/foundation/log';
5
+ import { bufferToHex } from '@aztec/foundation/string';
6
+ import { elapsed } from '@aztec/foundation/timer';
7
+ import { createTxValidatorForBlockBuilding, getDefaultAllowedSetupFunctions } from '@aztec/p2p/msg_validators';
8
+ import { LightweightCheckpointBuilder } from '@aztec/prover-client/light';
9
+ import { GuardedMerkleTreeOperations, PublicContractsDB, PublicProcessor, createPublicTxSimulatorForBlockBuilding } from '@aztec/simulator/server';
10
+ import { Gas } from '@aztec/stdlib/gas';
11
+ import { FullNodeBlockBuilderConfigKeys, InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
12
+ import { NullDebugLogStore } from '@aztec/stdlib/logs';
13
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
14
+ import { GlobalVariables } from '@aztec/stdlib/tx';
15
+ import { getTelemetryClient } from '@aztec/telemetry-client';
16
+ import { ForkCheckpoint } from '@aztec/world-state';
17
+ /**
18
+ * Builder for a single checkpoint. Handles building blocks within the checkpoint
19
+ * and completing it.
20
+ */ export class CheckpointBuilder {
21
+ checkpointBuilder;
22
+ fork;
23
+ config;
24
+ contractDataSource;
25
+ dateProvider;
26
+ telemetryClient;
27
+ debugLogStore;
28
+ log;
29
+ constructor(checkpointBuilder, fork, config, contractDataSource, dateProvider, telemetryClient, bindings, debugLogStore = new NullDebugLogStore()){
30
+ this.checkpointBuilder = checkpointBuilder;
31
+ this.fork = fork;
32
+ this.config = config;
33
+ this.contractDataSource = contractDataSource;
34
+ this.dateProvider = dateProvider;
35
+ this.telemetryClient = telemetryClient;
36
+ this.debugLogStore = debugLogStore;
37
+ this.log = createLogger('checkpoint-builder', {
38
+ ...bindings,
39
+ instanceId: `checkpoint-${checkpointBuilder.checkpointNumber}`
40
+ });
41
+ }
42
+ getConstantData() {
43
+ return this.checkpointBuilder.constants;
44
+ }
45
+ /**
46
+ * Builds a single block within this checkpoint.
47
+ * Automatically caps gas and blob field limits based on checkpoint-level budgets and prior blocks.
48
+ */ async buildBlock(pendingTxs, blockNumber, timestamp, opts = {}) {
49
+ const slot = this.checkpointBuilder.constants.slotNumber;
50
+ this.log.verbose(`Building block ${blockNumber} for slot ${slot} within checkpoint`, {
51
+ slot,
52
+ blockNumber,
53
+ ...opts,
54
+ currentTime: new Date(this.dateProvider.now())
55
+ });
56
+ const constants = this.checkpointBuilder.constants;
57
+ const globalVariables = GlobalVariables.from({
58
+ chainId: constants.chainId,
59
+ version: constants.version,
60
+ blockNumber,
61
+ slotNumber: constants.slotNumber,
62
+ timestamp,
63
+ coinbase: constants.coinbase,
64
+ feeRecipient: constants.feeRecipient,
65
+ gasFees: constants.gasFees
66
+ });
67
+ const { processor, validator } = await this.makeBlockBuilderDeps(globalVariables, this.fork);
68
+ // Cap gas limits amd available blob fields by remaining checkpoint-level budgets
69
+ const cappedOpts = {
70
+ ...opts,
71
+ ...this.capLimitsByCheckpointBudgets(opts)
72
+ };
73
+ // We execute all merkle tree operations on a world state fork checkpoint
74
+ // This enables us to discard all modifications in the event that we fail to successfully process sufficient transactions
75
+ const forkCheckpoint = await ForkCheckpoint.new(this.fork);
76
+ try {
77
+ const [publicProcessorDuration, [processedTxs, failedTxs, usedTxs]] = await elapsed(()=>processor.process(pendingTxs, cappedOpts, validator));
78
+ // Throw before updating state if we don't have enough valid txs
79
+ const minValidTxs = opts.minValidTxs ?? 0;
80
+ if (processedTxs.length < minValidTxs) {
81
+ throw new InsufficientValidTxsError(processedTxs.length, minValidTxs, failedTxs);
82
+ }
83
+ // Commit the fork checkpoint
84
+ await forkCheckpoint.commit();
85
+ // Add block to checkpoint
86
+ const { block } = await this.checkpointBuilder.addBlock(globalVariables, processedTxs, {
87
+ expectedEndState: opts.expectedEndState
88
+ });
89
+ this.log.debug('Built block within checkpoint', {
90
+ header: block.header.toInspect(),
91
+ processedTxs: processedTxs.map((tx)=>tx.hash.toString()),
92
+ failedTxs: failedTxs.map((tx)=>tx.tx.txHash.toString())
93
+ });
94
+ return {
95
+ block,
96
+ publicProcessorDuration,
97
+ numTxs: processedTxs.length,
98
+ failedTxs,
99
+ usedTxs
100
+ };
101
+ } catch (err) {
102
+ // If we reached the point of committing the checkpoint, this does nothing
103
+ // Otherwise it reverts any changes made to the fork for this failed block
104
+ await forkCheckpoint.revert();
105
+ throw err;
106
+ }
107
+ }
108
+ /** Completes the checkpoint and returns it. */ async completeCheckpoint() {
109
+ const checkpoint = await this.checkpointBuilder.completeCheckpoint();
110
+ this.log.verbose(`Completed checkpoint ${checkpoint.number}`, {
111
+ checkpointNumber: checkpoint.number,
112
+ numBlocks: checkpoint.blocks.length,
113
+ archiveRoot: checkpoint.archive.root.toString()
114
+ });
115
+ return checkpoint;
116
+ }
117
+ /** Gets the checkpoint currently in progress. */ getCheckpoint() {
118
+ return this.checkpointBuilder.clone().completeCheckpoint();
119
+ }
120
+ /**
121
+ * Caps per-block gas and blob field limits by remaining checkpoint-level budgets.
122
+ * Computes remaining L2 gas (mana), DA gas, and blob fields from blocks already added to the checkpoint,
123
+ * then returns opts with maxBlockGas and maxBlobFields capped accordingly.
124
+ */ capLimitsByCheckpointBudgets(opts) {
125
+ const existingBlocks = this.checkpointBuilder.getBlocks();
126
+ // Remaining L2 gas (mana)
127
+ // IMPORTANT: This assumes mana is computed solely based on L2 gas used in transactions.
128
+ // This may change in the future.
129
+ const usedMana = sum(existingBlocks.map((b)=>b.header.totalManaUsed.toNumber()));
130
+ const remainingMana = this.config.rollupManaLimit - usedMana;
131
+ // Remaining DA gas
132
+ const usedDAGas = sum(existingBlocks.map((b)=>b.computeDAGasUsed())) ?? 0;
133
+ const remainingDAGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT - usedDAGas;
134
+ // Remaining blob fields (block blob fields include both tx data and block-end overhead)
135
+ const usedBlobFields = sum(existingBlocks.map((b)=>b.toBlobFields().length));
136
+ const totalBlobCapacity = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB - NUM_CHECKPOINT_END_MARKER_FIELDS;
137
+ const isFirstBlock = existingBlocks.length === 0;
138
+ const blockEndOverhead = getNumBlockEndBlobFields(isFirstBlock);
139
+ const maxBlobFieldsForTxs = totalBlobCapacity - usedBlobFields - blockEndOverhead;
140
+ // When redistributeCheckpointBudget is enabled (default), compute a fair share of remaining budget
141
+ // across remaining blocks scaled by the multiplier, instead of letting one block consume it all.
142
+ const redistribute = this.config.redistributeCheckpointBudget !== false;
143
+ const remainingBlocks = Math.max(1, (this.config.maxBlocksPerCheckpoint ?? 1) - existingBlocks.length);
144
+ const multiplier = this.config.perBlockAllocationMultiplier ?? 1.2;
145
+ // Cap L2 gas by remaining checkpoint mana (with fair share when redistributing)
146
+ const fairShareL2 = redistribute ? Math.ceil(remainingMana / remainingBlocks * multiplier) : Infinity;
147
+ const cappedL2Gas = Math.min(opts.maxBlockGas?.l2Gas ?? Infinity, fairShareL2, remainingMana);
148
+ // Cap DA gas by remaining checkpoint DA gas budget (with fair share when redistributing)
149
+ const fairShareDA = redistribute ? Math.ceil(remainingDAGas / remainingBlocks * multiplier) : Infinity;
150
+ const cappedDAGas = Math.min(opts.maxBlockGas?.daGas ?? remainingDAGas, fairShareDA, remainingDAGas);
151
+ // Cap blob fields by remaining checkpoint blob capacity (with fair share when redistributing)
152
+ const fairShareBlobs = redistribute ? Math.ceil(maxBlobFieldsForTxs / remainingBlocks * multiplier) : Infinity;
153
+ const cappedBlobFields = Math.min(opts.maxBlobFields ?? Infinity, fairShareBlobs, maxBlobFieldsForTxs);
154
+ // Cap transaction count by remaining checkpoint tx budget (with fair share when redistributing)
155
+ let cappedMaxTransactions;
156
+ if (this.config.maxTxsPerCheckpoint !== undefined) {
157
+ const usedTxs = sum(existingBlocks.map((b)=>b.body.txEffects.length));
158
+ const remainingTxs = Math.max(0, this.config.maxTxsPerCheckpoint - usedTxs);
159
+ const fairShareTxs = redistribute ? Math.ceil(remainingTxs / remainingBlocks * multiplier) : Infinity;
160
+ cappedMaxTransactions = Math.min(opts.maxTransactions ?? Infinity, fairShareTxs, remainingTxs);
161
+ } else {
162
+ cappedMaxTransactions = opts.maxTransactions;
163
+ }
164
+ return {
165
+ maxBlockGas: new Gas(cappedDAGas, cappedL2Gas),
166
+ maxBlobFields: cappedBlobFields,
167
+ maxTransactions: cappedMaxTransactions
168
+ };
169
+ }
170
+ async makeBlockBuilderDeps(globalVariables, fork) {
171
+ const txPublicSetupAllowList = [
172
+ ...await getDefaultAllowedSetupFunctions(),
173
+ ...this.config.txPublicSetupAllowListExtend ?? []
174
+ ];
175
+ const contractsDB = new PublicContractsDB(this.contractDataSource, this.log.getBindings());
176
+ const guardedFork = new GuardedMerkleTreeOperations(fork);
177
+ const collectDebugLogs = this.debugLogStore.isEnabled;
178
+ const bindings = this.log.getBindings();
179
+ const publicTxSimulator = createPublicTxSimulatorForBlockBuilding(guardedFork, contractsDB, globalVariables, this.telemetryClient, bindings, collectDebugLogs);
180
+ const processor = new PublicProcessor(globalVariables, guardedFork, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient, createLogger('simulator:public-processor', bindings), this.config, this.debugLogStore);
181
+ const validator = createTxValidatorForBlockBuilding(fork, this.contractDataSource, globalVariables, txPublicSetupAllowList, this.log.getBindings());
182
+ return {
183
+ processor,
184
+ validator
185
+ };
186
+ }
187
+ }
188
+ /** Factory for creating checkpoint builders. */ export class FullNodeCheckpointsBuilder {
189
+ config;
190
+ worldState;
191
+ contractDataSource;
192
+ dateProvider;
193
+ telemetryClient;
194
+ debugLogStore;
195
+ log;
196
+ constructor(config, worldState, contractDataSource, dateProvider, telemetryClient = getTelemetryClient(), debugLogStore = new NullDebugLogStore()){
197
+ this.config = config;
198
+ this.worldState = worldState;
199
+ this.contractDataSource = contractDataSource;
200
+ this.dateProvider = dateProvider;
201
+ this.telemetryClient = telemetryClient;
202
+ this.debugLogStore = debugLogStore;
203
+ this.log = createLogger('checkpoint-builder');
204
+ }
205
+ getConfig() {
206
+ return this.config;
207
+ }
208
+ updateConfig(config) {
209
+ this.config = merge(this.config, pick(config, ...FullNodeBlockBuilderConfigKeys));
210
+ }
211
+ /**
212
+ * Starts a new checkpoint and returns a CheckpointBuilder to build blocks within it.
213
+ */ async startCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, bindings) {
214
+ const stateReference = await fork.getStateReference();
215
+ const archiveTree = await fork.getTreeInfo(MerkleTreeId.ARCHIVE);
216
+ this.log.verbose(`Building new checkpoint ${checkpointNumber}`, {
217
+ checkpointNumber,
218
+ msgCount: l1ToL2Messages.length,
219
+ initialStateReference: stateReference.toInspect(),
220
+ initialArchiveRoot: bufferToHex(archiveTree.root),
221
+ constants,
222
+ feeAssetPriceModifier
223
+ });
224
+ const lightweightBuilder = await LightweightCheckpointBuilder.startNewCheckpoint(checkpointNumber, constants, l1ToL2Messages, previousCheckpointOutHashes, fork, bindings, feeAssetPriceModifier);
225
+ return new CheckpointBuilder(lightweightBuilder, fork, this.config, this.contractDataSource, this.dateProvider, this.telemetryClient, bindings, this.debugLogStore);
226
+ }
227
+ /**
228
+ * Opens a checkpoint, either starting fresh or resuming from existing blocks.
229
+ */ async openCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, existingBlocks = [], bindings) {
230
+ const stateReference = await fork.getStateReference();
231
+ const archiveTree = await fork.getTreeInfo(MerkleTreeId.ARCHIVE);
232
+ if (existingBlocks.length === 0) {
233
+ return this.startCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, bindings);
234
+ }
235
+ this.log.verbose(`Resuming checkpoint ${checkpointNumber} with ${existingBlocks.length} existing blocks`, {
236
+ checkpointNumber,
237
+ msgCount: l1ToL2Messages.length,
238
+ existingBlockCount: existingBlocks.length,
239
+ initialStateReference: stateReference.toInspect(),
240
+ initialArchiveRoot: bufferToHex(archiveTree.root),
241
+ constants,
242
+ feeAssetPriceModifier
243
+ });
244
+ const lightweightBuilder = await LightweightCheckpointBuilder.resumeCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, existingBlocks, bindings);
245
+ return new CheckpointBuilder(lightweightBuilder, fork, this.config, this.contractDataSource, this.dateProvider, this.telemetryClient, bindings, this.debugLogStore);
246
+ }
247
+ /** Returns a fork of the world state at the given block number. */ getFork(blockNumber) {
248
+ return this.worldState.fork(blockNumber);
249
+ }
250
+ }
package/dest/config.d.ts CHANGED
@@ -1,17 +1,6 @@
1
1
  import { type ConfigMappingsType } from '@aztec/foundation/config';
2
- /**
3
- * The Validator Configuration
4
- */
5
- export interface ValidatorClientConfig {
6
- /** The private key of the validator participating in attestation duties */
7
- validatorPrivateKey?: string;
8
- /** Do not run the validator */
9
- disableValidator: boolean;
10
- /** Interval between polling for new attestations from peers */
11
- attestationPollingIntervalMs: number;
12
- /** Re-execute transactions before attesting */
13
- validatorReexecute: boolean;
14
- }
2
+ import type { ValidatorClientConfig } from '@aztec/stdlib/interfaces/server';
3
+ export type { ValidatorClientConfig };
15
4
  export declare const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientConfig>;
16
5
  /**
17
6
  * Returns the prover configuration from the environment variables.
@@ -19,4 +8,4 @@ export declare const validatorClientConfigMappings: ConfigMappingsType<Validator
19
8
  * @returns The validator configuration.
20
9
  */
21
10
  export declare function getProverEnvVars(): ValidatorClientConfig;
22
- //# sourceMappingURL=config.d.ts.map
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQUt4QixNQUFNLDBCQUEwQixDQUFDO0FBR2xDLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFN0UsWUFBWSxFQUFFLHFCQUFxQixFQUFFLENBQUM7QUFFdEMsZUFBTyxNQUFNLDZCQUE2QixFQUFFLGtCQUFrQixDQUFDLHFCQUFxQixDQXdGbkYsQ0FBQztBQUVGOzs7O0dBSUc7QUFDSCx3QkFBZ0IsZ0JBQWdCLElBQUkscUJBQXFCLENBRXhEIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,+BAA+B;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAE1B,+DAA+D;IAC/D,4BAA4B,EAAE,MAAM,CAAC;IAErC,+CAA+C;IAC/C,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CAqBnF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CAwFnF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
package/dest/config.js CHANGED
@@ -1,15 +1,30 @@
1
- import { NULL_KEY } from '@aztec/ethereum';
2
- import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
1
+ import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, secretValueConfigHelper } from '@aztec/foundation/config';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+ import { localSignerConfigMappings, validatorHASignerConfigMappings } from '@aztec/stdlib/ha-signing';
3
4
  export const validatorClientConfigMappings = {
4
- validatorPrivateKey: {
5
- env: 'VALIDATOR_PRIVATE_KEY',
6
- parseEnv: (val)=>val ? `0x${val.replace('0x', '')}` : NULL_KEY,
7
- description: 'The private key of the validator participating in attestation duties'
5
+ validatorPrivateKeys: {
6
+ env: 'VALIDATOR_PRIVATE_KEYS',
7
+ description: 'List of private keys of the validators participating in attestation duties',
8
+ ...secretValueConfigHelper((val)=>val ? val.split(',').map((key)=>`0x${key.replace('0x', '')}`) : []),
9
+ fallback: [
10
+ 'VALIDATOR_PRIVATE_KEY'
11
+ ]
12
+ },
13
+ validatorAddresses: {
14
+ env: 'VALIDATOR_ADDRESSES',
15
+ description: 'List of addresses of the validators to use with remote signers',
16
+ parseEnv: (val)=>val.split(',').filter((address)=>address && address.trim().length > 0).map((address)=>EthAddress.fromString(address.trim())),
17
+ defaultValue: []
8
18
  },
9
19
  disableValidator: {
10
20
  env: 'VALIDATOR_DISABLED',
11
21
  description: 'Do not run the validator',
12
- ...booleanConfigHelper()
22
+ ...booleanConfigHelper(false)
23
+ },
24
+ disabledValidators: {
25
+ description: 'Temporarily disable these specific validator addresses',
26
+ parseEnv: (val)=>val.split(',').filter((address)=>address && address.trim().length > 0).map((address)=>EthAddress.fromString(address.trim())),
27
+ defaultValue: []
13
28
  },
14
29
  attestationPollingIntervalMs: {
15
30
  env: 'VALIDATOR_ATTESTATIONS_POLLING_INTERVAL_MS',
@@ -20,7 +35,50 @@ export const validatorClientConfigMappings = {
20
35
  env: 'VALIDATOR_REEXECUTE',
21
36
  description: 'Re-execute transactions before attesting',
22
37
  ...booleanConfigHelper(true)
23
- }
38
+ },
39
+ alwaysReexecuteBlockProposals: {
40
+ description: 'Whether to always reexecute block proposals, even for non-validator nodes (useful for monitoring network status).',
41
+ defaultValue: true
42
+ },
43
+ fishermanMode: {
44
+ env: 'FISHERMAN_MODE',
45
+ description: 'Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus.',
46
+ ...booleanConfigHelper(false)
47
+ },
48
+ skipCheckpointProposalValidation: {
49
+ description: 'Skip checkpoint proposal validation and always attest (default: false)',
50
+ defaultValue: false
51
+ },
52
+ skipPushProposedBlocksToArchiver: {
53
+ description: 'Skip pushing re-executed blocks to archiver (default: false)',
54
+ defaultValue: false
55
+ },
56
+ attestToEquivocatedProposals: {
57
+ description: 'Agree to attest to equivocated checkpoint proposals (for testing purposes only)',
58
+ ...booleanConfigHelper(false)
59
+ },
60
+ validateMaxL2BlockGas: {
61
+ env: 'VALIDATOR_MAX_L2_BLOCK_GAS',
62
+ description: 'Maximum L2 block gas for validation. Proposals exceeding this limit are rejected.',
63
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
64
+ },
65
+ validateMaxDABlockGas: {
66
+ env: 'VALIDATOR_MAX_DA_BLOCK_GAS',
67
+ description: 'Maximum DA block gas for validation. Proposals exceeding this limit are rejected.',
68
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
69
+ },
70
+ validateMaxTxsPerBlock: {
71
+ env: 'VALIDATOR_MAX_TX_PER_BLOCK',
72
+ description: 'Maximum transactions per block for validation. Proposals exceeding this limit are rejected.',
73
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
74
+ },
75
+ validateMaxTxsPerCheckpoint: {
76
+ env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
77
+ description: 'Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected.',
78
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
79
+ },
80
+ ...localSignerConfigMappings,
81
+ ...validatorHASignerConfigMappings
24
82
  };
25
83
  /**
26
84
  * Returns the prover configuration from the environment variables.
@@ -1,29 +1,66 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
3
- import type { BlockHeader, TxHash } from '@aztec/stdlib/tx';
1
+ import { BlockNumber, type CheckpointNumber, IndexWithinCheckpoint, type SlotNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { EthAddress } from '@aztec/foundation/eth-address';
4
+ import type { Signature } from '@aztec/foundation/eth-signature';
5
+ import type { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
6
+ import type { CreateCheckpointProposalLastBlockData } from '@aztec/stdlib/interfaces/server';
7
+ import { BlockProposal, type BlockProposalOptions, CheckpointAttestation, CheckpointProposal, type CheckpointProposalCore, type CheckpointProposalOptions } from '@aztec/stdlib/p2p';
8
+ import type { CheckpointHeader } from '@aztec/stdlib/rollup';
9
+ import type { BlockHeader, Tx } from '@aztec/stdlib/tx';
4
10
  import type { ValidatorKeyStore } from '../key_store/interface.js';
5
11
  export declare class ValidationService {
6
12
  private keyStore;
7
- constructor(keyStore: ValidatorKeyStore);
13
+ private log;
14
+ constructor(keyStore: ValidatorKeyStore, log?: import("@aztec/foundation/log").Logger);
8
15
  /**
9
16
  * Create a block proposal with the given header, archive, and transactions
10
17
  *
11
- * @param header - The block header
18
+ * @param blockHeader - The block header
19
+ * @param blockIndexWithinCheckpoint - The block index within checkpoint for HA signing context
20
+ * @param inHash - Hash of L1 to L2 messages for this checkpoint
12
21
  * @param archive - The archive of the current block
13
- * @param txs - TxHash[] ordered list of transactions
22
+ * @param txs - Ordered list of transactions (Tx[])
23
+ * @param proposerAttesterAddress - The address of the proposer/attester, or undefined
24
+ * @param options - Block proposal options (including broadcastInvalidBlockProposal for testing)
14
25
  *
15
- * @returns A block proposal signing the above information (not the current implementation!!!)
26
+ * @returns A block proposal signing the above information
27
+ * @throws DutyAlreadySignedError if HA signer indicates duty already signed by another node
28
+ * @throws SlashingProtectionError if attempting to sign different data for same slot
16
29
  */
17
- createBlockProposal(header: BlockHeader, archive: Fr, txs: TxHash[]): Promise<BlockProposal>;
30
+ createBlockProposal(blockHeader: BlockHeader, blockIndexWithinCheckpoint: IndexWithinCheckpoint, inHash: Fr, archive: Fr, txs: Tx[], proposerAttesterAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal>;
18
31
  /**
19
- * Attest to the given block proposal constructed by the current sequencer
32
+ * Create a checkpoint proposal with the last block header and checkpoint header
33
+ *
34
+ * @param checkpointHeader - The checkpoint header containing aggregated data
35
+ * @param archive - The archive of the checkpoint
36
+ * @param lastBlockInfo - Info about the last block (header, index, txs) or undefined
37
+ * @param proposerAttesterAddress - The address of the proposer
38
+ * @param options - Checkpoint proposal options
39
+ *
40
+ * @returns A checkpoint proposal signing the above information
41
+ */
42
+ createCheckpointProposal(checkpointHeader: CheckpointHeader, archive: Fr, feeAssetPriceModifier: bigint, lastBlockInfo: CreateCheckpointProposalLastBlockData | undefined, proposerAttesterAddress: EthAddress | undefined, options: CheckpointProposalOptions): Promise<CheckpointProposal>;
43
+ /**
44
+ * Attest with selection of validators to the given checkpoint proposal
20
45
  *
21
46
  * NOTE: This is just a blind signing.
22
47
  * We assume that the proposal is valid and DA guarantees have been checked previously.
23
48
  *
24
- * @param proposal - The proposal to attest to
25
- * @returns attestation
49
+ * @param proposal - The checkpoint proposal (core version without lastBlock) to attest to
50
+ * @param attestors - The validators to attest with
51
+ * @returns checkpoint attestations
52
+ */
53
+ attestToCheckpointProposal(proposal: CheckpointProposalCore, attestors: EthAddress[]): Promise<CheckpointAttestation[]>;
54
+ /**
55
+ * Sign attestations and signers payload
56
+ * @param attestationsAndSigners - The attestations and signers to sign
57
+ * @param proposer - The proposer address to sign with
58
+ * @param slot - The slot number for HA signing context
59
+ * @param blockNumber - The block or checkpoint number for HA signing context
60
+ * @returns signature
61
+ * @throws DutyAlreadySignedError if already signed by another HA node
62
+ * @throws SlashingProtectionError if attempting to sign different data for same slot
26
63
  */
27
- attestToProposal(proposal: BlockProposal): Promise<BlockAttestation>;
64
+ signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress, slot: SlotNumber, blockNumber: BlockNumber | CheckpointNumber): Promise<Signature>;
28
65
  }
29
- //# sourceMappingURL=validation_service.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BQVUsRUFDaEIsV0FBVyxFQUFFLFdBQVcsR0FBRyxnQkFBZ0IsR0FDMUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQVdwQjtDQUNGIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"validation_service.d.ts","sourceRoot":"","sources":["../../src/duties/validation_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAA8C,MAAM,mBAAmB,CAAC;AAChH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,iBAAiB;IAE/C;;;;;;;;OAQG;IACH,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAM5F;;;;;;;;OAQG;IACG,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAS3E"}
1
+ {"version":3,"file":"validation_service.d.ts","sourceRoot":"","sources":["../../src/duties/validation_service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,KAAK,UAAU,EAChB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,qCAAqC,EAAE,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