@constellation-network/node-pilot 0.23.0-intnet → 0.24.0-devnet
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/dist/checks/check-hardware.js +2 -1
- package/dist/checks/check-pilot.js +3 -0
- package/dist/checks/check-project.js +1 -0
- package/dist/commands/mgkeys.d.ts +16 -0
- package/dist/commands/mgkeys.js +64 -0
- package/dist/commands/status.js +1 -1
- package/dist/helpers/env-templates.d.ts +1 -2
- package/dist/helpers/env-templates.js +0 -7
- package/dist/helpers/key-file-helper.d.ts +8 -0
- package/dist/helpers/key-file-helper.js +11 -0
- package/dist/services/cluster-service.d.ts +5 -5
- package/dist/services/cluster-service.js +15 -4
- package/dist/services/delegated-staking-service.d.ts +2 -19
- package/dist/services/fastforward-service.js +12 -11
- package/dist/services/migration-service.d.ts +1 -1
- package/dist/services/migration-service.js +24 -3
- package/dist/types.d.ts +27 -0
- package/oclif.manifest.json +58 -1
- package/package.json +6 -3
- package/projects/hypergraph/Dockerfile +1 -1
- package/projects/custom/pilot.json +0 -9
- package/projects/hypergraph/test +0 -0
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @constellation-network/node-pilot
|
|
|
21
21
|
$ cpilot COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ cpilot (--version|-v)
|
|
24
|
-
@constellation-network/node-pilot/0.
|
|
24
|
+
@constellation-network/node-pilot/0.24.0-devnet darwin-arm64 node-v22.15.0
|
|
25
25
|
$ cpilot --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ cpilot COMMAND
|
|
@@ -72,7 +72,7 @@ EXAMPLES
|
|
|
72
72
|
$ cpilot clean
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
75
|
+
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/clean.ts)_
|
|
76
76
|
|
|
77
77
|
## `cpilot config`
|
|
78
78
|
|
|
@@ -89,7 +89,7 @@ EXAMPLES
|
|
|
89
89
|
$ cpilot config
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
92
|
+
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/config.ts)_
|
|
93
93
|
|
|
94
94
|
## `cpilot config get [NAME]`
|
|
95
95
|
|
|
@@ -113,7 +113,7 @@ EXAMPLES
|
|
|
113
113
|
$ cpilot config get gl0:CL_PUBLIC_HTTP_PORT
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
116
|
+
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/config/get.ts)_
|
|
117
117
|
|
|
118
118
|
## `cpilot config set NAME VALUE`
|
|
119
119
|
|
|
@@ -136,7 +136,7 @@ EXAMPLES
|
|
|
136
136
|
$ cpilot config set gl0:CL_PUBLIC_HTTP_PORT 9000
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
139
|
+
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/config/set.ts)_
|
|
140
140
|
|
|
141
141
|
## `cpilot help [COMMAND]`
|
|
142
142
|
|
|
@@ -173,7 +173,7 @@ EXAMPLES
|
|
|
173
173
|
$ cpilot info
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
176
|
+
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/info.ts)_
|
|
177
177
|
|
|
178
178
|
## `cpilot logs LAYER`
|
|
179
179
|
|
|
@@ -199,7 +199,7 @@ EXAMPLES
|
|
|
199
199
|
$ cpilot logs
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
202
|
+
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/logs.ts)_
|
|
203
203
|
|
|
204
204
|
## `cpilot restart [LAYER]`
|
|
205
205
|
|
|
@@ -223,7 +223,7 @@ EXAMPLES
|
|
|
223
223
|
$ cpilot restart
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
226
|
+
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/restart.ts)_
|
|
227
227
|
|
|
228
228
|
## `cpilot shutdown`
|
|
229
229
|
|
|
@@ -240,7 +240,7 @@ EXAMPLES
|
|
|
240
240
|
$ cpilot shutdown
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
243
|
+
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/shutdown.ts)_
|
|
244
244
|
|
|
245
245
|
## `cpilot status`
|
|
246
246
|
|
|
@@ -254,7 +254,7 @@ DESCRIPTION
|
|
|
254
254
|
Display node status and configuration settings
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
257
|
+
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/status.ts)_
|
|
258
258
|
|
|
259
259
|
## `cpilot uninstall`
|
|
260
260
|
|
|
@@ -271,5 +271,5 @@ EXAMPLES
|
|
|
271
271
|
$ cpilot uninstall
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
-
_See code: [src/commands/uninstall.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
274
|
+
_See code: [src/commands/uninstall.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/uninstall.ts)_
|
|
275
275
|
<!-- commandsstop -->
|
|
@@ -48,7 +48,8 @@ export const checkHardware = {
|
|
|
48
48
|
await promptHelper.doYouWishToContinue('n');
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
clm.
|
|
51
|
+
clm.warn("System recommendations not met. The validator node may not function properly.\n");
|
|
52
|
+
await promptHelper.doYouWishToContinue('n');
|
|
52
53
|
}
|
|
53
54
|
pilotManager.setSystemInfo({ cores: numOfCores, disk: totalSpaceGB, memory: totalMemoryGB, platform: os.platform(), user: os.userInfo().username });
|
|
54
55
|
}
|
|
@@ -105,6 +105,9 @@ export const checkNodePilot = {
|
|
|
105
105
|
else if (pilotVersion.includes('intnet')) {
|
|
106
106
|
distTag = 'intnet';
|
|
107
107
|
}
|
|
108
|
+
else if (pilotVersion.includes('devnet')) {
|
|
109
|
+
distTag = 'devnet';
|
|
110
|
+
}
|
|
108
111
|
const latestVer = semver.parse(result['dist-tags'][distTag]);
|
|
109
112
|
const currentVer = semver.parse(pilotVersion);
|
|
110
113
|
if (latestVer !== null && currentVer !== null) {
|
|
@@ -79,6 +79,7 @@ export const checkProject = {
|
|
|
79
79
|
configStore.setProjectFlag('javaMemoryChecked', true);
|
|
80
80
|
},
|
|
81
81
|
async hasVersionChanged() {
|
|
82
|
+
clm.debug('Checking for network version change...');
|
|
82
83
|
const clusterVersion = await clusterService.getReleaseVersion();
|
|
83
84
|
const rInfo = await configHelper.getReleaseInfo();
|
|
84
85
|
return !rInfo || (rInfo.version !== clusterVersion);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Mgkeys extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
prefix: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
alias: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
complexity: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
password: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
static hidden: boolean;
|
|
14
|
+
private NAMES;
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* eslint-disable perfectionist/sort-objects */
|
|
2
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
3
|
+
import { keyFileHelper } from "../helpers/key-file-helper.js";
|
|
4
|
+
export default class Mgkeys extends Command {
|
|
5
|
+
static args = {
|
|
6
|
+
prefix: Args.string({ description: 'A short name to be used for the key file prefix', required: true }),
|
|
7
|
+
};
|
|
8
|
+
static description = 'generate new keys for a metagraph';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> <%= command.id %>',
|
|
11
|
+
];
|
|
12
|
+
static flags = {
|
|
13
|
+
alias: Flags.string({ char: 'a', default: 'alias', description: 'alias to use for each key' }),
|
|
14
|
+
complexity: Flags.integer({ char: 'l', description: 'generate new password with specified length', max: 128, min: 4 }),
|
|
15
|
+
password: Flags.string({ char: 'p', default: 'password', description: 'if no complexity is specified, apply this value for each key' }),
|
|
16
|
+
};
|
|
17
|
+
static hidden = true;
|
|
18
|
+
NAMES = ['node-1', 'node-2', 'node-3', 'owner', 'staking'];
|
|
19
|
+
async run() {
|
|
20
|
+
const { args, flags } = await this.parse(Mgkeys);
|
|
21
|
+
const { alias, complexity, password } = flags;
|
|
22
|
+
const passwords = Array.from({ length: 5 }, () => complexity
|
|
23
|
+
? Array.from({ length: complexity }).fill(0).map(() => Math.random().toString(36).charAt(2)).join('')
|
|
24
|
+
: password);
|
|
25
|
+
const keyInfos = [];
|
|
26
|
+
const printKeyInfo = [];
|
|
27
|
+
const currentDir = process.cwd();
|
|
28
|
+
for (let i = 0; i < this.NAMES.length; i++) {
|
|
29
|
+
const name = this.NAMES[i];
|
|
30
|
+
const password = passwords[i];
|
|
31
|
+
const file = `${currentDir}/${args.prefix}-${name}.p12`;
|
|
32
|
+
// console.log(`Generating key: ${file} with alias: ${alias} and password: ${password}`);
|
|
33
|
+
// eslint-disable-next-line no-await-in-loop
|
|
34
|
+
keyInfos[i] = await keyFileHelper.getKeyInfoFromParams({ CL_KEYALIAS: alias, CL_KEYSTORE: file, CL_PASSWORD: password });
|
|
35
|
+
// await this.spawnCommand('cpilot', ['keygen', '--alias', `${alias}-${name}`, '--password', password, '--output', keyName]);
|
|
36
|
+
printKeyInfo[i] = {
|
|
37
|
+
"name": `${args.prefix}-${name}`,
|
|
38
|
+
"key_file": {
|
|
39
|
+
"name": `${args.prefix}-${name}.p12`,
|
|
40
|
+
alias,
|
|
41
|
+
password
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
console.log('generated:', file);
|
|
45
|
+
}
|
|
46
|
+
const fees = {
|
|
47
|
+
"snapshot_fees": {
|
|
48
|
+
"owner": {
|
|
49
|
+
"key_file": printKeyInfo[3].key_file
|
|
50
|
+
},
|
|
51
|
+
"staking": {
|
|
52
|
+
"key_file": printKeyInfo[4].key_file,
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
// Show euclid.json "nodes" JSON array
|
|
57
|
+
console.log(JSON.stringify({ "nodes": printKeyInfo.slice(0, 3) }, null, 2));
|
|
58
|
+
// Show euclid.json snapshot_fees and staking object
|
|
59
|
+
console.log(JSON.stringify(fees, null, 2));
|
|
60
|
+
// Show each name and Node ID
|
|
61
|
+
for (const [i, kInfo] of keyInfos.entries())
|
|
62
|
+
console.log(`\n${args.prefix}-${this.NAMES[i]}\n${kInfo.address}\n${kInfo.id}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
package/dist/commands/status.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function checkInstallationAndConfigurationStatus() {
|
|
|
21
21
|
await checkNodePilot.checkMultipleUsers();
|
|
22
22
|
await checkProject.projectInstallation();
|
|
23
23
|
await checkNodePilot.checkVersion();
|
|
24
|
-
migrationService.runMigrations();
|
|
24
|
+
await migrationService.runMigrations();
|
|
25
25
|
await checkProject.checkJavaMemory();
|
|
26
26
|
await checkNetwork.checkExternalIpAddress();
|
|
27
27
|
if (!await checkNetwork.isNetworkConnectable()) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { EnvCombinedInfo
|
|
1
|
+
import { EnvCombinedInfo } from "../config-store.js";
|
|
2
2
|
import { TessellationLayer } from "../types.js";
|
|
3
3
|
export declare function getLayerEnvFileContent(layer: TessellationLayer, env: EnvCombinedInfo): string;
|
|
4
|
-
export declare function getKeyFileContent(env: EnvInfo): string;
|
|
5
4
|
export declare function getObjectToEnvContent(obj: object): string;
|
|
@@ -29,13 +29,6 @@ CL_P2P_HTTP_PORT=${env.CL_P2P_HTTP_PORT}
|
|
|
29
29
|
CL_CLI_HTTP_PORT=${env.CL_CLI_HTTP_PORT}
|
|
30
30
|
`;
|
|
31
31
|
}
|
|
32
|
-
export function getKeyFileContent(env) {
|
|
33
|
-
return `
|
|
34
|
-
export CL_KEYSTORE='${env.CL_KEYSTORE}'
|
|
35
|
-
export CL_KEYALIAS='${env.CL_KEYALIAS}'
|
|
36
|
-
export CL_PASSWORD='${env.CL_PASSWORD}'
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
39
32
|
export function getObjectToEnvContent(obj) {
|
|
40
33
|
return Object.entries(obj).map(([k, v]) => `${k}='${v}'`).join('\n') + '\n';
|
|
41
34
|
}
|
|
@@ -3,6 +3,14 @@ export declare const keyFileHelper: {
|
|
|
3
3
|
generate(): Promise<void>;
|
|
4
4
|
getAddress(): Promise<string>;
|
|
5
5
|
getId(): Promise<string>;
|
|
6
|
+
getKeyInfoFromParams(params: {
|
|
7
|
+
CL_KEYALIAS: string;
|
|
8
|
+
CL_KEYSTORE: string;
|
|
9
|
+
CL_PASSWORD: string;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
address: string;
|
|
12
|
+
id: string;
|
|
13
|
+
}>;
|
|
6
14
|
importKeyFile(): Promise<void>;
|
|
7
15
|
promptForKeyFile(): Promise<void>;
|
|
8
16
|
promptIfNoKeyFile(): Promise<void>;
|
|
@@ -59,6 +59,17 @@ export const keyFileHelper = {
|
|
|
59
59
|
const env = configStore.getEnvInfo();
|
|
60
60
|
return shellService.runCommandWithOutput(`java -jar ${projectDir}/dist/wallet.jar show-id`, env);
|
|
61
61
|
},
|
|
62
|
+
async getKeyInfoFromParams(params) {
|
|
63
|
+
if (fs.existsSync(params.CL_KEYSTORE)) {
|
|
64
|
+
throw new Error(`A key file already exists. Please delete it first. ${params.CL_KEYSTORE}`);
|
|
65
|
+
}
|
|
66
|
+
const { projectDir } = configStore.getProjectInfo();
|
|
67
|
+
await shellService.runCommand(`java -jar ${projectDir}/dist/keytool.jar generate`, params);
|
|
68
|
+
const id = await shellService.runCommandWithOutput(`java -jar ${projectDir}/dist/wallet.jar show-id`, params);
|
|
69
|
+
const address = await shellService.runCommandWithOutput(`java -jar ${projectDir}/dist/wallet.jar show-address`, params);
|
|
70
|
+
;
|
|
71
|
+
return { address, id };
|
|
72
|
+
},
|
|
62
73
|
async importKeyFile() {
|
|
63
74
|
const p12Files = fs.readdirSync(os.homedir())
|
|
64
75
|
.filter(file => file.endsWith('.p12'))
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ClusterConsensusInfo, ClusterInfo, NodeInfo, TessellationLayer } from "../types.js";
|
|
1
|
+
import { ClusterConsensusInfo, ClusterInfo, NodeInfo, NodeParamsDto, TessellationLayer } from "../types.js";
|
|
2
2
|
export declare const clusterService: {
|
|
3
3
|
fastForwardSnapshot(): Promise<void>;
|
|
4
4
|
getClusterInfo(layer?: TessellationLayer): Promise<ClusterInfo[]>;
|
|
5
5
|
getClusterNodeInfo(layer?: TessellationLayer): Promise<NodeInfo>;
|
|
6
6
|
getLatestConsensusInfo(layer?: TessellationLayer): Promise<ClusterConsensusInfo>;
|
|
7
7
|
getLayer0(): "gl0" | "ml0";
|
|
8
|
-
getNodeParams(id: string): Promise<
|
|
9
|
-
getReleaseVersion(): Promise<
|
|
8
|
+
getNodeParams(id: string): Promise<NodeParamsDto>;
|
|
9
|
+
getReleaseVersion(): Promise<string>;
|
|
10
10
|
getSourceNodeInfo(layer: TessellationLayer): Promise<NodeInfo>;
|
|
11
11
|
getSourceNodeLatestOrdinal(layer: TessellationLayer): Promise<number>;
|
|
12
12
|
getSourceNodeOrdinalHash(layer: TessellationLayer, ordinal: number): Promise<string>;
|
|
13
|
-
makeClusterRequestGet(path: string, layer?: TessellationLayer, params?: string): Promise<
|
|
13
|
+
makeClusterRequestGet<T>(path: string, layer?: TessellationLayer, params?: string): Promise<T>;
|
|
14
14
|
makeClusterRequestPost(path: string, body: string, layer?: TessellationLayer): Promise<any>;
|
|
15
|
-
makeRandomSourceNodeRequest(path: string, layer?: TessellationLayer): Promise<
|
|
15
|
+
makeRandomSourceNodeRequest<T>(path: string, layer?: TessellationLayer): Promise<T>;
|
|
16
16
|
makeSourceNodeRequest(path: string, layer: TessellationLayer): Promise<any>;
|
|
17
17
|
postNodeParams(body: string, layer?: TessellationLayer): Promise<string>;
|
|
18
18
|
};
|
|
@@ -60,7 +60,12 @@ export const clusterService = {
|
|
|
60
60
|
return this.makeClusterRequestGet(`node-params/${id}`, 'gl0');
|
|
61
61
|
},
|
|
62
62
|
async getReleaseVersion() {
|
|
63
|
-
|
|
63
|
+
clm.debug('Getting release version...');
|
|
64
|
+
return this.makeRandomSourceNodeRequest('node/info').then(i => i.version)
|
|
65
|
+
.catch(() => {
|
|
66
|
+
clm.debug(`Failed to get random source node. Attempting cluster node...`);
|
|
67
|
+
return this.makeClusterRequestGet('node/info').then(i => i.version);
|
|
68
|
+
});
|
|
64
69
|
},
|
|
65
70
|
async getSourceNodeInfo(layer) {
|
|
66
71
|
return this.makeRandomSourceNodeRequest('node/info', layer);
|
|
@@ -76,7 +81,9 @@ export const clusterService = {
|
|
|
76
81
|
const { type } = configStore.getNetworkInfo();
|
|
77
82
|
const envLayerInfo = configStore.getEnvLayerInfo(type, layer);
|
|
78
83
|
if (envLayerInfo.CL_LB) {
|
|
79
|
-
|
|
84
|
+
const url = `${envLayerInfo.CL_LB}/${path}${params}`;
|
|
85
|
+
clm.debug(`makeClusterRequestGet ${url}`);
|
|
86
|
+
return fetch(url)
|
|
80
87
|
.then(res => {
|
|
81
88
|
if (res.ok) {
|
|
82
89
|
return res.json();
|
|
@@ -88,8 +95,12 @@ export const clusterService = {
|
|
|
88
95
|
throw new Error('Error');
|
|
89
96
|
})
|
|
90
97
|
.catch(() => {
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
if (!params) {
|
|
99
|
+
return this.makeClusterRequestGet(path, layer, '?sticky=false');
|
|
100
|
+
}
|
|
101
|
+
// clm.debug(`Failed to get cluster GET from ${envLayerInfo.CL_LB}/${path}. Attempting source node...`);
|
|
102
|
+
// return this.makeRandomSourceNodeRequest(path, layer);
|
|
103
|
+
throw new Error(`Unable to connect to cluster at ${envLayerInfo.CL_LB}/${path}`);
|
|
93
104
|
});
|
|
94
105
|
}
|
|
95
106
|
return this.makeSourceNodeRequest(path, layer);
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
+
import { NodeParams } from "../types.js";
|
|
1
2
|
export declare const delegatedStakingService: {
|
|
2
3
|
configureNodeParams(): Promise<void>;
|
|
3
4
|
generateNodeParamPayload(rewardFraction: number, name: string, description: string, lastRef: {
|
|
4
5
|
hash: string;
|
|
5
6
|
ordinal: number;
|
|
6
7
|
}): Promise<string>;
|
|
7
|
-
getNodeParams(): Promise<
|
|
8
|
-
description: string;
|
|
9
|
-
lastRef: {
|
|
10
|
-
hash: string;
|
|
11
|
-
ordinal: number;
|
|
12
|
-
};
|
|
13
|
-
name: string;
|
|
14
|
-
rewardFraction: number;
|
|
15
|
-
reward?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
description: string;
|
|
18
|
-
lastRef: {
|
|
19
|
-
hash: string;
|
|
20
|
-
ordinal: number;
|
|
21
|
-
};
|
|
22
|
-
name: string;
|
|
23
|
-
reward: number;
|
|
24
|
-
rewardFraction?: undefined;
|
|
25
|
-
}>;
|
|
8
|
+
getNodeParams(): Promise<NodeParams>;
|
|
26
9
|
};
|
|
@@ -54,19 +54,20 @@ export class FastforwardService {
|
|
|
54
54
|
clm.postStep(`✅ Fastforward to snapshot ${chalk.bold(ordinal)} completed.`);
|
|
55
55
|
}
|
|
56
56
|
async fetchLatestSnapshot() {
|
|
57
|
+
const processResult = (d) => {
|
|
58
|
+
const { ordinal } = d[0].value;
|
|
59
|
+
clm.debug('fetchLatestSnapshot - ' + chalk.cyan(ordinal));
|
|
60
|
+
return [ordinal, d[0], d[1]];
|
|
61
|
+
};
|
|
57
62
|
const url = `${this.lbUrl}/global-snapshots/latest/combined?source_node=true&sticky=false`;
|
|
58
|
-
clm.debug('Fetching latest snapshot
|
|
63
|
+
clm.debug('Fetching latest snapshot from a source node: ' + chalk.cyan(url));
|
|
59
64
|
return fetch(url)
|
|
60
|
-
.then(res =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.then(data => {
|
|
67
|
-
const { ordinal } = data[0].value;
|
|
68
|
-
clm.debug('fetchLatestSnapshot - ' + chalk.cyan(ordinal));
|
|
69
|
-
return [ordinal, data[0], data[1]];
|
|
65
|
+
.then(res => res.json())
|
|
66
|
+
.then(processResult)
|
|
67
|
+
.catch(() => {
|
|
68
|
+
const url = `${this.lbUrl}/global-snapshots/latest/combined?sticky=false`;
|
|
69
|
+
clm.debug('FALLBACK: Fetching latest snapshot from cluster: ' + chalk.cyan(url));
|
|
70
|
+
return fetch(url).then(res => res.json()).then(processResult);
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
async fetchSnapshot(ordinal) {
|
|
@@ -2,14 +2,16 @@ import semver from "semver";
|
|
|
2
2
|
import { clm } from "../clm.js";
|
|
3
3
|
import { configStore } from "../config-store.js";
|
|
4
4
|
import { projectHelper } from "../helpers/project-helper.js";
|
|
5
|
+
import { shellService } from "./shell-service.js";
|
|
5
6
|
export const migrationService = {
|
|
6
|
-
runMigrations() {
|
|
7
|
+
async runMigrations() {
|
|
7
8
|
const migrations = {
|
|
8
9
|
'0.12.5': m0125,
|
|
9
10
|
'0.13.9': m0139,
|
|
10
11
|
'0.14.0-intnet.1': m0140intnet1,
|
|
11
12
|
'0.18.7-intnet': m01807,
|
|
12
|
-
'0.19.2-intnet': m0192intnet
|
|
13
|
+
'0.19.2-intnet': m0192intnet,
|
|
14
|
+
'0.24.0-0': m0240
|
|
13
15
|
// add more migrations as needed
|
|
14
16
|
};
|
|
15
17
|
const { version = '0.0.0' } = configStore.getProjectInfo();
|
|
@@ -28,12 +30,31 @@ export const migrationService = {
|
|
|
28
30
|
if (migrationVersions.length > 0) {
|
|
29
31
|
clm.preStep(`Migration versions to run: ${migrationVersions}`);
|
|
30
32
|
for (const version of migrationVersions) {
|
|
31
|
-
|
|
33
|
+
// eslint-disable-next-line no-await-in-loop
|
|
34
|
+
await migrations[version]();
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
configStore.setProjectInfo({ version: currentVersion.toString() });
|
|
35
38
|
}
|
|
36
39
|
};
|
|
40
|
+
async function m0240() {
|
|
41
|
+
clm.step('Running migration 0.24.0 — refreshing project files for Java 21 unified runtime...');
|
|
42
|
+
configStore.setProjectFlag('javaMemoryChecked', false);
|
|
43
|
+
projectHelper.upgradeHypergraph();
|
|
44
|
+
await shellService.runProjectCommand('bash scripts/install-dependencies.sh');
|
|
45
|
+
await refreshJavaHome();
|
|
46
|
+
}
|
|
47
|
+
async function refreshJavaHome() {
|
|
48
|
+
if (process.platform !== 'linux')
|
|
49
|
+
return;
|
|
50
|
+
const javaHome = await shellService
|
|
51
|
+
.runCommandWithOutput('dirname "$(dirname "$(readlink -f "$(which java)")")"')
|
|
52
|
+
.catch(() => '');
|
|
53
|
+
if (javaHome) {
|
|
54
|
+
process.env.JAVA_HOME = javaHome;
|
|
55
|
+
clm.debug(`JAVA_HOME refreshed to ${javaHome} for current process`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
37
58
|
function m0192intnet() {
|
|
38
59
|
clm.step('Running migration 0.19.2-intnet...');
|
|
39
60
|
projectHelper.upgradeHypergraph();
|
package/dist/types.d.ts
CHANGED
|
@@ -51,3 +51,30 @@ export type NodeDiagnosticInfo = {
|
|
|
51
51
|
state: string;
|
|
52
52
|
version: string;
|
|
53
53
|
};
|
|
54
|
+
export type NodeParamsDto = {
|
|
55
|
+
"lastRef": {
|
|
56
|
+
"hash": string;
|
|
57
|
+
"ordinal": number;
|
|
58
|
+
};
|
|
59
|
+
"latest": {
|
|
60
|
+
"value": {
|
|
61
|
+
"delegatedStakeRewardParameters": {
|
|
62
|
+
"rewardFraction": number;
|
|
63
|
+
};
|
|
64
|
+
"nodeMetadataParameters": {
|
|
65
|
+
"description": string;
|
|
66
|
+
"name": string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export type NodeParams = {
|
|
72
|
+
description: string;
|
|
73
|
+
lastRef: {
|
|
74
|
+
hash: string;
|
|
75
|
+
ordinal: number;
|
|
76
|
+
};
|
|
77
|
+
name: string;
|
|
78
|
+
reward?: number;
|
|
79
|
+
rewardFraction?: number;
|
|
80
|
+
};
|
package/oclif.manifest.json
CHANGED
|
@@ -155,6 +155,63 @@
|
|
|
155
155
|
"logs.js"
|
|
156
156
|
]
|
|
157
157
|
},
|
|
158
|
+
"mgkeys": {
|
|
159
|
+
"aliases": [],
|
|
160
|
+
"args": {
|
|
161
|
+
"prefix": {
|
|
162
|
+
"description": "A short name to be used for the key file prefix",
|
|
163
|
+
"name": "prefix",
|
|
164
|
+
"required": true
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"description": "generate new keys for a metagraph",
|
|
168
|
+
"examples": [
|
|
169
|
+
"<%= config.bin %> <%= command.id %>"
|
|
170
|
+
],
|
|
171
|
+
"flags": {
|
|
172
|
+
"alias": {
|
|
173
|
+
"char": "a",
|
|
174
|
+
"description": "alias to use for each key",
|
|
175
|
+
"name": "alias",
|
|
176
|
+
"default": "alias",
|
|
177
|
+
"hasDynamicHelp": false,
|
|
178
|
+
"multiple": false,
|
|
179
|
+
"type": "option"
|
|
180
|
+
},
|
|
181
|
+
"complexity": {
|
|
182
|
+
"char": "l",
|
|
183
|
+
"description": "generate new password with specified length",
|
|
184
|
+
"name": "complexity",
|
|
185
|
+
"hasDynamicHelp": false,
|
|
186
|
+
"multiple": false,
|
|
187
|
+
"type": "option"
|
|
188
|
+
},
|
|
189
|
+
"password": {
|
|
190
|
+
"char": "p",
|
|
191
|
+
"description": "if no complexity is specified, apply this value for each key",
|
|
192
|
+
"name": "password",
|
|
193
|
+
"default": "password",
|
|
194
|
+
"hasDynamicHelp": false,
|
|
195
|
+
"multiple": false,
|
|
196
|
+
"type": "option"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"hasDynamicHelp": false,
|
|
200
|
+
"hidden": true,
|
|
201
|
+
"hiddenAliases": [],
|
|
202
|
+
"id": "mgkeys",
|
|
203
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
|
204
|
+
"pluginName": "@constellation-network/node-pilot",
|
|
205
|
+
"pluginType": "core",
|
|
206
|
+
"strict": true,
|
|
207
|
+
"enableJsonFlag": false,
|
|
208
|
+
"isESM": true,
|
|
209
|
+
"relativePath": [
|
|
210
|
+
"dist",
|
|
211
|
+
"commands",
|
|
212
|
+
"mgkeys.js"
|
|
213
|
+
]
|
|
214
|
+
},
|
|
158
215
|
"project": {
|
|
159
216
|
"aliases": [],
|
|
160
217
|
"args": {},
|
|
@@ -392,5 +449,5 @@
|
|
|
392
449
|
]
|
|
393
450
|
}
|
|
394
451
|
},
|
|
395
|
-
"version": "0.
|
|
452
|
+
"version": "0.24.0-devnet"
|
|
396
453
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constellation-network/node-pilot",
|
|
3
3
|
"description": "An easy deployment and monitoring tool for Constellation nodes.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.0-devnet",
|
|
5
5
|
"author": "Frank Fox",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cpilot": "bin/run.js"
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
"version": "oclif readme && git add README.md",
|
|
22
22
|
"start": "./bin/dev.js",
|
|
23
23
|
"debug": "DEBUG=true ./bin/dev.js",
|
|
24
|
-
"pub": "npm publish --access public
|
|
24
|
+
"pub:mainnet": "npm publish --access public",
|
|
25
|
+
"pub:testnet": "npm publish --access public --tag testnet",
|
|
26
|
+
"pub:intnet": "npm publish --access public --tag intnet",
|
|
27
|
+
"pub:devnet": "npm publish --access public --tag devnet"
|
|
25
28
|
},
|
|
26
29
|
"types": "dist/index.d.ts",
|
|
27
30
|
"engines": {
|
|
@@ -69,7 +72,7 @@
|
|
|
69
72
|
"dist",
|
|
70
73
|
"oclif.manifest.json",
|
|
71
74
|
"install-dependencies.sh",
|
|
72
|
-
"projects",
|
|
75
|
+
"projects/hypergraph",
|
|
73
76
|
"scripts",
|
|
74
77
|
"README.md",
|
|
75
78
|
"LICENSE",
|
|
@@ -39,7 +39,7 @@ COPY dist/gl0.jar /app/jars/gl0.jar
|
|
|
39
39
|
#COPY ./health-check /health-check
|
|
40
40
|
#RUN chmod +x /health-check/bin/run.sh
|
|
41
41
|
#RUN chmod +x /health-check/bin/hydrate.sh
|
|
42
|
-
RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.
|
|
42
|
+
RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.39"
|
|
43
43
|
|
|
44
44
|
# Add entrypoint
|
|
45
45
|
COPY ./entrypoint.sh /app/entrypoint.sh
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "custom",
|
|
3
|
-
"projects": [
|
|
4
|
-
{ "name": "hg-intnet-1", "network": "intnet", "key": "key1.p12", "layers": "gl0" },
|
|
5
|
-
{ "name": "hg-intnet-2", "network": "intnet", "key": "key2.p12", "layers": "gl0" },
|
|
6
|
-
{ "name": "hg-intnet-3", "network": "intnet", "key": "key3.p12", "layers": "gl0" }
|
|
7
|
-
]
|
|
8
|
-
}
|
|
9
|
-
|
package/projects/hypergraph/test
DELETED
|
File without changes
|