Skip to content

Commit 1857a49

Browse files
philknowsnflaigg11tech
authored
chore: v1.15.1 release (#6379)
* v1.15.1 * fix: ignore stale keystore lockfiles (#6363) * fix: ignore stale keystore lockfiles * Update error message if lockfile is already acquired * Update keymanager lockfile e2e tests * fix: ignore forkchoice invalidations if latestValidHash not found (#6361) * fix: ignore forkchoice invalidations if latestValidHash not found * rename for better understanding * update the lvh search start index * apply feedback * fix: parse --blindedLocal flag value as boolean (#6403) --------- Co-authored-by: Nico Flaig <nflaig@protonmail.com> Co-authored-by: g11tech <develop@g11tech.io>
1 parent 5d93a62 commit 1857a49

File tree

29 files changed

+187
-176
lines changed

29 files changed

+187
-176
lines changed

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
],
55
"npmClient": "yarn",
66
"useNx": true,
7-
"version": "1.15.0",
7+
"version": "1.15.1",
88
"stream": true,
99
"command": {
1010
"version": {

packages/api/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"bugs": {
1212
"url": "https://github.com/ChainSafe/lodestar/issues"
1313
},
14-
"version": "1.15.0",
14+
"version": "1.15.1",
1515
"type": "module",
1616
"exports": {
1717
".": {
@@ -71,10 +71,10 @@
7171
"dependencies": {
7272
"@chainsafe/persistent-merkle-tree": "^0.6.1",
7373
"@chainsafe/ssz": "^0.14.0",
74-
"@lodestar/config": "^1.15.0",
75-
"@lodestar/params": "^1.15.0",
76-
"@lodestar/types": "^1.15.0",
77-
"@lodestar/utils": "^1.15.0",
74+
"@lodestar/config": "^1.15.1",
75+
"@lodestar/params": "^1.15.1",
76+
"@lodestar/types": "^1.15.1",
77+
"@lodestar/utils": "^1.15.1",
7878
"eventsource": "^2.0.2",
7979
"qs": "^6.11.1"
8080
},

packages/beacon-node/package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"bugs": {
1212
"url": "https://github.com/ChainSafe/lodestar/issues"
1313
},
14-
"version": "1.15.0",
14+
"version": "1.15.1",
1515
"type": "module",
1616
"exports": {
1717
".": {
@@ -121,18 +121,18 @@
121121
"@libp2p/peer-id-factory": "^4.0.3",
122122
"@libp2p/prometheus-metrics": "^3.0.10",
123123
"@libp2p/tcp": "9.0.10",
124-
"@lodestar/api": "^1.15.0",
125-
"@lodestar/config": "^1.15.0",
126-
"@lodestar/db": "^1.15.0",
127-
"@lodestar/fork-choice": "^1.15.0",
128-
"@lodestar/light-client": "^1.15.0",
129-
"@lodestar/logger": "^1.15.0",
130-
"@lodestar/params": "^1.15.0",
131-
"@lodestar/reqresp": "^1.15.0",
132-
"@lodestar/state-transition": "^1.15.0",
133-
"@lodestar/types": "^1.15.0",
134-
"@lodestar/utils": "^1.15.0",
135-
"@lodestar/validator": "^1.15.0",
124+
"@lodestar/api": "^1.15.1",
125+
"@lodestar/config": "^1.15.1",
126+
"@lodestar/db": "^1.15.1",
127+
"@lodestar/fork-choice": "^1.15.1",
128+
"@lodestar/light-client": "^1.15.1",
129+
"@lodestar/logger": "^1.15.1",
130+
"@lodestar/params": "^1.15.1",
131+
"@lodestar/reqresp": "^1.15.1",
132+
"@lodestar/state-transition": "^1.15.1",
133+
"@lodestar/types": "^1.15.1",
134+
"@lodestar/utils": "^1.15.1",
135+
"@lodestar/validator": "^1.15.1",
136136
"@multiformats/multiaddr": "^12.1.3",
137137
"@types/datastore-level": "^3.0.0",
138138
"buffer-xor": "^2.0.2",

packages/beacon-node/src/chain/blocks/verifyBlocksExecutionPayloads.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export async function verifyBlockExecutionPayload(
319319
const lvhResponse = {
320320
executionStatus,
321321
latestValidExecHash: execResult.latestValidHash,
322-
invalidateFromBlockHash: toHexString(block.message.parentRoot),
322+
invalidateFromParentBlockRoot: toHexString(block.message.parentRoot),
323323
};
324324
const execError = new BlockError(block, {
325325
code: BlockErrorCode.EXECUTION_ENGINE_ERROR,
@@ -416,7 +416,7 @@ function getSegmentErrorResponse(
416416
invalidSegmentLVH = {
417417
executionStatus: ExecutionStatus.Invalid,
418418
latestValidExecHash: lvhResponse.latestValidExecHash,
419-
invalidateFromBlockHash: parentBlock.blockRoot,
419+
invalidateFromParentBlockRoot: parentBlock.blockRoot,
420420
};
421421
}
422422
}

packages/cli/package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainsafe/lodestar",
3-
"version": "1.15.0",
3+
"version": "1.15.1",
44
"description": "Command line interface for lodestar",
55
"author": "ChainSafe Systems",
66
"license": "LGPL-3.0",
@@ -66,19 +66,18 @@
6666
"@libp2p/crypto": "^3.0.4",
6767
"@libp2p/peer-id": "^4.0.4",
6868
"@libp2p/peer-id-factory": "^4.0.3",
69-
"@lodestar/api": "^1.15.0",
70-
"@lodestar/beacon-node": "^1.15.0",
71-
"@lodestar/config": "^1.15.0",
72-
"@lodestar/db": "^1.15.0",
73-
"@lodestar/light-client": "^1.15.0",
74-
"@lodestar/logger": "^1.15.0",
75-
"@lodestar/params": "^1.15.0",
76-
"@lodestar/state-transition": "^1.15.0",
77-
"@lodestar/types": "^1.15.0",
78-
"@lodestar/utils": "^1.15.0",
79-
"@lodestar/validator": "^1.15.0",
69+
"@lodestar/api": "^1.15.1",
70+
"@lodestar/beacon-node": "^1.15.1",
71+
"@lodestar/config": "^1.15.1",
72+
"@lodestar/db": "^1.15.1",
73+
"@lodestar/light-client": "^1.15.1",
74+
"@lodestar/logger": "^1.15.1",
75+
"@lodestar/params": "^1.15.1",
76+
"@lodestar/state-transition": "^1.15.1",
77+
"@lodestar/types": "^1.15.1",
78+
"@lodestar/utils": "^1.15.1",
79+
"@lodestar/validator": "^1.15.1",
8080
"@multiformats/multiaddr": "^12.1.3",
81-
"@types/lockfile": "^1.0.2",
8281
"bip39": "^3.1.0",
8382
"deepmerge": "^4.3.1",
8483
"ethers": "^6.7.0",
@@ -87,22 +86,23 @@
8786
"got": "^11.8.6",
8887
"inquirer": "^9.1.5",
8988
"js-yaml": "^4.1.0",
90-
"lockfile": "^1.0.4",
9189
"lodash": "^4.17.21",
9290
"prom-client": "^15.1.0",
91+
"proper-lockfile": "^4.1.2",
9392
"rimraf": "^4.4.1",
9493
"source-map-support": "^0.5.21",
9594
"uint8arrays": "^4.0.9",
9695
"uuidv4": "^6.2.13",
9796
"yargs": "^17.7.1"
9897
},
9998
"devDependencies": {
100-
"@lodestar/test-utils": "^1.15.0",
99+
"@lodestar/test-utils": "^1.15.1",
101100
"@types/debug": "^4.1.7",
102101
"@types/expand-tilde": "^2.0.0",
103102
"@types/got": "^9.6.12",
104103
"@types/inquirer": "^9.0.3",
105104
"@types/lodash": "^4.14.192",
105+
"@types/proper-lockfile": "^4.1.4",
106106
"@types/yargs": "^17.0.24"
107107
}
108108
}

packages/cli/src/cmds/validator/options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {
267267
},
268268

269269
blindedLocal: {
270-
type: "string",
270+
type: "boolean",
271271
description: "Request fetching local block in blinded format for produceBlockV3",
272272
defaultDescription: `${defaultOptions.blindedLocal}`,
273273
},

packages/cli/src/util/lockfile.ts

+31-23
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
1-
export type Lockfile = {
2-
lockSync(path: string): void;
3-
unlockSync(path: string): void;
4-
};
5-
6-
const lockFile: Lockfile = (await import("lockfile")) as Lockfile;
7-
8-
function getLockFilepath(filepath: string): string {
9-
return `${filepath}.lock`;
10-
}
11-
12-
/**
13-
* When lockfile is imported, it registers listeners to process
14-
* Since it's only used by the validator client, require lazily to not pollute
15-
* beacon_node client context
16-
*/
17-
function getLockFile(): Lockfile {
18-
return lockFile;
19-
}
1+
import {lockSync, unlockSync} from "proper-lockfile";
202

213
/**
224
* Creates a .lock file for `filepath`, argument passed must not be the lock path
235
* @param filepath File to lock, i.e. `keystore_0001.json`
246
*/
257
export function lockFilepath(filepath: string): void {
26-
getLockFile().lockSync(getLockFilepath(filepath));
8+
try {
9+
lockSync(filepath, {
10+
// Allows to lock files that do not exist
11+
realpath: false,
12+
});
13+
} catch (e) {
14+
if (isLockfileError(e) && e.code === "ELOCKED") {
15+
e.message = `${filepath} is already in use by another process`;
16+
}
17+
throw e;
18+
}
2719
}
2820

2921
/**
3022
* Deletes a .lock file for `filepath`, argument passed must not be the lock path
3123
* @param filepath File to unlock, i.e. `keystore_0001.json`
3224
*/
3325
export function unlockFilepath(filepath: string): void {
34-
// Does not throw if the lock file is already deleted
35-
// https://github.com/npm/lockfile/blob/6590779867ee9bdc5dbebddc962640759892bb91/lockfile.js#L68
36-
getLockFile().unlockSync(getLockFilepath(filepath));
26+
try {
27+
unlockSync(filepath, {
28+
// Allows to unlock files that do not exist
29+
realpath: false,
30+
});
31+
} catch (e) {
32+
if (isLockfileError(e) && e.code === "ENOTACQUIRED") {
33+
// Do not throw if the lock file is already deleted
34+
return;
35+
}
36+
throw e;
37+
}
38+
}
39+
40+
// https://github.com/moxystudio/node-proper-lockfile/blob/9f8c303c91998e8404a911dc11c54029812bca69/lib/lockfile.js#L53
41+
export type LockfileError = Error & {code: "ELOCKED" | "ENOTACQUIRED"};
42+
43+
function isLockfileError(e: unknown): e is LockfileError {
44+
return e instanceof Error && (e as LockfileError).code !== undefined;
3745
}

packages/cli/test/e2e/importKeystoresFromApi.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ describe("import keystores from api", function () {
9595
validator.on("exit", (code) => {
9696
if (code !== null && code > 0) {
9797
// process should exit with code > 0, and an error related to locks. Sample error:
98-
// vc 351591: ✖ Error: EEXIST: file already exists, open '/tmp/tmp-351554-dMctEAj7sJIz/import-keystores-test/keystores/0x8be678633e927aa0435addad5dcd5283fef6110d91362519cd6d43e61f6c017d724fa579cc4b2972134e050b6ba120c0/voting-keystore.json.lock'
99-
// at Object.openSync (node:fs:585:3)
100-
// at Module.exports.lockSync (/home/lion/Code/eth2.0/lodestar/node_modules/lockfile/lockfile.js:277:17)
101-
if (/EEXIST.*voting-keystore\.json\.lock/.test(vcProc2Stderr.read())) {
98+
// vc 351591: ✖ Error: /tmp/tmp-5080-lwNxdM5Ok9ya/import-keystores-test/keystores/0x8be678633e927aa0435addad5dcd5283fef6110d91362519cd6d43e61f6c017d724fa579cc4b2972134e050b6ba120c0/voting-keystore.json is already in use by another process
99+
// at /home/runner/actions-runner/_work/lodestar/lodestar/node_modules/proper-lockfile/lib/lockfile.js:68:47
100+
// ... more stack trace
101+
if (/Error.*voting-keystore\.json is already in use by another process/.test(vcProc2Stderr.read())) {
102102
resolve();
103103
} else {
104104
reject(Error(`Second validator proc exited with unknown error. stderr:\n${vcProc2Stderr.read()}`));

packages/cli/test/unit/validator/decryptKeystoreDefinitions.test.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {cachedSeckeysHex} from "../../utils/cachedKeys.js";
77
import {testFilesDir} from "../../utils.js";
88
import {decryptKeystoreDefinitions} from "../../../src/cmds/validator/keymanager/decryptKeystoreDefinitions.js";
99
import {LocalKeystoreDefinition} from "../../../src/cmds/validator/keymanager/interface.js";
10+
import {LockfileError, unlockFilepath} from "../../../src/util/lockfile.js";
1011

1112
describe("decryptKeystoreDefinitions", () => {
1213
vi.setConfig({testTimeout: 100_000});
@@ -22,6 +23,10 @@ describe("decryptKeystoreDefinitions", () => {
2223
let definitions: LocalKeystoreDefinition[] = [];
2324

2425
beforeEach(async () => {
26+
// remove lockfiles from proper-lockfile cache
27+
for (const {keystorePath} of definitions) {
28+
unlockFilepath(keystorePath);
29+
}
2530
rimraf.sync(dataDir);
2631
rimraf.sync(importFromDir);
2732

@@ -46,7 +51,9 @@ describe("decryptKeystoreDefinitions", () => {
4651
expect(fs.existsSync(cacheFilePath)).toBe(true);
4752

4853
// remove lockfiles created during cache file preparation
49-
rimraf.sync(path.join(importFromDir, "*.lock"), {glob: true});
54+
for (const {keystorePath} of definitions) {
55+
unlockFilepath(keystorePath);
56+
}
5057
});
5158

5259
testDecryptKeystoreDefinitions(cacheFilePath);
@@ -75,14 +82,14 @@ describe("decryptKeystoreDefinitions", () => {
7582
await decryptKeystoreDefinitions(definitions, {logger: console, signal, cacheFilePath});
7683
expect.fail("Second decrypt should fail due to failure to get lockfile");
7784
} catch (e) {
78-
expect((e as Error).message.startsWith("EEXIST: file already exists")).toBe(true);
85+
expect((e as LockfileError).code).toBe<LockfileError["code"]>("ELOCKED");
7986
}
8087
});
8188

8289
it("decrypt keystores if lockfiles already exist if ignoreLockFile=true", async () => {
8390
await decryptKeystoreDefinitions(definitions, {logger: console, signal, cacheFilePath});
84-
8591
// lockfiles should exist after the first run
92+
8693
await decryptKeystoreDefinitions(definitions, {logger: console, signal, cacheFilePath, ignoreLockFile: true});
8794
});
8895
}

packages/config/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lodestar/config",
3-
"version": "1.15.0",
3+
"version": "1.15.1",
44
"description": "Chain configuration required for lodestar",
55
"author": "ChainSafe Systems",
66
"license": "Apache-2.0",
@@ -65,7 +65,7 @@
6565
],
6666
"dependencies": {
6767
"@chainsafe/ssz": "^0.14.0",
68-
"@lodestar/params": "^1.15.0",
69-
"@lodestar/types": "^1.15.0"
68+
"@lodestar/params": "^1.15.1",
69+
"@lodestar/types": "^1.15.1"
7070
}
7171
}

packages/db/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lodestar/db",
3-
"version": "1.15.0",
3+
"version": "1.15.1",
44
"description": "DB modules of Lodestar",
55
"author": "ChainSafe Systems",
66
"homepage": "https://github.com/ChainSafe/lodestar#readme",
@@ -38,13 +38,13 @@
3838
},
3939
"dependencies": {
4040
"@chainsafe/ssz": "^0.14.0",
41-
"@lodestar/config": "^1.15.0",
42-
"@lodestar/utils": "^1.15.0",
41+
"@lodestar/config": "^1.15.1",
42+
"@lodestar/utils": "^1.15.1",
4343
"@types/levelup": "^4.3.3",
4444
"it-all": "^3.0.4",
4545
"level": "^8.0.0"
4646
},
4747
"devDependencies": {
48-
"@lodestar/logger": "^1.15.0"
48+
"@lodestar/logger": "^1.15.1"
4949
}
5050
}

packages/db/src/controller/level.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class LevelDbController implements DatabaseController<Uint8Array, Uint8Ar
5252
await db.open();
5353
} catch (e) {
5454
if ((e as LevelDbError).cause?.code === "LEVEL_LOCKED") {
55-
throw new Error("Database is already in use by another Lodestar instance");
55+
throw new Error("Database is already in use by another process");
5656
}
5757
throw e;
5858
}

packages/flare/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lodestar/flare",
3-
"version": "1.15.0",
3+
"version": "1.15.1",
44
"description": "Beacon chain debugging tool",
55
"author": "ChainSafe Systems",
66
"license": "Apache-2.0",
@@ -60,12 +60,12 @@
6060
"dependencies": {
6161
"@chainsafe/bls": "7.1.1",
6262
"@chainsafe/bls-keygen": "^0.3.0",
63-
"@lodestar/api": "^1.15.0",
64-
"@lodestar/config": "^1.15.0",
65-
"@lodestar/params": "^1.15.0",
66-
"@lodestar/state-transition": "^1.15.0",
67-
"@lodestar/types": "^1.15.0",
68-
"@lodestar/utils": "^1.15.0",
63+
"@lodestar/api": "^1.15.1",
64+
"@lodestar/config": "^1.15.1",
65+
"@lodestar/params": "^1.15.1",
66+
"@lodestar/state-transition": "^1.15.1",
67+
"@lodestar/types": "^1.15.1",
68+
"@lodestar/utils": "^1.15.1",
6969
"source-map-support": "^0.5.21",
7070
"yargs": "^17.7.1"
7171
},

0 commit comments

Comments
 (0)