Closed kenny-io closed 1 week ago
how to configure it? i already update my apt-get install -y sudo && apt-get install -y logrotate but still error
Hi there i read the code but saw no unused fucntions to be sure of it i wrote a checker script in python
can you tell me waht you mean about unused code if every function is used ?
besides the only commented code are the disabled commands which I think are reserved for future use
I think the js is builded from the ts so I don't think there is a sue looking into it (but it does not look like there is unused functions)
python check_unused.py
adding . index.ts
adding . node-commands.ts
adding . gui-commands.ts
adding . projectFlags.ts
adding . pm2.ts
adding ./config default-rpc-config.ts
adding ./config default-network-config.ts
adding ./config default-gui-config.ts
adding ./config default-node-config.ts
adding ./utils index.ts
adding ./utils performance-stats.ts
adding ./utils logger.ts
adding ./utils tcache.ts
adding ./utils userInput.ts
adding ./utils fetch-network-data.ts
adding ./utils project-data.ts
adding ./utils fetch-node-data.ts
[registerNodeCommands] is used in ./index.ts import {registerNodeCommands} from './node-commands';
[registerNodeCommands] is used in ./index.ts registerNodeCommands(program);
[stopNode] is used in ./node-commands.ts return stopNode();
[stopNode] is used in ./node-commands.ts return stopNode();
[stopNode] is used in ./node-commands.ts return stopNode();
[unstake] is used in ./node-commands.ts console.error("Couldn't unstake (`eoaData` is null)");
[unstake] is used in ./node-commands.ts .command('unstake')
[unstake] is used in ./node-commands.ts 'Force unstake in case the node is stuck, will forfeit rewards'
[unstake] is used in ./node-commands.ts 'Confirm if you would like to force unstake (y/N): '
[unstake] is used in ./node-commands.ts await unstake(options);
[writeNodeConfig] is used in ./node-commands.ts writeNodeConfig();
[writeNodeConfig] is used in ./node-commands.ts writeNodeConfig();
[isNumber] is used in ./gui-commands.ts if (!isNumber(port)) {
[validPassword] is used in ./gui-commands.ts if (!validPassword(password)) {
[registerGuiCommands] is used in ./index.ts import {registerGuiCommands} from './gui-commands';
[registerGuiCommands] is used in ./index.ts registerGuiCommands(program);
[startGui] is used in ./gui-commands.ts .action(async () => await startGui());
[startGui] is used in ./gui-commands.ts await startGui();
[stopGui] is used in ./gui-commands.ts await stopGui();
[stopGui] is used in ./gui-commands.ts await stopGui();
[statusFromPM2] is used in ./node-commands.ts import {Pm2ProcessStatus, statusFromPM2} from './pm2';
[statusFromPM2] is used in ./node-commands.ts const status: Pm2ProcessStatus = statusFromPM2(description);
[statusFromPM2] is used in ./node-commands.ts const status: Pm2ProcessStatus = statusFromPM2(description);
[statusFromPM2] is used in ./gui-commands.ts import {Pm2ProcessStatus, statusFromPM2} from './pm2';
[statusFromPM2] is used in ./gui-commands.ts const status: Pm2ProcessStatus = statusFromPM2(description);
[statusFromPM2] is used in ./utils/fetch-network-data.ts import {Pm2ProcessStatus, statusFromPM2} from '../pm2';
[statusFromPM2] is used in ./utils/fetch-network-data.ts const status: Pm2ProcessStatus = statusFromPM2(description);
[getUsedDiskPercentage] is used in ./utils/performance-stats.ts const diskPercentage = await getUsedDiskPercentage();
[getCpuUsage] is used in ./utils/performance-stats.ts const cpuPercentage = await getCpuUsage();
[getPerformanceStatus] is used in ./node-commands.ts getPerformanceStatus,
[getPerformanceStatus] is used in ./node-commands.ts getPerformanceStatus(),
[readMaps] is used in ./utils/tcache.ts this.readMaps();
[writeMaps] is used in ./node-commands.ts cache.writeMaps();
[writeMaps] is used in ./node-commands.ts cache.writeMaps();
[writeMaps] is used in ./node-commands.ts cache.writeMaps();
[getUserInput] is used in ./node-commands.ts getUserInput,
[getUserInput] is used in ./node-commands.ts const answer = await getUserInput(
[getUserInput] is used in ./node-commands.ts const answer = await getUserInput(
[getUserInput] is used in ./node-commands.ts let privateKey = await getUserInput('Please enter your private key: ');
[getUserInput] is used in ./node-commands.ts privateKey = await getUserInput('Please enter your private key: ');
[getUserInput] is used in ./node-commands.ts let privateKey = await getUserInput('Please enter your private key: ');
[getUserInput] is used in ./node-commands.ts privateKey = await getUserInput('Please enter your private key: ');
[getUserInput] is used in ./node-commands.ts const answer = await getUserInput(
[readActiveNode] is used in ./utils/fetch-network-data.ts if (!readActiveNode()) {
[getNewActiveNode] is used in ./utils/fetch-network-data.ts await getNewActiveNode(config);
[getNewActiveNode] is used in ./utils/fetch-network-data.ts await getNewActiveNode(config);
[fetchInitialParameters] is used in ./utils/fetch-network-data.ts } = await fetchInitialParameters(config);
[fetchNodeParameters] is used in ./utils/fetch-network-data.ts const nodeData = await fetchNodeParameters(config, nodePubKey);
[fetchNodeLoad] is used in ./utils/fetch-network-data.ts const nodeLoad = await fetchNodeLoad(config);
[fetchNodeTxStats] is used in ./utils/fetch-network-data.ts const nodeTxStats = await fetchNodeTxStats(config);
[fetchNodeInfo] is used in ./node-commands.ts fetchNodeInfo,
[fetchNodeInfo] is used in ./node-commands.ts nodeInfo = await fetchNodeInfo(config);
[fetchNodeInfo] is used in ./node-commands.ts nodeInfo = await fetchNodeInfo(config);
[fetchNodeInfo] is used in ./node-commands.ts nodeInfo = await fetchNodeInfo(config);
[fetchNetworkStats] is used in ./utils/fetch-network-data.ts const networkStats = await fetchNetworkStats(config);
[getNetworkParams] is used in ./node-commands.ts getNetworkParams,
[getNetworkParams] is used in ./node-commands.ts const networkStats = await getNetworkParams(config, descriptions);
[fetchEOADetails] is used in ./node-commands.ts fetchEOADetails,
[fetchEOADetails] is used in ./node-commands.ts const eoaData = await fetchEOADetails(config, address)
[fetchEOADetails] is used in ./node-commands.ts fetchEOADetails(config, walletWithProvider.address),
[fetchEOADetails] is used in ./node-commands.ts const eoaData = await fetchEOADetails(config, walletWithProvider.address);
[fetchValidatorVersions] is used in ./node-commands.ts fetchValidatorVersions,
[fetchValidatorVersions] is used in ./node-commands.ts const validatorVersions = await fetchValidatorVersions(config);
[getAccountInfoParams] is used in ./node-commands.ts getAccountInfoParams,
[getAccountInfoParams] is used in ./node-commands.ts getAccountInfoParams(config, publicKey),
[fetchStakeParameters] is used in ./node-commands.ts fetchStakeParameters,
[fetchStakeParameters] is used in ./node-commands.ts fetchStakeParameters(config),
[fetchStakeParameters] is used in ./node-commands.ts fetchStakeParameters(config),
[fetchCycleDuration] is used in ./utils/fetch-network-data.ts const cycleDuration = await fetchCycleDuration(config);
[fetchCycleDuration] is used in ./utils/fetch-network-data.ts const cycleDuration = await fetchCycleDuration(config);
[getLatestCliVersion] is used in ./node-commands.ts getLatestCliVersion,
[getLatestCliVersion] is used in ./node-commands.ts latestCliVersion: await getLatestCliVersion(),
[getLatestGuiVersion] is used in ./node-commands.ts getLatestGuiVersion,
[getLatestGuiVersion] is used in ./node-commands.ts latestGuiVersion: await getLatestGuiVersion(),
[getInstalledGuiVersion] is used in ./node-commands.ts getInstalledGuiVersion,
[getInstalledGuiVersion] is used in ./node-commands.ts runningGuiVersion: getInstalledGuiVersion(),
[getInstalledGuiVersion] is used in ./gui-commands.ts import {getInstalledGuiVersion} from './utils/project-data';
[getInstalledGuiVersion] is used in ./gui-commands.ts console.log(getInstalledGuiVersion());
[getInstalledValidatorVersion] is used in ./node-commands.ts getInstalledValidatorVersion,
[getInstalledValidatorVersion] is used in ./node-commands.ts runnningValidatorVersion: getInstalledValidatorVersion(),
[isGuiInstalled] is used in ./node-commands.ts isGuiInstalled,
[isGuiInstalled] is used in ./node-commands.ts if (isGuiInstalled()) {
[isGuiInstalled] is used in ./utils/project-data.ts if (!isGuiInstalled()) {
[isValidatorInstalled] is used in ./node-commands.ts isValidatorInstalled,
[isValidatorInstalled] is used in ./node-commands.ts if (isValidatorInstalled()) {
[isValidatorInstalled] is used in ./utils/project-data.ts if (!isValidatorInstalled()) {
[getBranchNameForCLI] is used in ./node-commands.ts getBranchNameForCLI,
[getBranchNameForCLI] is used in ./node-commands.ts runningCliBranch: await getBranchNameForCLI(),
[getBranchNameForGUI] is used in ./node-commands.ts getBranchNameForGUI,
[getBranchNameForGUI] is used in ./node-commands.ts runningGuiBranch: await getBranchNameForGUI(),
[getBranchNameForValidator] is used in ./node-commands.ts getBranchNameForValidator,
[getBranchNameForValidator] is used in ./node-commands.ts runningValidatorBranch: await getBranchNameForValidator(),
[getCommitHashForCLI] is used in ./node-commands.ts getCommitHashForCLI,
[getCommitHashForCLI] is used in ./node-commands.ts runningCliCommitHash: await getCommitHashForCLI(),
[getCommitHashForGUI] is used in ./node-commands.ts getCommitHashForGUI,
[getCommitHashForGUI] is used in ./node-commands.ts runningGuiBranchCommitHash: await getCommitHashForGUI(),
[getCommitHashForValidator] is used in ./node-commands.ts getCommitHashForValidator,
[getCommitHashForValidator] is used in ./node-commands.ts runningValidatorBranchCommitHash: await getCommitHashForValidator(),
[getBranchNameFor] is used in ./utils/project-data.ts return getBranchNameFor(CLI_LOCAL_PATH);
[getBranchNameFor] is used in ./utils/project-data.ts return getBranchNameFor(GUI_LOCAL_PATH);
[getBranchNameFor] is used in ./utils/project-data.ts return getBranchNameFor(VALIDATOR_LOCAL_PATH);
[getCommitHash] is used in ./utils/project-data.ts return getCommitHash(CLI_LOCAL_PATH);
[getCommitHash] is used in ./utils/project-data.ts return getCommitHash(GUI_LOCAL_PATH);
[getCommitHash] is used in ./utils/project-data.ts return getCommitHash(VALIDATOR_LOCAL_PATH);
[fetchExitSummary] is used in ./utils/fetch-node-data.ts const exitSummary = fetchExitSummary();
[fetchStartSummary] is used in ./utils/fetch-node-data.ts const startSummary = fetchStartSummary();
[fetchNodeProgress] is used in ./node-commands.ts fetchNodeProgress,
[fetchNodeProgress] is used in ./node-commands.ts fetchNodeProgress().then(getProgressData),
[getExitInformation] is used in ./node-commands.ts getExitInformation,
[getExitInformation] is used in ./node-commands.ts getExitInformation(),
[interceptExitMessage] is used in ./utils/fetch-node-data.ts ? interceptExitMessage(exitSummary?.message)
[getProgressData] is used in ./node-commands.ts getProgressData,
[getProgressData] is used in ./node-commands.ts fetchNodeProgress().then(getProgressData),
[getNodeSettings] is used in ./node-commands.ts getNodeSettings,
[getNodeSettings] is used in ./node-commands.ts const settings = getNodeSettings();
[validatorLogExists] is used in ./utils/fetch-node-data.ts if (!validatorLogExists(logName)) {
[fetchFromLog] is used in ./utils/fetch-node-data.ts return fetchFromLog(`${File.EXIT_SUMMARY}`);
[fetchFromLog] is used in ./utils/fetch-node-data.ts return fetchFromLog(`${File.START_SUMMARY}`);
[fetchFromLog] is used in ./utils/fetch-node-data.ts return fetchFromLog(`${File.NODE_PROGRESS}`);
[fetchFromLog] is used in ./utils/fetch-node-data.ts const startData = fetchFromLog(`${File.START_SUMMARY}`);
[convertMsToDHM] is used in ./utils/fetch-node-data.ts totalTimeValidating: convertMsToDHM(nodeProgress.totalActiveTime)
you made me headache sir HAHA
Hi there i read the code but saw no unused fucntions to be sure of it i wrote a checker script in python
can you tell me waht you mean about unused code if every function is used ?
besides the only commented code are the disabled commands which I think are reserved for future use
I think the js is builded from the ts so I don't think there is a sue looking into it (but it does not look like there is unused functions)
@thibault-ketterer we have some unused and commented out code in the node-commands.ts
file . The entire test file is also not used but on a second thought I think we can keep them as we'll likely use those bits later. Thank you for digging around and trying to help with this. Look at some of our other open issues and help where you can!
The Validator CLI codebase contains unused code, some of which is commented out. We need to clean up the entire codebase by removing unnecessary code while being careful not to delete important comments, documentation, or code that's been temporarily commented out for future use.
Proposed Solution
Go through all files in the project, including TypeScript, JavaScript, and any other relevant files. Identify and remove unused code, being careful to preserve:
Expected Outcome
After implementing your solution:
Getting Started
git clone [your-fork-url]
git checkout -b cleanup/unused-code
git commit -m "Cleanup: Remove unused code from codebase"
git push origin cleanup/unused-code
Mentorship
If you need any help or have questions about which code is safe to remove, feel free to ask in the comments. You can also start a discussion here on Github and our team will be happy to provide the necessary assistance.