@aztec/validator-client 6.0.0-nightly.20260810 → 6.0.0-nightly.20260821
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 +5 -5
- package/dest/checkpoint_builder.d.ts +6 -3
- package/dest/checkpoint_builder.d.ts.map +1 -1
- package/dest/checkpoint_builder.js +14 -10
- package/dest/duties/validation_service.d.ts +3 -3
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +2 -3
- package/dest/factory.d.ts +2 -2
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +1 -13
- package/dest/metrics.d.ts +1 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +0 -1
- package/dest/proposal_handler.d.ts +32 -10
- package/dest/proposal_handler.d.ts.map +1 -1
- package/dest/proposal_handler.js +181 -46
- package/dest/streaming_inbox_checks.d.ts +103 -0
- package/dest/streaming_inbox_checks.d.ts.map +1 -0
- package/dest/streaming_inbox_checks.js +112 -0
- package/dest/validator.d.ts +6 -6
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +5 -18
- package/package.json +19 -19
- package/src/checkpoint_builder.ts +25 -11
- package/src/duties/validation_service.ts +3 -3
- package/src/factory.ts +1 -13
- package/src/metrics.ts +0 -1
- package/src/proposal_handler.ts +229 -40
- package/src/streaming_inbox_checks.ts +198 -0
- package/src/validator.ts +10 -22
package/src/validator.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { sleep } from '@aztec/foundation/sleep';
|
|
|
12
12
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
13
13
|
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
14
14
|
import type { DuplicateAttestationInfo, DuplicateProposalInfo, OversizedProposalInfo, P2P, PeerId } from '@aztec/p2p';
|
|
15
|
-
import { AuthRequest, AuthResponse,
|
|
15
|
+
import { AuthRequest, AuthResponse, ReqRespSubProtocol } from '@aztec/p2p';
|
|
16
16
|
import {
|
|
17
17
|
OffenseType,
|
|
18
18
|
WANT_TO_CLEAR_SLASH_EVENT,
|
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
ValidatorClientFullConfig,
|
|
32
32
|
WorldStateSynchronizer,
|
|
33
33
|
} from '@aztec/stdlib/interfaces/server';
|
|
34
|
-
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
34
|
+
import type { InboxBucketRef, L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
35
35
|
import {
|
|
36
36
|
type BlockProposal,
|
|
37
37
|
type BlockProposalOptions,
|
|
@@ -40,6 +40,8 @@ import {
|
|
|
40
40
|
type CheckpointProposalCore,
|
|
41
41
|
type CheckpointProposalOptions,
|
|
42
42
|
type CoordinationSignatureContext,
|
|
43
|
+
type ValidatedBlockProposal,
|
|
44
|
+
type ValidatedCheckpointProposalCore,
|
|
43
45
|
} from '@aztec/stdlib/p2p';
|
|
44
46
|
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
45
47
|
import { ConsensusTimetable } from '@aztec/stdlib/timetable';
|
|
@@ -58,7 +60,6 @@ import { EventEmitter } from 'events';
|
|
|
58
60
|
import type { TypedDataDefinition } from 'viem';
|
|
59
61
|
|
|
60
62
|
import type { FullNodeCheckpointsBuilder } from './checkpoint_builder.js';
|
|
61
|
-
import { DEFAULT_MAX_GOSSIP_CLOCK_DISPARITY_MS } from './config.js';
|
|
62
63
|
import { ValidationService } from './duties/validation_service.js';
|
|
63
64
|
import { HAKeyStore } from './key_store/ha_key_store.js';
|
|
64
65
|
import type { ExtendedValidatorKeyStore } from './key_store/interface.js';
|
|
@@ -221,24 +222,12 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
221
222
|
l1Constants: epochCache.getL1Constants(),
|
|
222
223
|
blockDuration: config.blockDurationMs / 1000,
|
|
223
224
|
});
|
|
224
|
-
const blockProposalValidator = new BlockProposalValidator(epochCache, consensusTimetable, {
|
|
225
|
-
txsPermitted: !config.disableTransactions,
|
|
226
|
-
maxTxsPerBlock: config.validateMaxTxsPerBlock,
|
|
227
|
-
maxBlocksPerCheckpoint: config.maxBlocksPerCheckpoint,
|
|
228
|
-
skipSlotValidation: config.skipProposalSlotValidation,
|
|
229
|
-
signatureContext: {
|
|
230
|
-
chainId: config.l1ChainId,
|
|
231
|
-
rollupAddress: config.rollupAddress,
|
|
232
|
-
},
|
|
233
|
-
clockDisparityMs: config.maxGossipClockDisparityMs ?? DEFAULT_MAX_GOSSIP_CLOCK_DISPARITY_MS,
|
|
234
|
-
});
|
|
235
225
|
const proposalHandler = new ProposalHandler(
|
|
236
226
|
checkpointsBuilder,
|
|
237
227
|
worldState,
|
|
238
228
|
blockSource,
|
|
239
229
|
l1ToL2MessageSource,
|
|
240
230
|
txProvider,
|
|
241
|
-
blockProposalValidator,
|
|
242
231
|
epochCache,
|
|
243
232
|
consensusTimetable,
|
|
244
233
|
config,
|
|
@@ -387,7 +376,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
387
376
|
this.log.debug(`Registering validator handlers for p2p client`);
|
|
388
377
|
|
|
389
378
|
// Block proposal handler - validates but does NOT attest (validators only attest to checkpoints)
|
|
390
|
-
const blockHandler = (block:
|
|
379
|
+
const blockHandler = (block: ValidatedBlockProposal, proposalSender: PeerId): Promise<boolean> =>
|
|
391
380
|
this.validateBlockProposal(block, proposalSender);
|
|
392
381
|
this.p2pClient.registerBlockProposalHandler(blockHandler);
|
|
393
382
|
|
|
@@ -395,7 +384,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
395
384
|
// The checkpoint is received as CheckpointProposalCore since the lastBlock is extracted
|
|
396
385
|
// and processed separately via the block handler above.
|
|
397
386
|
const checkpointHandler = (
|
|
398
|
-
checkpoint:
|
|
387
|
+
checkpoint: ValidatedCheckpointProposalCore,
|
|
399
388
|
proposalSender: PeerId,
|
|
400
389
|
): Promise<CheckpointAttestation[] | undefined> => this.attestToCheckpointProposal(checkpoint, proposalSender);
|
|
401
390
|
this.p2pClient.registerValidatorCheckpointProposalHandler(checkpointHandler);
|
|
@@ -431,7 +420,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
431
420
|
* Note: Validators do NOT attest to individual blocks - attestations are only for checkpoint proposals.
|
|
432
421
|
* @returns true if the proposal is valid, false otherwise
|
|
433
422
|
*/
|
|
434
|
-
async validateBlockProposal(proposal:
|
|
423
|
+
async validateBlockProposal(proposal: ValidatedBlockProposal, proposalSender: PeerId): Promise<boolean> {
|
|
435
424
|
const slotNumber = proposal.slotNumber;
|
|
436
425
|
|
|
437
426
|
// Note: During escape hatch, we still want to "validate" proposals for observability,
|
|
@@ -478,7 +467,6 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
478
467
|
'invalid_proposal',
|
|
479
468
|
'state_mismatch',
|
|
480
469
|
'failed_txs',
|
|
481
|
-
'in_hash_mismatch',
|
|
482
470
|
'parent_block_wrong_slot',
|
|
483
471
|
'duplicate_txs',
|
|
484
472
|
'invalid_embedded_txs',
|
|
@@ -529,7 +517,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
529
517
|
* @returns Checkpoint attestations if valid, undefined otherwise
|
|
530
518
|
*/
|
|
531
519
|
async attestToCheckpointProposal(
|
|
532
|
-
proposal:
|
|
520
|
+
proposal: ValidatedCheckpointProposalCore,
|
|
533
521
|
_proposalSender: PeerId,
|
|
534
522
|
): Promise<CheckpointAttestation[] | undefined> {
|
|
535
523
|
const proposalSlotNumber = proposal.slotNumber;
|
|
@@ -919,11 +907,11 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
919
907
|
blockHeader: BlockHeader,
|
|
920
908
|
checkpointNumber: CheckpointNumber,
|
|
921
909
|
indexWithinCheckpoint: IndexWithinCheckpoint,
|
|
922
|
-
inHash: Fr,
|
|
923
910
|
archive: Fr,
|
|
924
911
|
txs: Tx[],
|
|
925
912
|
proposerAddress: EthAddress | undefined,
|
|
926
913
|
options: BlockProposalOptions = {},
|
|
914
|
+
bucketRef?: InboxBucketRef,
|
|
927
915
|
): Promise<BlockProposal> {
|
|
928
916
|
// Validate that we're not creating a proposal for an older or equal position
|
|
929
917
|
if (this.lastProposedBlock) {
|
|
@@ -946,7 +934,6 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
946
934
|
blockHeader,
|
|
947
935
|
checkpointNumber,
|
|
948
936
|
indexWithinCheckpoint,
|
|
949
|
-
inHash,
|
|
950
937
|
archive,
|
|
951
938
|
txs,
|
|
952
939
|
proposerAddress,
|
|
@@ -955,6 +942,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
955
942
|
broadcastInvalidBlockProposal:
|
|
956
943
|
options.broadcastInvalidBlockProposal || this.config.broadcastInvalidBlockProposal,
|
|
957
944
|
},
|
|
945
|
+
bucketRef,
|
|
958
946
|
);
|
|
959
947
|
this.lastProposedBlock = newProposal;
|
|
960
948
|
return newProposal;
|