Skip to content

Commit a0c3b59

Browse files
authored
fix: lib upgrade (#3)
fix: reordered node types
1 parent 051f735 commit a0c3b59

File tree

10 files changed

+1024
-1040
lines changed

10 files changed

+1024
-1040
lines changed

docs/autocomplete.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ EXAMPLES
2626
$ symbol-network autocomplete --refresh-cache
2727
```
2828

29-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v0.3.0/src/commands/autocomplete/index.ts)_
29+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.2.0/src/commands/autocomplete/index.ts)_

docs/help.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ OPTIONS
2020
--all see all commands in CLI
2121
```
2222

23-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.3.1/src/commands/help.ts)_
23+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.18/src/commands/help.ts)_

package-lock.json

Lines changed: 943 additions & 963 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,50 +54,51 @@
5454
},
5555
"types": "lib/index.d.ts",
5656
"dependencies": {
57-
"@oclif/command": "^1.8.12",
58-
"@oclif/config": "^1.18.2",
59-
"@oclif/plugin-autocomplete": "^0.3.0",
60-
"@oclif/plugin-help": "^3.2.17",
61-
"cross-fetch": "^3.1.4",
57+
"@oclif/command": "^1.8.16",
58+
"@oclif/config": "^1.18.3",
59+
"@oclif/plugin-autocomplete": "^1.2.0",
60+
"@oclif/plugin-help": "^5.1.11",
61+
"cross-fetch": "^3.1.5",
6262
"figlet": "^1.5.2",
6363
"inquirer": "^8.2.0",
6464
"lodash": "^4.17.21",
6565
"remove": "^0.1.5",
66-
"symbol-bootstrap": "^1.1.4-alpha-e63d2e2",
67-
"symbol-sdk": "^1.0.3",
66+
"rxjs": "^7.5.2",
67+
"symbol-bootstrap": "^1.1.4-alpha-7dcd80b",
68+
"symbol-sdk": "^1.0.4-alpha-202112211435",
6869
"tslib": "^2.3.1",
69-
"winston": "^3.4.0"
70+
"winston": "^3.5.1"
7071
},
7172
"devDependencies": {
72-
"@oclif/dev-cli": "^1.26.9",
73-
"@oclif/test": "^1.2.8",
73+
"@oclif/dev-cli": "^1.26.10",
74+
"@oclif/test": "^2.0.3",
7475
"@types/chai": "^4.3.0",
7576
"@types/figlet": "^1.5.4",
76-
"@types/inquirer": "^8.1.3",
77+
"@types/inquirer": "^8.2.0",
7778
"@types/lodash": "^4.14.178",
78-
"@types/mocha": "^9.0.0",
79-
"@types/node": "^17.0.9",
79+
"@types/mocha": "^9.1.0",
80+
"@types/node": "^17.0.14",
8081
"@types/semver": "^7.3.9",
8182
"@types/winston": "^2.4.4",
82-
"@typescript-eslint/eslint-plugin": "^5.10.0",
83-
"@typescript-eslint/parser": "^5.10.0",
84-
"chai": "^4.3.4",
83+
"@typescript-eslint/eslint-plugin": "^5.10.2",
84+
"@typescript-eslint/parser": "^5.10.2",
85+
"chai": "^4.3.6",
8586
"coveralls": "^3.1.1",
8687
"create-ts-index": "^1.14.0",
8788
"dir-compare": "^4.0.0",
88-
"eslint": "^8.7.0",
89+
"eslint": "^8.8.0",
8990
"eslint-config-prettier": "^8.3.0",
9091
"eslint-plugin-prettier": "^4.0.0",
91-
"mocha": "^9.1.4",
92+
"mocha": "^9.2.0",
9293
"mocha-lcov-reporter": "^1.3.0",
9394
"mock-stdin": "^1.0.0",
9495
"nyc": "^15.1.0",
9596
"prettier": "^2.5.1",
9697
"prettier-plugin-organize-imports": "^2.3.4",
9798
"shx": "^0.3.4",
98-
"sinon": "^12.0.1",
99+
"sinon": "^13.0.1",
99100
"ts-node": "^10.4.0",
100101
"typedoc": "^0.22.11",
101-
"typescript": "^4.5.4"
102+
"typescript": "^4.5.5"
102103
}
103104
}

src/commands/generateNemesis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ After running this command, your new network nemesis seed would be created. It a
7676
logger.info('');
7777
logger.info(`Once you are happy, run:`);
7878
logger.info('');
79-
logger.info(`$ ${NetworkCommandUtils.CLI_TOOL} configureNodes --offline`);
79+
logger.info(`$ ${NetworkCommandUtils.CLI_TOOL} configureNodes --offline --zip`);
8080
logger.info('');
8181
logger.info(`To generate the nodes' configuration ready to be deployed.`);
8282

src/commands/verify.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
AppVersionService,
2020
AppVersionVerifyAction,
2121
Constants,
22-
Logger,
2322
LoggerFactory,
2423
LogType,
2524
RuntimeService,
@@ -38,7 +37,7 @@ export default class Verify extends Command {
3837

3938
public async run(): Promise<void> {
4039
NetworkCommandUtils.showBanner();
41-
const logger: Logger = LoggerFactory.getLogger(LogType.Console);
40+
const logger = LoggerFactory.getLogger(LogType.Console);
4241
const service = new VerifyService(logger);
4342
const runtimeService = new RuntimeService(logger);
4443
const appVersionService = new AppVersionService(logger, runtimeService);

src/model/NodeInformation.ts

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
import { Assembly, CustomPreset, NodeAccount as NodeAddresses } from 'symbol-bootstrap';
1818

1919
export enum NodeMetadataType {
20+
VotingDual = 'VotingDual',
2021
VotingPeer = 'VotingPeer',
2122
VotingApi = 'VotingApi',
22-
VotingDual = 'VotingDual',
23-
HarvestingPeer = 'HarvestingPeer',
2423
HarvestingDual = 'HarvestingDual',
25-
HarvestingDemo = 'HarvestingDemo',
26-
VotingNonHarvestingPeer = 'VotingNonHarvestingPeer',
24+
HarvestingPeer = 'HarvestingPeer',
2725
Services = 'Services',
2826
Peer = 'Peer',
2927
Api = 'Api',
28+
HarvestingDemo = 'HarvestingDemo',
29+
VotingNonHarvestingPeer = 'VotingNonHarvestingPeer',
3030
}
3131

3232
export enum RestProtocol {
@@ -59,44 +59,33 @@ export interface NodeTypeMetadata {
5959
}
6060

6161
export const nodesMetadata: Record<NodeMetadataType, NodeTypeMetadata> = {
62-
VotingPeer: {
63-
name: 'Voting Peer',
62+
VotingDual: {
63+
name: 'Voting Dual',
6464
balances: [3_000_000, 150],
6565
voting: true,
6666
harvesting: true,
6767
demo: false,
68-
api: false,
68+
api: true,
6969
peer: true,
70-
nickName: 'beacon',
70+
nickName: 'dual',
7171
suggestedCount: 3,
7272
},
73-
VotingApi: {
74-
name: 'Voting Api',
73+
VotingPeer: {
74+
name: 'Voting Peer',
7575
balances: [3_000_000, 150],
7676
voting: true,
77-
harvesting: false,
77+
harvesting: true,
7878
demo: false,
7979
api: false,
8080
peer: true,
8181
nickName: 'beacon',
8282
suggestedCount: 3,
8383
},
84-
VotingDual: {
85-
name: 'Voting Dual',
84+
VotingApi: {
85+
name: 'Voting Api',
8686
balances: [3_000_000, 150],
8787
voting: true,
88-
harvesting: true,
89-
demo: false,
90-
api: true,
91-
peer: true,
92-
nickName: 'dual',
93-
suggestedCount: 3,
94-
},
95-
HarvestingPeer: {
96-
name: 'Harvesting Peer',
97-
balances: [1_000_000, 150],
98-
voting: false,
99-
harvesting: true,
88+
harvesting: false,
10089
demo: false,
10190
api: false,
10291
peer: true,
@@ -114,28 +103,15 @@ export const nodesMetadata: Record<NodeMetadataType, NodeTypeMetadata> = {
114103
nickName: 'dual',
115104
suggestedCount: 3,
116105
},
117-
118-
HarvestingDemo: {
119-
name: 'Harvesting Demo',
106+
HarvestingPeer: {
107+
name: 'Harvesting Peer',
120108
balances: [1_000_000, 150],
121109
voting: false,
122110
harvesting: true,
123-
demo: true,
124-
api: true,
125-
peer: true,
126-
assembly: 'demo',
127-
nickName: 'demo',
128-
suggestedCount: 1,
129-
},
130-
Peer: {
131-
name: 'Peer',
132-
balances: [1_000, 0],
133-
voting: false,
134-
harvesting: false,
135111
demo: false,
136112
api: false,
137113
peer: true,
138-
nickName: 'peer',
114+
nickName: 'beacon',
139115
suggestedCount: 3,
140116
},
141117
Services: {
@@ -151,6 +127,17 @@ export const nodesMetadata: Record<NodeMetadataType, NodeTypeMetadata> = {
151127
assembly: Assembly.services,
152128
suggestedCount: 1,
153129
},
130+
Peer: {
131+
name: 'Peer',
132+
balances: [1_000, 0],
133+
voting: false,
134+
harvesting: false,
135+
demo: false,
136+
api: false,
137+
peer: true,
138+
nickName: 'peer',
139+
suggestedCount: 3,
140+
},
154141
Api: {
155142
name: 'Api',
156143
balances: [1_000, 0],
@@ -162,6 +149,19 @@ export const nodesMetadata: Record<NodeMetadataType, NodeTypeMetadata> = {
162149
nickName: 'api',
163150
suggestedCount: 3,
164151
},
152+
153+
HarvestingDemo: {
154+
name: 'Harvesting Demo',
155+
balances: [1_000_000, 150],
156+
voting: false,
157+
harvesting: true,
158+
demo: true,
159+
api: true,
160+
peer: true,
161+
assembly: 'demo',
162+
nickName: 'demo',
163+
suggestedCount: 1,
164+
},
165165
VotingNonHarvestingPeer: {
166166
name: 'Non Harvesting Voting Peer',
167167
balances: [51_000_000, 0],

src/services/NetworkHealthCheckService.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
import * as _ from 'lodash';
1717
import { Socket } from 'net';
18+
import { firstValueFrom } from 'rxjs';
1819
import { KeyName, Logger } from 'symbol-bootstrap';
1920
import { NodeStatusEnum } from 'symbol-openapi-typescript-fetch-client';
2021
import { AccountLinkVotingKey, Address, FinalizationProof } from 'symbol-sdk';
@@ -89,10 +90,9 @@ export class NetworkHealthCheckService {
8990
throw new Error('There are not running nodes. Have you deployed?');
9091
}
9192
const bestNodeRepositoryFactory = NetworkUtils.createRepositoryFactory(bestNodeInfo.bestRestUrl, timeout);
92-
const finalizationData = await bestNodeRepositoryFactory
93-
.createFinalizationRepository()
94-
.getFinalizationProofAtEpoch(bestNodeInfo.finalizedEpoch)
95-
.toPromise();
93+
const finalizationData = await firstValueFrom(
94+
bestNodeRepositoryFactory.createFinalizationRepository().getFinalizationProofAtEpoch(bestNodeInfo.finalizedEpoch),
95+
);
9696

9797
const reports = await Promise.all(
9898
input.nodes.map(async (node) => {
@@ -153,8 +153,8 @@ export class NetworkHealthCheckService {
153153
try {
154154
const url = NetworkUtils.resolveRestUrl(node.hostname, node.restProtocol);
155155
const repositoryFactory = NetworkUtils.createRepositoryFactory(url, timeout);
156-
const chainInfo = await repositoryFactory.createChainRepository().getChainInfo().toPromise();
157-
const nodeInfo = await repositoryFactory.createNodeRepository().getNodeInfo().toPromise();
156+
const chainInfo = await firstValueFrom(repositoryFactory.createChainRepository().getChainInfo());
157+
const nodeInfo = await firstValueFrom(repositoryFactory.createNodeRepository().getNodeInfo());
158158
return {
159159
height: chainInfo.height.compact(),
160160
finalizedHeight: chainInfo.latestFinalizedBlock.height.compact(),
@@ -202,7 +202,7 @@ export class NetworkHealthCheckService {
202202
const testUrl = `${url}/node/health`;
203203
report.success(`Testing ${testUrl}`);
204204
try {
205-
const healthStatus = await nodeRepository.getNodeHealth().toPromise();
205+
const healthStatus = await firstValueFrom(nodeRepository.getNodeHealth());
206206
if (healthStatus.apiNode === NodeStatusEnum.Down) {
207207
report.error(`Rest ${testUrl} is NOT up and running: Api Node is still Down!`);
208208
} else if (healthStatus.db === NodeStatusEnum.Down) {
@@ -215,7 +215,7 @@ export class NetworkHealthCheckService {
215215
}
216216

217217
try {
218-
const chainInfo = await repositoryFactory.createChainRepository().getChainInfo().toPromise();
218+
const chainInfo = await firstValueFrom(repositoryFactory.createChainRepository().getChainInfo());
219219
const nodeHeight = chainInfo.height.compact();
220220
const nodeFinalizedHeight = chainInfo.latestFinalizedBlock.height.compact();
221221
const nodeFinalizationEpoch = chainInfo.latestFinalizedBlock.finalizationEpoch;
@@ -244,7 +244,7 @@ export class NetworkHealthCheckService {
244244
}
245245

246246
try {
247-
const nodeInfo = await repositoryFactory.createNodeRepository().getNodeInfo().toPromise();
247+
const nodeInfo = await firstValueFrom(repositoryFactory.createNodeRepository().getNodeInfo());
248248
if (nodeInfo.version < maxNodeData.serverVersion) {
249249
report.error(`Node ${node.hostname} version is ${nodeInfo.version} when current is ${maxNodeData.serverVersion}`);
250250
} else {
@@ -287,7 +287,7 @@ export class NetworkHealthCheckService {
287287
}
288288
};
289289
try {
290-
const accountInfo = await accountRepository.getAccountInfo(address).toPromise();
290+
const accountInfo = await firstValueFrom(accountRepository.getAccountInfo(address));
291291
if (metadata.harvesting) {
292292
verify(KeyName.VRF, node.addresses?.vrf?.publicKey, accountInfo.supplementalPublicKeys.vrf?.publicKey);
293293
verify(KeyName.Remote, node.addresses?.remote?.publicKey, accountInfo.supplementalPublicKeys.linked?.publicKey);

src/utils/InitService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ export class InitService {
495495
const list: CurrencyDistribution[] = [];
496496
this.logger.info('');
497497
this.logger.info(
498-
`In additions to the node, faucet and founder accounts, you can include (opt-in) more accounts into the nemesis block by distributing ${mosaicName} coins.`,
498+
`In addition to the node, faucet and founder accounts, you can include (opt-in) more accounts into the nemesis block by distributing ${mosaicName} coins.`,
499499
);
500500
while (await this.confirm(`Do you want to distribute coin ${mosaicName} to different accounts on the nemesis block?`, false)) {
501501
const address = await this.promptAddress(networkType, 'distribution address');

test/commands/init.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ describe('Init', () => {
6969
`${TestUtils.toKey('F')}\n`, //sink
7070
`${TestUtils.toKey('AA')}\n`, //sink
7171
//First node
72+
StdUtils.keys.down,
7273
`\n`,
7374
'2',
7475
`\n`,
@@ -82,6 +83,9 @@ describe('Init', () => {
8283
StdUtils.keys.down,
8384
StdUtils.keys.down,
8485
StdUtils.keys.down,
86+
StdUtils.keys.down,
87+
StdUtils.keys.down,
88+
StdUtils.keys.down,
8589
`\n`,
8690
'1',
8791
`\n`,

0 commit comments

Comments
 (0)