@aztec/validator-client 0.0.1-commit.10bd49492 → 0.0.1-commit.11bf3dd6e
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 +9 -12
- package/dest/checkpoint_builder.d.ts +10 -7
- package/dest/checkpoint_builder.d.ts.map +1 -1
- package/dest/checkpoint_builder.js +64 -41
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +4 -9
- package/dest/duties/validation_service.d.ts +7 -9
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +14 -26
- package/dest/factory.d.ts +7 -4
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +5 -5
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/metrics.d.ts +6 -2
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +12 -0
- package/dest/proposal_handler.d.ts +108 -0
- package/dest/proposal_handler.d.ts.map +1 -0
- package/dest/{block_proposal_handler.js → proposal_handler.js} +393 -25
- package/dest/validator.d.ts +15 -20
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +59 -227
- package/package.json +19 -19
- package/src/checkpoint_builder.ts +79 -52
- package/src/config.ts +4 -9
- package/src/duties/validation_service.ts +17 -30
- package/src/factory.ts +10 -4
- package/src/index.ts +1 -1
- package/src/metrics.ts +19 -1
- package/src/{block_proposal_handler.ts → proposal_handler.ts} +441 -23
- package/src/validator.ts +85 -249
- package/dest/block_proposal_handler.d.ts +0 -64
- package/dest/block_proposal_handler.d.ts.map +0 -1
package/dest/validator.d.ts.map
CHANGED
|
@@ -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,EA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gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,MAAM,EAC7B,iBAAiB,EAAE,aAAa,GAAG,SAAS,EAC5C,eAAe,EAAE,UAAU,GAAG,SAAS,EACvC,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,kBAAkB,CAAC,CA0B7B;IAEK,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;IAEK,0BAA0B,CAC9B,sBAAsB,EAAE,+BAA+B,EACvD,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,UAAU,EAChB,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,SAAS,CAAC,CAOpB;IAEK,sBAAsB,CAC1B,QAAQ,EAAE,kBAAkB,EAC5B,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAiBlC;IAEK,mBAAmB,CACvB,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,IAAI,EACd,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAiElC;YAEa,iBAAiB;CAwBhC"}
|
package/dest/validator.js
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import { getBlobsPerL1Block } from '@aztec/blob-lib';
|
|
2
|
-
import {
|
|
3
|
-
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
|
-
import { TimeoutError } from '@aztec/foundation/error';
|
|
2
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
5
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
7
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
8
5
|
import { sleep } from '@aztec/foundation/sleep';
|
|
9
6
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
10
7
|
import { AuthRequest, AuthResponse, BlockProposalValidator, ReqRespSubProtocol } from '@aztec/p2p';
|
|
11
8
|
import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
|
|
12
|
-
import {
|
|
13
|
-
import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
14
|
-
import { accumulateCheckpointOutHashes } from '@aztec/stdlib/messaging';
|
|
9
|
+
import { getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
|
|
15
10
|
import { AttestationTimeoutError } from '@aztec/stdlib/validators';
|
|
16
11
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
17
|
-
import { createHASigner, createLocalSignerWithProtection } from '@aztec/validator-ha-signer/factory';
|
|
12
|
+
import { createHASigner, createLocalSignerWithProtection, createSignerFromSharedDb } from '@aztec/validator-ha-signer/factory';
|
|
18
13
|
import { DutyType } from '@aztec/validator-ha-signer/types';
|
|
19
14
|
import { EventEmitter } from 'events';
|
|
20
|
-
import { BlockProposalHandler } from './block_proposal_handler.js';
|
|
21
15
|
import { ValidationService } from './duties/validation_service.js';
|
|
22
16
|
import { HAKeyStore } from './key_store/ha_key_store.js';
|
|
23
17
|
import { NodeKeystoreAdapter } from './key_store/node_keystore_adapter.js';
|
|
24
18
|
import { ValidatorMetrics } from './metrics.js';
|
|
19
|
+
import { ProposalHandler } from './proposal_handler.js';
|
|
25
20
|
// We maintain a set of proposers who have proposed invalid blocks.
|
|
26
21
|
// Just cap the set to avoid unbounded growth.
|
|
27
22
|
const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
|
|
@@ -36,7 +31,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
36
31
|
keyStore;
|
|
37
32
|
epochCache;
|
|
38
33
|
p2pClient;
|
|
39
|
-
|
|
34
|
+
proposalHandler;
|
|
40
35
|
blockSource;
|
|
41
36
|
checkpointsBuilder;
|
|
42
37
|
worldState;
|
|
@@ -58,8 +53,8 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
58
53
|
/** Tracks the last epoch in which each attester successfully submitted at least one attestation. */ lastAttestedEpochByAttester;
|
|
59
54
|
proposersOfInvalidBlocks;
|
|
60
55
|
/** Tracks the last checkpoint proposal we attested to, to prevent equivocation. */ lastAttestedProposal;
|
|
61
|
-
constructor(keyStore, epochCache, p2pClient,
|
|
62
|
-
super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.
|
|
56
|
+
constructor(keyStore, epochCache, p2pClient, proposalHandler, blockSource, checkpointsBuilder, worldState, l1ToL2MessageSource, config, blobClient, slashingProtectionSigner, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator')){
|
|
57
|
+
super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.proposalHandler = proposalHandler, this.blockSource = blockSource, this.checkpointsBuilder = checkpointsBuilder, this.worldState = worldState, this.l1ToL2MessageSource = l1ToL2MessageSource, this.config = config, this.blobClient = blobClient, this.slashingProtectionSigner = slashingProtectionSigner, this.dateProvider = dateProvider, this.hasRegisteredHandlers = false, this.lastAttestedEpochByAttester = new Map(), this.proposersOfInvalidBlocks = new Set();
|
|
63
58
|
// Create child logger with fisherman prefix if in fisherman mode
|
|
64
59
|
this.log = config.fishermanMode ? log.createChild('[FISHERMAN]') : log;
|
|
65
60
|
this.tracer = telemetry.getTracer('Validator');
|
|
@@ -114,16 +109,22 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
114
109
|
this.log.error(`Error updating epoch committee`, err);
|
|
115
110
|
}
|
|
116
111
|
}
|
|
117
|
-
static async new(config, checkpointsBuilder, worldState, epochCache, p2pClient, blockSource, l1ToL2MessageSource, txProvider, keyStoreManager, blobClient, dateProvider = new DateProvider(), telemetry = getTelemetryClient()) {
|
|
112
|
+
static async new(config, checkpointsBuilder, worldState, epochCache, p2pClient, blockSource, l1ToL2MessageSource, txProvider, keyStoreManager, blobClient, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), slashingProtectionDb) {
|
|
118
113
|
const metrics = new ValidatorMetrics(telemetry);
|
|
119
114
|
const blockProposalValidator = new BlockProposalValidator(epochCache, {
|
|
120
115
|
txsPermitted: !config.disableTransactions,
|
|
121
116
|
maxTxsPerBlock: config.validateMaxTxsPerBlock
|
|
122
117
|
});
|
|
123
|
-
const
|
|
118
|
+
const proposalHandler = new ProposalHandler(checkpointsBuilder, worldState, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, epochCache, config, blobClient, metrics, dateProvider, telemetry, undefined);
|
|
124
119
|
const nodeKeystoreAdapter = NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager);
|
|
125
120
|
let slashingProtectionSigner;
|
|
126
|
-
if (
|
|
121
|
+
if (slashingProtectionDb) {
|
|
122
|
+
// Shared database mode: use a pre-existing database (e.g. for testing HA setups).
|
|
123
|
+
({ signer: slashingProtectionSigner } = createSignerFromSharedDb(slashingProtectionDb, config, {
|
|
124
|
+
telemetryClient: telemetry,
|
|
125
|
+
dateProvider
|
|
126
|
+
}));
|
|
127
|
+
} else if (config.haSigningEnabled) {
|
|
127
128
|
// Multi-node HA mode: use PostgreSQL-backed distributed locking.
|
|
128
129
|
// If maxStuckDutiesAgeMs is not explicitly set, compute it from Aztec slot duration
|
|
129
130
|
const haConfig = {
|
|
@@ -143,14 +144,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
143
144
|
}));
|
|
144
145
|
}
|
|
145
146
|
const validatorKeyStore = new HAKeyStore(nodeKeystoreAdapter, slashingProtectionSigner);
|
|
146
|
-
const validator = new ValidatorClient(validatorKeyStore, epochCache, p2pClient,
|
|
147
|
+
const validator = new ValidatorClient(validatorKeyStore, epochCache, p2pClient, proposalHandler, blockSource, checkpointsBuilder, worldState, l1ToL2MessageSource, config, blobClient, slashingProtectionSigner, dateProvider, telemetry);
|
|
147
148
|
return validator;
|
|
148
149
|
}
|
|
149
150
|
getValidatorAddresses() {
|
|
150
151
|
return this.keyStore.getAddresses().filter((addr)=>!this.config.disabledValidators.some((disabled)=>disabled.equals(addr)));
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
-
return this.
|
|
153
|
+
getProposalHandler() {
|
|
154
|
+
return this.proposalHandler;
|
|
154
155
|
}
|
|
155
156
|
signWithAddress(addr, msg, context) {
|
|
156
157
|
return this.keyStore.signTypedDataWithAddress(addr, msg, context);
|
|
@@ -206,7 +207,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
206
207
|
// The checkpoint is received as CheckpointProposalCore since the lastBlock is extracted
|
|
207
208
|
// and processed separately via the block handler above.
|
|
208
209
|
const checkpointHandler = (checkpoint, proposalSender)=>this.attestToCheckpointProposal(checkpoint, proposalSender);
|
|
209
|
-
this.p2pClient.
|
|
210
|
+
this.p2pClient.registerValidatorCheckpointProposalHandler(checkpointHandler);
|
|
210
211
|
// Duplicate proposal handler - triggers slashing for equivocation
|
|
211
212
|
this.p2pClient.registerDuplicateProposalCallback((info)=>{
|
|
212
213
|
this.handleDuplicateProposal(info);
|
|
@@ -235,13 +236,12 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
235
236
|
this.log.warn(`Received block proposal with invalid signature for slot ${slotNumber}`);
|
|
236
237
|
return false;
|
|
237
238
|
}
|
|
238
|
-
//
|
|
239
|
+
// Log self-proposals from HA peers (same validator key on different nodes)
|
|
239
240
|
if (this.getValidatorAddresses().some((addr)=>addr.equals(proposer))) {
|
|
240
|
-
this.log.
|
|
241
|
+
this.log.verbose(`Processing block proposal from HA peer for slot ${slotNumber}`, {
|
|
241
242
|
proposer: proposer.toString(),
|
|
242
243
|
slotNumber
|
|
243
244
|
});
|
|
244
|
-
return false;
|
|
245
245
|
}
|
|
246
246
|
// Check if we're in the committee (for metrics purposes)
|
|
247
247
|
const inCommittee = await this.epochCache.filterInCommittee(slotNumber, this.getValidatorAddresses());
|
|
@@ -257,9 +257,9 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
257
257
|
});
|
|
258
258
|
// Reexecute txs if we are part of the committee, or if slashing is enabled, or if we are configured to always reexecute.
|
|
259
259
|
// In fisherman mode, we always reexecute to validate proposals.
|
|
260
|
-
const {
|
|
261
|
-
const shouldReexecute = fishermanMode || slashBroadcastedInvalidBlockPenalty > 0n
|
|
262
|
-
const validationResult = await this.
|
|
260
|
+
const { slashBroadcastedInvalidBlockPenalty, alwaysReexecuteBlockProposals, fishermanMode } = this.config;
|
|
261
|
+
const shouldReexecute = fishermanMode || slashBroadcastedInvalidBlockPenalty > 0n || partOfCommittee || alwaysReexecuteBlockProposals || this.blobClient.canUpload();
|
|
262
|
+
const validationResult = await this.proposalHandler.handleBlockProposal(proposal, proposalSender, !!shouldReexecute && !escapeHatchOpen);
|
|
263
263
|
if (!validationResult.isValid) {
|
|
264
264
|
const reason = validationResult.reason || 'unknown';
|
|
265
265
|
this.log.warn(`Block proposal validation failed: ${reason}`, proposalInfo);
|
|
@@ -302,56 +302,46 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
302
302
|
* the lastBlock is extracted and processed separately via the block handler.
|
|
303
303
|
* @returns Checkpoint attestations if valid, undefined otherwise
|
|
304
304
|
*/ async attestToCheckpointProposal(proposal, _proposalSender) {
|
|
305
|
-
const
|
|
305
|
+
const proposalSlotNumber = proposal.slotNumber;
|
|
306
306
|
const proposer = proposal.getSender();
|
|
307
307
|
// If escape hatch is open for this slot's epoch, do not attest.
|
|
308
|
-
if (await this.epochCache.isEscapeHatchOpenAtSlot(
|
|
309
|
-
this.log.warn(`Escape hatch open for slot ${
|
|
310
|
-
return undefined;
|
|
311
|
-
}
|
|
312
|
-
// Reject proposals with invalid signatures
|
|
313
|
-
if (!proposer) {
|
|
314
|
-
this.log.warn(`Received checkpoint proposal with invalid signature for slot ${slotNumber}`);
|
|
308
|
+
if (await this.epochCache.isEscapeHatchOpenAtSlot(proposalSlotNumber)) {
|
|
309
|
+
this.log.warn(`Escape hatch open for slot ${proposalSlotNumber}, skipping checkpoint attestation handling`);
|
|
315
310
|
return undefined;
|
|
316
311
|
}
|
|
317
312
|
// Ignore proposals from ourselves (may happen in HA setups)
|
|
318
|
-
if (this.getValidatorAddresses().some((addr)=>addr.equals(proposer))) {
|
|
319
|
-
this.log.debug(`Ignoring block proposal from self for slot ${
|
|
313
|
+
if (proposer && this.getValidatorAddresses().some((addr)=>addr.equals(proposer))) {
|
|
314
|
+
this.log.debug(`Ignoring block proposal from self for slot ${proposalSlotNumber}`, {
|
|
320
315
|
proposer: proposer.toString(),
|
|
321
|
-
|
|
316
|
+
proposalSlotNumber
|
|
322
317
|
});
|
|
323
318
|
return undefined;
|
|
324
319
|
}
|
|
325
|
-
//
|
|
326
|
-
|
|
327
|
-
this.log.warn(`Received checkpoint proposal with invalid feeAssetPriceModifier ${proposal.feeAssetPriceModifier} for slot ${slotNumber}`);
|
|
328
|
-
return undefined;
|
|
329
|
-
}
|
|
330
|
-
// Check that I have any address in current committee before attesting
|
|
331
|
-
const inCommittee = await this.epochCache.filterInCommittee(slotNumber, this.getValidatorAddresses());
|
|
320
|
+
// Check that I have any address in the committee where this checkpoint will land before attesting
|
|
321
|
+
const inCommittee = await this.epochCache.filterInCommittee(proposalSlotNumber, this.getValidatorAddresses());
|
|
332
322
|
const partOfCommittee = inCommittee.length > 0;
|
|
333
323
|
const proposalInfo = {
|
|
334
|
-
|
|
324
|
+
proposalSlotNumber,
|
|
335
325
|
archive: proposal.archive.toString(),
|
|
336
|
-
proposer: proposer
|
|
326
|
+
proposer: proposer?.toString()
|
|
337
327
|
};
|
|
338
|
-
this.log.info(`Received checkpoint proposal for slot ${
|
|
328
|
+
this.log.info(`Received checkpoint proposal for slot ${proposalSlotNumber}`, {
|
|
339
329
|
...proposalInfo,
|
|
340
330
|
fishermanMode: this.config.fishermanMode || false
|
|
341
331
|
});
|
|
342
|
-
// Validate the checkpoint proposal before attesting (unless skipCheckpointProposalValidation is set)
|
|
332
|
+
// Validate the checkpoint proposal before attesting (unless skipCheckpointProposalValidation is set).
|
|
333
|
+
// Uses the cached result from the all-nodes callback if available (avoids double validation).
|
|
334
|
+
let checkpointNumber;
|
|
343
335
|
if (this.config.skipCheckpointProposalValidation) {
|
|
344
|
-
this.log.warn(`Skipping checkpoint proposal validation for slot ${
|
|
336
|
+
this.log.warn(`Skipping checkpoint proposal validation for slot ${proposalSlotNumber}`, proposalInfo);
|
|
337
|
+
checkpointNumber = CheckpointNumber(0);
|
|
345
338
|
} else {
|
|
346
|
-
const validationResult = await this.
|
|
339
|
+
const validationResult = await this.proposalHandler.handleCheckpointProposal(proposal, proposalInfo);
|
|
347
340
|
if (!validationResult.isValid) {
|
|
348
341
|
this.log.warn(`Checkpoint proposal validation failed: ${validationResult.reason}`, proposalInfo);
|
|
349
342
|
return undefined;
|
|
350
343
|
}
|
|
351
|
-
|
|
352
|
-
// Upload blobs to filestore if we can (fire and forget)
|
|
353
|
-
if (this.blobClient.canUpload()) {
|
|
354
|
-
void this.uploadBlobsForCheckpoint(proposal, proposalInfo);
|
|
344
|
+
checkpointNumber = validationResult.checkpointNumber;
|
|
355
345
|
}
|
|
356
346
|
// Check that I have any address in current committee before attesting
|
|
357
347
|
// In fisherman mode, we still create attestations for validation even if not in committee
|
|
@@ -360,14 +350,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
360
350
|
return undefined;
|
|
361
351
|
}
|
|
362
352
|
// Provided all of the above checks pass, we can attest to the proposal
|
|
363
|
-
this.log.info(`${partOfCommittee ? 'Attesting to' : 'Validated'} checkpoint proposal for slot ${
|
|
353
|
+
this.log.info(`${partOfCommittee ? 'Attesting to' : 'Validated'} checkpoint proposal for slot ${proposalSlotNumber}`, {
|
|
364
354
|
...proposalInfo,
|
|
365
355
|
inCommittee: partOfCommittee,
|
|
366
356
|
fishermanMode: this.config.fishermanMode || false
|
|
367
357
|
});
|
|
368
358
|
this.metrics.incSuccessfulAttestations(inCommittee.length);
|
|
369
359
|
// Track epoch participation per attester: count each (attester, epoch) pair at most once
|
|
370
|
-
const proposalEpoch = getEpochAtSlot(
|
|
360
|
+
const proposalEpoch = getEpochAtSlot(proposalSlotNumber, this.epochCache.getL1Constants());
|
|
371
361
|
for (const attester of inCommittee){
|
|
372
362
|
const key = attester.toString();
|
|
373
363
|
const lastEpoch = this.lastAttestedEpochByAttester.get(key);
|
|
@@ -392,13 +382,13 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
392
382
|
}
|
|
393
383
|
if (this.config.fishermanMode) {
|
|
394
384
|
// bail out early and don't save attestations to the pool in fisherman mode
|
|
395
|
-
this.log.info(`Creating checkpoint attestations for slot ${
|
|
385
|
+
this.log.info(`Creating checkpoint attestations for slot ${proposalSlotNumber}`, {
|
|
396
386
|
...proposalInfo,
|
|
397
387
|
attestors: attestors.map((a)=>a.toString())
|
|
398
388
|
});
|
|
399
389
|
return undefined;
|
|
400
390
|
}
|
|
401
|
-
return await this.createCheckpointAttestationsFromProposal(proposal, attestors);
|
|
391
|
+
return await this.createCheckpointAttestationsFromProposal(proposal, attestors, checkpointNumber);
|
|
402
392
|
}
|
|
403
393
|
/**
|
|
404
394
|
* Checks if we should attest to a slot based on equivocation prevention rules.
|
|
@@ -415,176 +405,18 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
415
405
|
}
|
|
416
406
|
return true;
|
|
417
407
|
}
|
|
418
|
-
async createCheckpointAttestationsFromProposal(proposal, attestors = []) {
|
|
408
|
+
async createCheckpointAttestationsFromProposal(proposal, attestors = [], checkpointNumber) {
|
|
419
409
|
// Equivocation check: must happen right before signing to minimize the race window
|
|
420
410
|
if (!this.shouldAttestToSlot(proposal.slotNumber)) {
|
|
421
411
|
return undefined;
|
|
422
412
|
}
|
|
423
|
-
const attestations = await this.validationService.attestToCheckpointProposal(proposal, attestors);
|
|
413
|
+
const attestations = await this.validationService.attestToCheckpointProposal(proposal, attestors, checkpointNumber);
|
|
424
414
|
// Track the proposal we attested to (to prevent equivocation)
|
|
425
415
|
this.lastAttestedProposal = proposal;
|
|
426
416
|
await this.p2pClient.addOwnCheckpointAttestations(attestations);
|
|
427
417
|
return attestations;
|
|
428
418
|
}
|
|
429
419
|
/**
|
|
430
|
-
* Validates a checkpoint proposal by building the full checkpoint and comparing it with the proposal.
|
|
431
|
-
* @returns Validation result with isValid flag and reason if invalid.
|
|
432
|
-
*/ async validateCheckpointProposal(proposal, proposalInfo) {
|
|
433
|
-
const slot = proposal.slotNumber;
|
|
434
|
-
// Timeout block syncing at the start of the next slot
|
|
435
|
-
const config = this.checkpointsBuilder.getConfig();
|
|
436
|
-
const nextSlotTimestampSeconds = Number(getTimestampForSlot(SlotNumber(slot + 1), config));
|
|
437
|
-
const timeoutSeconds = Math.max(1, nextSlotTimestampSeconds - Math.floor(this.dateProvider.now() / 1000));
|
|
438
|
-
// Wait for last block to sync by archive
|
|
439
|
-
let lastBlockHeader;
|
|
440
|
-
try {
|
|
441
|
-
lastBlockHeader = await retryUntil(async ()=>{
|
|
442
|
-
await this.blockSource.syncImmediate();
|
|
443
|
-
return this.blockSource.getBlockHeaderByArchive(proposal.archive);
|
|
444
|
-
}, `waiting for block with archive ${proposal.archive.toString()} for slot ${slot}`, timeoutSeconds, 0.5);
|
|
445
|
-
} catch (err) {
|
|
446
|
-
if (err instanceof TimeoutError) {
|
|
447
|
-
this.log.warn(`Timed out waiting for block with archive matching checkpoint proposal`, proposalInfo);
|
|
448
|
-
return {
|
|
449
|
-
isValid: false,
|
|
450
|
-
reason: 'last_block_not_found'
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
this.log.error(`Error fetching last block for checkpoint proposal`, err, proposalInfo);
|
|
454
|
-
return {
|
|
455
|
-
isValid: false,
|
|
456
|
-
reason: 'block_fetch_error'
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
if (!lastBlockHeader) {
|
|
460
|
-
this.log.warn(`Last block not found for checkpoint proposal`, proposalInfo);
|
|
461
|
-
return {
|
|
462
|
-
isValid: false,
|
|
463
|
-
reason: 'last_block_not_found'
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
// Get all full blocks for the slot and checkpoint
|
|
467
|
-
const blocks = await this.blockSource.getBlocksForSlot(slot);
|
|
468
|
-
if (blocks.length === 0) {
|
|
469
|
-
this.log.warn(`No blocks found for slot ${slot}`, proposalInfo);
|
|
470
|
-
return {
|
|
471
|
-
isValid: false,
|
|
472
|
-
reason: 'no_blocks_for_slot'
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
// Ensure the last block for this slot matches the archive in the checkpoint proposal
|
|
476
|
-
if (!blocks.at(-1)?.archive.root.equals(proposal.archive)) {
|
|
477
|
-
this.log.warn(`Last block archive mismatch for checkpoint proposal`, proposalInfo);
|
|
478
|
-
return {
|
|
479
|
-
isValid: false,
|
|
480
|
-
reason: 'last_block_archive_mismatch'
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
this.log.debug(`Found ${blocks.length} blocks for slot ${slot}`, {
|
|
484
|
-
...proposalInfo,
|
|
485
|
-
blockNumbers: blocks.map((b)=>b.number)
|
|
486
|
-
});
|
|
487
|
-
// Get checkpoint constants from first block
|
|
488
|
-
const firstBlock = blocks[0];
|
|
489
|
-
const constants = this.extractCheckpointConstants(firstBlock);
|
|
490
|
-
const checkpointNumber = firstBlock.checkpointNumber;
|
|
491
|
-
// Get L1-to-L2 messages for this checkpoint
|
|
492
|
-
const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(checkpointNumber);
|
|
493
|
-
// Collect the out hashes of all the checkpoints before this one in the same epoch
|
|
494
|
-
const epoch = getEpochAtSlot(slot, this.epochCache.getL1Constants());
|
|
495
|
-
const previousCheckpointOutHashes = (await this.blockSource.getCheckpointsDataForEpoch(epoch)).filter((c)=>c.checkpointNumber < checkpointNumber).map((c)=>c.checkpointOutHash);
|
|
496
|
-
// Fork world state at the block before the first block
|
|
497
|
-
const parentBlockNumber = BlockNumber(firstBlock.number - 1);
|
|
498
|
-
const fork = await this.worldState.fork(parentBlockNumber);
|
|
499
|
-
try {
|
|
500
|
-
// Create checkpoint builder with all existing blocks
|
|
501
|
-
const checkpointBuilder = await this.checkpointsBuilder.openCheckpoint(checkpointNumber, constants, proposal.feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, blocks, this.log.getBindings());
|
|
502
|
-
// Complete the checkpoint to get computed values
|
|
503
|
-
const computedCheckpoint = await checkpointBuilder.completeCheckpoint();
|
|
504
|
-
// Compare checkpoint header with proposal
|
|
505
|
-
if (!computedCheckpoint.header.equals(proposal.checkpointHeader)) {
|
|
506
|
-
this.log.warn(`Checkpoint header mismatch`, {
|
|
507
|
-
...proposalInfo,
|
|
508
|
-
computed: computedCheckpoint.header.toInspect(),
|
|
509
|
-
proposal: proposal.checkpointHeader.toInspect()
|
|
510
|
-
});
|
|
511
|
-
return {
|
|
512
|
-
isValid: false,
|
|
513
|
-
reason: 'checkpoint_header_mismatch'
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
// Compare archive root with proposal
|
|
517
|
-
if (!computedCheckpoint.archive.root.equals(proposal.archive)) {
|
|
518
|
-
this.log.warn(`Archive root mismatch`, {
|
|
519
|
-
...proposalInfo,
|
|
520
|
-
computed: computedCheckpoint.archive.root.toString(),
|
|
521
|
-
proposal: proposal.archive.toString()
|
|
522
|
-
});
|
|
523
|
-
return {
|
|
524
|
-
isValid: false,
|
|
525
|
-
reason: 'archive_mismatch'
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
// Check that the accumulated epoch out hash matches the value in the proposal.
|
|
529
|
-
// The epoch out hash is the accumulated hash of all checkpoint out hashes in the epoch.
|
|
530
|
-
const checkpointOutHash = computedCheckpoint.getCheckpointOutHash();
|
|
531
|
-
const computedEpochOutHash = accumulateCheckpointOutHashes([
|
|
532
|
-
...previousCheckpointOutHashes,
|
|
533
|
-
checkpointOutHash
|
|
534
|
-
]);
|
|
535
|
-
const proposalEpochOutHash = proposal.checkpointHeader.epochOutHash;
|
|
536
|
-
if (!computedEpochOutHash.equals(proposalEpochOutHash)) {
|
|
537
|
-
this.log.warn(`Epoch out hash mismatch`, {
|
|
538
|
-
proposalEpochOutHash: proposalEpochOutHash.toString(),
|
|
539
|
-
computedEpochOutHash: computedEpochOutHash.toString(),
|
|
540
|
-
checkpointOutHash: checkpointOutHash.toString(),
|
|
541
|
-
previousCheckpointOutHashes: previousCheckpointOutHashes.map((h)=>h.toString()),
|
|
542
|
-
...proposalInfo
|
|
543
|
-
});
|
|
544
|
-
return {
|
|
545
|
-
isValid: false,
|
|
546
|
-
reason: 'out_hash_mismatch'
|
|
547
|
-
};
|
|
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
|
-
}
|
|
565
|
-
this.log.verbose(`Checkpoint proposal validation successful for slot ${slot}`, proposalInfo);
|
|
566
|
-
return {
|
|
567
|
-
isValid: true
|
|
568
|
-
};
|
|
569
|
-
} finally{
|
|
570
|
-
await fork.close();
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* Extract checkpoint global variables from a block.
|
|
575
|
-
*/ extractCheckpointConstants(block) {
|
|
576
|
-
const gv = block.header.globalVariables;
|
|
577
|
-
return {
|
|
578
|
-
chainId: gv.chainId,
|
|
579
|
-
version: gv.version,
|
|
580
|
-
slotNumber: gv.slotNumber,
|
|
581
|
-
timestamp: gv.timestamp,
|
|
582
|
-
coinbase: gv.coinbase,
|
|
583
|
-
feeRecipient: gv.feeRecipient,
|
|
584
|
-
gasFees: gv.gasFees
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
420
|
* Uploads blobs for a checkpoint to the filestore (fire and forget).
|
|
589
421
|
*/ async uploadBlobsForCheckpoint(proposal, proposalInfo) {
|
|
590
422
|
try {
|
|
@@ -669,7 +501,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
669
501
|
}
|
|
670
502
|
]);
|
|
671
503
|
}
|
|
672
|
-
async createBlockProposal(blockHeader, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, options = {}) {
|
|
504
|
+
async createBlockProposal(blockHeader, checkpointNumber, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, options = {}) {
|
|
673
505
|
// Validate that we're not creating a proposal for an older or equal position
|
|
674
506
|
if (this.lastProposedBlock) {
|
|
675
507
|
const lastSlot = this.lastProposedBlock.slotNumber;
|
|
@@ -680,14 +512,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
680
512
|
}
|
|
681
513
|
}
|
|
682
514
|
this.log.info(`Assembling block proposal for block ${blockHeader.globalVariables.blockNumber} slot ${blockHeader.globalVariables.slotNumber}`);
|
|
683
|
-
const newProposal = await this.validationService.createBlockProposal(blockHeader, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, {
|
|
515
|
+
const newProposal = await this.validationService.createBlockProposal(blockHeader, checkpointNumber, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, {
|
|
684
516
|
...options,
|
|
685
517
|
broadcastInvalidBlockProposal: this.config.broadcastInvalidBlockProposal
|
|
686
518
|
});
|
|
687
519
|
this.lastProposedBlock = newProposal;
|
|
688
520
|
return newProposal;
|
|
689
521
|
}
|
|
690
|
-
async createCheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier,
|
|
522
|
+
async createCheckpointProposal(checkpointHeader, archive, checkpointNumber, feeAssetPriceModifier, lastBlockProposal, proposerAddress, options = {}) {
|
|
691
523
|
// Validate that we're not creating a proposal for an older or equal slot
|
|
692
524
|
if (this.lastProposedCheckpoint) {
|
|
693
525
|
const lastSlot = this.lastProposedCheckpoint.slotNumber;
|
|
@@ -697,23 +529,23 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
697
529
|
}
|
|
698
530
|
}
|
|
699
531
|
this.log.info(`Assembling checkpoint proposal for slot ${checkpointHeader.slotNumber}`);
|
|
700
|
-
const newProposal = await this.validationService.createCheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier,
|
|
532
|
+
const newProposal = await this.validationService.createCheckpointProposal(checkpointHeader, archive, checkpointNumber, feeAssetPriceModifier, lastBlockProposal, proposerAddress, options);
|
|
701
533
|
this.lastProposedCheckpoint = newProposal;
|
|
702
534
|
return newProposal;
|
|
703
535
|
}
|
|
704
536
|
async broadcastBlockProposal(proposal) {
|
|
705
537
|
await this.p2pClient.broadcastProposal(proposal);
|
|
706
538
|
}
|
|
707
|
-
async signAttestationsAndSigners(attestationsAndSigners, proposer, slot,
|
|
708
|
-
return await this.validationService.signAttestationsAndSigners(attestationsAndSigners, proposer, slot,
|
|
539
|
+
async signAttestationsAndSigners(attestationsAndSigners, proposer, slot, checkpointNumber) {
|
|
540
|
+
return await this.validationService.signAttestationsAndSigners(attestationsAndSigners, proposer, slot, checkpointNumber);
|
|
709
541
|
}
|
|
710
|
-
async collectOwnAttestations(proposal) {
|
|
542
|
+
async collectOwnAttestations(proposal, checkpointNumber) {
|
|
711
543
|
const slot = proposal.slotNumber;
|
|
712
544
|
const inCommittee = await this.epochCache.filterInCommittee(slot, this.getValidatorAddresses());
|
|
713
545
|
this.log.debug(`Collecting ${inCommittee.length} self-attestations for slot ${slot}`, {
|
|
714
546
|
inCommittee
|
|
715
547
|
});
|
|
716
|
-
const attestations = await this.createCheckpointAttestationsFromProposal(proposal, inCommittee);
|
|
548
|
+
const attestations = await this.createCheckpointAttestationsFromProposal(proposal, inCommittee, checkpointNumber);
|
|
717
549
|
if (!attestations) {
|
|
718
550
|
return [];
|
|
719
551
|
}
|
|
@@ -725,7 +557,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
725
557
|
});
|
|
726
558
|
return attestations;
|
|
727
559
|
}
|
|
728
|
-
async collectAttestations(proposal, required, deadline) {
|
|
560
|
+
async collectAttestations(proposal, required, deadline, checkpointNumber) {
|
|
729
561
|
// Wait and poll the p2pClient's attestation pool for this checkpoint until we have enough attestations
|
|
730
562
|
const slot = proposal.slotNumber;
|
|
731
563
|
this.log.debug(`Collecting ${required} attestations for slot ${slot} with deadline ${deadline.toISOString()}`);
|
|
@@ -733,7 +565,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
733
565
|
this.log.error(`Deadline ${deadline.toISOString()} for collecting ${required} attestations for slot ${slot} is in the past`);
|
|
734
566
|
throw new AttestationTimeoutError(0, required, slot);
|
|
735
567
|
}
|
|
736
|
-
await this.collectOwnAttestations(proposal);
|
|
568
|
+
await this.collectOwnAttestations(proposal, checkpointNumber);
|
|
737
569
|
const proposalId = proposal.archive.toString();
|
|
738
570
|
const myAddresses = this.getValidatorAddresses();
|
|
739
571
|
let attestations = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/validator-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.11bf3dd6e",
|
|
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": "0.0.1-commit.
|
|
68
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
69
|
-
"@aztec/constants": "0.0.1-commit.
|
|
70
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
71
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
72
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
73
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
74
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
75
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
76
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
77
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
78
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
79
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
80
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
81
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
82
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
67
|
+
"@aztec/blob-client": "0.0.1-commit.11bf3dd6e",
|
|
68
|
+
"@aztec/blob-lib": "0.0.1-commit.11bf3dd6e",
|
|
69
|
+
"@aztec/constants": "0.0.1-commit.11bf3dd6e",
|
|
70
|
+
"@aztec/epoch-cache": "0.0.1-commit.11bf3dd6e",
|
|
71
|
+
"@aztec/ethereum": "0.0.1-commit.11bf3dd6e",
|
|
72
|
+
"@aztec/foundation": "0.0.1-commit.11bf3dd6e",
|
|
73
|
+
"@aztec/node-keystore": "0.0.1-commit.11bf3dd6e",
|
|
74
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.11bf3dd6e",
|
|
75
|
+
"@aztec/p2p": "0.0.1-commit.11bf3dd6e",
|
|
76
|
+
"@aztec/protocol-contracts": "0.0.1-commit.11bf3dd6e",
|
|
77
|
+
"@aztec/prover-client": "0.0.1-commit.11bf3dd6e",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.11bf3dd6e",
|
|
79
|
+
"@aztec/slasher": "0.0.1-commit.11bf3dd6e",
|
|
80
|
+
"@aztec/stdlib": "0.0.1-commit.11bf3dd6e",
|
|
81
|
+
"@aztec/telemetry-client": "0.0.1-commit.11bf3dd6e",
|
|
82
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.11bf3dd6e",
|
|
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": "0.0.1-commit.
|
|
90
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
89
|
+
"@aztec/archiver": "0.0.1-commit.11bf3dd6e",
|
|
90
|
+
"@aztec/world-state": "0.0.1-commit.11bf3dd6e",
|
|
91
91
|
"@electric-sql/pglite": "^0.3.14",
|
|
92
92
|
"@jest/globals": "^30.0.0",
|
|
93
93
|
"@types/jest": "^30.0.0",
|