Skip to content

Commit

Permalink
fix: lib upgrade (#3)
Browse files Browse the repository at this point in the history
fix: reordered node types
  • Loading branch information
fboucquez authored Feb 2, 2022
1 parent 051f735 commit a0c3b59
Show file tree
Hide file tree
Showing 10 changed files with 1,024 additions and 1,040 deletions.
2 changes: 1 addition & 1 deletion docs/autocomplete.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ EXAMPLES
$ symbol-network autocomplete --refresh-cache
```

_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v0.3.0/src/commands/autocomplete/index.ts)_
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.2.0/src/commands/autocomplete/index.ts)_
2 changes: 1 addition & 1 deletion docs/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ OPTIONS
--all see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.3.1/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.18/src/commands/help.ts)_
1,906 changes: 943 additions & 963 deletions package-lock.json

Large diffs are not rendered by default.

41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,51 @@
},
"types": "lib/index.d.ts",
"dependencies": {
"@oclif/command": "^1.8.12",
"@oclif/config": "^1.18.2",
"@oclif/plugin-autocomplete": "^0.3.0",
"@oclif/plugin-help": "^3.2.17",
"cross-fetch": "^3.1.4",
"@oclif/command": "^1.8.16",
"@oclif/config": "^1.18.3",
"@oclif/plugin-autocomplete": "^1.2.0",
"@oclif/plugin-help": "^5.1.11",
"cross-fetch": "^3.1.5",
"figlet": "^1.5.2",
"inquirer": "^8.2.0",
"lodash": "^4.17.21",
"remove": "^0.1.5",
"symbol-bootstrap": "^1.1.4-alpha-e63d2e2",
"symbol-sdk": "^1.0.3",
"rxjs": "^7.5.2",
"symbol-bootstrap": "^1.1.4-alpha-7dcd80b",
"symbol-sdk": "^1.0.4-alpha-202112211435",
"tslib": "^2.3.1",
"winston": "^3.4.0"
"winston": "^3.5.1"
},
"devDependencies": {
"@oclif/dev-cli": "^1.26.9",
"@oclif/test": "^1.2.8",
"@oclif/dev-cli": "^1.26.10",
"@oclif/test": "^2.0.3",
"@types/chai": "^4.3.0",
"@types/figlet": "^1.5.4",
"@types/inquirer": "^8.1.3",
"@types/inquirer": "^8.2.0",
"@types/lodash": "^4.14.178",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.9",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.14",
"@types/semver": "^7.3.9",
"@types/winston": "^2.4.4",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"chai": "^4.3.4",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"chai": "^4.3.6",
"coveralls": "^3.1.1",
"create-ts-index": "^1.14.0",
"dir-compare": "^4.0.0",
"eslint": "^8.7.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"mocha": "^9.1.4",
"mocha": "^9.2.0",
"mocha-lcov-reporter": "^1.3.0",
"mock-stdin": "^1.0.0",
"nyc": "^15.1.0",
"prettier": "^2.5.1",
"prettier-plugin-organize-imports": "^2.3.4",
"shx": "^0.3.4",
"sinon": "^12.0.1",
"sinon": "^13.0.1",
"ts-node": "^10.4.0",
"typedoc": "^0.22.11",
"typescript": "^4.5.4"
"typescript": "^4.5.5"
}
}
2 changes: 1 addition & 1 deletion src/commands/generateNemesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ After running this command, your new network nemesis seed would be created. It a
logger.info('');
logger.info(`Once you are happy, run:`);
logger.info('');
logger.info(`$ ${NetworkCommandUtils.CLI_TOOL} configureNodes --offline`);
logger.info(`$ ${NetworkCommandUtils.CLI_TOOL} configureNodes --offline --zip`);
logger.info('');
logger.info(`To generate the nodes' configuration ready to be deployed.`);

Expand Down
3 changes: 1 addition & 2 deletions src/commands/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
AppVersionService,
AppVersionVerifyAction,
Constants,
Logger,
LoggerFactory,
LogType,
RuntimeService,
Expand All @@ -38,7 +37,7 @@ export default class Verify extends Command {

public async run(): Promise<void> {
NetworkCommandUtils.showBanner();
const logger: Logger = LoggerFactory.getLogger(LogType.Console);
const logger = LoggerFactory.getLogger(LogType.Console);
const service = new VerifyService(logger);
const runtimeService = new RuntimeService(logger);
const appVersionService = new AppVersionService(logger, runtimeService);
Expand Down
82 changes: 41 additions & 41 deletions src/model/NodeInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
import { Assembly, CustomPreset, NodeAccount as NodeAddresses } from 'symbol-bootstrap';

export enum NodeMetadataType {
VotingDual = 'VotingDual',
VotingPeer = 'VotingPeer',
VotingApi = 'VotingApi',
VotingDual = 'VotingDual',
HarvestingPeer = 'HarvestingPeer',
HarvestingDual = 'HarvestingDual',
HarvestingDemo = 'HarvestingDemo',
VotingNonHarvestingPeer = 'VotingNonHarvestingPeer',
HarvestingPeer = 'HarvestingPeer',
Services = 'Services',
Peer = 'Peer',
Api = 'Api',
HarvestingDemo = 'HarvestingDemo',
VotingNonHarvestingPeer = 'VotingNonHarvestingPeer',
}

export enum RestProtocol {
Expand Down Expand Up @@ -59,44 +59,33 @@ export interface NodeTypeMetadata {
}

export const nodesMetadata: Record<NodeMetadataType, NodeTypeMetadata> = {
VotingPeer: {
name: 'Voting Peer',
VotingDual: {
name: 'Voting Dual',
balances: [3_000_000, 150],
voting: true,
harvesting: true,
demo: false,
api: false,
api: true,
peer: true,
nickName: 'beacon',
nickName: 'dual',
suggestedCount: 3,
},
VotingApi: {
name: 'Voting Api',
VotingPeer: {
name: 'Voting Peer',
balances: [3_000_000, 150],
voting: true,
harvesting: false,
harvesting: true,
demo: false,
api: false,
peer: true,
nickName: 'beacon',
suggestedCount: 3,
},
VotingDual: {
name: 'Voting Dual',
VotingApi: {
name: 'Voting Api',
balances: [3_000_000, 150],
voting: true,
harvesting: true,
demo: false,
api: true,
peer: true,
nickName: 'dual',
suggestedCount: 3,
},
HarvestingPeer: {
name: 'Harvesting Peer',
balances: [1_000_000, 150],
voting: false,
harvesting: true,
harvesting: false,
demo: false,
api: false,
peer: true,
Expand All @@ -114,28 +103,15 @@ export const nodesMetadata: Record<NodeMetadataType, NodeTypeMetadata> = {
nickName: 'dual',
suggestedCount: 3,
},

HarvestingDemo: {
name: 'Harvesting Demo',
HarvestingPeer: {
name: 'Harvesting Peer',
balances: [1_000_000, 150],
voting: false,
harvesting: true,
demo: true,
api: true,
peer: true,
assembly: 'demo',
nickName: 'demo',
suggestedCount: 1,
},
Peer: {
name: 'Peer',
balances: [1_000, 0],
voting: false,
harvesting: false,
demo: false,
api: false,
peer: true,
nickName: 'peer',
nickName: 'beacon',
suggestedCount: 3,
},
Services: {
Expand All @@ -151,6 +127,17 @@ export const nodesMetadata: Record<NodeMetadataType, NodeTypeMetadata> = {
assembly: Assembly.services,
suggestedCount: 1,
},
Peer: {
name: 'Peer',
balances: [1_000, 0],
voting: false,
harvesting: false,
demo: false,
api: false,
peer: true,
nickName: 'peer',
suggestedCount: 3,
},
Api: {
name: 'Api',
balances: [1_000, 0],
Expand All @@ -162,6 +149,19 @@ export const nodesMetadata: Record<NodeMetadataType, NodeTypeMetadata> = {
nickName: 'api',
suggestedCount: 3,
},

HarvestingDemo: {
name: 'Harvesting Demo',
balances: [1_000_000, 150],
voting: false,
harvesting: true,
demo: true,
api: true,
peer: true,
assembly: 'demo',
nickName: 'demo',
suggestedCount: 1,
},
VotingNonHarvestingPeer: {
name: 'Non Harvesting Voting Peer',
balances: [51_000_000, 0],
Expand Down
20 changes: 10 additions & 10 deletions src/services/NetworkHealthCheckService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
import * as _ from 'lodash';
import { Socket } from 'net';
import { firstValueFrom } from 'rxjs';
import { KeyName, Logger } from 'symbol-bootstrap';
import { NodeStatusEnum } from 'symbol-openapi-typescript-fetch-client';
import { AccountLinkVotingKey, Address, FinalizationProof } from 'symbol-sdk';
Expand Down Expand Up @@ -89,10 +90,9 @@ export class NetworkHealthCheckService {
throw new Error('There are not running nodes. Have you deployed?');
}
const bestNodeRepositoryFactory = NetworkUtils.createRepositoryFactory(bestNodeInfo.bestRestUrl, timeout);
const finalizationData = await bestNodeRepositoryFactory
.createFinalizationRepository()
.getFinalizationProofAtEpoch(bestNodeInfo.finalizedEpoch)
.toPromise();
const finalizationData = await firstValueFrom(
bestNodeRepositoryFactory.createFinalizationRepository().getFinalizationProofAtEpoch(bestNodeInfo.finalizedEpoch),
);

const reports = await Promise.all(
input.nodes.map(async (node) => {
Expand Down Expand Up @@ -153,8 +153,8 @@ export class NetworkHealthCheckService {
try {
const url = NetworkUtils.resolveRestUrl(node.hostname, node.restProtocol);
const repositoryFactory = NetworkUtils.createRepositoryFactory(url, timeout);
const chainInfo = await repositoryFactory.createChainRepository().getChainInfo().toPromise();
const nodeInfo = await repositoryFactory.createNodeRepository().getNodeInfo().toPromise();
const chainInfo = await firstValueFrom(repositoryFactory.createChainRepository().getChainInfo());
const nodeInfo = await firstValueFrom(repositoryFactory.createNodeRepository().getNodeInfo());
return {
height: chainInfo.height.compact(),
finalizedHeight: chainInfo.latestFinalizedBlock.height.compact(),
Expand Down Expand Up @@ -202,7 +202,7 @@ export class NetworkHealthCheckService {
const testUrl = `${url}/node/health`;
report.success(`Testing ${testUrl}`);
try {
const healthStatus = await nodeRepository.getNodeHealth().toPromise();
const healthStatus = await firstValueFrom(nodeRepository.getNodeHealth());
if (healthStatus.apiNode === NodeStatusEnum.Down) {
report.error(`Rest ${testUrl} is NOT up and running: Api Node is still Down!`);
} else if (healthStatus.db === NodeStatusEnum.Down) {
Expand All @@ -215,7 +215,7 @@ export class NetworkHealthCheckService {
}

try {
const chainInfo = await repositoryFactory.createChainRepository().getChainInfo().toPromise();
const chainInfo = await firstValueFrom(repositoryFactory.createChainRepository().getChainInfo());
const nodeHeight = chainInfo.height.compact();
const nodeFinalizedHeight = chainInfo.latestFinalizedBlock.height.compact();
const nodeFinalizationEpoch = chainInfo.latestFinalizedBlock.finalizationEpoch;
Expand Down Expand Up @@ -244,7 +244,7 @@ export class NetworkHealthCheckService {
}

try {
const nodeInfo = await repositoryFactory.createNodeRepository().getNodeInfo().toPromise();
const nodeInfo = await firstValueFrom(repositoryFactory.createNodeRepository().getNodeInfo());
if (nodeInfo.version < maxNodeData.serverVersion) {
report.error(`Node ${node.hostname} version is ${nodeInfo.version} when current is ${maxNodeData.serverVersion}`);
} else {
Expand Down Expand Up @@ -287,7 +287,7 @@ export class NetworkHealthCheckService {
}
};
try {
const accountInfo = await accountRepository.getAccountInfo(address).toPromise();
const accountInfo = await firstValueFrom(accountRepository.getAccountInfo(address));
if (metadata.harvesting) {
verify(KeyName.VRF, node.addresses?.vrf?.publicKey, accountInfo.supplementalPublicKeys.vrf?.publicKey);
verify(KeyName.Remote, node.addresses?.remote?.publicKey, accountInfo.supplementalPublicKeys.linked?.publicKey);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/InitService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ export class InitService {
const list: CurrencyDistribution[] = [];
this.logger.info('');
this.logger.info(
`In additions to the node, faucet and founder accounts, you can include (opt-in) more accounts into the nemesis block by distributing ${mosaicName} coins.`,
`In addition to the node, faucet and founder accounts, you can include (opt-in) more accounts into the nemesis block by distributing ${mosaicName} coins.`,
);
while (await this.confirm(`Do you want to distribute coin ${mosaicName} to different accounts on the nemesis block?`, false)) {
const address = await this.promptAddress(networkType, 'distribution address');
Expand Down
4 changes: 4 additions & 0 deletions test/commands/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ describe('Init', () => {
`${TestUtils.toKey('F')}\n`, //sink
`${TestUtils.toKey('AA')}\n`, //sink
//First node
StdUtils.keys.down,
`\n`,
'2',
`\n`,
Expand All @@ -82,6 +83,9 @@ describe('Init', () => {
StdUtils.keys.down,
StdUtils.keys.down,
StdUtils.keys.down,
StdUtils.keys.down,
StdUtils.keys.down,
StdUtils.keys.down,
`\n`,
'1',
`\n`,
Expand Down

0 comments on commit a0c3b59

Please sign in to comment.