@chainsafe/lodestar 1.51.0-dev.950d6b9392 → 1.51.0-dev.9998f24b6e

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.
Files changed (84) hide show
  1. package/.git-data.json +1 -1
  2. package/README.md +9 -7
  3. package/lib/cmds/beacon/handler.d.ts.map +1 -1
  4. package/lib/cmds/beacon/handler.js +24 -11
  5. package/lib/cmds/beacon/handler.js.map +1 -1
  6. package/lib/cmds/beacon/initBeaconState.d.ts.map +1 -1
  7. package/lib/cmds/beacon/initBeaconState.js +1 -1
  8. package/lib/cmds/beacon/initBeaconState.js.map +1 -1
  9. package/lib/cmds/beacon/pubkeysFile.d.ts +1 -1
  10. package/lib/cmds/beacon/pubkeysFile.d.ts.map +1 -1
  11. package/lib/cmds/builder/loadKeypair.d.ts.map +1 -1
  12. package/lib/cmds/builder/loadKeypair.js +1 -1
  13. package/lib/cmds/builder/loadKeypair.js.map +1 -1
  14. package/lib/cmds/dev/handler.js +6 -6
  15. package/lib/cmds/dev/handler.js.map +1 -1
  16. package/lib/cmds/dev/options.d.ts +1 -1
  17. package/lib/cmds/dev/options.d.ts.map +1 -1
  18. package/lib/cmds/dev/options.js +1 -3
  19. package/lib/cmds/dev/options.js.map +1 -1
  20. package/lib/cmds/validator/blsToExecutionChange.js +1 -1
  21. package/lib/cmds/validator/blsToExecutionChange.js.map +1 -1
  22. package/lib/cmds/validator/keymanager/decryptKeystoreDefinitions.js +1 -1
  23. package/lib/cmds/validator/keymanager/decryptKeystoreDefinitions.js.map +1 -1
  24. package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.d.ts +1 -1
  25. package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.d.ts.map +1 -1
  26. package/lib/cmds/validator/keymanager/decryptKeystores/threadPool.js.map +1 -1
  27. package/lib/cmds/validator/keymanager/impl.d.ts.map +1 -1
  28. package/lib/cmds/validator/keymanager/impl.js +1 -1
  29. package/lib/cmds/validator/keymanager/impl.js.map +1 -1
  30. package/lib/cmds/validator/keymanager/keystoreCache.js +1 -1
  31. package/lib/cmds/validator/keymanager/keystoreCache.js.map +1 -1
  32. package/lib/cmds/validator/keymanager/persistedKeys.d.ts +1 -1
  33. package/lib/cmds/validator/keymanager/persistedKeys.d.ts.map +1 -1
  34. package/lib/cmds/validator/keymanager/persistedKeys.js +1 -1
  35. package/lib/cmds/validator/keymanager/persistedKeys.js.map +1 -1
  36. package/lib/cmds/validator/options.d.ts.map +1 -1
  37. package/lib/cmds/validator/options.js +3 -9
  38. package/lib/cmds/validator/options.js.map +1 -1
  39. package/lib/cmds/validator/signers/index.js +1 -1
  40. package/lib/cmds/validator/signers/index.js.map +1 -1
  41. package/lib/cmds/validator/slashingProtection/export.d.ts.map +1 -1
  42. package/lib/cmds/validator/slashingProtection/export.js +1 -3
  43. package/lib/cmds/validator/slashingProtection/export.js.map +1 -1
  44. package/lib/cmds/validator/slashingProtection/import.js +2 -2
  45. package/lib/cmds/validator/slashingProtection/import.js.map +1 -1
  46. package/lib/cmds/validator/voluntaryExit.d.ts.map +1 -1
  47. package/lib/cmds/validator/voluntaryExit.js +2 -4
  48. package/lib/cmds/validator/voluntaryExit.js.map +1 -1
  49. package/lib/options/beaconNodeOptions/builder.d.ts +1 -0
  50. package/lib/options/beaconNodeOptions/builder.d.ts.map +1 -1
  51. package/lib/options/beaconNodeOptions/builder.js +11 -0
  52. package/lib/options/beaconNodeOptions/builder.js.map +1 -1
  53. package/lib/options/beaconNodeOptions/chain.d.ts +0 -1
  54. package/lib/options/beaconNodeOptions/chain.d.ts.map +1 -1
  55. package/lib/options/beaconNodeOptions/chain.js +0 -8
  56. package/lib/options/beaconNodeOptions/chain.js.map +1 -1
  57. package/lib/options/beaconNodeOptions/index.d.ts +1 -1
  58. package/lib/util/file.d.ts.map +1 -1
  59. package/lib/util/file.js +3 -2
  60. package/lib/util/file.js.map +1 -1
  61. package/lib/util/format.js +1 -1
  62. package/lib/util/format.js.map +1 -1
  63. package/package.json +15 -16
  64. package/src/cmds/beacon/handler.ts +32 -11
  65. package/src/cmds/beacon/initBeaconState.ts +1 -1
  66. package/src/cmds/beacon/pubkeysFile.ts +1 -1
  67. package/src/cmds/builder/loadKeypair.ts +1 -1
  68. package/src/cmds/dev/handler.ts +6 -6
  69. package/src/cmds/dev/options.ts +1 -3
  70. package/src/cmds/validator/blsToExecutionChange.ts +1 -1
  71. package/src/cmds/validator/keymanager/decryptKeystoreDefinitions.ts +1 -1
  72. package/src/cmds/validator/keymanager/decryptKeystores/threadPool.ts +1 -1
  73. package/src/cmds/validator/keymanager/impl.ts +1 -1
  74. package/src/cmds/validator/keymanager/keystoreCache.ts +1 -1
  75. package/src/cmds/validator/keymanager/persistedKeys.ts +1 -1
  76. package/src/cmds/validator/options.ts +3 -9
  77. package/src/cmds/validator/signers/index.ts +1 -1
  78. package/src/cmds/validator/slashingProtection/export.ts +1 -3
  79. package/src/cmds/validator/slashingProtection/import.ts +2 -2
  80. package/src/cmds/validator/voluntaryExit.ts +2 -4
  81. package/src/options/beaconNodeOptions/builder.ts +15 -0
  82. package/src/options/beaconNodeOptions/chain.ts +0 -11
  83. package/src/util/file.ts +3 -2
  84. package/src/util/format.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainsafe/lodestar",
3
- "version": "1.51.0-dev.950d6b9392",
3
+ "version": "1.51.0-dev.9998f24b6e",
4
4
  "description": "Command line interface for lodestar",
5
5
  "author": "ChainSafe Systems",
6
6
  "license": "Apache-2.0",
@@ -64,24 +64,24 @@
64
64
  "@chainsafe/bls-keystore": "^3.1.0",
65
65
  "@chainsafe/discv5": "^12.0.2",
66
66
  "@chainsafe/enr": "^6.0.2",
67
- "@chainsafe/lodestar-z": "catalog:",
68
67
  "@chainsafe/persistent-merkle-tree": "^1.3.1",
69
68
  "@chainsafe/ssz": "^1.9.0",
70
69
  "@chainsafe/threads": "^1.11.3",
71
70
  "@libp2p/crypto": "^5.1.25",
72
71
  "@libp2p/interface": "^3.4.0",
73
72
  "@libp2p/peer-id": "^6.0.17",
74
- "@lodestar/api": "^1.51.0-dev.950d6b9392",
75
- "@lodestar/beacon-node": "^1.51.0-dev.950d6b9392",
76
- "@lodestar/builder": "^1.51.0-dev.950d6b9392",
77
- "@lodestar/config": "^1.51.0-dev.950d6b9392",
78
- "@lodestar/db": "^1.51.0-dev.950d6b9392",
79
- "@lodestar/logger": "^1.51.0-dev.950d6b9392",
80
- "@lodestar/params": "^1.51.0-dev.950d6b9392",
81
- "@lodestar/state-transition": "^1.51.0-dev.950d6b9392",
82
- "@lodestar/types": "^1.51.0-dev.950d6b9392",
83
- "@lodestar/utils": "^1.51.0-dev.950d6b9392",
84
- "@lodestar/validator": "^1.51.0-dev.950d6b9392",
73
+ "@lodestar/api": "^1.51.0-dev.9998f24b6e",
74
+ "@lodestar/beacon-node": "^1.51.0-dev.9998f24b6e",
75
+ "@lodestar/builder": "^1.51.0-dev.9998f24b6e",
76
+ "@lodestar/config": "^1.51.0-dev.9998f24b6e",
77
+ "@lodestar/db": "^1.51.0-dev.9998f24b6e",
78
+ "@lodestar/logger": "^1.51.0-dev.9998f24b6e",
79
+ "@lodestar/native": "^1.51.0-dev.9998f24b6e",
80
+ "@lodestar/params": "^1.51.0-dev.9998f24b6e",
81
+ "@lodestar/state-transition": "^1.51.0-dev.9998f24b6e",
82
+ "@lodestar/types": "^1.51.0-dev.9998f24b6e",
83
+ "@lodestar/utils": "^1.51.0-dev.9998f24b6e",
84
+ "@lodestar/validator": "^1.51.0-dev.9998f24b6e",
85
85
  "@multiformats/multiaddr": "^13.0.1",
86
86
  "deepmerge": "^4.3.1",
87
87
  "ethers": "^6.7.0",
@@ -89,7 +89,6 @@
89
89
  "inquirer": "^9.1.5",
90
90
  "js-yaml": "^4.1.0",
91
91
  "proper-lockfile": "^4.1.2",
92
- "rimraf": "^4.4.1",
93
92
  "source-map-support": "^0.5.21",
94
93
  "uint8arrays": "^5.0.1",
95
94
  "yargs": "^17.7.1"
@@ -97,7 +96,7 @@
97
96
  "devDependencies": {
98
97
  "@chainsafe/as-sha256": "^1.2.5",
99
98
  "@ethereumjs/rlp": "^4.0.1",
100
- "@lodestar/test-utils": "^1.51.0-dev.950d6b9392",
99
+ "@lodestar/test-utils": "^1.51.0-dev.9998f24b6e",
101
100
  "@types/debug": "^4.1.7",
102
101
  "@types/inquirer": "^9.0.3",
103
102
  "@types/js-yaml": "^4.0.5",
@@ -111,5 +110,5 @@
111
110
  "web3": "^4.0.3",
112
111
  "web3-eth-accounts": "^4.0.3"
113
112
  },
114
- "gitHead": "a8606e4d802dc0e6e4e56c830b01af8d8bb39c9e"
113
+ "gitHead": "39baa1f4ab6308a9cf95b56bbd419fb467b3d38e"
115
114
  }
@@ -1,13 +1,18 @@
1
1
  import path from "node:path";
2
2
  import {getHeapStatistics} from "node:v8";
3
3
  import {SignableENR} from "@chainsafe/enr";
4
- import {pubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
5
4
  import {hasher} from "@chainsafe/persistent-merkle-tree";
6
- import {BeaconDb, BeaconNode} from "@lodestar/beacon-node";
5
+ import {
6
+ BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS,
7
+ BUILDER_BID_LAG_BUFFER_MS,
8
+ BeaconDb,
9
+ BeaconNode,
10
+ } from "@lodestar/beacon-node";
7
11
  import {ChainForkConfig} from "@lodestar/config";
8
12
  import {LevelDbController} from "@lodestar/db/controller/level";
9
13
  import {LoggerNode, getNodeLogger} from "@lodestar/logger/node";
10
- import {ACTIVE_PRESET, PresetName} from "@lodestar/params";
14
+ import {pubkeyCache} from "@lodestar/native/pubkeys";
15
+ import {ACTIVE_PRESET, PresetName, isForkPostGloas} from "@lodestar/params";
11
16
  import {ErrorAborted, bytesToInt, formatBytes} from "@lodestar/utils";
12
17
  import {ProcessShutdownCallback} from "@lodestar/validator";
13
18
  import {BeaconNodeOptions, getBeaconConfigFromArgs} from "../../config/index.js";
@@ -61,6 +66,7 @@ export async function beaconHandler(args: BeaconArgs & GlobalArgs): Promise<void
61
66
  // Callback for beacon to request forced exit, for e.g. in case of irrecoverable
62
67
  // forkchoice errors
63
68
  const processShutdownCallback: ProcessShutdownCallback = (err) => {
69
+ process.exitCode = 1;
64
70
  logger.error("Process shutdown requested", {}, err);
65
71
  process.kill(process.pid, "SIGINT");
66
72
  };
@@ -142,21 +148,21 @@ export async function beaconHandler(args: BeaconArgs & GlobalArgs): Promise<void
142
148
  abortController.signal.addEventListener(
143
149
  "abort",
144
150
  async () => {
145
- let exitCode = 0;
146
151
  try {
147
152
  await node.close();
148
153
  logger.debug("Beacon node closed");
149
154
  } catch (e) {
150
155
  // If we start from unfinalized state, we don't have checkpoint state so there is this error
151
156
  // "No state in cache for finalized checkpoint state epoch"
152
- logger.warn("Error closing beacon node", {}, e as Error);
153
- // Make sure db is always closed gracefully
154
- await db.close();
155
- exitCode = 1;
157
+ // The logger prints only the message and stack of an AggregateError, not its causes
158
+ for (const error of e instanceof AggregateError ? e.errors : [e]) {
159
+ logger.warn("Error closing beacon node", {}, error as Error);
160
+ }
161
+ process.exitCode = 1;
156
162
  }
157
163
  savePubkeysFile(pubkeyCache, beaconPaths.pubkeysFile, logger);
158
164
  // Explicitly exit process due to potential active handles
159
- process.exit(exitCode);
165
+ process.exit(process.exitCode ?? 0);
160
166
  },
161
167
  {once: true}
162
168
  );
@@ -219,8 +225,8 @@ export async function beaconHandlerInit(args: BeaconArgs & GlobalArgs) {
219
225
  beaconNodeOptions.set({network: {private: true}, api: {private: true}});
220
226
  } else {
221
227
  const versionStr = `Lodestar/${version}`;
222
- // Add version string for libp2p agent version
223
- beaconNodeOptions.set({network: {version}});
228
+ const advertiseVersion = network !== "mainnet";
229
+ beaconNodeOptions.set({network: {version, advertiseVersion}});
224
230
  // Add User-Agent header to all builder requests
225
231
  beaconNodeOptions.set({executionBuilder: {userAgent: versionStr}});
226
232
  // Set jwt version with version string
@@ -238,6 +244,21 @@ export async function beaconHandlerInit(args: BeaconArgs & GlobalArgs) {
238
244
  );
239
245
  }
240
246
 
247
+ // Bids received up to the deadline plus the lag buffer must still have a chance to win the block
248
+ // production race, otherwise the local block is selected at the race cutoff before any bid.
249
+ // Only enforced on an explicitly configured deadline, the default is used as is on short slots
250
+ const bidDeadline = args["builder.bidDeadline"];
251
+ if (bidDeadline !== undefined) {
252
+ for (const {name: fork, epoch} of config.forksAscendingEpochOrder) {
253
+ const raceCutoffMs = config.getSlotComponentDurationMs(fork, BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS);
254
+ if (isForkPostGloas(fork) && epoch !== Infinity && bidDeadline + BUILDER_BID_LAG_BUFFER_MS >= raceCutoffMs) {
255
+ throw Error(
256
+ `--builder.bidDeadline of ${bidDeadline}ms must be below ${raceCutoffMs - BUILDER_BID_LAG_BUFFER_MS}ms for fork ${fork}`
257
+ );
258
+ }
259
+ }
260
+ }
261
+
241
262
  return {config, options, beaconPaths, network, version, commit, privateKey, logger};
242
263
  }
243
264
 
@@ -1,6 +1,6 @@
1
- import {pubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
2
1
  import {IBeaconDb} from "@lodestar/beacon-node";
3
2
  import {BeaconConfig, ChainForkConfig} from "@lodestar/config";
3
+ import {pubkeyCache} from "@lodestar/native/pubkeys";
4
4
  import {MAX_PENDING_DEPOSITS_PER_EPOCH, SLOTS_PER_EPOCH} from "@lodestar/params";
5
5
  import {
6
6
  IBeaconStateView,
@@ -1,5 +1,5 @@
1
- import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
2
1
  import {ChainForkConfig} from "@lodestar/config";
2
+ import {type PubkeyCache} from "@lodestar/native/pubkeys";
3
3
  import {getValidatorPubkeyFromStateBytes} from "@lodestar/state-transition";
4
4
  import {Logger, byteArrayEquals} from "@lodestar/utils";
5
5
 
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import {Keystore} from "@chainsafe/bls-keystore";
3
- import {SecretKey} from "@chainsafe/lodestar-z/blst";
4
3
  import {Keypair} from "@lodestar/builder";
4
+ import {SecretKey} from "@lodestar/native/blst";
5
5
  import {Logger} from "@lodestar/utils";
6
6
  import {ensure0xPrefix} from "../../util/format.js";
7
7
  import {readPassphraseFile} from "../../util/passphrase.js";
@@ -1,5 +1,5 @@
1
1
  import fs from "node:fs";
2
- import {rimraf} from "rimraf";
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 rimraf(beaconDbDir);
41
- await rimraf(validatorsDbDir);
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 rimraf(pubkeysFile);
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 rimraf(beaconDbDir);
52
- await rimraf(validatorsDbDir);
51
+ await rm(beaconDbDir, {recursive: true, force: true});
52
+ await rm(validatorsDbDir, {recursive: true, force: true});
53
53
  });
54
54
  }
55
55
 
@@ -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";
@@ -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 "@chainsafe/lodestar-z/blst";
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 "@chainsafe/lodestar-z/blst";
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 {ImportStatus, DeletionStatus};
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 "@chainsafe/lodestar-z/blst";
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 fs from "node:fs";
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 fs.promises.readFile(file, "utf8");
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: {
@@ -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 fs.promises.copyFile(urlOrPathSrc, pathDest);
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 fs.promises.readFile(pathOrUrl);
163
+ return fsReadFile(pathOrUrl);
163
164
  }
164
165
 
165
166
  /**
@@ -1,4 +1,4 @@
1
- import {PublicKey} from "@chainsafe/lodestar-z/blst";
1
+ import {PublicKey} from "@lodestar/native/blst";
2
2
  import {fromHex} from "@lodestar/utils";
3
3
 
4
4
  /**