Skip to content

Commit 0a1e4c8

Browse files
author
Marcin Mazurek
committed
Merge remote-tracking branch 'origin/develop' into chore/ddw-940-update-faker
2 parents 9a6c79d + 3ef535d commit 0a1e4c8

File tree

24 files changed

+217
-66
lines changed

24 files changed

+217
-66
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
### Features
66

7+
- Added ASCII name to token header when metadata name is missing ([PR 2904](https://github.com/input-output-hk/daedalus/pull/2904))
8+
- Improved IPC by reducing the amount of messages from periodic events ([PR 2892](https://github.com/input-output-hk/daedalus/pull/2892))
79
- Improved RTS flags splash screen message ([PR 2901](https://github.com/input-output-hk/daedalus/pull/2901))
810
- Implemented error message when trying to leave wallet without enough ada to support tokens ([PR 2783](https://github.com/input-output-hk/daedalus/pull/2783))
911

1012
### Fixes
1113

14+
- Fixed stake pool list view overlapping news feed ([PR 2917](https://github.com/input-output-hk/daedalus/pull/2917))
1215
- Restored opacity for search icon when focused ([PR 2909](https://github.com/input-output-hk/daedalus/pull/2909))
1316
- Fixed styling of the incentivized testnet rewards wallet dropdown ([PR 2907](https://github.com/input-output-hk/daedalus/pull/2907))
1417
- Fix warning sign displayed when recommend decimals is zero ([PR 2905](https://github.com/input-output-hk/daedalus/pull/2905))

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ If you get SSL error when running `nix-shell` (SSL peer certificate or SSH remot
6565

6666
1. Run `yarn nix:selfnode` from `daedalus`.
6767
2. Run `yarn dev` from the subsequent `nix-shell` (use `KEEP_LOCAL_CLUSTER_RUNNING` environment variable to keep the local cluster running after Daedalus exits: `KEEP_LOCAL_CLUSTER_RUNNING=true yarn dev`)
68+
1. Alternatively: run `yarn nix:selfnode yarn dev` to achieve the same thing in a single command. Note: after `yarn dev` exits, you will still remain in the `nix-shell`.
6869
3. Once Daedalus has started and has gotten past the loading screen run the following commands from a new terminal window if you wish to import funded wallets:
6970
- Byron wallets: `yarn byron:wallet:importer`
7071
- Shelley wallets: `yarn shelley:wallet:importer`
@@ -94,31 +95,37 @@ If you get SSL error when running `nix-shell` (SSL peer certificate or SSH remot
9495

9596
1. Run `yarn nix:mainnet` from `daedalus`.
9697
2. Run `yarn dev` from the subsequent `nix-shell`
98+
3. Or in one command: `yarn nix:mainnet yarn dev`
9799

98100
#### Flight
99101

100102
1. Run `yarn nix:flight` from `daedalus`.
101103
2. Run `yarn dev` from the subsequent `nix-shell`
104+
3. Or in one command: `yarn nix:flight yarn dev`
102105

103106
#### Testnet
104107

105108
1. Run `yarn nix:testnet` from `daedalus`.
106109
2. Run `yarn dev` from the subsequent `nix-shell`
110+
3. Or in one command: `yarn nix:testnet yarn dev`
107111

108112
#### Staging
109113

110114
1. Run `yarn nix:staging` from `daedalus`.
111115
2. Run `yarn dev` from the subsequent `nix-shell`
116+
3. Or in one command: `yarn nix:staging yarn dev`
112117

113118
#### Shelley QA
114119

115120
1. Run `yarn nix:shelley_qa` from `daedalus`.
116121
2. Run `yarn dev` from the subsequent `nix-shell`
122+
3. Or in one command: `yarn nix:shelley_qa yarn dev`
117123

118124
#### Alonzo Purple
119125

120126
1. Run `yarn nix:alonzo_purple` from `daedalus`.
121127
2. Run `yarn dev` from the subsequent `nix-shell`
128+
3. Or in one command: `yarn nix:alonzo_purple yarn dev`
122129

123130
#### Native token metadata server
124131

nix/yarn-nix-shell.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
# This small wrapper over `nix-shell`, called from package.json
4+
# (e.g. `yarn nix:testnet`) allows to specify an initial command to be
5+
# run inside the `nix-shell` once its ready, e.g.:
6+
#
7+
# $ yarn nix:testnet yarn dev
8+
#
9+
# After the command finishes, you will still be left inside the
10+
# nix-shell.
11+
12+
if [ $# -lt 2 ] ; then
13+
echo >&2 'fatal: usage: '"$0"' <network> <cluster> [<initial command> ...]'
14+
exit 1
15+
fi
16+
17+
NETWORK="$1" ; shift
18+
cluster="$1" ; shift
19+
20+
# Unfortunately, we need to shell-escape the command:
21+
# cf. <https://github.com/NixOS/nixpkgs/blob/877eb10cfbdb3e3d54bdc7a7f6fd3c4b4e6396da/lib/strings.nix#L310-L328>
22+
command=''
23+
while [ $# -gt 0 ] ; do
24+
command="$command '""${1//\'/\'\\\'\'}""'" ; shift
25+
done
26+
27+
if [ -z "$command" ] ; then
28+
command=':' # no-op, if no command
29+
fi
30+
31+
export NETWORK
32+
# `return` will make the user stay in `nix-shell` after the initial command finishes:
33+
exec nix-shell --argstr nodeImplementation cardano --argstr cluster "$cluster" --command "$command ; return"

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@
4949
"themes:update": "gulp build:themes && ts-node -r esm ./dist/scripts/update.js && yarn prettier --loglevel warn --write source/renderer/app/themes/daedalus/*.ts",
5050
"themes:copy": "ts-node -r @babel/register -r @babel/polyfill source/renderer/app/themes/utils/copyTheme.ts && yarn prettier --loglevel warn --write source/renderer/app/themes/daedalus/*.ts",
5151
"clear:cache": "gulp clear:cache",
52-
"nix:alonzo_purple": "NETWORK=alonzo_purple nix-shell --argstr nodeImplementation cardano --argstr cluster alonzo_purple",
53-
"nix:mainnet": "NETWORK=mainnet nix-shell --argstr nodeImplementation cardano --argstr cluster mainnet",
54-
"nix:flight": "NETWORK=mainnet nix-shell --argstr nodeImplementation cardano --argstr cluster mainnet_flight",
55-
"nix:selfnode": "NETWORK=selfnode nix-shell --argstr nodeImplementation cardano --argstr cluster selfnode",
56-
"nix:shelley_qa": "NETWORK=shelley_qa nix-shell --argstr nodeImplementation cardano --argstr cluster shelley_qa",
57-
"nix:staging": "NETWORK=staging nix-shell --argstr nodeImplementation cardano --argstr cluster staging",
58-
"nix:testnet": "NETWORK=testnet nix-shell --argstr nodeImplementation cardano --argstr cluster testnet",
52+
"nix:alonzo_purple": "./nix/yarn-nix-shell.sh alonzo_purple alonzo_purple",
53+
"nix:mainnet": "./nix/yarn-nix-shell.sh mainnet mainnet",
54+
"nix:flight": "./nix/yarn-nix-shell.sh mainnet mainnet_flight",
55+
"nix:selfnode": "./nix/yarn-nix-shell.sh selfnode selfnode",
56+
"nix:shelley_qa": "./nix/yarn-nix-shell.sh shelley_qa shelley_qa",
57+
"nix:staging": "./nix/yarn-nix-shell.sh staging staging",
58+
"nix:testnet": "./nix/yarn-nix-shell.sh testnet testnet",
5959
"byron:wallet:importer": "ts-node utils/api-importer/byron-wallet-importer.ts",
6060
"shelley:wallet:importer": "ts-node utils/api-importer/shelley-wallet-importer.ts",
6161
"mary:wallet:importer": "ts-node utils/api-importer/mary-wallet-importer.ts",
@@ -271,6 +271,7 @@
271271
"shasum": "1.0.2",
272272
"source-map-support": "0.5.19",
273273
"spectron-fake-dialog": "0.0.1",
274+
"tail": "2.2.4",
274275
"tcp-port-used": "1.0.1",
275276
"trezor-connect": "8.2.4-extended",
276277
"unorm": "1.6.0",

source/main/config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ export const DISK_SPACE_RECOMMENDED_PERCENTAGE = 15; // 15% of the total disk sp
172172

173173
export const DISK_SPACE_CHECK_TIMEOUT = 9 * 1000; // Timeout for checking disks pace
174174

175-
export const BLOCK_REPLAY_PROGRESS_CHECK_INTERVAL = 1 * 1000; // 1 seconds | unit: milliseconds
176-
177175
// Used if token metadata server URL is not defined in launcher config
178176
export const FALLBACK_TOKEN_METADATA_SERVER_URL =
179177
'https://metadata.cardano-testnet.iohkdev.io';

source/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const onAppReady = async () => {
248248
};
249249

250250
mainErrorHandler(onMainError);
251-
await handleCheckBlockReplayProgress(mainWindow, launcherConfig.logsPrefix);
251+
handleCheckBlockReplayProgress(mainWindow, launcherConfig.logsPrefix);
252252
await handleCheckDiskSpace();
253253

254254
if (isWatchMode) {
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import moment, { Moment } from 'moment';
22

33
export function isItFreshLog(applicationStartDate: Moment, line: string) {
4-
const [, logDate] = line.match(
5-
/\[(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d+) UTC]/
6-
);
4+
const [, logDate] =
5+
line.match(/\[(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d+) UTC]/) || [];
6+
7+
if (!logDate) {
8+
return false;
9+
}
10+
711
return applicationStartDate.isBefore(moment.utc(logDate));
812
}

source/main/utils/handleCheckBlockReplayProgress.ts

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { BrowserWindow } from 'electron';
22
import fs from 'fs';
3-
import moment, { Moment } from 'moment';
4-
import readline from 'readline';
3+
import moment from 'moment';
54
import path from 'path';
5+
import { Tail } from 'tail';
66
import { getBlockSyncProgressChannel } from '../ipc/get-block-sync-progress';
77
import type { GetBlockSyncProgressType } from '../../common/ipc/api';
8-
import { BLOCK_REPLAY_PROGRESS_CHECK_INTERVAL } from '../config';
98
import { BlockSyncType } from '../../common/types/cardano-node.types';
109
import { isItFreshLog } from './blockSyncProgressHelpers';
1110

@@ -48,30 +47,23 @@ export const handleCheckBlockReplayProgress = (
4847
mainWindow: BrowserWindow,
4948
logsDirectoryPath: string
5049
) => {
51-
const checkBlockReplayProgress = async () => {
52-
const filename = 'node.log';
53-
const logFilePath = `${logsDirectoryPath}/pub/`;
54-
const filePath = path.join(logFilePath, filename);
55-
if (!fs.existsSync(filePath)) return;
56-
const fileStream = fs.createReadStream(filePath);
57-
const rl = readline.createInterface({
58-
input: fileStream,
59-
});
60-
const progress = [];
50+
const filename = 'node.log';
51+
const logFilePath = `${logsDirectoryPath}/pub/`;
52+
const filePath = path.join(logFilePath, filename);
53+
if (!fs.existsSync(filePath)) return;
6154

62-
for await (const line of rl) {
63-
if (
64-
containProgressKeywords(line) &&
65-
isItFreshLog(applicationStartDate, line)
66-
) {
67-
progress.push(line);
68-
}
55+
const tail = new Tail(filePath);
56+
57+
tail.on('line', (line) => {
58+
if (
59+
!isItFreshLog(applicationStartDate, line) ||
60+
!containProgressKeywords(line)
61+
) {
62+
return;
6963
}
7064

71-
if (!progress.length) return;
72-
const finalProgress = progress.slice(-1).pop();
73-
const percentage = finalProgress.match(/Progress:([\s\d.,]+)%/)?.[1];
74-
const progressType = getProgressType(finalProgress);
65+
const percentage = line.match(/Progress:([\s\d.,]+)%/)?.[1];
66+
const progressType = getProgressType(line);
7567
if (!percentage || !progressType) {
7668
return;
7769
}
@@ -81,15 +73,5 @@ export const handleCheckBlockReplayProgress = (
8173
{ progress: finalProgressPercentage, type: progressType },
8274
mainWindow.webContents
8375
);
84-
};
85-
86-
const setBlockReplayProgressCheckingInterval = () => {
87-
setInterval(async () => {
88-
checkBlockReplayProgress();
89-
}, BLOCK_REPLAY_PROGRESS_CHECK_INTERVAL);
90-
};
91-
92-
// Start default interval
93-
setBlockReplayProgressCheckingInterval();
94-
return checkBlockReplayProgress;
76+
});
9577
};

source/renderer/app/api/api.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,7 @@ export default class AdaApi {
246246

247247
getWallets = async (): Promise<Array<Wallet>> => {
248248
logger.debug('AdaApi::getWallets called');
249-
const {
250-
getHardwareWalletLocalData,
251-
getHardwareWalletsLocalData,
252-
} = global.daedalus.api.localStorage;
249+
const { getHardwareWalletsLocalData } = global.daedalus.api.localStorage;
253250

254251
try {
255252
const wallets: Array<AdaWallet | LegacyAdaWallet> = await getWallets(
@@ -281,7 +278,9 @@ export default class AdaApi {
281278
return await Promise.all(
282279
wallets.map(async (wallet: AdaWallet) => {
283280
const { id } = wallet;
284-
const walletData = await getHardwareWalletLocalData(id);
281+
282+
const walletData = hwLocalData[id];
283+
285284
return _createWalletFromServerData({
286285
...wallet,
287286
isHardwareWallet:

source/renderer/app/components/assets/Asset.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
overflow: hidden;
7676
text-overflow: ellipsis;
7777
white-space: nowrap;
78+
79+
&.ascii {
80+
color: var(--theme-tokens-list-header-text-color);
81+
}
7882
}
7983

8084
.metadata {

0 commit comments

Comments
 (0)