Skip to content

Commit a664040

Browse files
authored
[DDW-158] Update Cardano node / Cardano wallet info shown on the "Diagnostics" screen (#1980)
* [DDW-158] Update node/walelt info on the Diagnostics screen * [DDW-158] Adds cardano wallet version to System info log * [DDW-158] Expose Daedalus build number on the 'Diagnostics' screen
1 parent be8de51 commit a664040

File tree

17 files changed

+287
-164
lines changed

17 files changed

+287
-164
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Changelog
55

66
### Fixes
77

8+
- Fixed `cardano-node` / `jormungandr` and `cardano-wallet` info on the "Diagnostics" screen ([PR 1980](https://github.com/input-output-hk/daedalus/pull/1980))
89
- Persist "Blank screen fix" / "--safe-mode" flag between Daedalus restarts ([PR 1979](https://github.com/input-output-hk/daedalus/pull/1979))
910
- Track `cardano-node` / `jormungandr` PID and use it for safe shutdowns and improve cardano-launcher error handling ([PR 1972](https://github.com/input-output-hk/daedalus/pull/1972))
1011
- Fixed "Wallet import" UI/UX issues ([PR 1968](https://github.com/input-output-hk/daedalus/pull/1968))

source/common/types/cardano-node.types.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,6 @@ export type CardanoStatus = {
123123
isNodeSyncing: boolean,
124124
isNodeInSync: boolean,
125125
hasBeenConnected: boolean,
126-
cardanoNodeID: number,
126+
cardanoNodePID: number,
127+
cardanoWalletPID: number,
127128
};

source/common/types/logging.types.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export type ElectronLoggerMessage = {
5353
};
5454

5555
export type LogSystemInfoParams = {
56-
cardanoVersion: string,
56+
cardanoNodeVersion: string,
57+
cardanoWalletVersion: string,
5758
cpu: Array<Object>,
5859
daedalusVersion: string,
5960
isBlankScreenFixActive: boolean,

source/common/utils/environmentCheckers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const evaluateNetwork = (network: ?string) => {
3535
};
3636

3737
export const getBuildLabel = (
38-
buildNumber: string,
38+
build: string,
3939
network: string,
4040
currentNodeEnv: string,
4141
isFlight: boolean,
@@ -45,7 +45,7 @@ export const getBuildLabel = (
4545
const networkLabel = checkIsMainnet(network)
4646
? ''
4747
: ` ${networkPrettyNames[network]}`;
48-
let buildLabel = `Daedalus${flightLabel}${networkLabel} (${version}#${buildNumber})`;
48+
let buildLabel = `Daedalus${flightLabel}${networkLabel} (${version}#${build})`;
4949
if (!checkIsProduction(currentNodeEnv))
5050
buildLabel += ` ${upperFirst(currentNodeEnv)}`;
5151
return buildLabel;

source/main/cardano/CardanoNode.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { spawn, exec } from 'child_process';
44
import type { ChildProcess } from 'child_process';
55
import type { WriteStream } from 'fs';
66
import type { Launcher } from 'cardano-launcher';
7-
import { toInteger } from 'lodash';
7+
import { get, toInteger } from 'lodash';
88
import moment from 'moment';
99
import rfs from 'rotating-file-stream';
1010
import { environment } from '../environment';
@@ -203,7 +203,7 @@ export class CardanoNode {
203203
* @returns {TlsConfig} // I think this returns a number...
204204
*/
205205
get pid(): ?number {
206-
return this._node ? this._node.pid : null;
206+
return get(this, '_node.pid', null);
207207
}
208208

209209
/**
@@ -220,7 +220,8 @@ export class CardanoNode {
220220
*/
221221
get status(): ?CardanoStatus {
222222
return Object.assign({}, this._status, {
223-
cardanoNodeID: this._node ? this._node.pid : 0,
223+
cardanoNodePID: get(this, '_node.pid', 0),
224+
cardanoWalletPID: get(this, '_node.wpid', 0),
224225
});
225226
}
226227

@@ -373,7 +374,8 @@ export class CardanoNode {
373374
this._handleCardanoNodeExit(code, signal);
374375
});
375376

376-
node.pid = processes.node.pid; // TODO: expose wallet pid too
377+
node.pid = processes.node.pid;
378+
node.wpid = processes.wallet.pid;
377379
node.connected = true; // TODO: use processes.wallet.connected here
378380
_log.info(
379381
`CardanoNode#start: cardano-node child process spawned with PID ${processes.node.pid}`,

source/main/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111
isProduction,
1212
isBlankScreenFixActive,
1313
current,
14-
buildNumber,
14+
build,
1515
network,
1616
version,
1717
} = environment;
@@ -124,7 +124,7 @@ export const pubLogsFolderPath = path.join(appLogsFolderPath, 'pub');
124124
export const stateDirectoryPath = stateDir;
125125
export const stateDrive = isWindows ? stateDirectoryPath.slice(0, 2) : '/';
126126
export const buildLabel = getBuildLabel(
127-
buildNumber,
127+
build,
128128
network,
129129
current,
130130
isFlight,

source/main/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ const {
5050
network,
5151
os: osName,
5252
version: daedalusVersion,
53-
buildNumber: cardanoVersion,
53+
nodeVersion: cardanoNodeVersion,
54+
apiVersion: cardanoWalletVersion,
5455
} = environment;
5556

5657
if (isBlankScreenFixActive) {
@@ -99,7 +100,8 @@ const onAppReady = async () => {
99100
const systemLocale = detectSystemLocale();
100101

101102
const systemInfo = logSystemInfo({
102-
cardanoVersion,
103+
cardanoNodeVersion,
104+
cardanoWalletVersion,
103105
cpu,
104106
daedalusVersion,
105107
isBlankScreenFixActive,

source/main/utils/setupLogging.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ export const logStateSnapshot = (
116116
daedalusProcessID,
117117
daedalusMainProcessID,
118118
isBlankScreenFixActive,
119-
cardanoVersion,
119+
cardanoNodeVersion,
120120
cardanoNetwork,
121-
cardanoProcessID,
122-
cardanoAPIPort,
121+
cardanoNodePID,
122+
cardanoWalletVersion,
123+
cardanoWalletPID,
124+
cardanoWalletApiPort,
123125
daedalusStateDirectoryPath,
124126
} = coreInfo;
125127
const env = `${cardanoNetwork}:${platform}:${platformVersion}`;
@@ -140,10 +142,12 @@ export const logStateSnapshot = (
140142
daedalusProcessID,
141143
daedalusMainProcessID,
142144
isBlankScreenFixActive,
143-
cardanoVersion,
144145
cardanoNetwork,
145-
cardanoProcessID,
146-
cardanoAPIPort,
146+
cardanoNodeVersion,
147+
cardanoNodePID,
148+
cardanoWalletVersion,
149+
cardanoWalletPID,
150+
cardanoWalletApiPort,
147151
daedalusStateDirectoryPath,
148152
data,
149153
};

source/renderer/app/components/status/DaedalusDiagnostics.js

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ const messages = defineMessages({
7676
defaultMessage: '!!!Daedalus version',
7777
description: 'Daedalus version',
7878
},
79+
daedalusBuildNumber: {
80+
id: 'daedalus.diagnostics.dialog.daedalusBuildNumber',
81+
defaultMessage: '!!!Daedalus build number',
82+
description: 'Daedalus build number',
83+
},
7984
daedalusMainProcessID: {
8085
id: 'daedalus.diagnostics.dialog.daedalusMainProcessID',
8186
defaultMessage: '!!!Daedalus main process ID',
@@ -91,20 +96,35 @@ const messages = defineMessages({
9196
defaultMessage: "!!!Daedalus 'Blank Screen Fix' active",
9297
description: "Daedalus 'Blank Screen Fix' active",
9398
},
94-
cardanoVersion: {
95-
id: 'daedalus.diagnostics.dialog.cardanoVersion',
99+
cardanoNodeVersion: {
100+
id: 'daedalus.diagnostics.dialog.cardanoNodeVersion',
96101
defaultMessage: '!!!Cardano node version',
97102
description: 'Cardano node version',
98103
},
99-
cardanoProcessID: {
100-
id: 'daedalus.diagnostics.dialog.cardanoProcessID',
104+
cardanoNodePID: {
105+
id: 'daedalus.diagnostics.dialog.cardanoNodePID',
101106
defaultMessage: '!!!Cardano node process ID',
102107
description: 'Cardano node process ID',
103108
},
104-
cardanoApiPort: {
105-
id: 'daedalus.diagnostics.dialog.cardanoApiPort',
106-
defaultMessage: '!!!Cardano node API port',
107-
description: 'Cardano node API port',
109+
cardanoNodeApiPort: {
110+
id: 'daedalus.diagnostics.dialog.cardanoNodeApiPort',
111+
defaultMessage: '!!!Cardano node port',
112+
description: 'Cardano node port',
113+
},
114+
cardanoWalletPID: {
115+
id: 'daedalus.diagnostics.dialog.cardanoWalletPID',
116+
defaultMessage: '!!!Cardano wallet process ID',
117+
description: 'Cardano wallet process ID',
118+
},
119+
cardanoWalletVersion: {
120+
id: 'daedalus.diagnostics.dialog.cardanoWalletVersion',
121+
defaultMessage: '!!!Cardano wallet version',
122+
description: 'Cardano wallet version',
123+
},
124+
cardanoWalletApiPort: {
125+
id: 'daedalus.diagnostics.dialog.cardanoWalletApiPort',
126+
defaultMessage: '!!!Cardano wallet port',
127+
description: 'Cardano wallet port',
108128
},
109129
cardanoNetwork: {
110130
id: 'daedalus.diagnostics.dialog.cardanoNetwork',
@@ -454,12 +474,15 @@ export default class DaedalusDiagnostics extends Component<Props, State> {
454474

455475
const {
456476
daedalusVersion,
477+
daedalusBuildNumber,
457478
daedalusProcessID,
458479
daedalusMainProcessID,
459480
isBlankScreenFixActive,
460-
cardanoVersion,
461-
cardanoProcessID,
462-
cardanoAPIPort,
481+
cardanoNodeVersion,
482+
cardanoNodePID,
483+
cardanoWalletVersion,
484+
cardanoWalletPID,
485+
cardanoWalletApiPort,
463486
cardanoRawNetwork,
464487
cardanoNetwork,
465488
daedalusStateDirectoryPath,
@@ -534,6 +557,7 @@ export default class DaedalusDiagnostics extends Component<Props, State> {
534557
<div>
535558
{getSectionRow('coreInfo')}
536559
{getRow('daedalusVersion', daedalusVersion)}
560+
{getRow('daedalusBuildNumber', daedalusBuildNumber)}
537561
{getRow('daedalusMainProcessID', daedalusMainProcessID)}
538562
{getRow('daedalusProcessID', daedalusProcessID)}
539563
{getRow(
@@ -575,10 +599,12 @@ export default class DaedalusDiagnostics extends Component<Props, State> {
575599
</CopyToClipboard>
576600
</Fragment>
577601
)}
578-
{getRow('cardanoVersion', cardanoVersion)}
579-
{getRow('cardanoProcessID', cardanoProcessID || '-')}
580-
{getRow('cardanoApiPort', cardanoAPIPort || '-')}
581-
{getRow('cardanoNetwork', cardanoNetworkValue)}
602+
{getRow('cardanoNodeVersion', cardanoNodeVersion)}
603+
{getRow('cardanoNodePID', cardanoNodePID || '-')}
604+
{/* getRow('cardanoNodeApiPort', '-') */}
605+
{getRow('cardanoWalletVersion', cardanoWalletVersion)}
606+
{getRow('cardanoWalletPID', cardanoWalletPID || '-')}
607+
{getRow('cardanoWalletApiPort', cardanoWalletApiPort || '-')}
582608
</div>
583609
{isConnected && nodeConnectionError ? (
584610
<div>
@@ -599,6 +625,7 @@ export default class DaedalusDiagnostics extends Component<Props, State> {
599625
<div className={styles.table}>
600626
<div>
601627
{getSectionRow('daedalusStatus')}
628+
{getRow('cardanoNetwork', cardanoNetworkValue)}
602629
{getRow('connected', isConnected)}
603630
{getRow('synced', isSynced)}
604631
{getRow(

source/renderer/app/containers/status/DaedalusDiagnosticsDialog.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export default class DaedalusDiagnosticsDialog extends Component<Props> {
5050
environment,
5151
diskSpaceAvailable,
5252
tlsConfig,
53-
cardanoNodeID,
53+
cardanoNodePID,
54+
cardanoWalletPID,
5455
stateDirectoryPath,
5556
getNetworkClockRequest,
5657
} = networkStatus;
@@ -71,17 +72,22 @@ export default class DaedalusDiagnosticsDialog extends Component<Props> {
7172
mainProcessID,
7273
isBlankScreenFixActive,
7374
nodeVersion,
75+
apiVersion,
76+
build,
7477
} = environment;
7578

7679
const coreInfo = {
7780
daedalusVersion: version,
81+
daedalusBuildNumber: build,
7882
daedalusProcessID: rendererProcessID,
7983
daedalusMainProcessID: mainProcessID,
8084
daedalusStateDirectoryPath: stateDirectoryPath,
8185
isBlankScreenFixActive,
82-
cardanoVersion: nodeVersion,
83-
cardanoProcessID: cardanoNodeID,
84-
cardanoAPIPort: tlsConfig ? tlsConfig.port : 0,
86+
cardanoNodeVersion: nodeVersion,
87+
cardanoNodePID,
88+
cardanoWalletVersion: apiVersion,
89+
cardanoWalletPID,
90+
cardanoWalletApiPort: tlsConfig ? tlsConfig.port : 0,
8591
cardanoNetwork: network,
8692
cardanoRawNetwork: rawNetwork,
8793
};

0 commit comments

Comments
 (0)