Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: v1.15.1 release #6379

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"npmClient": "yarn",
"useNx": true,
"version": "1.15.0",
"version": "1.15.1",
"stream": true,
"command": {
"version": {
Expand Down
10 changes: 5 additions & 5 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": {
"url": "https://github.com/ChainSafe/lodestar/issues"
},
"version": "1.15.0",
"version": "1.15.1",
"type": "module",
"exports": {
".": {
Expand Down Expand Up @@ -71,10 +71,10 @@
"dependencies": {
"@chainsafe/persistent-merkle-tree": "^0.6.1",
"@chainsafe/ssz": "^0.14.0",
"@lodestar/config": "^1.15.0",
"@lodestar/params": "^1.15.0",
"@lodestar/types": "^1.15.0",
"@lodestar/utils": "^1.15.0",
"@lodestar/config": "^1.15.1",
"@lodestar/params": "^1.15.1",
"@lodestar/types": "^1.15.1",
"@lodestar/utils": "^1.15.1",
"eventsource": "^2.0.2",
"qs": "^6.11.1"
},
Expand Down
26 changes: 13 additions & 13 deletions packages/beacon-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": {
"url": "https://github.com/ChainSafe/lodestar/issues"
},
"version": "1.15.0",
"version": "1.15.1",
"type": "module",
"exports": {
".": {
Expand Down Expand Up @@ -121,18 +121,18 @@
"@libp2p/peer-id-factory": "^4.0.3",
"@libp2p/prometheus-metrics": "^3.0.10",
"@libp2p/tcp": "9.0.10",
"@lodestar/api": "^1.15.0",
"@lodestar/config": "^1.15.0",
"@lodestar/db": "^1.15.0",
"@lodestar/fork-choice": "^1.15.0",
"@lodestar/light-client": "^1.15.0",
"@lodestar/logger": "^1.15.0",
"@lodestar/params": "^1.15.0",
"@lodestar/reqresp": "^1.15.0",
"@lodestar/state-transition": "^1.15.0",
"@lodestar/types": "^1.15.0",
"@lodestar/utils": "^1.15.0",
"@lodestar/validator": "^1.15.0",
"@lodestar/api": "^1.15.1",
"@lodestar/config": "^1.15.1",
"@lodestar/db": "^1.15.1",
"@lodestar/fork-choice": "^1.15.1",
"@lodestar/light-client": "^1.15.1",
"@lodestar/logger": "^1.15.1",
"@lodestar/params": "^1.15.1",
"@lodestar/reqresp": "^1.15.1",
"@lodestar/state-transition": "^1.15.1",
"@lodestar/types": "^1.15.1",
"@lodestar/utils": "^1.15.1",
"@lodestar/validator": "^1.15.1",
"@multiformats/multiaddr": "^12.1.3",
"@types/datastore-level": "^3.0.0",
"buffer-xor": "^2.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export async function verifyBlockExecutionPayload(
const lvhResponse = {
executionStatus,
latestValidExecHash: execResult.latestValidHash,
invalidateFromBlockHash: toHexString(block.message.parentRoot),
invalidateFromParentBlockRoot: toHexString(block.message.parentRoot),
};
const execError = new BlockError(block, {
code: BlockErrorCode.EXECUTION_ENGINE_ERROR,
Expand Down Expand Up @@ -416,7 +416,7 @@ function getSegmentErrorResponse(
invalidSegmentLVH = {
executionStatus: ExecutionStatus.Invalid,
latestValidExecHash: lvhResponse.latestValidExecHash,
invalidateFromBlockHash: parentBlock.blockRoot,
invalidateFromParentBlockRoot: parentBlock.blockRoot,
};
}
}
Expand Down
30 changes: 15 additions & 15 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainsafe/lodestar",
"version": "1.15.0",
"version": "1.15.1",
"description": "Command line interface for lodestar",
"author": "ChainSafe Systems",
"license": "LGPL-3.0",
Expand Down Expand Up @@ -66,19 +66,18 @@
"@libp2p/crypto": "^3.0.4",
"@libp2p/peer-id": "^4.0.4",
"@libp2p/peer-id-factory": "^4.0.3",
"@lodestar/api": "^1.15.0",
"@lodestar/beacon-node": "^1.15.0",
"@lodestar/config": "^1.15.0",
"@lodestar/db": "^1.15.0",
"@lodestar/light-client": "^1.15.0",
"@lodestar/logger": "^1.15.0",
"@lodestar/params": "^1.15.0",
"@lodestar/state-transition": "^1.15.0",
"@lodestar/types": "^1.15.0",
"@lodestar/utils": "^1.15.0",
"@lodestar/validator": "^1.15.0",
"@lodestar/api": "^1.15.1",
"@lodestar/beacon-node": "^1.15.1",
"@lodestar/config": "^1.15.1",
"@lodestar/db": "^1.15.1",
"@lodestar/light-client": "^1.15.1",
"@lodestar/logger": "^1.15.1",
"@lodestar/params": "^1.15.1",
"@lodestar/state-transition": "^1.15.1",
"@lodestar/types": "^1.15.1",
"@lodestar/utils": "^1.15.1",
"@lodestar/validator": "^1.15.1",
"@multiformats/multiaddr": "^12.1.3",
"@types/lockfile": "^1.0.2",
"bip39": "^3.1.0",
"deepmerge": "^4.3.1",
"ethers": "^6.7.0",
Expand All @@ -87,22 +86,23 @@
"got": "^11.8.6",
"inquirer": "^9.1.5",
"js-yaml": "^4.1.0",
"lockfile": "^1.0.4",
"lodash": "^4.17.21",
"prom-client": "^15.1.0",
"proper-lockfile": "^4.1.2",
"rimraf": "^4.4.1",
"source-map-support": "^0.5.21",
"uint8arrays": "^4.0.9",
"uuidv4": "^6.2.13",
"yargs": "^17.7.1"
},
"devDependencies": {
"@lodestar/test-utils": "^1.15.0",
"@lodestar/test-utils": "^1.15.1",
"@types/debug": "^4.1.7",
"@types/expand-tilde": "^2.0.0",
"@types/got": "^9.6.12",
"@types/inquirer": "^9.0.3",
"@types/lodash": "^4.14.192",
"@types/proper-lockfile": "^4.1.4",
"@types/yargs": "^17.0.24"
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/cmds/validator/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {
},

blindedLocal: {
type: "string",
type: "boolean",
description: "Request fetching local block in blinded format for produceBlockV3",
defaultDescription: `${defaultOptions.blindedLocal}`,
},
Expand Down
54 changes: 31 additions & 23 deletions packages/cli/src/util/lockfile.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
export type Lockfile = {
lockSync(path: string): void;
unlockSync(path: string): void;
};

const lockFile: Lockfile = (await import("lockfile")) as Lockfile;

function getLockFilepath(filepath: string): string {
return `${filepath}.lock`;
}

/**
* When lockfile is imported, it registers listeners to process
* Since it's only used by the validator client, require lazily to not pollute
* beacon_node client context
*/
function getLockFile(): Lockfile {
return lockFile;
}
import {lockSync, unlockSync} from "proper-lockfile";

/**
* Creates a .lock file for `filepath`, argument passed must not be the lock path
* @param filepath File to lock, i.e. `keystore_0001.json`
*/
export function lockFilepath(filepath: string): void {
getLockFile().lockSync(getLockFilepath(filepath));
try {
lockSync(filepath, {
// Allows to lock files that do not exist
realpath: false,
});
} catch (e) {
if (isLockfileError(e) && e.code === "ELOCKED") {
e.message = `${filepath} is already in use by another process`;
}
throw e;
}
}

/**
* Deletes a .lock file for `filepath`, argument passed must not be the lock path
* @param filepath File to unlock, i.e. `keystore_0001.json`
*/
export function unlockFilepath(filepath: string): void {
// Does not throw if the lock file is already deleted
// https://github.com/npm/lockfile/blob/6590779867ee9bdc5dbebddc962640759892bb91/lockfile.js#L68
getLockFile().unlockSync(getLockFilepath(filepath));
try {
unlockSync(filepath, {
// Allows to unlock files that do not exist
realpath: false,
});
} catch (e) {
if (isLockfileError(e) && e.code === "ENOTACQUIRED") {
// Do not throw if the lock file is already deleted
return;
}
throw e;
}
}

// https://github.com/moxystudio/node-proper-lockfile/blob/9f8c303c91998e8404a911dc11c54029812bca69/lib/lockfile.js#L53
export type LockfileError = Error & {code: "ELOCKED" | "ENOTACQUIRED"};

function isLockfileError(e: unknown): e is LockfileError {
return e instanceof Error && (e as LockfileError).code !== undefined;
}
8 changes: 4 additions & 4 deletions packages/cli/test/e2e/importKeystoresFromApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ describe("import keystores from api", function () {
validator.on("exit", (code) => {
if (code !== null && code > 0) {
// process should exit with code > 0, and an error related to locks. Sample error:
// vc 351591: ✖ Error: EEXIST: file already exists, open '/tmp/tmp-351554-dMctEAj7sJIz/import-keystores-test/keystores/0x8be678633e927aa0435addad5dcd5283fef6110d91362519cd6d43e61f6c017d724fa579cc4b2972134e050b6ba120c0/voting-keystore.json.lock'
// at Object.openSync (node:fs:585:3)
// at Module.exports.lockSync (/home/lion/Code/eth2.0/lodestar/node_modules/lockfile/lockfile.js:277:17)
if (/EEXIST.*voting-keystore\.json\.lock/.test(vcProc2Stderr.read())) {
// vc 351591: ✖ Error: /tmp/tmp-5080-lwNxdM5Ok9ya/import-keystores-test/keystores/0x8be678633e927aa0435addad5dcd5283fef6110d91362519cd6d43e61f6c017d724fa579cc4b2972134e050b6ba120c0/voting-keystore.json is already in use by another process
// at /home/runner/actions-runner/_work/lodestar/lodestar/node_modules/proper-lockfile/lib/lockfile.js:68:47
// ... more stack trace
if (/Error.*voting-keystore\.json is already in use by another process/.test(vcProc2Stderr.read())) {
resolve();
} else {
reject(Error(`Second validator proc exited with unknown error. stderr:\n${vcProc2Stderr.read()}`));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {cachedSeckeysHex} from "../../utils/cachedKeys.js";
import {testFilesDir} from "../../utils.js";
import {decryptKeystoreDefinitions} from "../../../src/cmds/validator/keymanager/decryptKeystoreDefinitions.js";
import {LocalKeystoreDefinition} from "../../../src/cmds/validator/keymanager/interface.js";
import {LockfileError, unlockFilepath} from "../../../src/util/lockfile.js";

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

beforeEach(async () => {
// remove lockfiles from proper-lockfile cache
for (const {keystorePath} of definitions) {
unlockFilepath(keystorePath);
}
rimraf.sync(dataDir);
rimraf.sync(importFromDir);

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

// remove lockfiles created during cache file preparation
rimraf.sync(path.join(importFromDir, "*.lock"), {glob: true});
for (const {keystorePath} of definitions) {
unlockFilepath(keystorePath);
}
});

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

it("decrypt keystores if lockfiles already exist if ignoreLockFile=true", async () => {
await decryptKeystoreDefinitions(definitions, {logger: console, signal, cacheFilePath});

// lockfiles should exist after the first run

await decryptKeystoreDefinitions(definitions, {logger: console, signal, cacheFilePath, ignoreLockFile: true});
});
}
Expand Down
6 changes: 3 additions & 3 deletions packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lodestar/config",
"version": "1.15.0",
"version": "1.15.1",
"description": "Chain configuration required for lodestar",
"author": "ChainSafe Systems",
"license": "Apache-2.0",
Expand Down Expand Up @@ -65,7 +65,7 @@
],
"dependencies": {
"@chainsafe/ssz": "^0.14.0",
"@lodestar/params": "^1.15.0",
"@lodestar/types": "^1.15.0"
"@lodestar/params": "^1.15.1",
"@lodestar/types": "^1.15.1"
}
}
8 changes: 4 additions & 4 deletions packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lodestar/db",
"version": "1.15.0",
"version": "1.15.1",
"description": "DB modules of Lodestar",
"author": "ChainSafe Systems",
"homepage": "https://github.com/ChainSafe/lodestar#readme",
Expand Down Expand Up @@ -38,13 +38,13 @@
},
"dependencies": {
"@chainsafe/ssz": "^0.14.0",
"@lodestar/config": "^1.15.0",
"@lodestar/utils": "^1.15.0",
"@lodestar/config": "^1.15.1",
"@lodestar/utils": "^1.15.1",
"@types/levelup": "^4.3.3",
"it-all": "^3.0.4",
"level": "^8.0.0"
},
"devDependencies": {
"@lodestar/logger": "^1.15.0"
"@lodestar/logger": "^1.15.1"
}
}
2 changes: 1 addition & 1 deletion packages/db/src/controller/level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class LevelDbController implements DatabaseController<Uint8Array, Uint8Ar
await db.open();
} catch (e) {
if ((e as LevelDbError).cause?.code === "LEVEL_LOCKED") {
throw new Error("Database is already in use by another Lodestar instance");
throw new Error("Database is already in use by another process");
}
throw e;
}
Expand Down
14 changes: 7 additions & 7 deletions packages/flare/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lodestar/flare",
"version": "1.15.0",
"version": "1.15.1",
"description": "Beacon chain debugging tool",
"author": "ChainSafe Systems",
"license": "Apache-2.0",
Expand Down Expand Up @@ -60,12 +60,12 @@
"dependencies": {
"@chainsafe/bls": "7.1.1",
"@chainsafe/bls-keygen": "^0.3.0",
"@lodestar/api": "^1.15.0",
"@lodestar/config": "^1.15.0",
"@lodestar/params": "^1.15.0",
"@lodestar/state-transition": "^1.15.0",
"@lodestar/types": "^1.15.0",
"@lodestar/utils": "^1.15.0",
"@lodestar/api": "^1.15.1",
"@lodestar/config": "^1.15.1",
"@lodestar/params": "^1.15.1",
"@lodestar/state-transition": "^1.15.1",
"@lodestar/types": "^1.15.1",
"@lodestar/utils": "^1.15.1",
"source-map-support": "^0.5.21",
"yargs": "^17.7.1"
},
Expand Down
Loading
Loading