Skip to content
Closed
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
48 changes: 48 additions & 0 deletions PR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Pull Request:Allow Voluntary Exit To Write-to-File Feature and Prepare a manual node Test.

## Summary
This PR adds a `--saveToFile` JSON file option to the validator `voluntary-exit` command for later submission workflows. It does not submit to the beacon node.


## Changes Made
1. packages/cli/src/cmds/validator/voluntaryExit.ts` — implement saveToFile behavior
2. packages/cli/manual-tests/voluntaryExit.writefile.test.js` — manual script that:
-runs the handler with `saveToFile`
-verifies the file is created and readable.
-submits to a mock beacon client rather than publish to network.

> **Note:** The manual test demonstrates the behavior and was run locally.I kept the manual script so reviewers can quickly run and validate.I'm working on Jest/CI setup. I’d appreciate guidance or help from maintainers about the preferred location/approach for the automated test in repo CI.
## How to run the node test manually:

From repo root, run:
-$yarn install
-$yarn build
-$yarn workspace @chainsafe/lodestar node packages/cli/manual-tests/voluntaryExit.writefile.test.js

## Expected Output:
✅ File created successfully: .../manual-tests/exit-test.json
📄 File content: { message: 'Mock voluntary exit data' }
📨 Mock beacon received voluntary exit: { message: 'Mock voluntary exit data' }
✅ Voluntary exit successfully submitted to mock beacon client.
🧹 Cleaned up test file.

## Why manual test included:
While authoring an automated Jest test I ran into some repository-specific Jest/ESM config complexity. The manual test is included to provide clear, reproducible proof of functionality . It also aims to:
(a) let reviewers run the feature instantly.
(b) improve it to adapt to the repo's CI.

## Assistance needed:
I would appreciate guidance on:
- Correct integration testing pattern for Lodestar CLI commands.(I am happy to follow maintainers' suggestions to convert into an automated test).
- Ensuring that my local Jest configuration aligns with Lodestar’s monorepo test standards.

## To Do.
- Convert manual test to an automated Jest integration test in packages/cli/test/validator.
- Add any required test harness / mocks used by repo CI.

## Additional Notes
I’m learning to contribute to Ethereum core tooling via Lodestar, and this PR forms part of my contribution proof and learning process.

Thank you for reviewing, I look forward to reading your feedbacks.

Comment on lines +1 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file appears to contain content that should have been in the pull request description. It doesn't seem to be part of the project's documentation and should be removed from the repository.

19 changes: 19 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import tseslint from "typescript-eslint";

export default tseslint.config([
{
files: ["**/*.ts", "**/*.js"],
ignores: ["node_modules/**", "dist/**"],
languageOptions: {
parser: tseslint.parser,
},
plugins: {
"@typescript-eslint": tseslint.plugin,
},
rules: {
semi: ["error", "always"],
quotes: ["error", "double"],
"@typescript-eslint/no-unused-vars": ["warn"],
},
},
]);
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import json from "@eslint/json";
import markdown from "@eslint/markdown";
import { defineConfig } from "eslint/config";

export default defineConfig([
{ files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.browser } },
tseslint.configs.recommended,
{ files: ["**/*.json"], plugins: { json }, language: "json/json", extends: ["json/recommended"] },
{ files: ["**/*.jsonc"], plugins: { json }, language: "json/jsonc", extends: ["json/recommended"] },
{ files: ["**/*.json5"], plugins: { json }, language: "json/json5", extends: ["json/recommended"] },
{ files: ["**/*.md"], plugins: { markdown }, language: "markdown/gfm", extends: ["markdown/recommended"] },
]);
210 changes: 210 additions & 0 deletions exit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
[
{
"message": {
"epoch": 2,
"validatorIndex": 0
},
"signature": {
"0": 166,
"1": 226,
"2": 53,
"3": 185,
"4": 29,
"5": 121,
"6": 138,
"7": 61,
"8": 109,
"9": 227,
"10": 218,
"11": 199,
"12": 22,
"13": 145,
"14": 183,
"15": 143,
"16": 222,
"17": 16,
"18": 189,
"19": 146,
"20": 75,
"21": 116,
"22": 43,
"23": 60,
"24": 235,
"25": 188,
"26": 245,
"27": 103,
"28": 195,
"29": 243,
"30": 107,
"31": 32,
"32": 79,
"33": 68,
"34": 200,
"35": 133,
"36": 115,
"37": 71,
"38": 107,
"39": 63,
"40": 138,
"41": 49,
"42": 155,
"43": 77,
"44": 239,
"45": 126,
"46": 16,
"47": 223,
"48": 9,
"49": 50,
"50": 75,
"51": 122,
"52": 117,
"53": 97,
"54": 233,
"55": 84,
"56": 44,
"57": 101,
"58": 251,
"59": 31,
"60": 160,
"61": 138,
"62": 139,
"63": 213,
"64": 202,
"65": 103,
"66": 216,
"67": 21,
"68": 233,
"69": 205,
"70": 122,
"71": 157,
"72": 145,
"73": 199,
"74": 99,
"75": 172,
"76": 249,
"77": 45,
"78": 205,
"79": 140,
"80": 45,
"81": 62,
"82": 248,
"83": 203,
"84": 79,
"85": 162,
"86": 212,
"87": 167,
"88": 166,
"89": 130,
"90": 188,
"91": 133,
"92": 248,
"93": 243,
"94": 172,
"95": 154
}
},
{
"message": {
"epoch": 2,
"validatorIndex": 1
},
"signature": {
"0": 130,
"1": 125,
"2": 222,
"3": 60,
"4": 88,
"5": 46,
"6": 123,
"7": 74,
"8": 198,
"9": 139,
"10": 183,
"11": 247,
"12": 163,
"13": 22,
"14": 246,
"15": 45,
"16": 124,
"17": 108,
"18": 253,
"19": 211,
"20": 153,
"21": 185,
"22": 106,
"23": 202,
"24": 230,
"25": 187,
"26": 187,
"27": 3,
"28": 105,
"29": 40,
"30": 153,
"31": 74,
"32": 205,
"33": 50,
"34": 244,
"35": 230,
"36": 94,
"37": 138,
"38": 192,
"39": 151,
"40": 69,
"41": 152,
"42": 142,
"43": 130,
"44": 189,
"45": 235,
"46": 44,
"47": 122,
"48": 5,
"49": 195,
"50": 138,
"51": 234,
"52": 210,
"53": 229,
"54": 84,
"55": 87,
"56": 238,
"57": 141,
"58": 233,
"59": 193,
"60": 213,
"61": 27,
"62": 163,
"63": 66,
"64": 65,
"65": 52,
"66": 163,
"67": 15,
"68": 198,
"69": 151,
"70": 121,
"71": 20,
"72": 215,
"73": 36,
"74": 255,
"75": 97,
"76": 226,
"77": 161,
"78": 222,
"79": 85,
"80": 98,
"81": 238,
"82": 137,
"83": 92,
"84": 242,
"85": 77,
"86": 53,
"87": 247,
"88": 35,
"89": 173,
"90": 210,
"91": 4,
"92": 228,
"93": 73,
"94": 94,
"95": 189
}
}
]
Comment on lines +1 to +210
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file seems to be an example output or a test artifact. Such files should typically not be committed to the source repository. Please consider adding exit.json and other similar generated files to .gitignore.

11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "root",
"private": true,
"type": "module",
"engines": {
"node": ">=22 <23"
},
Expand Down Expand Up @@ -45,14 +46,22 @@
"@biomejs/biome": "^2.2.0",
"@chainsafe/benchmark": "^1.2.3",
"@chainsafe/biomejs-config": "^1.0.0",
"@eslint/js": "^9.37.0",
"@eslint/json": "^0.13.2",
"@eslint/markdown": "^7.4.0",
"@types/jest": "^30.0.0",
"@types/node": "^22.18.6",
"@types/react": "^19.1.12",
"@typescript-eslint/eslint-plugin": "^8.46.0",
"@typescript-eslint/parser": "^8.46.0",
"@vitest/browser": "3.0.9",
"@vitest/coverage-v8": "3.0.9",
"bun-types": "^1.2.21",
"crypto-browserify": "^3.12.0",
"dotenv": "^16.4.5",
"electron": "^26.2.2",
"eslint": "^9.37.0",
"globals": "^16.4.0",
"https-browserify": "^1.0.0",
"jsdom": "^23.0.1",
"lerna": "^7.3.0",
Expand All @@ -69,6 +78,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.9.2",
"typescript-docs-verifier": "^3.0.1",
"typescript-eslint": "^8.46.0",
"vite": "^6.0.11",
"vite-plugin-dts": "^4.5.0",
"vite-plugin-node-polyfills": "^0.23.0",
Expand All @@ -86,4 +96,5 @@
"vitest": "3.0.9",
"elliptic": ">=6.6.1"
}

}
Empty file.
19 changes: 19 additions & 0 deletions packages/cli/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import tseslint from "typescript-eslint";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you adding eslint configs? we are use biomejs for linting


export default tseslint.config([
{
files: ["**/*.ts", "**/*.js"],
languageOptions: {
parser: tseslint.parser,
},
plugins: {
"@typescript-eslint": tseslint.plugin,
},
rules: {
semi: ["error", "always"],
quotes: ["error", "double"],
"@typescript-eslint/no-unused-vars": ["warn"],
},
},
]);

Loading