@chainsafe/lodestar 1.51.0-dev.2b933d3b9a → 1.51.0-dev.2bcbe7ce2d
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/README.md +9 -7
- package/lib/cmds/beacon/handler.d.ts.map +1 -1
- package/lib/cmds/beacon/handler.js +19 -7
- package/lib/cmds/beacon/handler.js.map +1 -1
- package/lib/cmds/beacon/initBeaconState.d.ts.map +1 -1
- package/lib/cmds/beacon/initBeaconState.js +1 -1
- package/lib/cmds/beacon/initBeaconState.js.map +1 -1
- package/lib/cmds/beacon/pubkeysFile.d.ts +1 -1
- package/lib/cmds/beacon/pubkeysFile.d.ts.map +1 -1
- package/lib/cmds/builder/handler.d.ts.map +1 -1
- package/lib/cmds/builder/handler.js +48 -3
- package/lib/cmds/builder/handler.js.map +1 -1
- package/lib/cmds/builder/loadKeypair.d.ts.map +1 -1
- package/lib/cmds/builder/loadKeypair.js +1 -1
- package/lib/cmds/builder/loadKeypair.js.map +1 -1
- package/lib/cmds/builder/options.d.ts +13 -0
- package/lib/cmds/builder/options.d.ts.map +1 -1
- package/lib/cmds/builder/options.js +83 -1
- package/lib/cmds/builder/options.js.map +1 -1
- package/lib/cmds/dev/handler.js +6 -6
- package/lib/cmds/dev/handler.js.map +1 -1
- package/lib/cmds/dev/options.d.ts +2 -1
- package/lib/cmds/dev/options.d.ts.map +1 -1
- package/lib/cmds/dev/options.js +1 -3
- package/lib/cmds/dev/options.js.map +1 -1
- package/lib/cmds/validator/blsToExecutionChange.js +1 -1
- package/lib/cmds/validator/blsToExecutionChange.js.map +1 -1
- package/lib/cmds/validator/handler.d.ts.map +1 -1
- package/lib/cmds/validator/handler.js +12 -2
- package/lib/cmds/validator/handler.js.map +1 -1
- package/lib/cmds/validator/keymanager/decryptKeystoreDefinitions.js +1 -1
- package/lib/cmds/validator/keymanager/decryptKeystoreDefinitions.js.map +1 -1
- package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.d.ts +1 -1
- package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.d.ts.map +1 -1
- package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.js.map +1 -1
- package/lib/cmds/validator/keymanager/impl.d.ts.map +1 -1
- package/lib/cmds/validator/keymanager/impl.js +1 -1
- package/lib/cmds/validator/keymanager/impl.js.map +1 -1
- package/lib/cmds/validator/keymanager/keystoreCache.js +1 -1
- package/lib/cmds/validator/keymanager/keystoreCache.js.map +1 -1
- package/lib/cmds/validator/keymanager/persistedKeys.d.ts +1 -1
- package/lib/cmds/validator/keymanager/persistedKeys.d.ts.map +1 -1
- package/lib/cmds/validator/keymanager/persistedKeys.js +1 -1
- package/lib/cmds/validator/keymanager/persistedKeys.js.map +1 -1
- package/lib/cmds/validator/options.d.ts.map +1 -1
- package/lib/cmds/validator/options.js +3 -9
- package/lib/cmds/validator/options.js.map +1 -1
- package/lib/cmds/validator/signers/index.js +1 -1
- package/lib/cmds/validator/signers/index.js.map +1 -1
- package/lib/cmds/validator/slashingProtection/export.d.ts.map +1 -1
- package/lib/cmds/validator/slashingProtection/export.js +1 -3
- package/lib/cmds/validator/slashingProtection/export.js.map +1 -1
- package/lib/cmds/validator/slashingProtection/import.js +2 -2
- package/lib/cmds/validator/slashingProtection/import.js.map +1 -1
- package/lib/cmds/validator/voluntaryExit.d.ts.map +1 -1
- package/lib/cmds/validator/voluntaryExit.js +2 -4
- package/lib/cmds/validator/voluntaryExit.js.map +1 -1
- package/lib/options/beaconNodeOptions/api.d.ts +1 -0
- package/lib/options/beaconNodeOptions/api.d.ts.map +1 -1
- package/lib/options/beaconNodeOptions/api.js +8 -0
- package/lib/options/beaconNodeOptions/api.js.map +1 -1
- package/lib/options/beaconNodeOptions/builder.d.ts +1 -0
- package/lib/options/beaconNodeOptions/builder.d.ts.map +1 -1
- package/lib/options/beaconNodeOptions/builder.js +11 -0
- package/lib/options/beaconNodeOptions/builder.js.map +1 -1
- package/lib/options/beaconNodeOptions/chain.d.ts +0 -1
- package/lib/options/beaconNodeOptions/chain.d.ts.map +1 -1
- package/lib/options/beaconNodeOptions/chain.js +0 -8
- package/lib/options/beaconNodeOptions/chain.js.map +1 -1
- package/lib/options/beaconNodeOptions/index.d.ts +2 -1
- package/lib/options/beaconNodeOptions/index.d.ts.map +1 -1
- package/lib/util/file.d.ts.map +1 -1
- package/lib/util/file.js +3 -2
- package/lib/util/file.js.map +1 -1
- package/lib/util/format.js +1 -1
- package/lib/util/format.js.map +1 -1
- package/package.json +22 -20
- package/src/cmds/beacon/handler.ts +27 -7
- package/src/cmds/beacon/initBeaconState.ts +1 -1
- package/src/cmds/beacon/pubkeysFile.ts +1 -1
- package/src/cmds/builder/handler.ts +68 -3
- package/src/cmds/builder/loadKeypair.ts +1 -1
- package/src/cmds/builder/options.ts +118 -1
- package/src/cmds/dev/handler.ts +6 -6
- package/src/cmds/dev/options.ts +1 -3
- package/src/cmds/validator/blsToExecutionChange.ts +1 -1
- package/src/cmds/validator/handler.ts +10 -1
- package/src/cmds/validator/keymanager/decryptKeystoreDefinitions.ts +1 -1
- package/src/cmds/validator/keymanager/decryptKeystores/threadPool.ts +1 -1
- package/src/cmds/validator/keymanager/impl.ts +1 -1
- package/src/cmds/validator/keymanager/keystoreCache.ts +1 -1
- package/src/cmds/validator/keymanager/persistedKeys.ts +1 -1
- package/src/cmds/validator/options.ts +3 -9
- package/src/cmds/validator/signers/index.ts +1 -1
- package/src/cmds/validator/slashingProtection/export.ts +1 -3
- package/src/cmds/validator/slashingProtection/import.ts +2 -2
- package/src/cmds/validator/voluntaryExit.ts +2 -4
- package/src/options/beaconNodeOptions/api.ts +11 -0
- package/src/options/beaconNodeOptions/builder.ts +15 -0
- package/src/options/beaconNodeOptions/chain.ts +0 -11
- package/src/util/file.ts +3 -2
- package/src/util/format.ts +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {defaultExecutionEngineHttpOpts} from "@lodestar/beacon-node";
|
|
1
2
|
import {defaultOptions} from "@lodestar/builder";
|
|
2
3
|
import {CliCommandOptions} from "@lodestar/utils";
|
|
3
4
|
import {LogArgs, logOptions} from "../../options/logOptions.js";
|
|
@@ -16,6 +17,21 @@ export type IBuilderCliArgs = LogArgs & {
|
|
|
16
17
|
executionFeeRecipient: string;
|
|
17
18
|
requestTimeout: number;
|
|
18
19
|
|
|
20
|
+
"execution.urls": string[];
|
|
21
|
+
"execution.timeout"?: number;
|
|
22
|
+
"execution.retries": number;
|
|
23
|
+
"execution.retryDelay": number;
|
|
24
|
+
"execution.jwtSecret"?: string;
|
|
25
|
+
|
|
26
|
+
"bidding.shareBps": number;
|
|
27
|
+
"bidding.fixedCostGwei": number;
|
|
28
|
+
"bidding.minValueGwei": number;
|
|
29
|
+
"bidding.maxValueGwei"?: number;
|
|
30
|
+
"bidding.deadlineBps": number;
|
|
31
|
+
"bidding.getPayloadTimeout": number;
|
|
32
|
+
"bidding.minOperatingBalanceGwei": number;
|
|
33
|
+
"reveal.cutoffBps"?: number;
|
|
34
|
+
|
|
19
35
|
metrics?: boolean;
|
|
20
36
|
"metrics.port"?: number;
|
|
21
37
|
"metrics.address"?: string;
|
|
@@ -25,7 +41,8 @@ export const builderOptions: CliCommandOptions<IBuilderCliArgs> = {
|
|
|
25
41
|
...logOptions,
|
|
26
42
|
|
|
27
43
|
beaconNodeUrl: {
|
|
28
|
-
description:
|
|
44
|
+
description:
|
|
45
|
+
"URL of the beacon node. It must run with `--emitPayloadAttributes` to emit payload attributes for every slot",
|
|
29
46
|
type: "string",
|
|
30
47
|
default: defaultOptions.beaconNodeUrl,
|
|
31
48
|
},
|
|
@@ -59,6 +76,106 @@ export const builderOptions: CliCommandOptions<IBuilderCliArgs> = {
|
|
|
59
76
|
default: defaultOptions.requestTimeout,
|
|
60
77
|
},
|
|
61
78
|
|
|
79
|
+
// Execution
|
|
80
|
+
|
|
81
|
+
"execution.urls": {
|
|
82
|
+
description:
|
|
83
|
+
"Url to the execution client engine API that builds the payloads. The execution client must be kept in sync by a beacon node",
|
|
84
|
+
default: defaultExecutionEngineHttpOpts.urls.join(","),
|
|
85
|
+
type: "array",
|
|
86
|
+
string: true,
|
|
87
|
+
coerce: (urls: string[]): string[] =>
|
|
88
|
+
// Parse ["url1,url2"] to ["url1", "url2"]
|
|
89
|
+
urls.flatMap((item) => item.split(",")),
|
|
90
|
+
group: "execution",
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
"execution.timeout": {
|
|
94
|
+
description: "Timeout in milliseconds for execution engine API HTTP client",
|
|
95
|
+
type: "number",
|
|
96
|
+
defaultDescription: String(defaultExecutionEngineHttpOpts.timeout),
|
|
97
|
+
group: "execution",
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
"execution.retries": {
|
|
101
|
+
description: "Number of retries when calling execution engine API",
|
|
102
|
+
type: "number",
|
|
103
|
+
default: defaultExecutionEngineHttpOpts.retries,
|
|
104
|
+
group: "execution",
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
"execution.retryDelay": {
|
|
108
|
+
description: "Delay time in milliseconds between retries when retrying calls to the execution engine API",
|
|
109
|
+
type: "number",
|
|
110
|
+
default: defaultExecutionEngineHttpOpts.retryDelay,
|
|
111
|
+
group: "execution",
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
"execution.jwtSecret": {
|
|
115
|
+
description:
|
|
116
|
+
"File path to a shared hex-encoded jwt secret which will be used to generate and bundle HS256 encoded jwt tokens for authentication with the EL client's rpc server hosting engine apis. Secret to be exactly same as the one used by the corresponding EL client.",
|
|
117
|
+
type: "string",
|
|
118
|
+
group: "execution",
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
// Bidding
|
|
122
|
+
|
|
123
|
+
"bidding.shareBps": {
|
|
124
|
+
description: "Share of the payload value offered to the proposer, in basis points",
|
|
125
|
+
type: "number",
|
|
126
|
+
default: defaultOptions.bidding.shareBps,
|
|
127
|
+
group: "bidding",
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
"bidding.fixedCostGwei": {
|
|
131
|
+
description: "Fixed amount in gwei deducted from the proposer share of every bid",
|
|
132
|
+
type: "number",
|
|
133
|
+
default: defaultOptions.bidding.fixedCostGwei,
|
|
134
|
+
group: "bidding",
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
"bidding.minValueGwei": {
|
|
138
|
+
description: "Never bid below this value in gwei",
|
|
139
|
+
type: "number",
|
|
140
|
+
default: defaultOptions.bidding.minValueGwei,
|
|
141
|
+
group: "bidding",
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
"bidding.maxValueGwei": {
|
|
145
|
+
description: "Never bid above this value in gwei",
|
|
146
|
+
type: "number",
|
|
147
|
+
group: "bidding",
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
"bidding.deadlineBps": {
|
|
151
|
+
description:
|
|
152
|
+
"Point within the slot before the proposal slot at which the payload is retrieved and the bid is published, in basis points",
|
|
153
|
+
type: "number",
|
|
154
|
+
default: defaultOptions.bidding.deadlineBps,
|
|
155
|
+
group: "bidding",
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
"bidding.getPayloadTimeout": {
|
|
159
|
+
description: "Timeout in milliseconds for retrieving the payload from the execution client at the bid deadline",
|
|
160
|
+
type: "number",
|
|
161
|
+
default: defaultOptions.bidding.getPayloadTimeout,
|
|
162
|
+
group: "bidding",
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
"bidding.minOperatingBalanceGwei": {
|
|
166
|
+
description: "Do not bid while the builder balance is below this value in gwei",
|
|
167
|
+
type: "number",
|
|
168
|
+
default: defaultOptions.bidding.minOperatingBalanceGwei,
|
|
169
|
+
group: "bidding",
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
"reveal.cutoffBps": {
|
|
173
|
+
description:
|
|
174
|
+
"Do not reveal the payload if the block committing to our bid arrives after this point within its slot, in basis points. Defaults to PAYLOAD_ATTESTATION_DUE_BPS of the network",
|
|
175
|
+
type: "number",
|
|
176
|
+
group: "reveal",
|
|
177
|
+
},
|
|
178
|
+
|
|
62
179
|
// Metrics
|
|
63
180
|
|
|
64
181
|
metrics: {
|
package/src/cmds/dev/handler.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import {rm} from "node:fs/promises";
|
|
3
3
|
import {nodeUtils} from "@lodestar/beacon-node";
|
|
4
4
|
import {fromHex, toHex} from "@lodestar/utils";
|
|
5
5
|
import {getBeaconConfigFromArgs} from "../../config/beaconParams.js";
|
|
@@ -37,10 +37,10 @@ export async function devHandler(args: IDevArgs & GlobalArgs): Promise<void> {
|
|
|
37
37
|
// Remove slashing protection db. Otherwise the validators won't be able to propose nor attest
|
|
38
38
|
// until the clock reach a higher slot than the previous run of the dev command
|
|
39
39
|
if (args.genesisTime === undefined) {
|
|
40
|
-
await
|
|
41
|
-
await
|
|
40
|
+
await rm(beaconDbDir, {recursive: true, force: true});
|
|
41
|
+
await rm(validatorsDbDir, {recursive: true, force: true});
|
|
42
42
|
// Validators deposited in the previous run do not exist on the new chain
|
|
43
|
-
await
|
|
43
|
+
await rm(pubkeysFile, {recursive: true, force: true});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
mkdir(beaconDbDir);
|
|
@@ -48,8 +48,8 @@ export async function devHandler(args: IDevArgs & GlobalArgs): Promise<void> {
|
|
|
48
48
|
|
|
49
49
|
if (args.reset) {
|
|
50
50
|
onGracefulShutdown(async () => {
|
|
51
|
-
await
|
|
52
|
-
await
|
|
51
|
+
await rm(beaconDbDir, {recursive: true, force: true});
|
|
52
|
+
await rm(validatorsDbDir, {recursive: true, force: true});
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
|
package/src/cmds/dev/options.ts
CHANGED
|
@@ -34,9 +34,7 @@ const devOwnOptions: CliCommandOptions<IDevOwnArgs> = {
|
|
|
34
34
|
type: "array",
|
|
35
35
|
coerce: (indexes: string[]): number[] =>
|
|
36
36
|
// Parse ["11..13,15..17"] to ["11..13", "15..17"]
|
|
37
|
-
indexes
|
|
38
|
-
.flatMap((item) => item.split(","))
|
|
39
|
-
.flatMap(parseRange),
|
|
37
|
+
indexes.flatMap((item) => item.split(",")).flatMap(parseRange),
|
|
40
38
|
group: "dev",
|
|
41
39
|
},
|
|
42
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {SecretKey} from "@chainsafe/lodestar-z/blst";
|
|
2
1
|
import {getClient} from "@lodestar/api";
|
|
3
2
|
import {createBeaconConfig} from "@lodestar/config";
|
|
3
|
+
import {SecretKey} from "@lodestar/native/blst";
|
|
4
4
|
import {DOMAIN_BLS_TO_EXECUTION_CHANGE, ForkName} from "@lodestar/params";
|
|
5
5
|
import {computeSigningRoot} from "@lodestar/state-transition";
|
|
6
6
|
import {capella, ssz} from "@lodestar/types";
|
|
@@ -77,7 +77,16 @@ export async function validatorHandler(args: IValidatorCliArgs & GlobalArgs): Pr
|
|
|
77
77
|
|
|
78
78
|
const onGracefulShutdownCbs: (() => Promise<void> | void)[] = [];
|
|
79
79
|
onGracefulShutdown(async () => {
|
|
80
|
-
|
|
80
|
+
let exitCode = 0;
|
|
81
|
+
try {
|
|
82
|
+
for (const cb of onGracefulShutdownCbs) await cb();
|
|
83
|
+
logger.debug("Validator client closed");
|
|
84
|
+
} catch (e) {
|
|
85
|
+
logger.warn("Error closing validator client", {}, e as Error);
|
|
86
|
+
exitCode = 1;
|
|
87
|
+
}
|
|
88
|
+
// Explicitly exit process due to potential active handles (e.g. EventSource / in-flight HTTP via DVT middleware)
|
|
89
|
+
process.exit(exitCode);
|
|
81
90
|
}, logger.info.bind(logger));
|
|
82
91
|
|
|
83
92
|
// Callback for validator to request forced exit, in case of doppelganger detection
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import {Keystore} from "@chainsafe/bls-keystore";
|
|
4
|
-
import {SecretKey} from "@
|
|
4
|
+
import {SecretKey} from "@lodestar/native/blst";
|
|
5
5
|
import {LogLevel, Logger} from "@lodestar/utils";
|
|
6
6
|
import {SignerLocal, SignerType} from "@lodestar/validator";
|
|
7
7
|
import {lockFilepath, unlockFilepath} from "../../../util/lockfile.js";
|
|
@@ -45,7 +45,7 @@ export class DecryptKeystoresThreadPool {
|
|
|
45
45
|
*/
|
|
46
46
|
queue(
|
|
47
47
|
args: DecryptKeystoreArgs,
|
|
48
|
-
onDecrypted: (secretKeyBytes: Uint8Array) => void
|
|
48
|
+
onDecrypted: (secretKeyBytes: Uint8Array) => void | Promise<void>,
|
|
49
49
|
onError: (e: Error) => void
|
|
50
50
|
): void {
|
|
51
51
|
const task = this.pool.queue((thread) => thread.decryptKeystore(args));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {Keystore} from "@chainsafe/bls-keystore";
|
|
2
|
-
import {SecretKey} from "@chainsafe/lodestar-z/blst";
|
|
3
2
|
import {
|
|
4
3
|
BuilderBoostFactorData,
|
|
5
4
|
BuilderConfigData,
|
|
@@ -20,6 +19,7 @@ import {
|
|
|
20
19
|
} from "@lodestar/api/keymanager";
|
|
21
20
|
import {KeymanagerApiMethods as Api} from "@lodestar/api/keymanager/server";
|
|
22
21
|
import {ApiError} from "@lodestar/api/server";
|
|
22
|
+
import {SecretKey} from "@lodestar/native/blst";
|
|
23
23
|
import {Epoch} from "@lodestar/types";
|
|
24
24
|
import {fromHex, isValidHttpUrl} from "@lodestar/utils";
|
|
25
25
|
import {Interchange, SignerType, Validator} from "@lodestar/validator";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import {Keystore} from "@chainsafe/bls-keystore";
|
|
4
|
-
import {SecretKey} from "@
|
|
4
|
+
import {SecretKey} from "@lodestar/native/blst";
|
|
5
5
|
import {fromHex, toHex, toPubkeyHex} from "@lodestar/utils";
|
|
6
6
|
import {SignerLocal, SignerType} from "@lodestar/validator";
|
|
7
7
|
import {writeFile600Perm} from "../../../util/file.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {lockFilepath} from "../../../util/lockfile.js";
|
|
15
15
|
import {IPersistedKeysBackend, LocalKeystoreDefinition} from "./interface.js";
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export {DeletionStatus, ImportStatus};
|
|
18
18
|
|
|
19
19
|
type PathArgs = {
|
|
20
20
|
keystoresDir: string;
|
|
@@ -416,9 +416,7 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {
|
|
|
416
416
|
string: true, // Ensures the pubkey string is not automatically converted to numbers
|
|
417
417
|
coerce: (pubkeys: string[]): string[] =>
|
|
418
418
|
// Parse ["0x11,0x22"] to ["0x11", "0x22"]
|
|
419
|
-
pubkeys
|
|
420
|
-
.flatMap((item) => item.split(","))
|
|
421
|
-
.map(ensure0xPrefix),
|
|
419
|
+
pubkeys.flatMap((item) => item.split(",")).map(ensure0xPrefix),
|
|
422
420
|
group: "externalSigner",
|
|
423
421
|
},
|
|
424
422
|
|
|
@@ -518,9 +516,7 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {
|
|
|
518
516
|
type: "array",
|
|
519
517
|
coerce: (indexes: string[]): number[] =>
|
|
520
518
|
// Parse ["11..13,15..17"] to ["11..13", "15..17"]
|
|
521
|
-
indexes
|
|
522
|
-
.flatMap((item) => item.split(","))
|
|
523
|
-
.flatMap(parseRange),
|
|
519
|
+
indexes.flatMap((item) => item.split(",")).flatMap(parseRange),
|
|
524
520
|
},
|
|
525
521
|
|
|
526
522
|
fromMnemonic: {
|
|
@@ -535,8 +531,6 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {
|
|
|
535
531
|
type: "array",
|
|
536
532
|
coerce: (indexes: string[]): number[] =>
|
|
537
533
|
// Parse ["11..13,15..17"] to ["11..13", "15..17"]
|
|
538
|
-
indexes
|
|
539
|
-
.flatMap((item) => item.split(","))
|
|
540
|
-
.flatMap(parseRange),
|
|
534
|
+
indexes.flatMap((item) => item.split(",")).flatMap(parseRange),
|
|
541
535
|
},
|
|
542
536
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import {deriveEth2ValidatorKeys, deriveKeyFromMnemonic} from "@chainsafe/bls-keygen";
|
|
3
|
-
import {SecretKey} from "@
|
|
3
|
+
import {SecretKey} from "@lodestar/native/blst";
|
|
4
4
|
import {interopSecretKey} from "@lodestar/state-transition";
|
|
5
5
|
import {LogLevel, Logger, isValidHttpUrl} from "@lodestar/utils";
|
|
6
6
|
import {Signer, SignerType, externalSignerGetKeys} from "@lodestar/validator";
|
|
@@ -42,9 +42,7 @@ export const exportCmd: CliCommand<ExportArgs, ISlashingProtectionArgs & Account
|
|
|
42
42
|
string: true, // Ensures the pubkey string is not automatically converted to numbers
|
|
43
43
|
coerce: (pubkeys: string[]): string[] =>
|
|
44
44
|
// Parse ["0x11,0x22"] to ["0x11", "0x22"]
|
|
45
|
-
pubkeys
|
|
46
|
-
.flatMap((item) => item.split(","))
|
|
47
|
-
.map(ensure0xPrefix),
|
|
45
|
+
pubkeys.flatMap((item) => item.split(",")).map(ensure0xPrefix),
|
|
48
46
|
},
|
|
49
47
|
},
|
|
50
48
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {readFile} from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import {getNodeLogger} from "@lodestar/logger/node";
|
|
4
4
|
import {CliCommand} from "@lodestar/utils";
|
|
@@ -61,7 +61,7 @@ export const importCmd: CliCommand<ImportArgs, ISlashingProtectionArgs & Account
|
|
|
61
61
|
(await metadata.getGenesisValidatorsRoot()) ?? (await getGenesisValidatorsRoot(args));
|
|
62
62
|
|
|
63
63
|
logger.verbose("Reading slashing protection data", {file});
|
|
64
|
-
const interchangeStr = await
|
|
64
|
+
const interchangeStr = await readFile(file, "utf8");
|
|
65
65
|
const interchangeJson = JSON.parse(interchangeStr) as Interchange;
|
|
66
66
|
|
|
67
67
|
await slashingProtection.importInterchange(interchangeJson, genesisValidatorsRoot, logger);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import inquirer from "inquirer";
|
|
4
|
-
import {Signature} from "@chainsafe/lodestar-z/blst";
|
|
5
4
|
import {ApiClient, getClient} from "@lodestar/api";
|
|
6
5
|
import {BeaconConfig, createBeaconConfig} from "@lodestar/config";
|
|
6
|
+
import {Signature} from "@lodestar/native/blst";
|
|
7
7
|
import {
|
|
8
8
|
computeEpochAtSlot,
|
|
9
9
|
computeSigningRoot,
|
|
@@ -59,9 +59,7 @@ If no `pubkeys` are provided, it will exit all validators that have been importe
|
|
|
59
59
|
string: true, // Ensures the pubkey string is not automatically converted to numbers
|
|
60
60
|
coerce: (pubkeys: string[]): string[] =>
|
|
61
61
|
// Parse ["0x11,0x22"] to ["0x11", "0x22"]
|
|
62
|
-
pubkeys
|
|
63
|
-
.flatMap((item) => item.split(","))
|
|
64
|
-
.map(ensure0xPrefix),
|
|
62
|
+
pubkeys.flatMap((item) => item.split(",")).map(ensure0xPrefix),
|
|
65
63
|
},
|
|
66
64
|
|
|
67
65
|
yes: {
|
|
@@ -13,6 +13,7 @@ export function coerceCors(cors: string): string {
|
|
|
13
13
|
|
|
14
14
|
export type ApiArgs = {
|
|
15
15
|
"api.maxGindicesInProof"?: number;
|
|
16
|
+
"api.disableBidValidation"?: boolean;
|
|
16
17
|
"rest.namespace"?: string[];
|
|
17
18
|
"rest.cors"?: string;
|
|
18
19
|
rest: boolean;
|
|
@@ -27,6 +28,7 @@ export type ApiArgs = {
|
|
|
27
28
|
export function parseArgs(args: ApiArgs): IBeaconNodeOptions["api"] {
|
|
28
29
|
return {
|
|
29
30
|
maxGindicesInProof: args["api.maxGindicesInProof"],
|
|
31
|
+
disableBidValidation: args["api.disableBidValidation"],
|
|
30
32
|
rest: {
|
|
31
33
|
api: args["rest.namespace"] as IBeaconNodeOptions["api"]["rest"]["api"],
|
|
32
34
|
cors: args["rest.cors"],
|
|
@@ -57,6 +59,15 @@ export const options: CliCommandOptions<ApiArgs> = {
|
|
|
57
59
|
group: "api",
|
|
58
60
|
},
|
|
59
61
|
|
|
62
|
+
"api.disableBidValidation": {
|
|
63
|
+
hidden: true,
|
|
64
|
+
type: "boolean",
|
|
65
|
+
description:
|
|
66
|
+
"Broadcast execution payload bids submitted via the API without running gossip validation. Only enable if the API is exclusively used by a trusted local builder, forwarding invalid bids gets the node penalized by peers",
|
|
67
|
+
defaultDescription: String(defaultOptions.api.disableBidValidation),
|
|
68
|
+
group: "api",
|
|
69
|
+
},
|
|
70
|
+
|
|
60
71
|
"rest.namespace": {
|
|
61
72
|
type: "array",
|
|
62
73
|
choices: [...allNamespaces, enabledAll, enabledAllBashFriendly],
|
|
@@ -6,6 +6,7 @@ export type ExecutionBuilderArgs = {
|
|
|
6
6
|
builder: boolean;
|
|
7
7
|
"builder.url"?: string;
|
|
8
8
|
"builder.timeout"?: number;
|
|
9
|
+
"builder.bidDeadline"?: number;
|
|
9
10
|
"builder.faultInspectionWindow"?: number;
|
|
10
11
|
"builder.allowedFaults"?: number;
|
|
11
12
|
};
|
|
@@ -20,10 +21,16 @@ export function parseArgs(args: ExecutionBuilderArgs): IBeaconNodeOptions["execu
|
|
|
20
21
|
);
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
const bidDeadline = args["builder.bidDeadline"];
|
|
25
|
+
if (bidDeadline !== undefined && (!Number.isInteger(bidDeadline) || bidDeadline <= 0)) {
|
|
26
|
+
throw new YargsError("builder.bidDeadline must be a positive integer");
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
return {
|
|
24
30
|
enabled: args.builder,
|
|
25
31
|
url: args["builder.url"] ?? defaultExecutionBuilderHttpOpts.url,
|
|
26
32
|
timeout: args["builder.timeout"],
|
|
33
|
+
bidDeadline,
|
|
27
34
|
faultInspectionWindow: args["builder.faultInspectionWindow"],
|
|
28
35
|
allowedFaults: args["builder.allowedFaults"],
|
|
29
36
|
};
|
|
@@ -54,6 +61,14 @@ export const options: CliCommandOptions<ExecutionBuilderArgs> = {
|
|
|
54
61
|
group: "builder",
|
|
55
62
|
},
|
|
56
63
|
|
|
64
|
+
"builder.bidDeadline": {
|
|
65
|
+
description:
|
|
66
|
+
"Time in milliseconds builders are given to provide a bid once block production starts. Advertised to builder API endpoints via the `X-Timeout-Ms` header and applied to bids received via p2p. Post-Gloas only",
|
|
67
|
+
type: "number",
|
|
68
|
+
defaultDescription: String(defaultExecutionBuilderHttpOpts.bidDeadline),
|
|
69
|
+
group: "builder",
|
|
70
|
+
},
|
|
71
|
+
|
|
57
72
|
"builder.faultInspectionWindow": {
|
|
58
73
|
type: "number",
|
|
59
74
|
description:
|
|
@@ -29,7 +29,6 @@ export type ChainArgs = {
|
|
|
29
29
|
"chain.maxSkipSlots"?: number;
|
|
30
30
|
"chain.disableProposerSlashings"?: boolean;
|
|
31
31
|
emitPayloadAttributes?: boolean;
|
|
32
|
-
broadcastValidationStrictness?: string;
|
|
33
32
|
"chain.minSameMessageSignatureSetsToBatch"?: number;
|
|
34
33
|
"chain.maxShufflingCacheEpochs"?: number;
|
|
35
34
|
"chain.archiveStateEpochFrequency": number;
|
|
@@ -72,7 +71,6 @@ export function parseArgs(args: ChainArgs & CircuitBreakerArgs): IBeaconNodeOpti
|
|
|
72
71
|
maxSkipSlots: args["chain.maxSkipSlots"],
|
|
73
72
|
disableProposerSlashings: args["chain.disableProposerSlashings"],
|
|
74
73
|
emitPayloadAttributes: args.emitPayloadAttributes,
|
|
75
|
-
broadcastValidationStrictness: args.broadcastValidationStrictness,
|
|
76
74
|
minSameMessageSignatureSetsToBatch:
|
|
77
75
|
args["chain.minSameMessageSignatureSetsToBatch"] ?? defaultOptions.chain.minSameMessageSignatureSetsToBatch,
|
|
78
76
|
maxShufflingCacheEpochs: args["chain.maxShufflingCacheEpochs"] ?? defaultOptions.chain.maxShufflingCacheEpochs,
|
|
@@ -286,15 +284,6 @@ Will double processing times. Use only for debugging purposes.",
|
|
|
286
284
|
group: "chain",
|
|
287
285
|
},
|
|
288
286
|
|
|
289
|
-
broadcastValidationStrictness: {
|
|
290
|
-
// TODO: hide the option till validations fully implemented
|
|
291
|
-
hidden: true,
|
|
292
|
-
description:
|
|
293
|
-
"'warn' or 'error' - options to either throw error or to log warning when broadcast validation can't be performed",
|
|
294
|
-
type: "string",
|
|
295
|
-
default: "warn",
|
|
296
|
-
},
|
|
297
|
-
|
|
298
287
|
"chain.minSameMessageSignatureSetsToBatch": {
|
|
299
288
|
hidden: true,
|
|
300
289
|
description: "Minimum number of same message signature sets to batch",
|
package/src/util/file.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import {copyFile, readFile as fsReadFile} from "node:fs/promises";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import {Readable} from "node:stream";
|
|
4
5
|
import stream from "node:stream/promises";
|
|
@@ -120,7 +121,7 @@ export async function downloadOrCopyFile(pathDest: string, urlOrPathSrc: string)
|
|
|
120
121
|
await downloadFile(pathDest, urlOrPathSrc);
|
|
121
122
|
} else {
|
|
122
123
|
mkdir(path.dirname(pathDest));
|
|
123
|
-
await
|
|
124
|
+
await copyFile(urlOrPathSrc, pathDest);
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
|
|
@@ -159,7 +160,7 @@ export async function downloadOrLoadFile(pathOrUrl: string): Promise<Uint8Array>
|
|
|
159
160
|
const arrayBuffer = await res.arrayBuffer();
|
|
160
161
|
return new Uint8Array(arrayBuffer);
|
|
161
162
|
}
|
|
162
|
-
return
|
|
163
|
+
return fsReadFile(pathOrUrl);
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
/**
|
package/src/util/format.ts
CHANGED