@aztec/validator-client 0.0.1-commit.fce3e4f → 0.0.1-commit.ffe5b04ea
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.
- package/README.md +327 -0
- package/dest/block_proposal_handler.d.ts +25 -14
- package/dest/block_proposal_handler.d.ts.map +1 -1
- package/dest/block_proposal_handler.js +366 -105
- package/dest/checkpoint_builder.d.ts +76 -0
- package/dest/checkpoint_builder.d.ts.map +1 -0
- package/dest/checkpoint_builder.js +228 -0
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +37 -8
- package/dest/duties/validation_service.d.ts +42 -13
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +105 -28
- package/dest/factory.d.ts +13 -8
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +4 -3
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/key_store/ha_key_store.d.ts +99 -0
- package/dest/key_store/ha_key_store.d.ts.map +1 -0
- package/dest/key_store/ha_key_store.js +208 -0
- package/dest/key_store/index.d.ts +2 -1
- package/dest/key_store/index.d.ts.map +1 -1
- package/dest/key_store/index.js +1 -0
- package/dest/key_store/interface.d.ts +36 -6
- package/dest/key_store/interface.d.ts.map +1 -1
- package/dest/key_store/local_key_store.d.ts +10 -5
- package/dest/key_store/local_key_store.d.ts.map +1 -1
- package/dest/key_store/local_key_store.js +9 -5
- package/dest/key_store/node_keystore_adapter.d.ts +18 -5
- package/dest/key_store/node_keystore_adapter.d.ts.map +1 -1
- package/dest/key_store/node_keystore_adapter.js +18 -4
- package/dest/key_store/web3signer_key_store.d.ts +10 -5
- package/dest/key_store/web3signer_key_store.d.ts.map +1 -1
- package/dest/key_store/web3signer_key_store.js +9 -5
- package/dest/metrics.d.ts +12 -3
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +46 -30
- package/dest/validator.d.ts +76 -21
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +478 -57
- package/package.json +23 -13
- package/src/block_proposal_handler.ts +288 -75
- package/src/checkpoint_builder.ts +390 -0
- package/src/config.ts +36 -7
- package/src/duties/validation_service.ts +156 -33
- package/src/factory.ts +18 -8
- package/src/index.ts +1 -0
- package/src/key_store/ha_key_store.ts +269 -0
- package/src/key_store/index.ts +1 -0
- package/src/key_store/interface.ts +44 -5
- package/src/key_store/local_key_store.ts +14 -5
- package/src/key_store/node_keystore_adapter.ts +28 -5
- package/src/key_store/web3signer_key_store.ts +18 -5
- package/src/metrics.ts +63 -33
- package/src/validator.ts +640 -85
|
@@ -0,0 +1,390 @@
|
|
|
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 { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import { merge, pick, sum } from '@aztec/foundation/collection';
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import { bufferToHex } from '@aztec/foundation/string';
|
|
8
|
+
import { DateProvider, elapsed } from '@aztec/foundation/timer';
|
|
9
|
+
import { createTxValidatorForBlockBuilding, getDefaultAllowedSetupFunctions } from '@aztec/p2p/msg_validators';
|
|
10
|
+
import { LightweightCheckpointBuilder } from '@aztec/prover-client/light';
|
|
11
|
+
import {
|
|
12
|
+
GuardedMerkleTreeOperations,
|
|
13
|
+
PublicContractsDB,
|
|
14
|
+
PublicProcessor,
|
|
15
|
+
createPublicTxSimulatorForBlockBuilding,
|
|
16
|
+
} from '@aztec/simulator/server';
|
|
17
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
18
|
+
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
19
|
+
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
20
|
+
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
21
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
22
|
+
import {
|
|
23
|
+
type BuildBlockInCheckpointResult,
|
|
24
|
+
type FullNodeBlockBuilderConfig,
|
|
25
|
+
FullNodeBlockBuilderConfigKeys,
|
|
26
|
+
type ICheckpointBlockBuilder,
|
|
27
|
+
type ICheckpointsBuilder,
|
|
28
|
+
type MerkleTreeWriteOperations,
|
|
29
|
+
NoValidTxsError,
|
|
30
|
+
type PublicProcessorLimits,
|
|
31
|
+
type WorldStateSynchronizer,
|
|
32
|
+
} from '@aztec/stdlib/interfaces/server';
|
|
33
|
+
import { type DebugLogStore, NullDebugLogStore } from '@aztec/stdlib/logs';
|
|
34
|
+
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
35
|
+
import { type CheckpointGlobalVariables, GlobalVariables, StateReference, Tx } from '@aztec/stdlib/tx';
|
|
36
|
+
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
37
|
+
|
|
38
|
+
// Re-export for backward compatibility
|
|
39
|
+
export type { BuildBlockInCheckpointResult } from '@aztec/stdlib/interfaces/server';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Builder for a single checkpoint. Handles building blocks within the checkpoint
|
|
43
|
+
* and completing it.
|
|
44
|
+
*/
|
|
45
|
+
export class CheckpointBuilder implements ICheckpointBlockBuilder {
|
|
46
|
+
private log: Logger;
|
|
47
|
+
|
|
48
|
+
constructor(
|
|
49
|
+
private checkpointBuilder: LightweightCheckpointBuilder,
|
|
50
|
+
private fork: MerkleTreeWriteOperations,
|
|
51
|
+
private config: FullNodeBlockBuilderConfig,
|
|
52
|
+
private contractDataSource: ContractDataSource,
|
|
53
|
+
private dateProvider: DateProvider,
|
|
54
|
+
private telemetryClient: TelemetryClient,
|
|
55
|
+
bindings?: LoggerBindings,
|
|
56
|
+
private debugLogStore: DebugLogStore = new NullDebugLogStore(),
|
|
57
|
+
) {
|
|
58
|
+
this.log = createLogger('checkpoint-builder', {
|
|
59
|
+
...bindings,
|
|
60
|
+
instanceId: `checkpoint-${checkpointBuilder.checkpointNumber}`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getConstantData(): CheckpointGlobalVariables {
|
|
65
|
+
return this.checkpointBuilder.constants;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Builds a single block within this checkpoint.
|
|
70
|
+
* Automatically caps gas and blob field limits based on checkpoint-level budgets and prior blocks.
|
|
71
|
+
*/
|
|
72
|
+
async buildBlock(
|
|
73
|
+
pendingTxs: Iterable<Tx> | AsyncIterable<Tx>,
|
|
74
|
+
blockNumber: BlockNumber,
|
|
75
|
+
timestamp: bigint,
|
|
76
|
+
opts: PublicProcessorLimits & { expectedEndState?: StateReference } = {},
|
|
77
|
+
): Promise<BuildBlockInCheckpointResult> {
|
|
78
|
+
const slot = this.checkpointBuilder.constants.slotNumber;
|
|
79
|
+
|
|
80
|
+
this.log.verbose(`Building block ${blockNumber} for slot ${slot} within checkpoint`, {
|
|
81
|
+
slot,
|
|
82
|
+
blockNumber,
|
|
83
|
+
...opts,
|
|
84
|
+
currentTime: new Date(this.dateProvider.now()),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const constants = this.checkpointBuilder.constants;
|
|
88
|
+
const globalVariables = GlobalVariables.from({
|
|
89
|
+
chainId: constants.chainId,
|
|
90
|
+
version: constants.version,
|
|
91
|
+
blockNumber,
|
|
92
|
+
slotNumber: constants.slotNumber,
|
|
93
|
+
timestamp,
|
|
94
|
+
coinbase: constants.coinbase,
|
|
95
|
+
feeRecipient: constants.feeRecipient,
|
|
96
|
+
gasFees: constants.gasFees,
|
|
97
|
+
});
|
|
98
|
+
const { processor, validator } = await this.makeBlockBuilderDeps(globalVariables, this.fork);
|
|
99
|
+
|
|
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),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Throw if we didn't collect a single valid tx and we're not allowed to build empty blocks
|
|
111
|
+
// (only the first block in a checkpoint can be empty)
|
|
112
|
+
if (processedTxs.length === 0 && this.checkpointBuilder.getBlockCount() > 0) {
|
|
113
|
+
throw new NoValidTxsError(failedTxs);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Add block to checkpoint
|
|
117
|
+
const { block } = await this.checkpointBuilder.addBlock(globalVariables, processedTxs, {
|
|
118
|
+
expectedEndState: opts.expectedEndState,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
this.log.debug('Built block within checkpoint', {
|
|
122
|
+
header: block.header.toInspect(),
|
|
123
|
+
processedTxs: processedTxs.map(tx => tx.hash.toString()),
|
|
124
|
+
failedTxs: failedTxs.map(tx => tx.tx.txHash.toString()),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
block,
|
|
129
|
+
publicProcessorDuration,
|
|
130
|
+
numTxs: processedTxs.length,
|
|
131
|
+
failedTxs,
|
|
132
|
+
usedTxs,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Completes the checkpoint and returns it. */
|
|
137
|
+
async completeCheckpoint(): Promise<Checkpoint> {
|
|
138
|
+
const checkpoint = await this.checkpointBuilder.completeCheckpoint();
|
|
139
|
+
|
|
140
|
+
this.log.verbose(`Completed checkpoint ${checkpoint.number}`, {
|
|
141
|
+
checkpointNumber: checkpoint.number,
|
|
142
|
+
numBlocks: checkpoint.blocks.length,
|
|
143
|
+
archiveRoot: checkpoint.archive.root.toString(),
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
return checkpoint;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Gets the checkpoint currently in progress. */
|
|
150
|
+
getCheckpoint(): Promise<Checkpoint> {
|
|
151
|
+
return this.checkpointBuilder.clone().completeCheckpoint();
|
|
152
|
+
}
|
|
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
|
+
|
|
209
|
+
protected async makeBlockBuilderDeps(globalVariables: GlobalVariables, fork: MerkleTreeWriteOperations) {
|
|
210
|
+
const txPublicSetupAllowList = [
|
|
211
|
+
...(await getDefaultAllowedSetupFunctions()),
|
|
212
|
+
...(this.config.txPublicSetupAllowListExtend ?? []),
|
|
213
|
+
];
|
|
214
|
+
const contractsDB = new PublicContractsDB(this.contractDataSource, this.log.getBindings());
|
|
215
|
+
const guardedFork = new GuardedMerkleTreeOperations(fork);
|
|
216
|
+
|
|
217
|
+
const collectDebugLogs = this.debugLogStore.isEnabled;
|
|
218
|
+
|
|
219
|
+
const bindings = this.log.getBindings();
|
|
220
|
+
const publicTxSimulator = createPublicTxSimulatorForBlockBuilding(
|
|
221
|
+
guardedFork,
|
|
222
|
+
contractsDB,
|
|
223
|
+
globalVariables,
|
|
224
|
+
this.telemetryClient,
|
|
225
|
+
bindings,
|
|
226
|
+
collectDebugLogs,
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
const processor = new PublicProcessor(
|
|
230
|
+
globalVariables,
|
|
231
|
+
guardedFork,
|
|
232
|
+
contractsDB,
|
|
233
|
+
publicTxSimulator,
|
|
234
|
+
this.dateProvider,
|
|
235
|
+
this.telemetryClient,
|
|
236
|
+
createLogger('simulator:public-processor', bindings),
|
|
237
|
+
this.config,
|
|
238
|
+
this.debugLogStore,
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
const validator = createTxValidatorForBlockBuilding(
|
|
242
|
+
fork,
|
|
243
|
+
this.contractDataSource,
|
|
244
|
+
globalVariables,
|
|
245
|
+
txPublicSetupAllowList,
|
|
246
|
+
this.log.getBindings(),
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
processor,
|
|
251
|
+
validator,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Factory for creating checkpoint builders. */
|
|
257
|
+
export class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
|
|
258
|
+
private log: Logger;
|
|
259
|
+
|
|
260
|
+
constructor(
|
|
261
|
+
private config: FullNodeBlockBuilderConfig & Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>,
|
|
262
|
+
private worldState: WorldStateSynchronizer,
|
|
263
|
+
private contractDataSource: ContractDataSource,
|
|
264
|
+
private dateProvider: DateProvider,
|
|
265
|
+
private telemetryClient: TelemetryClient = getTelemetryClient(),
|
|
266
|
+
private debugLogStore: DebugLogStore = new NullDebugLogStore(),
|
|
267
|
+
) {
|
|
268
|
+
this.log = createLogger('checkpoint-builder');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
public getConfig(): FullNodeBlockBuilderConfig {
|
|
272
|
+
return this.config;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
public updateConfig(config: Partial<FullNodeBlockBuilderConfig>) {
|
|
276
|
+
this.config = merge(this.config, pick(config, ...FullNodeBlockBuilderConfigKeys));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Starts a new checkpoint and returns a CheckpointBuilder to build blocks within it.
|
|
281
|
+
*/
|
|
282
|
+
async startCheckpoint(
|
|
283
|
+
checkpointNumber: CheckpointNumber,
|
|
284
|
+
constants: CheckpointGlobalVariables,
|
|
285
|
+
feeAssetPriceModifier: bigint,
|
|
286
|
+
l1ToL2Messages: Fr[],
|
|
287
|
+
previousCheckpointOutHashes: Fr[],
|
|
288
|
+
fork: MerkleTreeWriteOperations,
|
|
289
|
+
bindings?: LoggerBindings,
|
|
290
|
+
): Promise<CheckpointBuilder> {
|
|
291
|
+
const stateReference = await fork.getStateReference();
|
|
292
|
+
const archiveTree = await fork.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
293
|
+
|
|
294
|
+
this.log.verbose(`Building new checkpoint ${checkpointNumber}`, {
|
|
295
|
+
checkpointNumber,
|
|
296
|
+
msgCount: l1ToL2Messages.length,
|
|
297
|
+
initialStateReference: stateReference.toInspect(),
|
|
298
|
+
initialArchiveRoot: bufferToHex(archiveTree.root),
|
|
299
|
+
constants,
|
|
300
|
+
feeAssetPriceModifier,
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
const lightweightBuilder = await LightweightCheckpointBuilder.startNewCheckpoint(
|
|
304
|
+
checkpointNumber,
|
|
305
|
+
constants,
|
|
306
|
+
l1ToL2Messages,
|
|
307
|
+
previousCheckpointOutHashes,
|
|
308
|
+
fork,
|
|
309
|
+
bindings,
|
|
310
|
+
feeAssetPriceModifier,
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
return new CheckpointBuilder(
|
|
314
|
+
lightweightBuilder,
|
|
315
|
+
fork,
|
|
316
|
+
this.config,
|
|
317
|
+
this.contractDataSource,
|
|
318
|
+
this.dateProvider,
|
|
319
|
+
this.telemetryClient,
|
|
320
|
+
bindings,
|
|
321
|
+
this.debugLogStore,
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Opens a checkpoint, either starting fresh or resuming from existing blocks.
|
|
327
|
+
*/
|
|
328
|
+
async openCheckpoint(
|
|
329
|
+
checkpointNumber: CheckpointNumber,
|
|
330
|
+
constants: CheckpointGlobalVariables,
|
|
331
|
+
feeAssetPriceModifier: bigint,
|
|
332
|
+
l1ToL2Messages: Fr[],
|
|
333
|
+
previousCheckpointOutHashes: Fr[],
|
|
334
|
+
fork: MerkleTreeWriteOperations,
|
|
335
|
+
existingBlocks: L2Block[] = [],
|
|
336
|
+
bindings?: LoggerBindings,
|
|
337
|
+
): Promise<CheckpointBuilder> {
|
|
338
|
+
const stateReference = await fork.getStateReference();
|
|
339
|
+
const archiveTree = await fork.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
340
|
+
|
|
341
|
+
if (existingBlocks.length === 0) {
|
|
342
|
+
return this.startCheckpoint(
|
|
343
|
+
checkpointNumber,
|
|
344
|
+
constants,
|
|
345
|
+
feeAssetPriceModifier,
|
|
346
|
+
l1ToL2Messages,
|
|
347
|
+
previousCheckpointOutHashes,
|
|
348
|
+
fork,
|
|
349
|
+
bindings,
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
this.log.verbose(`Resuming checkpoint ${checkpointNumber} with ${existingBlocks.length} existing blocks`, {
|
|
354
|
+
checkpointNumber,
|
|
355
|
+
msgCount: l1ToL2Messages.length,
|
|
356
|
+
existingBlockCount: existingBlocks.length,
|
|
357
|
+
initialStateReference: stateReference.toInspect(),
|
|
358
|
+
initialArchiveRoot: bufferToHex(archiveTree.root),
|
|
359
|
+
constants,
|
|
360
|
+
feeAssetPriceModifier,
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
const lightweightBuilder = await LightweightCheckpointBuilder.resumeCheckpoint(
|
|
364
|
+
checkpointNumber,
|
|
365
|
+
constants,
|
|
366
|
+
feeAssetPriceModifier,
|
|
367
|
+
l1ToL2Messages,
|
|
368
|
+
previousCheckpointOutHashes,
|
|
369
|
+
fork,
|
|
370
|
+
existingBlocks,
|
|
371
|
+
bindings,
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
return new CheckpointBuilder(
|
|
375
|
+
lightweightBuilder,
|
|
376
|
+
fork,
|
|
377
|
+
this.config,
|
|
378
|
+
this.contractDataSource,
|
|
379
|
+
this.dateProvider,
|
|
380
|
+
this.telemetryClient,
|
|
381
|
+
bindings,
|
|
382
|
+
this.debugLogStore,
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** Returns a fork of the world state at the given block number. */
|
|
387
|
+
getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations> {
|
|
388
|
+
return this.worldState.fork(blockNumber);
|
|
389
|
+
}
|
|
390
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
secretValueConfigHelper,
|
|
7
7
|
} from '@aztec/foundation/config';
|
|
8
8
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
|
+
import { localSignerConfigMappings, validatorHASignerConfigMappings } from '@aztec/stdlib/ha-signing';
|
|
9
10
|
import type { ValidatorClientConfig } from '@aztec/stdlib/interfaces/server';
|
|
10
11
|
|
|
11
12
|
export type { ValidatorClientConfig };
|
|
@@ -53,16 +54,10 @@ export const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientCo
|
|
|
53
54
|
description: 'Re-execute transactions before attesting',
|
|
54
55
|
...booleanConfigHelper(true),
|
|
55
56
|
},
|
|
56
|
-
validatorReexecuteDeadlineMs: {
|
|
57
|
-
env: 'VALIDATOR_REEXECUTE_DEADLINE_MS',
|
|
58
|
-
description: 'Will re-execute until this many milliseconds are left in the slot',
|
|
59
|
-
...numberConfigHelper(6000),
|
|
60
|
-
},
|
|
61
57
|
alwaysReexecuteBlockProposals: {
|
|
62
|
-
env: 'ALWAYS_REEXECUTE_BLOCK_PROPOSALS',
|
|
63
58
|
description:
|
|
64
59
|
'Whether to always reexecute block proposals, even for non-validator nodes (useful for monitoring network status).',
|
|
65
|
-
|
|
60
|
+
defaultValue: true,
|
|
66
61
|
},
|
|
67
62
|
fishermanMode: {
|
|
68
63
|
env: 'FISHERMAN_MODE',
|
|
@@ -70,6 +65,40 @@ export const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientCo
|
|
|
70
65
|
'Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus.',
|
|
71
66
|
...booleanConfigHelper(false),
|
|
72
67
|
},
|
|
68
|
+
skipCheckpointProposalValidation: {
|
|
69
|
+
description: 'Skip checkpoint proposal validation and always attest (default: false)',
|
|
70
|
+
defaultValue: false,
|
|
71
|
+
},
|
|
72
|
+
skipPushProposedBlocksToArchiver: {
|
|
73
|
+
description: 'Skip pushing re-executed blocks to archiver (default: false)',
|
|
74
|
+
defaultValue: false,
|
|
75
|
+
},
|
|
76
|
+
attestToEquivocatedProposals: {
|
|
77
|
+
description: 'Agree to attest to equivocated checkpoint proposals (for testing purposes only)',
|
|
78
|
+
...booleanConfigHelper(false),
|
|
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
|
+
},
|
|
100
|
+
...localSignerConfigMappings,
|
|
101
|
+
...validatorHASignerConfigMappings,
|
|
73
102
|
};
|
|
74
103
|
|
|
75
104
|
/**
|