@aztec/validator-client 2.1.7-rc.2 → 2.1.7-rc.3
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/dest/block_proposal_handler.d.ts.map +1 -1
- package/dest/block_proposal_handler.js +3 -0
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +5 -0
- package/dest/validator.d.ts +3 -2
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +40 -9
- package/package.json +11 -11
- package/src/block_proposal_handler.ts +3 -0
- package/src/config.ts +6 -0
- package/src/validator.ts +46 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_proposal_handler.d.ts","sourceRoot":"","sources":["../src/block_proposal_handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAS,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAe,KAAK,QAAQ,EAAmB,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAOxF,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAsB,MAAM,yBAAyB,CAAC;AAEhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,MAA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aAAa,EACvB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,EAAE,EAAE,EACT,cAAc,EAAE,EAAE,EAAE,GACnB,OAAO,CAAC,2BAA2B,CAAC;CA8ExC"}
|
|
@@ -31,6 +31,9 @@ export class BlockProposalHandler {
|
|
|
31
31
|
this.metrics = metrics;
|
|
32
32
|
this.dateProvider = dateProvider;
|
|
33
33
|
this.log = log;
|
|
34
|
+
if (config.fishermanMode) {
|
|
35
|
+
this.log = this.log.createChild('[FISHERMAN]');
|
|
36
|
+
}
|
|
34
37
|
this.tracer = telemetry.getTracer('BlockProposalHandler');
|
|
35
38
|
}
|
|
36
39
|
registerForReexecution(p2pClient) {
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CA4DnF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
|
package/dest/config.js
CHANGED
|
@@ -44,6 +44,11 @@ export const validatorClientConfigMappings = {
|
|
|
44
44
|
env: 'ALWAYS_REEXECUTE_BLOCK_PROPOSALS',
|
|
45
45
|
description: 'Whether to always reexecute block proposals, even for non-validator nodes (useful for monitoring network status).',
|
|
46
46
|
...booleanConfigHelper(false)
|
|
47
|
+
},
|
|
48
|
+
fishermanMode: {
|
|
49
|
+
env: 'FISHERMAN_MODE',
|
|
50
|
+
description: 'Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus.',
|
|
51
|
+
...booleanConfigHelper(false)
|
|
47
52
|
}
|
|
48
53
|
};
|
|
49
54
|
/**
|
package/dest/validator.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { EpochCache } from '@aztec/epoch-cache';
|
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
5
6
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
6
7
|
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
7
8
|
import type { P2P, PeerId, TxProvider } from '@aztec/p2p';
|
|
@@ -27,16 +28,16 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
27
28
|
private blockProposalHandler;
|
|
28
29
|
private config;
|
|
29
30
|
private dateProvider;
|
|
30
|
-
private log;
|
|
31
31
|
readonly tracer: Tracer;
|
|
32
32
|
private validationService;
|
|
33
33
|
private metrics;
|
|
34
|
+
private log;
|
|
34
35
|
private hasRegisteredHandlers;
|
|
35
36
|
private previousProposal?;
|
|
36
37
|
private lastEpochForCommitteeUpdateLoop;
|
|
37
38
|
private epochCacheUpdateLoop;
|
|
38
39
|
private proposersOfInvalidBlocks;
|
|
39
|
-
protected constructor(keyStore: NodeKeystoreAdapter, epochCache: EpochCache, p2pClient: P2P, blockProposalHandler: BlockProposalHandler, config: ValidatorClientFullConfig, dateProvider?: DateProvider, telemetry?: TelemetryClient, log?:
|
|
40
|
+
protected constructor(keyStore: NodeKeystoreAdapter, epochCache: EpochCache, p2pClient: P2P, blockProposalHandler: BlockProposalHandler, config: ValidatorClientFullConfig, dateProvider?: DateProvider, telemetry?: TelemetryClient, log?: Logger);
|
|
40
41
|
static validateKeyStoreConfiguration(keyStoreManager: KeystoreManager): void;
|
|
41
42
|
private handleEpochCommitteeUpdate;
|
|
42
43
|
static new(config: ValidatorClientFullConfig, blockBuilder: IFullNodeBlockBuilder, epochCache: EpochCache, p2pClient: P2P, blockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, txProvider: TxProvider, keyStoreManager: KeystoreManager, dateProvider?: DateProvider, telemetry?: TelemetryClient): ValidatorClient;
|
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,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,E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EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC;IAkHhH,OAAO,CAAC,iBAAiB;IA2BnB,mBAAmB,CACvB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,EAAE,EACX,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,EAAE,EAAE,EACT,eAAe,EAAE,UAAU,GAAG,SAAS,EACvC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAkB/B,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D,0BAA0B,CAC9B,sBAAsB,EAAE,+BAA+B,EACvD,QAAQ,EAAE,UAAU,GAAG,SAAS,GAC/B,OAAO,CAAC,SAAS,CAAC;IAIf,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAO5E,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAmEnG,mCAAmC;YASnC,iBAAiB;CAsBhC"}
|
package/dest/validator.js
CHANGED
|
@@ -28,10 +28,10 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
28
28
|
blockProposalHandler;
|
|
29
29
|
config;
|
|
30
30
|
dateProvider;
|
|
31
|
-
log;
|
|
32
31
|
tracer;
|
|
33
32
|
validationService;
|
|
34
33
|
metrics;
|
|
34
|
+
log;
|
|
35
35
|
// Whether it has already registered handlers on the p2p client
|
|
36
36
|
hasRegisteredHandlers;
|
|
37
37
|
// Used to check if we are sending the same proposal twice
|
|
@@ -40,12 +40,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
40
40
|
epochCacheUpdateLoop;
|
|
41
41
|
proposersOfInvalidBlocks;
|
|
42
42
|
constructor(keyStore, epochCache, p2pClient, blockProposalHandler, config, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator')){
|
|
43
|
-
super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.blockProposalHandler = blockProposalHandler, this.config = config, this.dateProvider = dateProvider, this.
|
|
43
|
+
super(), this.keyStore = keyStore, this.epochCache = epochCache, this.p2pClient = p2pClient, this.blockProposalHandler = blockProposalHandler, this.config = config, this.dateProvider = dateProvider, this.hasRegisteredHandlers = false, this.proposersOfInvalidBlocks = new Set();
|
|
44
|
+
// Create child logger with fisherman prefix if in fisherman mode
|
|
45
|
+
this.log = config.fishermanMode ? log.createChild('[FISHERMAN]') : log;
|
|
44
46
|
this.tracer = telemetry.getTracer('Validator');
|
|
45
47
|
this.metrics = new ValidatorMetrics(telemetry);
|
|
46
48
|
this.validationService = new ValidationService(keyStore);
|
|
47
49
|
// Refresh epoch cache every second to trigger alert if participation in committee changes
|
|
48
|
-
this.epochCacheUpdateLoop = new RunningPromise(this.handleEpochCommitteeUpdate.bind(this), log, 1000);
|
|
50
|
+
this.epochCacheUpdateLoop = new RunningPromise(this.handleEpochCommitteeUpdate.bind(this), this.log, 1000);
|
|
49
51
|
const myAddresses = this.getValidatorAddresses();
|
|
50
52
|
this.log.verbose(`Initialized validator with addresses: ${myAddresses.map((a)=>a.toString()).join(', ')}`);
|
|
51
53
|
}
|
|
@@ -173,12 +175,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
173
175
|
};
|
|
174
176
|
this.log.info(`Received proposal for slot ${slotNumber}`, {
|
|
175
177
|
...proposalInfo,
|
|
176
|
-
txHashes: proposal.txHashes.map((t)=>t.toString())
|
|
178
|
+
txHashes: proposal.txHashes.map((t)=>t.toString()),
|
|
179
|
+
fishermanMode: this.config.fishermanMode || false
|
|
177
180
|
});
|
|
178
181
|
// Reexecute txs if we are part of the committee so we can attest, or if slashing is enabled so we can slash
|
|
179
182
|
// invalid proposals even when not in the committee, or if we are configured to always reexecute for monitoring purposes.
|
|
180
|
-
|
|
181
|
-
const
|
|
183
|
+
// In fisherman mode, we always reexecute to validate proposals.
|
|
184
|
+
const { validatorReexecute, slashBroadcastedInvalidBlockPenalty, alwaysReexecuteBlockProposals, fishermanMode } = this.config;
|
|
185
|
+
const shouldReexecute = fishermanMode || slashBroadcastedInvalidBlockPenalty > 0n && validatorReexecute || partOfCommittee && validatorReexecute || alwaysReexecuteBlockProposals;
|
|
182
186
|
const validationResult = await this.blockProposalHandler.handleBlockProposal(proposal, proposalSender, !!shouldReexecute);
|
|
183
187
|
if (!validationResult.isValid) {
|
|
184
188
|
this.log.warn(`Proposal validation failed: ${validationResult.reason}`, proposalInfo);
|
|
@@ -205,15 +209,42 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
205
209
|
return undefined;
|
|
206
210
|
}
|
|
207
211
|
// Check that I have any address in current committee before attesting
|
|
208
|
-
if
|
|
212
|
+
// In fisherman mode, we still create attestations for validation even if not in committee
|
|
213
|
+
if (!partOfCommittee && !this.config.fishermanMode) {
|
|
209
214
|
this.log.verbose(`No validator in the current committee, skipping attestation`, proposalInfo);
|
|
210
215
|
return undefined;
|
|
211
216
|
}
|
|
212
217
|
// Provided all of the above checks pass, we can attest to the proposal
|
|
213
|
-
this.log.info(
|
|
218
|
+
this.log.info(`${partOfCommittee ? 'Attesting to' : 'Validated'} proposal for slot ${slotNumber}`, {
|
|
219
|
+
...proposalInfo,
|
|
220
|
+
inCommittee: partOfCommittee,
|
|
221
|
+
fishermanMode: this.config.fishermanMode || false
|
|
222
|
+
});
|
|
214
223
|
this.metrics.incSuccessfulAttestations(inCommittee.length);
|
|
215
224
|
// If the above function does not throw an error, then we can attest to the proposal
|
|
216
|
-
|
|
225
|
+
// Determine which validators should attest
|
|
226
|
+
let attestors;
|
|
227
|
+
if (partOfCommittee) {
|
|
228
|
+
attestors = inCommittee;
|
|
229
|
+
} else if (this.config.fishermanMode) {
|
|
230
|
+
// In fisherman mode, create attestations for validation purposes even if not in committee. These won't be broadcast.
|
|
231
|
+
attestors = this.getValidatorAddresses();
|
|
232
|
+
} else {
|
|
233
|
+
attestors = [];
|
|
234
|
+
}
|
|
235
|
+
// Only create attestations if we have attestors
|
|
236
|
+
if (attestors.length === 0) {
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
if (this.config.fishermanMode) {
|
|
240
|
+
// bail out early and don't save attestations to the pool in fisherman mode
|
|
241
|
+
this.log.info(`Creating attestations for proposal for slot ${slotNumber}`, {
|
|
242
|
+
...proposalInfo,
|
|
243
|
+
attestors: attestors.map((a)=>a.toString())
|
|
244
|
+
});
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
return this.createBlockAttestationsFromProposal(proposal, attestors);
|
|
217
248
|
}
|
|
218
249
|
slashInvalidBlock(proposal) {
|
|
219
250
|
const proposer = proposal.getSender();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/validator-client",
|
|
3
|
-
"version": "2.1.7-rc.
|
|
3
|
+
"version": "2.1.7-rc.3",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -64,16 +64,16 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/constants": "2.1.7-rc.
|
|
68
|
-
"@aztec/epoch-cache": "2.1.7-rc.
|
|
69
|
-
"@aztec/ethereum": "2.1.7-rc.
|
|
70
|
-
"@aztec/foundation": "2.1.7-rc.
|
|
71
|
-
"@aztec/node-keystore": "2.1.7-rc.
|
|
72
|
-
"@aztec/p2p": "2.1.7-rc.
|
|
73
|
-
"@aztec/prover-client": "2.1.7-rc.
|
|
74
|
-
"@aztec/slasher": "2.1.7-rc.
|
|
75
|
-
"@aztec/stdlib": "2.1.7-rc.
|
|
76
|
-
"@aztec/telemetry-client": "2.1.7-rc.
|
|
67
|
+
"@aztec/constants": "2.1.7-rc.3",
|
|
68
|
+
"@aztec/epoch-cache": "2.1.7-rc.3",
|
|
69
|
+
"@aztec/ethereum": "2.1.7-rc.3",
|
|
70
|
+
"@aztec/foundation": "2.1.7-rc.3",
|
|
71
|
+
"@aztec/node-keystore": "2.1.7-rc.3",
|
|
72
|
+
"@aztec/p2p": "2.1.7-rc.3",
|
|
73
|
+
"@aztec/prover-client": "2.1.7-rc.3",
|
|
74
|
+
"@aztec/slasher": "2.1.7-rc.3",
|
|
75
|
+
"@aztec/stdlib": "2.1.7-rc.3",
|
|
76
|
+
"@aztec/telemetry-client": "2.1.7-rc.3",
|
|
77
77
|
"koa": "^2.16.1",
|
|
78
78
|
"koa-router": "^13.1.1",
|
|
79
79
|
"tslib": "^2.4.0",
|
|
@@ -73,6 +73,9 @@ export class BlockProposalHandler {
|
|
|
73
73
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
74
74
|
private log = createLogger('validator:block-proposal-handler'),
|
|
75
75
|
) {
|
|
76
|
+
if (config.fishermanMode) {
|
|
77
|
+
this.log = this.log.createChild('[FISHERMAN]');
|
|
78
|
+
}
|
|
76
79
|
this.tracer = telemetry.getTracer('BlockProposalHandler');
|
|
77
80
|
}
|
|
78
81
|
|
package/src/config.ts
CHANGED
|
@@ -64,6 +64,12 @@ export const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientCo
|
|
|
64
64
|
'Whether to always reexecute block proposals, even for non-validator nodes (useful for monitoring network status).',
|
|
65
65
|
...booleanConfigHelper(false),
|
|
66
66
|
},
|
|
67
|
+
fishermanMode: {
|
|
68
|
+
env: 'FISHERMAN_MODE',
|
|
69
|
+
description:
|
|
70
|
+
'Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus.',
|
|
71
|
+
...booleanConfigHelper(false),
|
|
72
|
+
},
|
|
67
73
|
};
|
|
68
74
|
|
|
69
75
|
/**
|
package/src/validator.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { EpochCache } from '@aztec/epoch-cache';
|
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
6
6
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
7
7
|
import { sleep } from '@aztec/foundation/sleep';
|
|
8
8
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
@@ -44,6 +44,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
44
44
|
public readonly tracer: Tracer;
|
|
45
45
|
private validationService: ValidationService;
|
|
46
46
|
private metrics: ValidatorMetrics;
|
|
47
|
+
private log: Logger;
|
|
47
48
|
|
|
48
49
|
// Whether it has already registered handlers on the p2p client
|
|
49
50
|
private hasRegisteredHandlers = false;
|
|
@@ -64,16 +65,20 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
64
65
|
private config: ValidatorClientFullConfig,
|
|
65
66
|
private dateProvider: DateProvider = new DateProvider(),
|
|
66
67
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
67
|
-
|
|
68
|
+
log = createLogger('validator'),
|
|
68
69
|
) {
|
|
69
70
|
super();
|
|
71
|
+
|
|
72
|
+
// Create child logger with fisherman prefix if in fisherman mode
|
|
73
|
+
this.log = config.fishermanMode ? log.createChild('[FISHERMAN]') : log;
|
|
74
|
+
|
|
70
75
|
this.tracer = telemetry.getTracer('Validator');
|
|
71
76
|
this.metrics = new ValidatorMetrics(telemetry);
|
|
72
77
|
|
|
73
78
|
this.validationService = new ValidationService(keyStore);
|
|
74
79
|
|
|
75
80
|
// Refresh epoch cache every second to trigger alert if participation in committee changes
|
|
76
|
-
this.epochCacheUpdateLoop = new RunningPromise(this.handleEpochCommitteeUpdate.bind(this), log, 1000);
|
|
81
|
+
this.epochCacheUpdateLoop = new RunningPromise(this.handleEpochCommitteeUpdate.bind(this), this.log, 1000);
|
|
77
82
|
|
|
78
83
|
const myAddresses = this.getValidatorAddresses();
|
|
79
84
|
this.log.verbose(`Initialized validator with addresses: ${myAddresses.map(a => a.toString()).join(', ')}`);
|
|
@@ -270,12 +275,16 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
270
275
|
this.log.info(`Received proposal for slot ${slotNumber}`, {
|
|
271
276
|
...proposalInfo,
|
|
272
277
|
txHashes: proposal.txHashes.map(t => t.toString()),
|
|
278
|
+
fishermanMode: this.config.fishermanMode || false,
|
|
273
279
|
});
|
|
274
280
|
|
|
275
281
|
// Reexecute txs if we are part of the committee so we can attest, or if slashing is enabled so we can slash
|
|
276
282
|
// invalid proposals even when not in the committee, or if we are configured to always reexecute for monitoring purposes.
|
|
277
|
-
|
|
283
|
+
// In fisherman mode, we always reexecute to validate proposals.
|
|
284
|
+
const { validatorReexecute, slashBroadcastedInvalidBlockPenalty, alwaysReexecuteBlockProposals, fishermanMode } =
|
|
285
|
+
this.config;
|
|
278
286
|
const shouldReexecute =
|
|
287
|
+
fishermanMode ||
|
|
279
288
|
(slashBroadcastedInvalidBlockPenalty > 0n && validatorReexecute) ||
|
|
280
289
|
(partOfCommittee && validatorReexecute) ||
|
|
281
290
|
alwaysReexecuteBlockProposals;
|
|
@@ -319,17 +328,47 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
319
328
|
}
|
|
320
329
|
|
|
321
330
|
// Check that I have any address in current committee before attesting
|
|
322
|
-
if
|
|
331
|
+
// In fisherman mode, we still create attestations for validation even if not in committee
|
|
332
|
+
if (!partOfCommittee && !this.config.fishermanMode) {
|
|
323
333
|
this.log.verbose(`No validator in the current committee, skipping attestation`, proposalInfo);
|
|
324
334
|
return undefined;
|
|
325
335
|
}
|
|
326
336
|
|
|
327
337
|
// Provided all of the above checks pass, we can attest to the proposal
|
|
328
|
-
this.log.info(
|
|
338
|
+
this.log.info(`${partOfCommittee ? 'Attesting to' : 'Validated'} proposal for slot ${slotNumber}`, {
|
|
339
|
+
...proposalInfo,
|
|
340
|
+
inCommittee: partOfCommittee,
|
|
341
|
+
fishermanMode: this.config.fishermanMode || false,
|
|
342
|
+
});
|
|
343
|
+
|
|
329
344
|
this.metrics.incSuccessfulAttestations(inCommittee.length);
|
|
330
345
|
|
|
331
346
|
// If the above function does not throw an error, then we can attest to the proposal
|
|
332
|
-
|
|
347
|
+
// Determine which validators should attest
|
|
348
|
+
let attestors: EthAddress[];
|
|
349
|
+
if (partOfCommittee) {
|
|
350
|
+
attestors = inCommittee;
|
|
351
|
+
} else if (this.config.fishermanMode) {
|
|
352
|
+
// In fisherman mode, create attestations for validation purposes even if not in committee. These won't be broadcast.
|
|
353
|
+
attestors = this.getValidatorAddresses();
|
|
354
|
+
} else {
|
|
355
|
+
attestors = [];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Only create attestations if we have attestors
|
|
359
|
+
if (attestors.length === 0) {
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (this.config.fishermanMode) {
|
|
364
|
+
// bail out early and don't save attestations to the pool in fisherman mode
|
|
365
|
+
this.log.info(`Creating attestations for proposal for slot ${slotNumber}`, {
|
|
366
|
+
...proposalInfo,
|
|
367
|
+
attestors: attestors.map(a => a.toString()),
|
|
368
|
+
});
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
return this.createBlockAttestationsFromProposal(proposal, attestors);
|
|
333
372
|
}
|
|
334
373
|
|
|
335
374
|
private slashInvalidBlock(proposal: BlockProposal) {
|