@chainsafe/lodestar 1.35.0-dev.8644a83c62 → 1.35.0-dev.894daf8b44
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/.git-data.json +1 -1
- package/bin/lodestar.js +3 -0
- package/bin/lodestar.ts +3 -0
- package/lib/applyPreset.d.ts.map +1 -0
- package/lib/applyPreset.js +1 -1
- package/lib/applyPreset.js.map +1 -1
- package/lib/cli.d.ts +3 -3
- package/lib/cli.d.ts.map +1 -0
- package/lib/cli.js +1 -1
- package/lib/cli.js.map +1 -1
- package/lib/cmds/beacon/handler.d.ts +1 -1
- package/lib/cmds/beacon/handler.d.ts.map +1 -0
- package/lib/cmds/beacon/handler.js +1 -1
- package/lib/cmds/beacon/handler.js.map +1 -1
- package/lib/cmds/beacon/index.d.ts.map +1 -0
- package/lib/cmds/beacon/initBeaconState.d.ts.map +1 -0
- package/lib/cmds/beacon/initBeaconState.js.map +1 -1
- package/lib/cmds/beacon/initPeerIdAndEnr.d.ts +2 -2
- package/lib/cmds/beacon/initPeerIdAndEnr.d.ts.map +1 -0
- package/lib/cmds/beacon/initPeerIdAndEnr.js +1 -1
- package/lib/cmds/beacon/initPeerIdAndEnr.js.map +1 -1
- package/lib/cmds/beacon/options.d.ts.map +1 -0
- package/lib/cmds/beacon/paths.d.ts.map +1 -0
- package/lib/cmds/bootnode/handler.d.ts +13 -8
- package/lib/cmds/bootnode/handler.d.ts.map +1 -0
- package/lib/cmds/bootnode/handler.js +2 -2
- package/lib/cmds/bootnode/handler.js.map +1 -1
- package/lib/cmds/bootnode/index.d.ts.map +1 -0
- package/lib/cmds/bootnode/options.d.ts.map +1 -0
- package/lib/cmds/bootnode/options.js +2 -1
- package/lib/cmds/bootnode/options.js.map +1 -1
- package/lib/cmds/dev/files.d.ts.map +1 -0
- package/lib/cmds/dev/handler.d.ts.map +1 -0
- package/lib/cmds/dev/handler.js +1 -1
- package/lib/cmds/dev/handler.js.map +1 -1
- package/lib/cmds/dev/index.d.ts.map +1 -0
- package/lib/cmds/dev/options.d.ts.map +1 -0
- package/lib/cmds/index.d.ts.map +1 -0
- package/lib/cmds/lightclient/handler.d.ts.map +1 -0
- package/lib/cmds/lightclient/index.d.ts.map +1 -0
- package/lib/cmds/lightclient/options.d.ts.map +1 -0
- package/lib/cmds/validator/blsToExecutionChange.d.ts.map +1 -0
- package/lib/cmds/validator/blsToExecutionChange.js.map +1 -1
- package/lib/cmds/validator/handler.d.ts.map +1 -0
- package/lib/cmds/validator/handler.js +3 -5
- package/lib/cmds/validator/handler.js.map +1 -1
- package/lib/cmds/validator/import.d.ts.map +1 -0
- package/lib/cmds/validator/index.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/decryptKeystoreDefinitions.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/decryptKeystores/index.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/decryptKeystores/poolSize.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.js +4 -1
- package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.js.map +1 -1
- package/lib/cmds/validator/keymanager/decryptKeystores/types.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/decryptKeystores/worker.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/impl.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/impl.js +4 -0
- package/lib/cmds/validator/keymanager/impl.js.map +1 -1
- package/lib/cmds/validator/keymanager/interface.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/keystoreCache.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/persistedKeys.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/persistedKeys.js +1 -0
- package/lib/cmds/validator/keymanager/persistedKeys.js.map +1 -1
- package/lib/cmds/validator/keymanager/server.d.ts.map +1 -0
- package/lib/cmds/validator/keymanager/server.js +2 -0
- package/lib/cmds/validator/keymanager/server.js.map +1 -1
- package/lib/cmds/validator/list.d.ts.map +1 -0
- package/lib/cmds/validator/options.d.ts.map +1 -0
- package/lib/cmds/validator/options.js +5 -3
- package/lib/cmds/validator/options.js.map +1 -1
- package/lib/cmds/validator/paths.d.ts.map +1 -0
- package/lib/cmds/validator/signers/importExternalKeystores.d.ts.map +1 -0
- package/lib/cmds/validator/signers/index.d.ts.map +1 -0
- package/lib/cmds/validator/signers/logSigners.d.ts.map +1 -0
- package/lib/cmds/validator/slashingProtection/export.d.ts.map +1 -0
- package/lib/cmds/validator/slashingProtection/import.d.ts.map +1 -0
- package/lib/cmds/validator/slashingProtection/index.d.ts.map +1 -0
- package/lib/cmds/validator/slashingProtection/options.d.ts.map +1 -0
- package/lib/cmds/validator/slashingProtection/utils.d.ts.map +1 -0
- package/lib/cmds/validator/slashingProtection/utils.js +1 -1
- package/lib/cmds/validator/slashingProtection/utils.js.map +1 -1
- package/lib/cmds/validator/voluntaryExit.d.ts.map +1 -0
- package/lib/cmds/validator/voluntaryExit.js +1 -1
- package/lib/cmds/validator/voluntaryExit.js.map +1 -1
- package/lib/config/beaconNodeOptions.d.ts.map +1 -0
- package/lib/config/beaconNodeOptions.js +2 -1
- package/lib/config/beaconNodeOptions.js.map +1 -1
- package/lib/config/beaconParams.d.ts.map +1 -0
- package/lib/config/index.d.ts.map +1 -0
- package/lib/config/peerId.d.ts.map +1 -0
- package/lib/config/types.d.ts.map +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js.map +1 -1
- package/lib/migrations/index.d.ts +1 -0
- package/lib/migrations/index.d.ts.map +1 -0
- package/lib/migrations/index.js +1 -1
- package/lib/networks/chiado.d.ts.map +1 -0
- package/lib/networks/dev.d.ts.map +1 -0
- package/lib/networks/ephemery.d.ts.map +1 -0
- package/lib/networks/gnosis.d.ts.map +1 -0
- package/lib/networks/holesky.d.ts.map +1 -0
- package/lib/networks/hoodi.d.ts.map +1 -0
- package/lib/networks/index.d.ts.map +1 -0
- package/lib/networks/index.js +1 -2
- package/lib/networks/index.js.map +1 -1
- package/lib/networks/mainnet.d.ts.map +1 -0
- package/lib/networks/sepolia.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/api.d.ts +6 -0
- package/lib/options/beaconNodeOptions/api.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/api.js +14 -6
- package/lib/options/beaconNodeOptions/api.js.map +1 -1
- package/lib/options/beaconNodeOptions/builder.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/chain.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/eth1.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/execution.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/index.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/metrics.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/monitoring.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/network.d.ts +1 -0
- package/lib/options/beaconNodeOptions/network.d.ts.map +1 -0
- package/lib/options/beaconNodeOptions/network.js +6 -3
- package/lib/options/beaconNodeOptions/network.js.map +1 -1
- package/lib/options/beaconNodeOptions/sync.d.ts.map +1 -0
- package/lib/options/globalOptions.d.ts.map +1 -0
- package/lib/options/index.d.ts.map +1 -0
- package/lib/options/logOptions.d.ts.map +1 -0
- package/lib/options/paramsOptions.d.ts.map +1 -0
- package/lib/paths/global.d.ts.map +1 -0
- package/lib/paths/rootDir.d.ts.map +1 -0
- package/lib/util/errors.d.ts.map +1 -0
- package/lib/util/ethers.d.ts.map +1 -0
- package/lib/util/feeRecipient.d.ts.map +1 -0
- package/lib/util/file.d.ts.map +1 -0
- package/lib/util/file.js +1 -1
- package/lib/util/file.js.map +1 -1
- package/lib/util/format.d.ts.map +1 -0
- package/lib/util/fs.d.ts.map +1 -0
- package/lib/util/gitData/gitDataPath.d.ts.map +1 -0
- package/lib/util/gitData/index.d.ts.map +1 -0
- package/lib/util/gitData/index.js.map +1 -1
- package/lib/util/gitData/writeGitData.d.ts.map +1 -0
- package/lib/util/hasher_bun.d.ts +3 -0
- package/lib/util/hasher_bun.d.ts.map +1 -0
- package/lib/util/hasher_bun.js +118 -0
- package/lib/util/hasher_bun.js.map +1 -0
- package/lib/util/hasher_nodejs.d.ts +3 -0
- package/lib/util/hasher_nodejs.d.ts.map +1 -0
- package/lib/util/hasher_nodejs.js +3 -0
- package/lib/util/hasher_nodejs.js.map +1 -0
- package/lib/util/index.d.ts +3 -3
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +3 -3
- package/lib/util/index.js.map +1 -1
- package/lib/util/jwt.d.ts.map +1 -0
- package/lib/util/lockfile.d.ts.map +1 -0
- package/lib/util/logger.d.ts.map +1 -0
- package/lib/util/logger.js +1 -1
- package/lib/util/logger.js.map +1 -1
- package/lib/util/object.d.ts.map +1 -0
- package/lib/util/object.js.map +1 -1
- package/lib/util/passphrase.d.ts.map +1 -0
- package/lib/util/process.d.ts.map +1 -0
- package/lib/util/progress.d.ts.map +1 -0
- package/lib/util/proposerConfig.d.ts.map +1 -0
- package/lib/util/proposerConfig.js.map +1 -1
- package/lib/util/pruneOldFilesInDir.d.ts.map +1 -0
- package/lib/util/sleep.d.ts.map +1 -0
- package/lib/util/stripOffNewlines.d.ts.map +1 -0
- package/lib/util/types.d.ts.map +1 -0
- package/lib/util/version.d.ts.map +1 -0
- package/package.json +33 -20
- package/src/applyPreset.ts +92 -0
- package/src/cli.ts +56 -0
- package/src/cmds/beacon/handler.ts +267 -0
- package/src/cmds/beacon/index.ts +18 -0
- package/src/cmds/beacon/initBeaconState.ts +275 -0
- package/src/cmds/beacon/initPeerIdAndEnr.ts +199 -0
- package/src/cmds/beacon/options.ts +214 -0
- package/src/cmds/beacon/paths.ts +62 -0
- package/src/cmds/bootnode/handler.ts +203 -0
- package/src/cmds/bootnode/index.ts +13 -0
- package/src/cmds/bootnode/options.ts +109 -0
- package/src/cmds/dev/files.ts +52 -0
- package/src/cmds/dev/handler.ts +86 -0
- package/src/cmds/dev/index.ts +18 -0
- package/src/cmds/dev/options.ts +110 -0
- package/src/cmds/index.ts +15 -0
- package/src/cmds/lightclient/handler.ts +36 -0
- package/src/cmds/lightclient/index.ts +18 -0
- package/src/cmds/lightclient/options.ts +21 -0
- package/src/cmds/validator/blsToExecutionChange.ts +91 -0
- package/src/cmds/validator/handler.ts +300 -0
- package/src/cmds/validator/import.ts +111 -0
- package/src/cmds/validator/index.ts +28 -0
- package/src/cmds/validator/keymanager/decryptKeystoreDefinitions.ts +189 -0
- package/src/cmds/validator/keymanager/decryptKeystores/index.ts +1 -0
- package/src/cmds/validator/keymanager/decryptKeystores/poolSize.ts +16 -0
- package/src/cmds/validator/keymanager/decryptKeystores/threadPool.ts +75 -0
- package/src/cmds/validator/keymanager/decryptKeystores/types.ts +12 -0
- package/src/cmds/validator/keymanager/decryptKeystores/worker.ts +24 -0
- package/src/cmds/validator/keymanager/impl.ts +425 -0
- package/src/cmds/validator/keymanager/interface.ts +35 -0
- package/src/cmds/validator/keymanager/keystoreCache.ts +91 -0
- package/src/cmds/validator/keymanager/persistedKeys.ts +268 -0
- package/src/cmds/validator/keymanager/server.ts +86 -0
- package/src/cmds/validator/list.ts +35 -0
- package/src/cmds/validator/options.ts +463 -0
- package/src/cmds/validator/paths.ts +95 -0
- package/src/cmds/validator/signers/importExternalKeystores.ts +69 -0
- package/src/cmds/validator/signers/index.ts +176 -0
- package/src/cmds/validator/signers/logSigners.ts +81 -0
- package/src/cmds/validator/slashingProtection/export.ts +110 -0
- package/src/cmds/validator/slashingProtection/import.ts +70 -0
- package/src/cmds/validator/slashingProtection/index.ts +12 -0
- package/src/cmds/validator/slashingProtection/options.ts +15 -0
- package/src/cmds/validator/slashingProtection/utils.ts +56 -0
- package/src/cmds/validator/voluntaryExit.ts +232 -0
- package/src/config/beaconNodeOptions.ts +68 -0
- package/src/config/beaconParams.ts +87 -0
- package/src/config/index.ts +3 -0
- package/src/config/peerId.ts +50 -0
- package/src/config/types.ts +3 -0
- package/src/index.ts +28 -0
- package/src/migrations/index.ts +0 -0
- package/src/networks/chiado.ts +20 -0
- package/src/networks/dev.ts +27 -0
- package/src/networks/ephemery.ts +9 -0
- package/src/networks/gnosis.ts +18 -0
- package/src/networks/holesky.ts +17 -0
- package/src/networks/hoodi.ts +16 -0
- package/src/networks/index.ts +236 -0
- package/src/networks/mainnet.ts +34 -0
- package/src/networks/sepolia.ts +17 -0
- package/src/options/beaconNodeOptions/api.ts +120 -0
- package/src/options/beaconNodeOptions/builder.ts +63 -0
- package/src/options/beaconNodeOptions/chain.ts +326 -0
- package/src/options/beaconNodeOptions/eth1.ts +95 -0
- package/src/options/beaconNodeOptions/execution.ts +92 -0
- package/src/options/beaconNodeOptions/index.ts +50 -0
- package/src/options/beaconNodeOptions/metrics.ts +39 -0
- package/src/options/beaconNodeOptions/monitoring.ts +61 -0
- package/src/options/beaconNodeOptions/network.ts +401 -0
- package/src/options/beaconNodeOptions/sync.ts +65 -0
- package/src/options/globalOptions.ts +72 -0
- package/src/options/index.ts +3 -0
- package/src/options/logOptions.ts +70 -0
- package/src/options/paramsOptions.ts +72 -0
- package/src/paths/global.ts +24 -0
- package/src/paths/rootDir.ts +11 -0
- package/src/util/errors.ts +20 -0
- package/src/util/ethers.ts +44 -0
- package/src/util/feeRecipient.ts +6 -0
- package/src/util/file.ts +167 -0
- package/src/util/format.ts +76 -0
- package/src/util/fs.ts +59 -0
- package/src/util/gitData/gitDataPath.ts +48 -0
- package/src/util/gitData/index.ts +70 -0
- package/src/util/gitData/writeGitData.ts +10 -0
- package/src/util/hasher_bun.ts +133 -0
- package/src/util/hasher_nodejs.ts +3 -0
- package/src/util/index.ts +17 -0
- package/src/util/jwt.ts +10 -0
- package/src/util/lockfile.ts +45 -0
- package/src/util/logger.ts +105 -0
- package/src/util/object.ts +15 -0
- package/src/util/passphrase.ts +25 -0
- package/src/util/process.ts +25 -0
- package/src/util/progress.ts +58 -0
- package/src/util/proposerConfig.ts +136 -0
- package/src/util/pruneOldFilesInDir.ts +27 -0
- package/src/util/sleep.ts +3 -0
- package/src/util/stripOffNewlines.ts +6 -0
- package/src/util/types.ts +8 -0
- package/src/util/version.ts +74 -0
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import {WireFormat, defaultInit} from "@lodestar/api";
|
|
2
|
+
import {CliCommandOptions} from "@lodestar/utils";
|
|
3
|
+
import {defaultOptions} from "@lodestar/validator";
|
|
4
|
+
import {coerceCors, enabledAllBashFriendly} from "../../options/beaconNodeOptions/api.js";
|
|
5
|
+
import {LogArgs, logOptions} from "../../options/logOptions.js";
|
|
6
|
+
import {ensure0xPrefix} from "../../util/index.js";
|
|
7
|
+
import {keymanagerRestApiServerOptsDefault} from "./keymanager/server.js";
|
|
8
|
+
import {defaultAccountPaths, defaultValidatorPaths} from "./paths.js";
|
|
9
|
+
|
|
10
|
+
export type AccountValidatorArgs = {
|
|
11
|
+
keystoresDir?: string;
|
|
12
|
+
secretsDir?: string;
|
|
13
|
+
remoteKeysDir?: string;
|
|
14
|
+
proposerDir?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const validatorMetricsDefaultOptions = {
|
|
18
|
+
enabled: false,
|
|
19
|
+
port: 5064,
|
|
20
|
+
address: "127.0.0.1",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const validatorMonitoringDefaultOptions = {
|
|
24
|
+
interval: 60_000,
|
|
25
|
+
initialDelay: 30_000,
|
|
26
|
+
requestTimeout: 10_000,
|
|
27
|
+
collectSystemStats: false,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Defined as variable to not set yargs.default to an array
|
|
31
|
+
export const DEFAULT_BEACON_NODE_URL = "";
|
|
32
|
+
|
|
33
|
+
export type IValidatorCliArgs = AccountValidatorArgs &
|
|
34
|
+
KeymanagerArgs &
|
|
35
|
+
LogArgs & {
|
|
36
|
+
validatorsDbDir?: string;
|
|
37
|
+
beaconNodes: string[];
|
|
38
|
+
force?: boolean;
|
|
39
|
+
graffiti?: string;
|
|
40
|
+
afterBlockDelaySlotFraction?: number;
|
|
41
|
+
scAfterBlockDelaySlotFraction?: number;
|
|
42
|
+
suggestedFeeRecipient?: string;
|
|
43
|
+
proposerSettingsFile?: string;
|
|
44
|
+
strictFeeRecipientCheck?: boolean;
|
|
45
|
+
doppelgangerProtection?: boolean;
|
|
46
|
+
defaultGasLimit?: number;
|
|
47
|
+
|
|
48
|
+
builder?: boolean;
|
|
49
|
+
"builder.selection"?: string;
|
|
50
|
+
"builder.boostFactor"?: string;
|
|
51
|
+
|
|
52
|
+
/** @deprecated */
|
|
53
|
+
useProduceBlockV3?: boolean;
|
|
54
|
+
broadcastValidation?: string;
|
|
55
|
+
blindedLocal?: boolean;
|
|
56
|
+
|
|
57
|
+
importKeystores?: string[];
|
|
58
|
+
importKeystoresPassword?: string;
|
|
59
|
+
disableKeystoresThreadPool?: boolean;
|
|
60
|
+
|
|
61
|
+
"http.requestWireFormat"?: string;
|
|
62
|
+
"http.responseWireFormat"?: string;
|
|
63
|
+
|
|
64
|
+
"externalSigner.url"?: string;
|
|
65
|
+
"externalSigner.pubkeys"?: string[];
|
|
66
|
+
"externalSigner.fetch"?: boolean;
|
|
67
|
+
"externalSigner.fetchInterval"?: number;
|
|
68
|
+
|
|
69
|
+
distributed?: boolean;
|
|
70
|
+
|
|
71
|
+
interopIndexes?: string;
|
|
72
|
+
fromMnemonic?: string;
|
|
73
|
+
mnemonicIndexes?: string;
|
|
74
|
+
|
|
75
|
+
metrics?: boolean;
|
|
76
|
+
"metrics.port"?: number;
|
|
77
|
+
"metrics.address"?: string;
|
|
78
|
+
|
|
79
|
+
"monitoring.endpoint"?: string;
|
|
80
|
+
"monitoring.interval"?: number;
|
|
81
|
+
"monitoring.initialDelay"?: number;
|
|
82
|
+
"monitoring.requestTimeout"?: number;
|
|
83
|
+
"monitoring.collectSystemStats"?: boolean;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type KeymanagerArgs = {
|
|
87
|
+
keymanager?: boolean;
|
|
88
|
+
"keymanager.auth"?: boolean;
|
|
89
|
+
"keymanager.tokenFile"?: string;
|
|
90
|
+
"keymanager.port"?: number;
|
|
91
|
+
"keymanager.address"?: string;
|
|
92
|
+
"keymanager.cors"?: string;
|
|
93
|
+
"keymanager.headerLimit"?: number;
|
|
94
|
+
"keymanager.bodyLimit"?: number;
|
|
95
|
+
"keymanager.stacktraces"?: boolean;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const keymanagerOptions: CliCommandOptions<KeymanagerArgs> = {
|
|
99
|
+
keymanager: {
|
|
100
|
+
type: "boolean",
|
|
101
|
+
description: "Enable key manager API server",
|
|
102
|
+
default: false,
|
|
103
|
+
group: "keymanager",
|
|
104
|
+
},
|
|
105
|
+
"keymanager.auth": {
|
|
106
|
+
alias: ["keymanager.authEnabled"],
|
|
107
|
+
type: "boolean",
|
|
108
|
+
description: "Enable token bearer authentication for key manager API server",
|
|
109
|
+
default: true,
|
|
110
|
+
group: "keymanager",
|
|
111
|
+
},
|
|
112
|
+
"keymanager.tokenFile": {
|
|
113
|
+
alias: ["tokenFile"],
|
|
114
|
+
type: "string",
|
|
115
|
+
description: "Path to file containing bearer token used for key manager API authentication",
|
|
116
|
+
group: "keymanager",
|
|
117
|
+
},
|
|
118
|
+
"keymanager.port": {
|
|
119
|
+
type: "number",
|
|
120
|
+
description: "Set port for key manager API",
|
|
121
|
+
defaultDescription: String(keymanagerRestApiServerOptsDefault.port),
|
|
122
|
+
group: "keymanager",
|
|
123
|
+
},
|
|
124
|
+
"keymanager.address": {
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "Set host for key manager API",
|
|
127
|
+
defaultDescription: keymanagerRestApiServerOptsDefault.address,
|
|
128
|
+
group: "keymanager",
|
|
129
|
+
},
|
|
130
|
+
"keymanager.cors": {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: `Configures the Access-Control-Allow-Origin CORS header for key manager API. Use '${enabledAllBashFriendly}' to allow all origins`,
|
|
133
|
+
defaultDescription: keymanagerRestApiServerOptsDefault.cors,
|
|
134
|
+
group: "keymanager",
|
|
135
|
+
coerce: coerceCors,
|
|
136
|
+
},
|
|
137
|
+
"keymanager.headerLimit": {
|
|
138
|
+
hidden: true,
|
|
139
|
+
type: "number",
|
|
140
|
+
description: "Defines the maximum length of request headers, in bytes, the server is allowed to accept",
|
|
141
|
+
},
|
|
142
|
+
"keymanager.bodyLimit": {
|
|
143
|
+
hidden: true,
|
|
144
|
+
type: "number",
|
|
145
|
+
description: "Defines the maximum payload, in bytes, the server is allowed to accept",
|
|
146
|
+
},
|
|
147
|
+
"keymanager.stacktraces": {
|
|
148
|
+
hidden: true,
|
|
149
|
+
type: "boolean",
|
|
150
|
+
description: "Return stacktraces in HTTP error responses",
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {
|
|
155
|
+
...logOptions,
|
|
156
|
+
...keymanagerOptions,
|
|
157
|
+
|
|
158
|
+
keystoresDir: {
|
|
159
|
+
hidden: true,
|
|
160
|
+
description: "Directory for storing validator keystores.",
|
|
161
|
+
defaultDescription: defaultAccountPaths.keystoresDir,
|
|
162
|
+
type: "string",
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
secretsDir: {
|
|
166
|
+
hidden: true,
|
|
167
|
+
description: "Directory for storing validator keystore secrets.",
|
|
168
|
+
defaultDescription: defaultAccountPaths.secretsDir,
|
|
169
|
+
type: "string",
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
remoteKeysDir: {
|
|
173
|
+
hidden: true,
|
|
174
|
+
description: "Directory for storing validator remote key definitions.",
|
|
175
|
+
defaultDescription: defaultAccountPaths.keystoresDir,
|
|
176
|
+
type: "string",
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
proposerDir: {
|
|
180
|
+
hidden: true,
|
|
181
|
+
description: "Directory for storing keymanager's proposer configs for validators",
|
|
182
|
+
defaultDescription: defaultAccountPaths.proposerDir,
|
|
183
|
+
type: "string",
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
validatorsDbDir: {
|
|
187
|
+
hidden: true,
|
|
188
|
+
description: "Data directory for validator databases.",
|
|
189
|
+
defaultDescription: defaultValidatorPaths.validatorsDbDir,
|
|
190
|
+
type: "string",
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
beaconNodes: {
|
|
194
|
+
description: "Addresses to connect to BeaconNode",
|
|
195
|
+
default: ["http://127.0.0.1:9596"],
|
|
196
|
+
type: "array",
|
|
197
|
+
string: true,
|
|
198
|
+
coerce: (urls: string[]): string[] =>
|
|
199
|
+
// Parse ["url1,url2"] to ["url1", "url2"]
|
|
200
|
+
urls.flatMap((item) => item.split(",")),
|
|
201
|
+
alias: ["server"], // for backwards compatibility
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
force: {
|
|
205
|
+
description: "Open validators even if there's a lockfile. Use with caution",
|
|
206
|
+
type: "boolean",
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
graffiti: {
|
|
210
|
+
description: "Specify your custom graffiti to be included in blocks (plain UTF8 text, 32 characters max)",
|
|
211
|
+
type: "string",
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
afterBlockDelaySlotFraction: {
|
|
215
|
+
hidden: true,
|
|
216
|
+
description:
|
|
217
|
+
"Delay before publishing attestations if block comes early, as a fraction of SLOT_DURATION_MS (value is from 0 inclusive to 1 exclusive)",
|
|
218
|
+
type: "number",
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
scAfterBlockDelaySlotFraction: {
|
|
222
|
+
hidden: true,
|
|
223
|
+
description:
|
|
224
|
+
"Delay before publishing SyncCommitteeSignature if block comes early, as a fraction of SLOT_DURATION_MS (value is from 0 inclusive to 1 exclusive)",
|
|
225
|
+
type: "number",
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
proposerSettingsFile: {
|
|
229
|
+
description:
|
|
230
|
+
"A yaml file to specify detailed default and per validator public key customized proposer configs. PS: This feature and its format is in alpha and subject to change",
|
|
231
|
+
type: "string",
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
suggestedFeeRecipient: {
|
|
235
|
+
description:
|
|
236
|
+
"Specify fee recipient default for collecting the EL block fees and rewards (a hex string representing 20 bytes address: ^0x[a-fA-F0-9]{40}$). It would be possible (WIP) to override this per validator key using config or key manager API. Only used post merge.",
|
|
237
|
+
defaultDescription: defaultOptions.suggestedFeeRecipient,
|
|
238
|
+
type: "string",
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
strictFeeRecipientCheck: {
|
|
242
|
+
description: "Enable strict checking of the validator's `feeRecipient` with the one returned by engine",
|
|
243
|
+
type: "boolean",
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
defaultGasLimit: {
|
|
247
|
+
description: "Suggested gas limit to the engine/builder for building execution payloads. Only used post merge.",
|
|
248
|
+
defaultDescription: `${defaultOptions.defaultGasLimit}`,
|
|
249
|
+
type: "number",
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
builder: {
|
|
253
|
+
type: "boolean",
|
|
254
|
+
description: `An alias for \`--builder.selection ${defaultOptions.builderAliasSelection}\` for the builder flow, ignored if \`--builder.selection\` is explicitly provided`,
|
|
255
|
+
group: "builder",
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
"builder.selection": {
|
|
259
|
+
type: "string",
|
|
260
|
+
description:
|
|
261
|
+
"Builder block selection strategy `default`, `maxprofit`, `builderalways`, `builderonly`, `executionalways`, or `executiononly`",
|
|
262
|
+
defaultDescription: `${defaultOptions.builderSelection}`,
|
|
263
|
+
group: "builder",
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
"builder.boostFactor": {
|
|
267
|
+
type: "string",
|
|
268
|
+
description:
|
|
269
|
+
"Percentage multiplier the block producing beacon node must apply to boost (>100) or dampen (<100) builder block value for selection against execution block. The multiplier is ignored if `--builder.selection` is set to anything other than `maxprofit`",
|
|
270
|
+
defaultDescription: `${defaultOptions.builderBoostFactor}`,
|
|
271
|
+
group: "builder",
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
useProduceBlockV3: {
|
|
275
|
+
hidden: true,
|
|
276
|
+
deprecated: true,
|
|
277
|
+
type: "boolean",
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
broadcastValidation: {
|
|
281
|
+
type: "string",
|
|
282
|
+
description: "Validations to be run by beacon node for the signed block prior to publishing",
|
|
283
|
+
defaultDescription: `${defaultOptions.broadcastValidation}`,
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
blindedLocal: {
|
|
287
|
+
type: "boolean",
|
|
288
|
+
description: "Request fetching local block in blinded format for produceBlockV3",
|
|
289
|
+
defaultDescription: `${defaultOptions.blindedLocal}`,
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
importKeystores: {
|
|
293
|
+
alias: ["keystore"], // Backwards compatibility with old `validator import` cmdx
|
|
294
|
+
description: "Path(s) to a directory or single file path to validator keystores, i.e. Launchpad validators",
|
|
295
|
+
defaultDescription: "./keystores/*.json",
|
|
296
|
+
type: "array",
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
importKeystoresPassword: {
|
|
300
|
+
alias: ["passphraseFile"], // Backwards compatibility with old `validator import` cmd
|
|
301
|
+
description: "Path to a file with password to decrypt all keystores from `importKeystores` option",
|
|
302
|
+
defaultDescription: "./password.txt",
|
|
303
|
+
type: "string",
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
disableKeystoresThreadPool: {
|
|
307
|
+
hidden: true,
|
|
308
|
+
description:
|
|
309
|
+
"Disable thread pool and instead use main thread to decrypt keystores. This can speed up decryption in testing environments like Kurtosis",
|
|
310
|
+
type: "boolean",
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
doppelgangerProtection: {
|
|
314
|
+
alias: ["doppelgangerProtectionEnabled"],
|
|
315
|
+
description: "Enables Doppelganger protection",
|
|
316
|
+
default: false,
|
|
317
|
+
type: "boolean",
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
"http.requestWireFormat": {
|
|
321
|
+
type: "string",
|
|
322
|
+
description: `Wire format to use in HTTP requests to beacon node. Can be one of \`${WireFormat.json}\` or \`${WireFormat.ssz}\``,
|
|
323
|
+
defaultDescription: `${defaultInit.requestWireFormat}`,
|
|
324
|
+
group: "http",
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
"http.responseWireFormat": {
|
|
328
|
+
type: "string",
|
|
329
|
+
description: `Preferred wire format for HTTP responses from beacon node. Can be one of \`${WireFormat.json}\` or \`${WireFormat.ssz}\``,
|
|
330
|
+
defaultDescription: `${defaultInit.responseWireFormat}`,
|
|
331
|
+
group: "http",
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
// External signer
|
|
335
|
+
|
|
336
|
+
"externalSigner.url": {
|
|
337
|
+
description: "URL to connect to an external signing server",
|
|
338
|
+
type: "string",
|
|
339
|
+
group: "externalSigner",
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
"externalSigner.pubkeys": {
|
|
343
|
+
implies: ["externalSigner.url"],
|
|
344
|
+
description:
|
|
345
|
+
"List of validator public keys used by an external signer. May also provide a single string of comma-separated public keys",
|
|
346
|
+
type: "array",
|
|
347
|
+
string: true, // Ensures the pubkey string is not automatically converted to numbers
|
|
348
|
+
coerce: (pubkeys: string[]): string[] =>
|
|
349
|
+
// Parse ["0x11,0x22"] to ["0x11", "0x22"]
|
|
350
|
+
pubkeys
|
|
351
|
+
.flatMap((item) => item.split(","))
|
|
352
|
+
.map(ensure0xPrefix),
|
|
353
|
+
group: "externalSigner",
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
"externalSigner.fetch": {
|
|
357
|
+
implies: ["externalSigner.url"],
|
|
358
|
+
conflicts: ["externalSigner.pubkeys"],
|
|
359
|
+
description:
|
|
360
|
+
"Fetch the list of public keys to validate from an external signer. Cannot be used in combination with `--externalSigner.pubkeys`",
|
|
361
|
+
type: "boolean",
|
|
362
|
+
group: "externalSigner",
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
"externalSigner.fetchInterval": {
|
|
366
|
+
implies: ["externalSigner.fetch"],
|
|
367
|
+
description:
|
|
368
|
+
"Interval in milliseconds between fetching the list of public keys from external signer, once per epoch by default",
|
|
369
|
+
type: "number",
|
|
370
|
+
group: "externalSigner",
|
|
371
|
+
},
|
|
372
|
+
|
|
373
|
+
// Distributed validator
|
|
374
|
+
|
|
375
|
+
distributed: {
|
|
376
|
+
description: "Enables specific features required to run as part of a distributed validator cluster",
|
|
377
|
+
type: "boolean",
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
// Metrics
|
|
381
|
+
|
|
382
|
+
metrics: {
|
|
383
|
+
type: "boolean",
|
|
384
|
+
description: "Enable the Prometheus metrics HTTP server",
|
|
385
|
+
defaultDescription: String(validatorMetricsDefaultOptions.enabled),
|
|
386
|
+
group: "metrics",
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
"metrics.port": {
|
|
390
|
+
type: "number",
|
|
391
|
+
description: "Listen TCP port for the Prometheus metrics HTTP server",
|
|
392
|
+
defaultDescription: String(validatorMetricsDefaultOptions.port),
|
|
393
|
+
group: "metrics",
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
"metrics.address": {
|
|
397
|
+
type: "string",
|
|
398
|
+
description: "Listen address for the Prometheus metrics HTTP server",
|
|
399
|
+
defaultDescription: String(validatorMetricsDefaultOptions.address),
|
|
400
|
+
group: "metrics",
|
|
401
|
+
},
|
|
402
|
+
|
|
403
|
+
// Monitoring
|
|
404
|
+
|
|
405
|
+
"monitoring.endpoint": {
|
|
406
|
+
type: "string",
|
|
407
|
+
description:
|
|
408
|
+
"Enables monitoring service for sending clients stats to the specified endpoint of a remote service (e.g. beaconcha.in)",
|
|
409
|
+
group: "monitoring",
|
|
410
|
+
},
|
|
411
|
+
|
|
412
|
+
"monitoring.interval": {
|
|
413
|
+
type: "number",
|
|
414
|
+
description: "Interval in milliseconds between sending client stats to the remote service",
|
|
415
|
+
defaultDescription: String(validatorMonitoringDefaultOptions.interval),
|
|
416
|
+
group: "monitoring",
|
|
417
|
+
},
|
|
418
|
+
|
|
419
|
+
"monitoring.initialDelay": {
|
|
420
|
+
type: "number",
|
|
421
|
+
description: "Initial delay in milliseconds before client stats are sent to the remote service",
|
|
422
|
+
defaultDescription: String(validatorMonitoringDefaultOptions.initialDelay),
|
|
423
|
+
group: "monitoring",
|
|
424
|
+
hidden: true,
|
|
425
|
+
},
|
|
426
|
+
|
|
427
|
+
"monitoring.requestTimeout": {
|
|
428
|
+
type: "number",
|
|
429
|
+
description: "Timeout in milliseconds for sending client stats to the remote service",
|
|
430
|
+
defaultDescription: String(validatorMonitoringDefaultOptions.requestTimeout),
|
|
431
|
+
group: "monitoring",
|
|
432
|
+
hidden: true,
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
"monitoring.collectSystemStats": {
|
|
436
|
+
type: "boolean",
|
|
437
|
+
description:
|
|
438
|
+
"Enable collecting system stats. This should only be enabled if validator client and beacon node are running on different hosts.",
|
|
439
|
+
defaultDescription: String(validatorMonitoringDefaultOptions.collectSystemStats),
|
|
440
|
+
group: "monitoring",
|
|
441
|
+
hidden: true,
|
|
442
|
+
},
|
|
443
|
+
|
|
444
|
+
// For testing only
|
|
445
|
+
|
|
446
|
+
interopIndexes: {
|
|
447
|
+
hidden: true,
|
|
448
|
+
description: "Range (inclusive) of interop key indexes to validate with: 0..16",
|
|
449
|
+
type: "string",
|
|
450
|
+
},
|
|
451
|
+
|
|
452
|
+
fromMnemonic: {
|
|
453
|
+
hidden: true,
|
|
454
|
+
description: "UNSAFE. Run keys from a mnemonic. Requires mnemonicIndexes option",
|
|
455
|
+
type: "string",
|
|
456
|
+
},
|
|
457
|
+
|
|
458
|
+
mnemonicIndexes: {
|
|
459
|
+
hidden: true,
|
|
460
|
+
description: "UNSAFE. Range (inclusive) of mnemonic key indexes to validate with: 0..16",
|
|
461
|
+
type: "string",
|
|
462
|
+
},
|
|
463
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import {GlobalArgs} from "../../options/index.js";
|
|
3
|
+
import {GlobalPaths, getGlobalPaths} from "../../paths/global.js";
|
|
4
|
+
|
|
5
|
+
export type IValidatorPaths = {
|
|
6
|
+
validatorsDbDir: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type AccountPaths = {
|
|
10
|
+
cacheDir: string;
|
|
11
|
+
keystoresDir: string;
|
|
12
|
+
secretsDir: string;
|
|
13
|
+
remoteKeysDir: string;
|
|
14
|
+
proposerDir: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Defines the path structure of the validator files
|
|
19
|
+
*
|
|
20
|
+
* ```bash
|
|
21
|
+
* $validatordataDir
|
|
22
|
+
* └── validator-db
|
|
23
|
+
* └── (db files)
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function getValidatorPaths(
|
|
27
|
+
args: Partial<IValidatorPaths> & Pick<GlobalArgs, "dataDir">,
|
|
28
|
+
network: string
|
|
29
|
+
): IValidatorPaths & GlobalPaths {
|
|
30
|
+
// Compute global paths first
|
|
31
|
+
const globalPaths = getGlobalPaths(args, network);
|
|
32
|
+
|
|
33
|
+
const dataDir = globalPaths.dataDir;
|
|
34
|
+
const validatorsDbDir = args.validatorsDbDir ?? path.join(dataDir, "validator-db");
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
...globalPaths,
|
|
38
|
+
validatorsDbDir,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Constructs representations of the path structure to show in command's description
|
|
44
|
+
*/
|
|
45
|
+
export const defaultValidatorPaths = getValidatorPaths({dataDir: "$dataDir"}, "$network");
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Defines the path structure of the account files
|
|
49
|
+
*
|
|
50
|
+
* ```bash
|
|
51
|
+
* $accountsdataDir
|
|
52
|
+
* ├── secrets
|
|
53
|
+
* | ├── 0x8e41b969493454318c27ec6fac90645769331c07ebc8db5037...
|
|
54
|
+
* | └── 0xa329f988c16993768299643d918a2694892c012765d896a16f...
|
|
55
|
+
* ├── keystores
|
|
56
|
+
* | ├── 0x8e41b969493454318c27ec6fac90645769331c07ebc8db5037...
|
|
57
|
+
* | | ├── eth1-deposit-data.rlp
|
|
58
|
+
* | | ├── eth1-deposit-gwei.txt
|
|
59
|
+
* | | └── voting-keystore.json
|
|
60
|
+
* | └── 0xa329f988c16993768299643d918a2694892c012765d896a16f...
|
|
61
|
+
* | ├── eth1-deposit-data.rlp
|
|
62
|
+
* | ├── eth1-deposit-gwei.txt
|
|
63
|
+
* | └── voting-keystore.json
|
|
64
|
+
* └── remoteKeys
|
|
65
|
+
* └── 0xa329f988c16993768299643d918a2694892c012765d896a16f.json
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
// Using Pick<GlobalArgs, "dataDir"> make changes in GlobalArgs throw a type error here
|
|
69
|
+
export function getAccountPaths(
|
|
70
|
+
args: Partial<AccountPaths> & Pick<GlobalArgs, "dataDir">,
|
|
71
|
+
network: string
|
|
72
|
+
): AccountPaths & GlobalPaths {
|
|
73
|
+
// Compute global paths first
|
|
74
|
+
const globalPaths = getGlobalPaths(args, network);
|
|
75
|
+
|
|
76
|
+
const dataDir = globalPaths.dataDir;
|
|
77
|
+
const cacheDir = args.cacheDir || path.join(dataDir, "cache");
|
|
78
|
+
const keystoresDir = args.keystoresDir || path.join(dataDir, "keystores");
|
|
79
|
+
const secretsDir = args.secretsDir || path.join(dataDir, "secrets");
|
|
80
|
+
const remoteKeysDir = args.remoteKeysDir || path.join(dataDir, "remoteKeys");
|
|
81
|
+
const proposerDir = args.proposerDir || path.join(dataDir, "proposerConfigs");
|
|
82
|
+
return {
|
|
83
|
+
...globalPaths,
|
|
84
|
+
cacheDir,
|
|
85
|
+
keystoresDir,
|
|
86
|
+
secretsDir,
|
|
87
|
+
remoteKeysDir,
|
|
88
|
+
proposerDir,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Constructs representations of the path structure to show in command's description
|
|
94
|
+
*/
|
|
95
|
+
export const defaultAccountPaths = getAccountPaths({dataDir: "$dataDir"}, "$network");
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import inquirer from "inquirer";
|
|
2
|
+
import {readPassphraseFile, recursiveLookup} from "../../../util/index.js";
|
|
3
|
+
import {LocalKeystoreDefinition} from "../keymanager/interface.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Imports keystores from un-controlled directories provided by the user.
|
|
7
|
+
* This directories are expected to contain other files, so some filtering in done to improve UX.
|
|
8
|
+
* @param args
|
|
9
|
+
*/
|
|
10
|
+
export function importKeystoreDefinitionsFromExternalDir(args: {
|
|
11
|
+
keystoresPath: string[];
|
|
12
|
+
password: string;
|
|
13
|
+
}): LocalKeystoreDefinition[] {
|
|
14
|
+
const allFiles: string[] = [];
|
|
15
|
+
|
|
16
|
+
for (const keystorePath of args.keystoresPath) {
|
|
17
|
+
recursiveLookup(keystorePath, allFiles);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return allFiles
|
|
21
|
+
.filter((filepath) => isVotingKeystore(filepath))
|
|
22
|
+
.map((keystorePath) => ({
|
|
23
|
+
keystorePath,
|
|
24
|
+
password: args.password,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function readPassphraseOrPrompt(args: {importKeystoresPassword?: string}): Promise<string> {
|
|
29
|
+
if (args.importKeystoresPassword) {
|
|
30
|
+
return readPassphraseFile(args.importKeystoresPassword);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const answers = await inquirer.prompt<{password: string}>([
|
|
34
|
+
{
|
|
35
|
+
name: "password",
|
|
36
|
+
type: "password",
|
|
37
|
+
message: "Enter the keystore(s) password",
|
|
38
|
+
},
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
return answers.password;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns `true` if we should consider the `filename` to represent a voting keystore.
|
|
46
|
+
*/
|
|
47
|
+
export function isVotingKeystore(filename: string): boolean {
|
|
48
|
+
// All formats end with `.json`.
|
|
49
|
+
return (
|
|
50
|
+
filename.endsWith(".json") &&
|
|
51
|
+
// The staking-deposit-cli tool outputs a deposit_data file in the directory users typically import from.
|
|
52
|
+
// Ignoring that file is very helpful for UX, and it's very unlikely that someone names their keystore that way.
|
|
53
|
+
!/deposit_data-\d+\.json$/gi.test(filename)
|
|
54
|
+
// Note: Previously this tool only imported the exact naming from the staking-deposit-cli tool.
|
|
55
|
+
// However, that's too restrictive. Guide left here as a reference
|
|
56
|
+
//
|
|
57
|
+
// The format exported by the `staking-deposit-cli` library.
|
|
58
|
+
//
|
|
59
|
+
// Reference to function that generates keystores:
|
|
60
|
+
// https://github.com/ethereum/staking-deposit-cli/blob/7cebff15eac299b3b1b090c896dd3410c8463450/eth2deposit/credentials.py#L58-L62
|
|
61
|
+
//
|
|
62
|
+
// Since we include the key derivation path of `m/12381/3600/x/0/0` this should only ever match
|
|
63
|
+
// with a voting keystore and never a withdrawal keystore.
|
|
64
|
+
//
|
|
65
|
+
// Key derivation path reference:
|
|
66
|
+
//
|
|
67
|
+
// https://eips.ethereum.org/EIPS/eip-2334
|
|
68
|
+
);
|
|
69
|
+
}
|