@aztec/validator-client 0.0.1-commit.3469e52 → 0.0.1-commit.3895657bc
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 +64 -19
- package/dest/block_proposal_handler.d.ts +7 -9
- package/dest/block_proposal_handler.d.ts.map +1 -1
- package/dest/block_proposal_handler.js +71 -81
- package/dest/checkpoint_builder.d.ts +22 -13
- package/dest/checkpoint_builder.d.ts.map +1 -1
- package/dest/checkpoint_builder.js +107 -39
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +30 -7
- package/dest/duties/validation_service.d.ts +2 -2
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +5 -11
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +2 -1
- package/dest/index.d.ts +1 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +0 -1
- package/dest/key_store/ha_key_store.d.ts +1 -1
- package/dest/key_store/ha_key_store.d.ts.map +1 -1
- package/dest/key_store/ha_key_store.js +2 -2
- package/dest/metrics.d.ts +12 -3
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +46 -5
- package/dest/validator.d.ts +40 -14
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +212 -56
- package/package.json +19 -17
- package/src/block_proposal_handler.ts +87 -109
- package/src/checkpoint_builder.ts +146 -40
- package/src/config.ts +30 -7
- package/src/duties/validation_service.ts +11 -10
- package/src/factory.ts +1 -0
- package/src/index.ts +0 -1
- package/src/key_store/ha_key_store.ts +2 -2
- package/src/metrics.ts +63 -6
- package/src/validator.ts +262 -68
- package/dest/tx_validator/index.d.ts +0 -3
- package/dest/tx_validator/index.d.ts.map +0 -1
- package/dest/tx_validator/index.js +0 -2
- package/dest/tx_validator/nullifier_cache.d.ts +0 -14
- package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
- package/dest/tx_validator/nullifier_cache.js +0 -24
- package/dest/tx_validator/tx_validator_factory.d.ts +0 -18
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -54
- package/src/tx_validator/index.ts +0 -2
- package/src/tx_validator/nullifier_cache.ts +0 -30
- package/src/tx_validator/tx_validator_factory.ts +0 -135
package/dest/validator.d.ts
CHANGED
|
@@ -4,21 +4,21 @@ import { BlockNumber, CheckpointNumber, IndexWithinCheckpoint, SlotNumber } from
|
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
6
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
7
|
-
import { type Logger } from '@aztec/foundation/log';
|
|
7
|
+
import { type LogData, type Logger } from '@aztec/foundation/log';
|
|
8
8
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
9
|
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
10
|
-
import type { P2P, PeerId
|
|
10
|
+
import type { P2P, PeerId } from '@aztec/p2p';
|
|
11
11
|
import { type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
12
12
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
13
|
import type { CommitteeAttestationsAndSigners, L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
|
|
14
|
-
import type { CreateCheckpointProposalLastBlockData, Validator, ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
15
|
-
import type
|
|
16
|
-
import type
|
|
17
|
-
import { CheckpointProposal } from '@aztec/stdlib/p2p';
|
|
14
|
+
import type { CreateCheckpointProposalLastBlockData, ITxProvider, Validator, ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
15
|
+
import { type L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
16
|
+
import { type BlockProposal, type BlockProposalOptions, type CheckpointAttestation, CheckpointProposal, type CheckpointProposalCore, type CheckpointProposalOptions } from '@aztec/stdlib/p2p';
|
|
18
17
|
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
19
18
|
import type { BlockHeader, Tx } from '@aztec/stdlib/tx';
|
|
20
19
|
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
21
20
|
import { type SigningContext } from '@aztec/validator-ha-signer/types';
|
|
21
|
+
import type { ValidatorHASigner } from '@aztec/validator-ha-signer/validator-ha-signer';
|
|
22
22
|
import type { TypedDataDefinition } from 'viem';
|
|
23
23
|
import { BlockProposalHandler } from './block_proposal_handler.js';
|
|
24
24
|
import type { FullNodeCheckpointsBuilder } from './checkpoint_builder.js';
|
|
@@ -38,21 +38,28 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
38
38
|
private l1ToL2MessageSource;
|
|
39
39
|
private config;
|
|
40
40
|
private blobClient;
|
|
41
|
+
private slashingProtectionSigner;
|
|
41
42
|
private dateProvider;
|
|
42
43
|
readonly tracer: Tracer;
|
|
43
44
|
private validationService;
|
|
44
45
|
private metrics;
|
|
45
46
|
private log;
|
|
46
47
|
private hasRegisteredHandlers;
|
|
47
|
-
|
|
48
|
+
/** Tracks the last block proposal we created, to detect duplicate proposal attempts. */
|
|
49
|
+
private lastProposedBlock?;
|
|
50
|
+
/** Tracks the last checkpoint proposal we created. */
|
|
51
|
+
private lastProposedCheckpoint?;
|
|
48
52
|
private lastEpochForCommitteeUpdateLoop;
|
|
49
53
|
private epochCacheUpdateLoop;
|
|
54
|
+
/** Tracks the last epoch in which each attester successfully submitted at least one attestation. */
|
|
55
|
+
private lastAttestedEpochByAttester;
|
|
50
56
|
private proposersOfInvalidBlocks;
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
/** Tracks the last checkpoint proposal we attested to, to prevent equivocation. */
|
|
58
|
+
private lastAttestedProposal?;
|
|
59
|
+
protected constructor(keyStore: ExtendedValidatorKeyStore, epochCache: EpochCache, p2pClient: P2P, blockProposalHandler: BlockProposalHandler, blockSource: L2BlockSource, checkpointsBuilder: FullNodeCheckpointsBuilder, worldState: WorldStateSynchronizer, l1ToL2MessageSource: L1ToL2MessageSource, config: ValidatorClientFullConfig, blobClient: BlobClientInterface, slashingProtectionSigner: ValidatorHASigner, dateProvider?: DateProvider, telemetry?: TelemetryClient, log?: Logger);
|
|
53
60
|
static validateKeyStoreConfiguration(keyStoreManager: KeystoreManager, logger?: Logger): void;
|
|
54
61
|
private handleEpochCommitteeUpdate;
|
|
55
|
-
static new(config: ValidatorClientFullConfig, checkpointsBuilder: FullNodeCheckpointsBuilder, worldState: WorldStateSynchronizer, epochCache: EpochCache, p2pClient: P2P, blockSource: L2BlockSource & L2BlockSink, l1ToL2MessageSource: L1ToL2MessageSource, txProvider:
|
|
62
|
+
static new(config: ValidatorClientFullConfig, checkpointsBuilder: FullNodeCheckpointsBuilder, worldState: WorldStateSynchronizer, epochCache: EpochCache, p2pClient: P2P, blockSource: L2BlockSource & L2BlockSink, l1ToL2MessageSource: L1ToL2MessageSource, txProvider: ITxProvider, keyStoreManager: KeystoreManager, blobClient: BlobClientInterface, dateProvider?: DateProvider, telemetry?: TelemetryClient): Promise<ValidatorClient>;
|
|
56
63
|
getValidatorAddresses(): EthAddress[];
|
|
57
64
|
getBlockProposalHandler(): BlockProposalHandler;
|
|
58
65
|
signWithAddress(addr: EthAddress, msg: TypedDataDefinition, context: SigningContext): Promise<Signature>;
|
|
@@ -60,6 +67,7 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
60
67
|
getFeeRecipientForAttestor(attestor: EthAddress): AztecAddress;
|
|
61
68
|
getConfig(): ValidatorClientFullConfig;
|
|
62
69
|
updateConfig(config: Partial<ValidatorClientFullConfig>): void;
|
|
70
|
+
reloadKeystore(newManager: KeystoreManager): void;
|
|
63
71
|
start(): Promise<void>;
|
|
64
72
|
stop(): Promise<void>;
|
|
65
73
|
/** Register handlers on the p2p client */
|
|
@@ -77,16 +85,34 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
77
85
|
* @returns Checkpoint attestations if valid, undefined otherwise
|
|
78
86
|
*/
|
|
79
87
|
attestToCheckpointProposal(proposal: CheckpointProposalCore, _proposalSender: PeerId): Promise<CheckpointAttestation[] | undefined>;
|
|
88
|
+
/**
|
|
89
|
+
* Checks if we should attest to a slot based on equivocation prevention rules.
|
|
90
|
+
* @returns true if we should attest, false if we should skip
|
|
91
|
+
*/
|
|
92
|
+
private shouldAttestToSlot;
|
|
80
93
|
private createCheckpointAttestationsFromProposal;
|
|
81
94
|
private validateCheckpointProposal;
|
|
82
95
|
/**
|
|
83
96
|
* Extract checkpoint global variables from a block.
|
|
84
97
|
*/
|
|
85
98
|
private extractCheckpointConstants;
|
|
86
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Uploads blobs for a checkpoint to the filestore (fire and forget).
|
|
101
|
+
*/
|
|
102
|
+
protected uploadBlobsForCheckpoint(proposal: CheckpointProposalCore, proposalInfo: LogData): Promise<void>;
|
|
87
103
|
private slashInvalidBlock;
|
|
88
|
-
|
|
89
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Handle detection of a duplicate proposal (equivocation).
|
|
106
|
+
* Emits a slash event when a proposer sends multiple proposals for the same position.
|
|
107
|
+
*/
|
|
108
|
+
private handleDuplicateProposal;
|
|
109
|
+
/**
|
|
110
|
+
* Handle detection of a duplicate attestation (equivocation).
|
|
111
|
+
* Emits a slash event when an attester signs attestations for different proposals at the same slot.
|
|
112
|
+
*/
|
|
113
|
+
private handleDuplicateAttestation;
|
|
114
|
+
createBlockProposal(blockHeader: BlockHeader, indexWithinCheckpoint: IndexWithinCheckpoint, inHash: Fr, archive: Fr, txs: Tx[], proposerAddress: EthAddress | undefined, options?: BlockProposalOptions): Promise<BlockProposal>;
|
|
115
|
+
createCheckpointProposal(checkpointHeader: CheckpointHeader, archive: Fr, feeAssetPriceModifier: bigint, lastBlockInfo: CreateCheckpointProposalLastBlockData | undefined, proposerAddress: EthAddress | undefined, options?: CheckpointProposalOptions): Promise<CheckpointProposal>;
|
|
90
116
|
broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
|
|
91
117
|
signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress, slot: SlotNumber, blockNumber: BlockNumber | CheckpointNumber): Promise<Signature>;
|
|
92
118
|
collectOwnAttestations(proposal: CheckpointProposal): Promise<CheckpointAttestation[]>;
|
|
@@ -94,4 +120,4 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
94
120
|
private handleAuthRequest;
|
|
95
121
|
}
|
|
96
122
|
export {};
|
|
97
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
123
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdmFsaWRhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFckUsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFckQsT0FBTyxFQUNMLFdBQVcsRUFDWCxnQkFBZ0IsRUFFaEIscUJBQXFCLEVBQ3JCLFVBQVUsRUFDWCxNQUFNLGlDQUFpQyxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUVwRCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsS0FBSyxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFJ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FBQWEsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRW5FO0lBRUssMEJBQTBCLENBQzlCLHNCQUFzQixFQUFFLCtCQUErQixFQUN2RCxRQUFRLEVBQUUsVUFBVSxFQUNwQixJQUFJLEVBQUUsVUFBVSxFQUNoQixXQUFXLEVBQUUsV0FBVyxHQUFHLGdCQUFnQixHQUMxQyxPQUFPLENBQUMsU0FBUyxDQUFDLENBRXBCO0lBRUssc0JBQXNCLENBQUMsUUFBUSxFQUFFLGtCQUFrQixHQUFHLE9BQU8sQ0FBQyxxQkFBcUIsRUFBRSxDQUFDLENBaUIzRjtJQUVLLG1CQUFtQixDQUN2QixRQUFRLEVBQUUsa0JBQWtCLEVBQzVCLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLFFBQVEsRUFBRSxJQUFJLEdBQ2IsT0FBTyxDQUFDLHFCQUFxQixFQUFFLENBQUMsQ0FpRWxDO1lBRWEsaUJBQWlCO0NBd0JoQyJ9
|
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,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,WAAW,EACX,gBAAgB,EAEhB,qBAAqB,EACrB,UAAU,EACX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;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CAAC,CAEpB;IAEK,sBAAsB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAiB3F;IAEK,mBAAmB,CACvB,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,IAAI,GACb,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAiElC;YAEa,iBAAiB;CAwBhC"}
|
package/dest/validator.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getBlobsPerL1Block } from '@aztec/blob-lib';
|
|
2
|
-
import {
|
|
2
|
+
import { validateFeeAssetPriceModifier } from '@aztec/ethereum/contracts';
|
|
3
|
+
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { TimeoutError } from '@aztec/foundation/error';
|
|
4
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
6
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -8,10 +9,12 @@ import { sleep } from '@aztec/foundation/sleep';
|
|
|
8
9
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
10
|
import { AuthRequest, AuthResponse, BlockProposalValidator, ReqRespSubProtocol } from '@aztec/p2p';
|
|
10
11
|
import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
|
|
11
|
-
import {
|
|
12
|
+
import { validateCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
13
|
+
import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
14
|
+
import { accumulateCheckpointOutHashes } from '@aztec/stdlib/messaging';
|
|
12
15
|
import { AttestationTimeoutError } from '@aztec/stdlib/validators';
|
|
13
16
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
14
|
-
import { createHASigner } from '@aztec/validator-ha-signer/factory';
|
|
17
|
+
import { createHASigner, createLocalSignerWithProtection } from '@aztec/validator-ha-signer/factory';
|
|
15
18
|
import { DutyType } from '@aztec/validator-ha-signer/types';
|
|
16
19
|
import { EventEmitter } from 'events';
|
|
17
20
|
import { BlockProposalHandler } from './block_proposal_handler.js';
|
|
@@ -40,6 +43,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
40
43
|
l1ToL2MessageSource;
|
|
41
44
|
config;
|
|
42
45
|
blobClient;
|
|
46
|
+
slashingProtectionSigner;
|
|
43
47
|
dateProvider;
|
|
44
48
|
tracer;
|
|
45
49
|
validationService;
|
|
@@ -47,17 +51,15 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
47
51
|
log;
|
|
48
52
|
// Whether it has already registered handlers on the p2p client
|
|
49
53
|
hasRegisteredHandlers;
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
/** Tracks the last block proposal we created, to detect duplicate proposal attempts. */ lastProposedBlock;
|
|
55
|
+
/** Tracks the last checkpoint proposal we created. */ lastProposedCheckpoint;
|
|
52
56
|
lastEpochForCommitteeUpdateLoop;
|
|
53
57
|
epochCacheUpdateLoop;
|
|
58
|
+
/** Tracks the last epoch in which each attester successfully submitted at least one attestation. */ lastAttestedEpochByAttester;
|
|
54
59
|
proposersOfInvalidBlocks;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
validatedBlockSlots;
|
|
59
|
-
constructor(keyStore, epochCache, p2pClient, blockProposalHandler, blockSource, checkpointsBuilder, worldState, l1ToL2MessageSource, config, blobClient, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator')){
|
|
60
|
-
super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.blockProposalHandler = blockProposalHandler, this.blockSource = blockSource, this.checkpointsBuilder = checkpointsBuilder, this.worldState = worldState, this.l1ToL2MessageSource = l1ToL2MessageSource, this.config = config, this.blobClient = blobClient, this.dateProvider = dateProvider, this.hasRegisteredHandlers = false, this.proposersOfInvalidBlocks = new Set(), this.validatedBlockSlots = new Set();
|
|
60
|
+
/** Tracks the last checkpoint proposal we attested to, to prevent equivocation. */ lastAttestedProposal;
|
|
61
|
+
constructor(keyStore, epochCache, p2pClient, blockProposalHandler, blockSource, checkpointsBuilder, worldState, l1ToL2MessageSource, config, blobClient, slashingProtectionSigner, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator')){
|
|
62
|
+
super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.blockProposalHandler = blockProposalHandler, this.blockSource = blockSource, this.checkpointsBuilder = checkpointsBuilder, this.worldState = worldState, this.l1ToL2MessageSource = l1ToL2MessageSource, this.config = config, this.blobClient = blobClient, this.slashingProtectionSigner = slashingProtectionSigner, this.dateProvider = dateProvider, this.hasRegisteredHandlers = false, this.lastAttestedEpochByAttester = new Map(), this.proposersOfInvalidBlocks = new Set();
|
|
61
63
|
// Create child logger with fisherman prefix if in fisherman mode
|
|
62
64
|
this.log = config.fishermanMode ? log.createChild('[FISHERMAN]') : log;
|
|
63
65
|
this.tracer = telemetry.getTracer('Validator');
|
|
@@ -96,6 +98,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
96
98
|
this.log.trace(`No committee found for slot`);
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
101
|
+
this.metrics.setCurrentEpoch(epoch);
|
|
99
102
|
if (epoch !== this.lastEpochForCommitteeUpdateLoop) {
|
|
100
103
|
const me = this.getValidatorAddresses();
|
|
101
104
|
const committeeSet = new Set(committee.map((v)=>v.toString()));
|
|
@@ -114,20 +117,33 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
114
117
|
static async new(config, checkpointsBuilder, worldState, epochCache, p2pClient, blockSource, l1ToL2MessageSource, txProvider, keyStoreManager, blobClient, dateProvider = new DateProvider(), telemetry = getTelemetryClient()) {
|
|
115
118
|
const metrics = new ValidatorMetrics(telemetry);
|
|
116
119
|
const blockProposalValidator = new BlockProposalValidator(epochCache, {
|
|
117
|
-
txsPermitted: !config.disableTransactions
|
|
120
|
+
txsPermitted: !config.disableTransactions,
|
|
121
|
+
maxTxsPerBlock: config.validateMaxTxsPerBlock
|
|
118
122
|
});
|
|
119
123
|
const blockProposalHandler = new BlockProposalHandler(checkpointsBuilder, worldState, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, epochCache, config, metrics, dateProvider, telemetry);
|
|
120
|
-
|
|
124
|
+
const nodeKeystoreAdapter = NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager);
|
|
125
|
+
let slashingProtectionSigner;
|
|
121
126
|
if (config.haSigningEnabled) {
|
|
127
|
+
// Multi-node HA mode: use PostgreSQL-backed distributed locking.
|
|
122
128
|
// If maxStuckDutiesAgeMs is not explicitly set, compute it from Aztec slot duration
|
|
123
129
|
const haConfig = {
|
|
124
130
|
...config,
|
|
125
131
|
maxStuckDutiesAgeMs: config.maxStuckDutiesAgeMs ?? epochCache.getL1Constants().slotDuration * 2 * 1000
|
|
126
132
|
};
|
|
127
|
-
|
|
128
|
-
|
|
133
|
+
({ signer: slashingProtectionSigner } = await createHASigner(haConfig, {
|
|
134
|
+
telemetryClient: telemetry,
|
|
135
|
+
dateProvider
|
|
136
|
+
}));
|
|
137
|
+
} else {
|
|
138
|
+
// Single-node mode: use LMDB-backed local signing protection.
|
|
139
|
+
// This prevents double-signing if the node crashes and restarts mid-proposal.
|
|
140
|
+
({ signer: slashingProtectionSigner } = await createLocalSignerWithProtection(config, {
|
|
141
|
+
telemetryClient: telemetry,
|
|
142
|
+
dateProvider
|
|
143
|
+
}));
|
|
129
144
|
}
|
|
130
|
-
const
|
|
145
|
+
const validatorKeyStore = new HAKeyStore(nodeKeystoreAdapter, slashingProtectionSigner);
|
|
146
|
+
const validator = new ValidatorClient(validatorKeyStore, epochCache, p2pClient, blockProposalHandler, blockSource, checkpointsBuilder, worldState, l1ToL2MessageSource, config, blobClient, slashingProtectionSigner, dateProvider, telemetry);
|
|
131
147
|
return validator;
|
|
132
148
|
}
|
|
133
149
|
getValidatorAddresses() {
|
|
@@ -154,6 +170,11 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
154
170
|
...config
|
|
155
171
|
};
|
|
156
172
|
}
|
|
173
|
+
reloadKeystore(newManager) {
|
|
174
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
175
|
+
this.keyStore = new HAKeyStore(newAdapter, this.slashingProtectionSigner);
|
|
176
|
+
this.validationService = new ValidationService(this.keyStore, this.log.createChild('validation-service'));
|
|
177
|
+
}
|
|
157
178
|
async start() {
|
|
158
179
|
if (this.epochCacheUpdateLoop.isRunning()) {
|
|
159
180
|
this.log.warn(`Validator client already started`);
|
|
@@ -186,6 +207,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
186
207
|
// and processed separately via the block handler above.
|
|
187
208
|
const checkpointHandler = (checkpoint, proposalSender)=>this.attestToCheckpointProposal(checkpoint, proposalSender);
|
|
188
209
|
this.p2pClient.registerCheckpointProposalHandler(checkpointHandler);
|
|
210
|
+
// Duplicate proposal handler - triggers slashing for equivocation
|
|
211
|
+
this.p2pClient.registerDuplicateProposalCallback((info)=>{
|
|
212
|
+
this.handleDuplicateProposal(info);
|
|
213
|
+
});
|
|
214
|
+
// Duplicate attestation handler - triggers slashing for attestation equivocation
|
|
215
|
+
this.p2pClient.registerDuplicateAttestationCallback((info)=>{
|
|
216
|
+
this.handleDuplicateAttestation(info);
|
|
217
|
+
});
|
|
189
218
|
const myAddresses = this.getValidatorAddresses();
|
|
190
219
|
this.p2pClient.registerThisValidatorAddresses(myAddresses);
|
|
191
220
|
await this.p2pClient.addReqRespSubProtocol(ReqRespSubProtocol.AUTH, this.handleAuthRequest.bind(this));
|
|
@@ -206,6 +235,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
206
235
|
this.log.warn(`Received block proposal with invalid signature for slot ${slotNumber}`);
|
|
207
236
|
return false;
|
|
208
237
|
}
|
|
238
|
+
// Ignore proposals from ourselves (may happen in HA setups)
|
|
239
|
+
if (this.getValidatorAddresses().some((addr)=>addr.equals(proposer))) {
|
|
240
|
+
this.log.warn(`Ignoring block proposal from self for slot ${slotNumber}`, {
|
|
241
|
+
proposer: proposer.toString(),
|
|
242
|
+
slotNumber
|
|
243
|
+
});
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
209
246
|
// Check if we're in the committee (for metrics purposes)
|
|
210
247
|
const inCommittee = await this.epochCache.filterInCommittee(slotNumber, this.getValidatorAddresses());
|
|
211
248
|
const partOfCommittee = inCommittee.length > 0;
|
|
@@ -257,9 +294,6 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
257
294
|
this.log.warn(`Escape hatch open for slot ${slotNumber}, rejecting block proposal`, proposalInfo);
|
|
258
295
|
return false;
|
|
259
296
|
}
|
|
260
|
-
// TODO(palla/mbps): Remove this once checkpoint validation is stable.
|
|
261
|
-
// Track that we successfully validated a block for this slot, so we can attest to checkpoint proposals for it.
|
|
262
|
-
this.validatedBlockSlots.add(slotNumber);
|
|
263
297
|
return true;
|
|
264
298
|
}
|
|
265
299
|
/**
|
|
@@ -280,30 +314,34 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
280
314
|
this.log.warn(`Received checkpoint proposal with invalid signature for slot ${slotNumber}`);
|
|
281
315
|
return undefined;
|
|
282
316
|
}
|
|
317
|
+
// Ignore proposals from ourselves (may happen in HA setups)
|
|
318
|
+
if (this.getValidatorAddresses().some((addr)=>addr.equals(proposer))) {
|
|
319
|
+
this.log.warn(`Ignoring block proposal from self for slot ${slotNumber}`, {
|
|
320
|
+
proposer: proposer.toString(),
|
|
321
|
+
slotNumber
|
|
322
|
+
});
|
|
323
|
+
return undefined;
|
|
324
|
+
}
|
|
325
|
+
// Validate fee asset price modifier is within allowed range
|
|
326
|
+
if (!validateFeeAssetPriceModifier(proposal.feeAssetPriceModifier)) {
|
|
327
|
+
this.log.warn(`Received checkpoint proposal with invalid feeAssetPriceModifier ${proposal.feeAssetPriceModifier} for slot ${slotNumber}`);
|
|
328
|
+
return undefined;
|
|
329
|
+
}
|
|
283
330
|
// Check that I have any address in current committee before attesting
|
|
284
331
|
const inCommittee = await this.epochCache.filterInCommittee(slotNumber, this.getValidatorAddresses());
|
|
285
332
|
const partOfCommittee = inCommittee.length > 0;
|
|
286
333
|
const proposalInfo = {
|
|
287
334
|
slotNumber,
|
|
288
335
|
archive: proposal.archive.toString(),
|
|
289
|
-
proposer: proposer.toString()
|
|
290
|
-
txCount: proposal.txHashes.length
|
|
336
|
+
proposer: proposer.toString()
|
|
291
337
|
};
|
|
292
338
|
this.log.info(`Received checkpoint proposal for slot ${slotNumber}`, {
|
|
293
339
|
...proposalInfo,
|
|
294
|
-
txHashes: proposal.txHashes.map((t)=>t.toString()),
|
|
295
340
|
fishermanMode: this.config.fishermanMode || false
|
|
296
341
|
});
|
|
297
|
-
// TODO(palla/mbps): Remove this once checkpoint validation is stable.
|
|
298
|
-
// Check that we have successfully validated a block for this slot before attesting to the checkpoint.
|
|
299
|
-
if (!this.validatedBlockSlots.has(slotNumber)) {
|
|
300
|
-
this.log.warn(`No validated block found for slot ${slotNumber}, refusing to attest to checkpoint`, proposalInfo);
|
|
301
|
-
return undefined;
|
|
302
|
-
}
|
|
303
342
|
// Validate the checkpoint proposal before attesting (unless skipCheckpointProposalValidation is set)
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
this.log.verbose(`Skipping checkpoint proposal validation for slot ${slotNumber}`, proposalInfo);
|
|
343
|
+
if (this.config.skipCheckpointProposalValidation) {
|
|
344
|
+
this.log.warn(`Skipping checkpoint proposal validation for slot ${slotNumber}`, proposalInfo);
|
|
307
345
|
} else {
|
|
308
346
|
const validationResult = await this.validateCheckpointProposal(proposal, proposalInfo);
|
|
309
347
|
if (!validationResult.isValid) {
|
|
@@ -328,6 +366,16 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
328
366
|
fishermanMode: this.config.fishermanMode || false
|
|
329
367
|
});
|
|
330
368
|
this.metrics.incSuccessfulAttestations(inCommittee.length);
|
|
369
|
+
// Track epoch participation per attester: count each (attester, epoch) pair at most once
|
|
370
|
+
const proposalEpoch = getEpochAtSlot(slotNumber, this.epochCache.getL1Constants());
|
|
371
|
+
for (const attester of inCommittee){
|
|
372
|
+
const key = attester.toString();
|
|
373
|
+
const lastEpoch = this.lastAttestedEpochByAttester.get(key);
|
|
374
|
+
if (lastEpoch === undefined || proposalEpoch > lastEpoch) {
|
|
375
|
+
this.lastAttestedEpochByAttester.set(key, proposalEpoch);
|
|
376
|
+
this.metrics.incAttestedEpochCount(attester);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
331
379
|
// Determine which validators should attest
|
|
332
380
|
let attestors;
|
|
333
381
|
if (partOfCommittee) {
|
|
@@ -350,11 +398,32 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
350
398
|
});
|
|
351
399
|
return undefined;
|
|
352
400
|
}
|
|
353
|
-
return this.createCheckpointAttestationsFromProposal(proposal, attestors);
|
|
401
|
+
return await this.createCheckpointAttestationsFromProposal(proposal, attestors);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Checks if we should attest to a slot based on equivocation prevention rules.
|
|
405
|
+
* @returns true if we should attest, false if we should skip
|
|
406
|
+
*/ shouldAttestToSlot(slotNumber) {
|
|
407
|
+
// If attestToEquivocatedProposals is true, always allow
|
|
408
|
+
if (this.config.attestToEquivocatedProposals) {
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
// Check if incoming slot is strictly greater than last attested
|
|
412
|
+
if (this.lastAttestedProposal && slotNumber <= this.lastAttestedProposal.slotNumber) {
|
|
413
|
+
this.log.warn(`Refusing to process a proposal for slot ${slotNumber} given we already attested to a proposal for slot ${this.lastAttestedProposal.slotNumber}`);
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
return true;
|
|
354
417
|
}
|
|
355
418
|
async createCheckpointAttestationsFromProposal(proposal, attestors = []) {
|
|
419
|
+
// Equivocation check: must happen right before signing to minimize the race window
|
|
420
|
+
if (!this.shouldAttestToSlot(proposal.slotNumber)) {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
356
423
|
const attestations = await this.validationService.attestToCheckpointProposal(proposal, attestors);
|
|
357
|
-
|
|
424
|
+
// Track the proposal we attested to (to prevent equivocation)
|
|
425
|
+
this.lastAttestedProposal = proposal;
|
|
426
|
+
await this.p2pClient.addOwnCheckpointAttestations(attestations);
|
|
358
427
|
return attestations;
|
|
359
428
|
}
|
|
360
429
|
/**
|
|
@@ -362,7 +431,10 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
362
431
|
* @returns Validation result with isValid flag and reason if invalid.
|
|
363
432
|
*/ async validateCheckpointProposal(proposal, proposalInfo) {
|
|
364
433
|
const slot = proposal.slotNumber;
|
|
365
|
-
|
|
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));
|
|
366
438
|
// Wait for last block to sync by archive
|
|
367
439
|
let lastBlockHeader;
|
|
368
440
|
try {
|
|
@@ -400,6 +472,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
400
472
|
reason: 'no_blocks_for_slot'
|
|
401
473
|
};
|
|
402
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
|
+
}
|
|
403
483
|
this.log.debug(`Found ${blocks.length} blocks for slot ${slot}`, {
|
|
404
484
|
...proposalInfo,
|
|
405
485
|
blockNumbers: blocks.map((b)=>b.number)
|
|
@@ -410,18 +490,15 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
410
490
|
const checkpointNumber = firstBlock.checkpointNumber;
|
|
411
491
|
// Get L1-to-L2 messages for this checkpoint
|
|
412
492
|
const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(checkpointNumber);
|
|
413
|
-
//
|
|
414
|
-
// TODO: There can be a more efficient way to get the previous checkpoint out hashes without having to fetch the
|
|
415
|
-
// actual checkpoints and the blocks/txs in them.
|
|
493
|
+
// Collect the out hashes of all the checkpoints before this one in the same epoch
|
|
416
494
|
const epoch = getEpochAtSlot(slot, this.epochCache.getL1Constants());
|
|
417
|
-
const
|
|
418
|
-
const previousCheckpointOutHashes = previousCheckpoints.map((c)=>c.getCheckpointOutHash());
|
|
495
|
+
const previousCheckpointOutHashes = (await this.blockSource.getCheckpointsDataForEpoch(epoch)).filter((c)=>c.checkpointNumber < checkpointNumber).map((c)=>c.checkpointOutHash);
|
|
419
496
|
// Fork world state at the block before the first block
|
|
420
497
|
const parentBlockNumber = BlockNumber(firstBlock.number - 1);
|
|
421
498
|
const fork = await this.worldState.fork(parentBlockNumber);
|
|
422
499
|
try {
|
|
423
500
|
// Create checkpoint builder with all existing blocks
|
|
424
|
-
const checkpointBuilder = await this.checkpointsBuilder.openCheckpoint(checkpointNumber, constants, l1ToL2Messages, previousCheckpointOutHashes, fork, blocks);
|
|
501
|
+
const checkpointBuilder = await this.checkpointsBuilder.openCheckpoint(checkpointNumber, constants, proposal.feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, blocks, this.log.getBindings());
|
|
425
502
|
// Complete the checkpoint to get computed values
|
|
426
503
|
const computedCheckpoint = await checkpointBuilder.completeCheckpoint();
|
|
427
504
|
// Compare checkpoint header with proposal
|
|
@@ -448,13 +525,20 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
448
525
|
reason: 'archive_mismatch'
|
|
449
526
|
};
|
|
450
527
|
}
|
|
451
|
-
// Check that the accumulated out hash matches the value in the proposal.
|
|
452
|
-
|
|
453
|
-
const
|
|
454
|
-
|
|
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)) {
|
|
455
537
|
this.log.warn(`Epoch out hash mismatch`, {
|
|
456
|
-
|
|
457
|
-
|
|
538
|
+
proposalEpochOutHash: proposalEpochOutHash.toString(),
|
|
539
|
+
computedEpochOutHash: computedEpochOutHash.toString(),
|
|
540
|
+
checkpointOutHash: checkpointOutHash.toString(),
|
|
541
|
+
previousCheckpointOutHashes: previousCheckpointOutHashes.map((h)=>h.toString()),
|
|
458
542
|
...proposalInfo
|
|
459
543
|
});
|
|
460
544
|
return {
|
|
@@ -462,6 +546,22 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
462
546
|
reason: 'out_hash_mismatch'
|
|
463
547
|
};
|
|
464
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
|
+
}
|
|
465
565
|
this.log.verbose(`Checkpoint proposal validation successful for slot ${slot}`, proposalInfo);
|
|
466
566
|
return {
|
|
467
567
|
isValid: true
|
|
@@ -478,6 +578,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
478
578
|
chainId: gv.chainId,
|
|
479
579
|
version: gv.version,
|
|
480
580
|
slotNumber: gv.slotNumber,
|
|
581
|
+
timestamp: gv.timestamp,
|
|
481
582
|
coinbase: gv.coinbase,
|
|
482
583
|
feeRecipient: gv.feeRecipient,
|
|
483
584
|
gasFees: gv.gasFees
|
|
@@ -498,7 +599,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
498
599
|
return;
|
|
499
600
|
}
|
|
500
601
|
const blobFields = blocks.flatMap((b)=>b.toBlobFields());
|
|
501
|
-
const blobs = getBlobsPerL1Block(blobFields);
|
|
602
|
+
const blobs = await getBlobsPerL1Block(blobFields);
|
|
502
603
|
await this.blobClient.sendBlobsToFilestore(blobs);
|
|
503
604
|
this.log.debug(`Uploaded ${blobs.length} blobs to filestore for checkpoint at slot ${proposal.slotNumber}`, {
|
|
504
605
|
...proposalInfo,
|
|
@@ -530,23 +631,75 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
530
631
|
}
|
|
531
632
|
]);
|
|
532
633
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
634
|
+
/**
|
|
635
|
+
* Handle detection of a duplicate proposal (equivocation).
|
|
636
|
+
* Emits a slash event when a proposer sends multiple proposals for the same position.
|
|
637
|
+
*/ handleDuplicateProposal(info) {
|
|
638
|
+
const { slot, proposer, type } = info;
|
|
639
|
+
this.log.warn(`Triggering slash event for duplicate ${type} proposal from ${proposer.toString()} at slot ${slot}`, {
|
|
640
|
+
proposer: proposer.toString(),
|
|
641
|
+
slot,
|
|
642
|
+
type
|
|
643
|
+
});
|
|
644
|
+
// Emit slash event
|
|
645
|
+
this.emit(WANT_TO_SLASH_EVENT, [
|
|
646
|
+
{
|
|
647
|
+
validator: proposer,
|
|
648
|
+
amount: this.config.slashDuplicateProposalPenalty,
|
|
649
|
+
offenseType: OffenseType.DUPLICATE_PROPOSAL,
|
|
650
|
+
epochOrSlot: BigInt(slot)
|
|
651
|
+
}
|
|
652
|
+
]);
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Handle detection of a duplicate attestation (equivocation).
|
|
656
|
+
* Emits a slash event when an attester signs attestations for different proposals at the same slot.
|
|
657
|
+
*/ handleDuplicateAttestation(info) {
|
|
658
|
+
const { slot, attester } = info;
|
|
659
|
+
this.log.warn(`Triggering slash event for duplicate attestation from ${attester.toString()} at slot ${slot}`, {
|
|
660
|
+
attester: attester.toString(),
|
|
661
|
+
slot
|
|
662
|
+
});
|
|
663
|
+
this.emit(WANT_TO_SLASH_EVENT, [
|
|
664
|
+
{
|
|
665
|
+
validator: attester,
|
|
666
|
+
amount: this.config.slashDuplicateAttestationPenalty,
|
|
667
|
+
offenseType: OffenseType.DUPLICATE_ATTESTATION,
|
|
668
|
+
epochOrSlot: BigInt(slot)
|
|
669
|
+
}
|
|
670
|
+
]);
|
|
671
|
+
}
|
|
672
|
+
async createBlockProposal(blockHeader, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, options = {}) {
|
|
673
|
+
// Validate that we're not creating a proposal for an older or equal position
|
|
674
|
+
if (this.lastProposedBlock) {
|
|
675
|
+
const lastSlot = this.lastProposedBlock.slotNumber;
|
|
676
|
+
const lastIndex = this.lastProposedBlock.indexWithinCheckpoint;
|
|
677
|
+
const newSlot = blockHeader.globalVariables.slotNumber;
|
|
678
|
+
if (newSlot < lastSlot || newSlot === lastSlot && indexWithinCheckpoint <= lastIndex) {
|
|
679
|
+
throw new Error(`Cannot create block proposal for slot ${newSlot} index ${indexWithinCheckpoint}: ` + `already proposed block for slot ${lastSlot} index ${lastIndex}`);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
539
682
|
this.log.info(`Assembling block proposal for block ${blockHeader.globalVariables.blockNumber} slot ${blockHeader.globalVariables.slotNumber}`);
|
|
540
683
|
const newProposal = await this.validationService.createBlockProposal(blockHeader, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, {
|
|
541
684
|
...options,
|
|
542
685
|
broadcastInvalidBlockProposal: this.config.broadcastInvalidBlockProposal
|
|
543
686
|
});
|
|
544
|
-
this.
|
|
687
|
+
this.lastProposedBlock = newProposal;
|
|
545
688
|
return newProposal;
|
|
546
689
|
}
|
|
547
|
-
async createCheckpointProposal(checkpointHeader, archive, lastBlockInfo, proposerAddress, options) {
|
|
690
|
+
async createCheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier, lastBlockInfo, proposerAddress, options = {}) {
|
|
691
|
+
// Validate that we're not creating a proposal for an older or equal slot
|
|
692
|
+
if (this.lastProposedCheckpoint) {
|
|
693
|
+
const lastSlot = this.lastProposedCheckpoint.slotNumber;
|
|
694
|
+
const newSlot = checkpointHeader.slotNumber;
|
|
695
|
+
if (newSlot <= lastSlot) {
|
|
696
|
+
throw new Error(`Cannot create checkpoint proposal for slot ${newSlot}: ` + `already proposed checkpoint for slot ${lastSlot}`);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
548
699
|
this.log.info(`Assembling checkpoint proposal for slot ${checkpointHeader.slotNumber}`);
|
|
549
|
-
|
|
700
|
+
const newProposal = await this.validationService.createCheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier, lastBlockInfo, proposerAddress, options);
|
|
701
|
+
this.lastProposedCheckpoint = newProposal;
|
|
702
|
+
return newProposal;
|
|
550
703
|
}
|
|
551
704
|
async broadcastBlockProposal(proposal) {
|
|
552
705
|
await this.p2pClient.broadcastProposal(proposal);
|
|
@@ -561,6 +714,9 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
561
714
|
inCommittee
|
|
562
715
|
});
|
|
563
716
|
const attestations = await this.createCheckpointAttestationsFromProposal(proposal, inCommittee);
|
|
717
|
+
if (!attestations) {
|
|
718
|
+
return [];
|
|
719
|
+
}
|
|
564
720
|
// We broadcast our own attestations to our peers so, in case our block does not get mined on L1,
|
|
565
721
|
// other nodes can see that our validators did attest to this block proposal, and do not slash us
|
|
566
722
|
// due to inactivity for missed attestations.
|