@lightprotocol/zk-compression-cli 0.24.0 → 0.25.0
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 +1 -1
- package/accounts/address_merkle_tree_amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2.json +1 -1
- package/accounts/batch_address_merkle_tree_EzKE84aVTkCUhDHLELqyJaq1Y7UVVmqxXqZjVHwHY3rK.json +1 -0
- package/accounts/batch_state_merkle_tree_HLKs5NJ8FXkJg8BrzJt56adFYYuwg5etzDtBbQYTsixu.json +1 -0
- package/accounts/batched_output_queue_6L7SzhYB3anwEQ9cphpJ1U7Scwj57bx2xueReg7R9cKU.json +1 -0
- package/accounts/cpi_context_2_cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK.json +1 -0
- package/accounts/cpi_context_cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK.json +1 -0
- package/accounts/group_pda_32tgQWfaASE7SfTQvMaSJDrqe728tJQ2SGzxtDDrpDwS.json +1 -0
- package/accounts/merkle_tree_pubkey_2_smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho.json +1 -0
- package/accounts/merkle_tree_pubkey_smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho.json +1 -0
- package/accounts/nullifier_queue_pubkey_2_nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X.json +1 -0
- package/accounts/nullifier_queue_pubkey_nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X.json +1 -0
- package/accounts/registered_program_pda_35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh.json +1 -1
- package/accounts/registered_registry_program_pda_DumMsyvkaGJG4QnQ1BhTgvoRMXsgGxfpKDUCr22Xqu4w.json +1 -1
- package/bin/account_compression.so +0 -0
- package/bin/light_compressed_token.so +0 -0
- package/bin/light_registry.so +0 -0
- package/bin/light_system_program_pinocchio.so +0 -0
- package/bin/prover-darwin-arm64 +0 -0
- package/bin/prover-darwin-x64 +0 -0
- package/bin/prover-linux-arm64 +0 -0
- package/bin/prover-linux-x64 +0 -0
- package/bin/prover-windows-arm64.exe +0 -0
- package/bin/prover-windows-x64.exe +0 -0
- package/bin/proving-keys/combined_32_40_1_1.key +0 -0
- package/bin/proving-keys/{combined_26_3_2.key → combined_32_40_1_2.key} +0 -0
- package/bin/proving-keys/{combined_26_2_2.key → combined_32_40_2_1.key} +0 -0
- package/bin/proving-keys/inclusion_32_1.key +0 -0
- package/bin/proving-keys/inclusion_32_2.key +0 -0
- package/bin/proving-keys/{combined_26_3_1.key → inclusion_32_3.key} +0 -0
- package/bin/proving-keys/{combined_26_4_1.key → inclusion_32_4.key} +0 -0
- package/bin/proving-keys/{inclusion_26_2.key → mainnet_inclusion_26_2.key} +0 -0
- package/bin/proving-keys/non-inclusion_40_1.key +0 -0
- package/bin/proving-keys/non-inclusion_40_2.key +0 -0
- package/dist/commands/balance/index.d.ts +0 -1
- package/dist/commands/balance/index.js +10 -17
- package/dist/commands/compress-spl/index.js +3 -1
- package/dist/commands/decompress-spl/index.js +3 -1
- package/dist/commands/init/index.js +33 -3
- package/dist/commands/start-prover/index.d.ts +2 -0
- package/dist/commands/start-prover/index.js +31 -6
- package/dist/commands/test-validator/index.d.ts +2 -2
- package/dist/commands/test-validator/index.js +36 -31
- package/dist/commands/token-balance/index.d.ts +12 -0
- package/dist/commands/token-balance/index.js +55 -0
- package/dist/utils/constants.d.ts +20 -12
- package/dist/utils/constants.js +24 -13
- package/dist/utils/initTestEnv.d.ts +9 -1
- package/dist/utils/initTestEnv.js +38 -28
- package/dist/utils/process.d.ts +4 -0
- package/dist/utils/process.js +41 -2
- package/dist/utils/processPhotonIndexer.d.ts +1 -1
- package/dist/utils/processPhotonIndexer.js +33 -24
- package/dist/utils/processProverServer.d.ts +3 -1
- package/dist/utils/processProverServer.js +83 -2
- package/oclif.manifest.json +115 -66
- package/package.json +29 -51
- package/bin/proving-keys/CHECKSUM +0 -127
- package/bin/proving-keys/combined_26_1_1.vkey +0 -1
- package/bin/proving-keys/combined_26_1_2.vkey +0 -1
- package/bin/proving-keys/combined_26_2_1.vkey +0 -1
- package/bin/proving-keys/combined_26_2_2.vkey +0 -1
- package/bin/proving-keys/combined_26_3_1.vkey +0 -1
- package/bin/proving-keys/combined_26_3_2.vkey +0 -1
- package/bin/proving-keys/combined_26_4_1.vkey +0 -1
- package/bin/proving-keys/combined_26_4_2.key +0 -0
- package/bin/proving-keys/combined_26_4_2.vkey +0 -1
- package/bin/proving-keys/inclusion_26_1.vkey +0 -1
- package/bin/proving-keys/inclusion_26_2.vkey +0 -1
- package/bin/proving-keys/inclusion_26_3.vkey +0 -1
- package/bin/proving-keys/inclusion_26_4.vkey +0 -1
- package/bin/proving-keys/inclusion_26_8.key +0 -0
- package/bin/proving-keys/inclusion_26_8.vkey +0 -1
- package/bin/proving-keys/non-inclusion_26_1.vkey +0 -1
- package/bin/proving-keys/non-inclusion_26_2.vkey +0 -1
- /package/bin/proving-keys/{inclusion_26_1.key → mainnet_inclusion_26_1.key} +0 -0
- /package/bin/proving-keys/{inclusion_26_3.key → mainnet_inclusion_26_3.key} +0 -0
- /package/bin/proving-keys/{inclusion_26_4.key → mainnet_inclusion_26_4.key} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SYSTEM_PROGRAMS = void 0;
|
|
3
4
|
exports.stopTestEnv = stopTestEnv;
|
|
4
5
|
exports.initTestEnv = initTestEnv;
|
|
5
6
|
exports.initTestEnvIfNeeded = initTestEnvIfNeeded;
|
|
@@ -16,6 +17,33 @@ const psp_utils_1 = require("../psp-utils");
|
|
|
16
17
|
const process_1 = require("./process");
|
|
17
18
|
const processProverServer_1 = require("./processProverServer");
|
|
18
19
|
const processPhotonIndexer_1 = require("./processPhotonIndexer");
|
|
20
|
+
exports.SYSTEM_PROGRAMS = [
|
|
21
|
+
{
|
|
22
|
+
id: "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV",
|
|
23
|
+
name: "spl_noop.so",
|
|
24
|
+
tag: constants_1.SPL_NOOP_PROGRAM_TAG,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7",
|
|
28
|
+
name: "light_system_program_pinocchio.so",
|
|
29
|
+
tag: constants_1.LIGHT_SYSTEM_PROGRAM_TAG,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m",
|
|
33
|
+
name: "light_compressed_token.so",
|
|
34
|
+
tag: constants_1.LIGHT_COMPRESSED_TOKEN_TAG,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq",
|
|
38
|
+
name: "account_compression.so",
|
|
39
|
+
tag: constants_1.LIGHT_ACCOUNT_COMPRESSION_TAG,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX",
|
|
43
|
+
name: "light_registry.so",
|
|
44
|
+
tag: constants_1.LIGHT_REGISTRY_TAG,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
19
47
|
async function stopTestEnv(options) {
|
|
20
48
|
const processesToKill = [
|
|
21
49
|
{ name: "photon", condition: options.indexer, killFunction: processPhotonIndexer_1.killIndexer },
|
|
@@ -65,7 +93,15 @@ async function initTestEnv({ additionalPrograms, skipSystemAccounts, indexer = t
|
|
|
65
93
|
const config = (0, utils_1.getConfig)();
|
|
66
94
|
config.proverUrl = `http://127.0.0.1:${proverPort}`;
|
|
67
95
|
(0, utils_1.setConfig)(config);
|
|
68
|
-
|
|
96
|
+
try {
|
|
97
|
+
// TODO: check if using redisUrl is better here.
|
|
98
|
+
await (0, processProverServer_1.startProver)(proverPort, proverRunMode, circuits);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
console.error("Failed to start prover:", error);
|
|
102
|
+
// Prover logs will be automatically displayed by spawnBinary in process.ts
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
69
105
|
}
|
|
70
106
|
}
|
|
71
107
|
async function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, indexer = false, prover = false, geyserConfig, validatorArgs, } = {}) {
|
|
@@ -120,33 +156,7 @@ function programFilePath(programName) {
|
|
|
120
156
|
}
|
|
121
157
|
async function getSolanaArgs({ additionalPrograms, skipSystemAccounts, limitLedgerSize, rpcPort, gossipHost, downloadBinaries = true, }) {
|
|
122
158
|
// TODO: adjust program tags
|
|
123
|
-
const programs = [
|
|
124
|
-
{
|
|
125
|
-
id: "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV",
|
|
126
|
-
name: "spl_noop.so",
|
|
127
|
-
tag: constants_1.SPL_NOOP_PROGRAM_TAG,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
id: "SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7",
|
|
131
|
-
name: "light_system_program.so",
|
|
132
|
-
tag: constants_1.LIGHT_SYSTEM_PROGRAM_TAG,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
id: "cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m",
|
|
136
|
-
name: "light_compressed_token.so",
|
|
137
|
-
tag: constants_1.LIGHT_COMPRESSED_TOKEN_TAG,
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
id: "compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq",
|
|
141
|
-
name: "account_compression.so",
|
|
142
|
-
tag: constants_1.LIGHT_ACCOUNT_COMPRESSION_TAG,
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
id: "Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX",
|
|
146
|
-
name: "light_registry.so",
|
|
147
|
-
tag: constants_1.LIGHT_REGISTRY_TAG,
|
|
148
|
-
},
|
|
149
|
-
];
|
|
159
|
+
const programs = [...exports.SYSTEM_PROGRAMS];
|
|
150
160
|
if (additionalPrograms)
|
|
151
161
|
additionalPrograms.forEach((program) => {
|
|
152
162
|
programs.push({ id: program.address, path: program.path });
|
package/dist/utils/process.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs the contents of prover log files in test-ledger dir.
|
|
3
|
+
*/
|
|
4
|
+
export declare function logProverFileContents(): Promise<void>;
|
|
1
5
|
export declare function killProcess(processName: string): Promise<void>;
|
|
2
6
|
export declare function killProcessByPort(port: number): Promise<void>;
|
|
3
7
|
/**
|
package/dist/utils/process.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logProverFileContents = logProverFileContents;
|
|
3
4
|
exports.killProcess = killProcess;
|
|
4
5
|
exports.killProcessByPort = killProcessByPort;
|
|
5
6
|
exports.executeCommand = executeCommand;
|
|
@@ -16,6 +17,41 @@ const node_child_process_1 = require("node:child_process");
|
|
|
16
17
|
const util_1 = require("util");
|
|
17
18
|
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
18
19
|
const waitOn = require("wait-on");
|
|
20
|
+
const readdir = (0, util_1.promisify)(fs_1.default.readdir);
|
|
21
|
+
const readFile = (0, util_1.promisify)(fs_1.default.readFile);
|
|
22
|
+
/**
|
|
23
|
+
* Logs the contents of prover log files in test-ledger dir.
|
|
24
|
+
*/
|
|
25
|
+
async function logProverFileContents() {
|
|
26
|
+
const testLedgerDir = path_1.default.join(__dirname, "../..", "test-ledger");
|
|
27
|
+
try {
|
|
28
|
+
if (!fs_1.default.existsSync(testLedgerDir)) {
|
|
29
|
+
console.log("test-ledger directory does not exist");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const files = await readdir(testLedgerDir);
|
|
33
|
+
const proverFiles = files.filter((file) => file.includes("prover"));
|
|
34
|
+
if (proverFiles.length === 0) {
|
|
35
|
+
console.log("No prover log files found in test-ledger directory");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
for (const file of proverFiles) {
|
|
39
|
+
const filePath = path_1.default.join(testLedgerDir, file);
|
|
40
|
+
console.log(`\n========== Contents of ${file} ==========`);
|
|
41
|
+
try {
|
|
42
|
+
const contents = await readFile(filePath, "utf8");
|
|
43
|
+
console.log(contents);
|
|
44
|
+
console.log(`========== End of ${file} ==========\n`);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error(`Error reading ${file}:`, error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error("Error accessing test-ledger directory:", error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
19
55
|
async function killProcess(processName) {
|
|
20
56
|
const processList = await (0, find_process_1.default)("name", processName);
|
|
21
57
|
const targetProcesses = processList.filter((proc) => proc.name.includes(processName) || proc.cmd.includes(processName));
|
|
@@ -27,7 +63,6 @@ async function killProcess(processName) {
|
|
|
27
63
|
console.error(`Failed to kill process ${proc.pid}: ${error}`);
|
|
28
64
|
}
|
|
29
65
|
}
|
|
30
|
-
// Double-check if processes are still running
|
|
31
66
|
const remainingProcesses = await (0, find_process_1.default)("name", processName);
|
|
32
67
|
if (remainingProcesses.length > 0) {
|
|
33
68
|
console.warn(`Warning: ${remainingProcesses.length} processes still running after kill attempt`);
|
|
@@ -145,8 +180,12 @@ function spawnBinary(command, args = []) {
|
|
|
145
180
|
shell: false,
|
|
146
181
|
detached: true,
|
|
147
182
|
});
|
|
148
|
-
spawnedProcess.on("close", (code) => {
|
|
183
|
+
spawnedProcess.on("close", async (code) => {
|
|
149
184
|
console.log(`${binaryName} process exited with code ${code}`);
|
|
185
|
+
if (code !== 0 && binaryName.includes("prover")) {
|
|
186
|
+
console.error(`Prover process failed with exit code ${code}`);
|
|
187
|
+
await logProverFileContents();
|
|
188
|
+
}
|
|
150
189
|
});
|
|
151
190
|
return spawnedProcess;
|
|
152
191
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function startIndexer(rpcUrl: string, indexerPort: number, checkPhotonVersion?: boolean, photonDatabaseUrl?: string): Promise<
|
|
1
|
+
export declare function startIndexer(rpcUrl: string, indexerPort: number, checkPhotonVersion?: boolean, photonDatabaseUrl?: string): Promise<undefined>;
|
|
2
2
|
export declare function killIndexer(): Promise<void>;
|
|
@@ -8,27 +8,48 @@ const process_1 = require("./process");
|
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const node_child_process_1 = require("node:child_process");
|
|
10
10
|
const util = tslib_1.__importStar(require("node:util"));
|
|
11
|
+
const node_process_1 = require("node:process");
|
|
12
|
+
const execAsync = util.promisify(node_child_process_1.exec);
|
|
13
|
+
async function isExpectedPhotonVersion(requiredVersion) {
|
|
14
|
+
try {
|
|
15
|
+
const { stdout } = await execAsync("photon --version");
|
|
16
|
+
const version = stdout.trim();
|
|
17
|
+
return version.includes(requiredVersion);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error("Error checking Photon version:", error);
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function getPhotonInstallMessage() {
|
|
25
|
+
if (constants_1.USE_PHOTON_FROM_GIT && constants_1.PHOTON_GIT_COMMIT) {
|
|
26
|
+
return `\nLatest Photon indexer not found. Please install it by running: "cargo install --git ${constants_1.PHOTON_GIT_REPO} --rev ${constants_1.PHOTON_GIT_COMMIT} --locked"`;
|
|
27
|
+
}
|
|
28
|
+
else if (constants_1.USE_PHOTON_FROM_GIT) {
|
|
29
|
+
return `\nLatest Photon indexer not found. Please install it by running: "cargo install --git ${constants_1.PHOTON_GIT_REPO} --locked"`;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return `\nLatest Photon indexer not found. Please install it by running: "cargo install photon-indexer --version ${constants_1.PHOTON_VERSION} --locked"`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
11
35
|
async function startIndexer(rpcUrl, indexerPort, checkPhotonVersion = true, photonDatabaseUrl) {
|
|
12
36
|
await killIndexer();
|
|
13
37
|
const resolvedOrNull = which_1.default.sync("photon", { nothrow: true });
|
|
14
38
|
if (resolvedOrNull === null ||
|
|
15
39
|
(checkPhotonVersion && !(await isExpectedPhotonVersion(constants_1.PHOTON_VERSION)))) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
throw new Error(message);
|
|
40
|
+
console.log(getPhotonInstallMessage());
|
|
41
|
+
return (0, node_process_1.exit)(1);
|
|
19
42
|
}
|
|
20
43
|
else {
|
|
21
44
|
console.log("Starting indexer...");
|
|
22
|
-
|
|
45
|
+
const args = [
|
|
46
|
+
"--port",
|
|
47
|
+
indexerPort.toString(),
|
|
48
|
+
"--rpc-url",
|
|
49
|
+
rpcUrl,
|
|
50
|
+
];
|
|
23
51
|
if (photonDatabaseUrl) {
|
|
24
|
-
args
|
|
25
|
-
"--db-url",
|
|
26
|
-
photonDatabaseUrl,
|
|
27
|
-
"--port",
|
|
28
|
-
indexerPort.toString(),
|
|
29
|
-
"--rpc-url",
|
|
30
|
-
rpcUrl,
|
|
31
|
-
];
|
|
52
|
+
args.push("--db-url", photonDatabaseUrl);
|
|
32
53
|
}
|
|
33
54
|
(0, process_1.spawnBinary)(constants_1.INDEXER_PROCESS_NAME, args);
|
|
34
55
|
await (0, process_1.waitForServers)([{ port: indexerPort, path: "/getIndexerHealth" }]);
|
|
@@ -38,15 +59,3 @@ async function startIndexer(rpcUrl, indexerPort, checkPhotonVersion = true, phot
|
|
|
38
59
|
async function killIndexer() {
|
|
39
60
|
await (0, process_1.killProcess)(constants_1.INDEXER_PROCESS_NAME);
|
|
40
61
|
}
|
|
41
|
-
const execAsync = util.promisify(node_child_process_1.exec);
|
|
42
|
-
async function isExpectedPhotonVersion(requiredVersion) {
|
|
43
|
-
try {
|
|
44
|
-
const { stdout } = await execAsync("photon --version");
|
|
45
|
-
const version = stdout.trim();
|
|
46
|
-
return version.includes(requiredVersion);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.error("Error checking Photon version:", error);
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare function killProver(): Promise<void>;
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function isProverRunningWithFlags(runMode?: string, circuits?: string[], proverPort?: number, redisUrl?: string): Promise<boolean>;
|
|
3
|
+
export declare function startProver(proverPort: number, runMode: string | undefined, circuits?: string[] | undefined, force?: boolean, redisUrl?: string): Promise<void>;
|
|
3
4
|
export declare function getProverNameByArch(): string;
|
|
4
5
|
export declare function getProverPathByArch(): string;
|
|
6
|
+
export declare function healthCheck(port: number, retries?: number, timeout?: number): Promise<boolean>;
|
|
@@ -1,19 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.killProver = killProver;
|
|
4
|
+
exports.isProverRunningWithFlags = isProverRunningWithFlags;
|
|
4
5
|
exports.startProver = startProver;
|
|
5
6
|
exports.getProverNameByArch = getProverNameByArch;
|
|
6
7
|
exports.getProverPathByArch = getProverPathByArch;
|
|
8
|
+
exports.healthCheck = healthCheck;
|
|
7
9
|
const tslib_1 = require("tslib");
|
|
8
10
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
11
|
const process_1 = require("./process");
|
|
10
12
|
const constants_1 = require("./constants");
|
|
13
|
+
const find_process_1 = tslib_1.__importDefault(require("find-process"));
|
|
11
14
|
const KEYS_DIR = "proving-keys/";
|
|
12
15
|
async function killProver() {
|
|
13
16
|
await (0, process_1.killProcess)(getProverNameByArch());
|
|
14
17
|
await (0, process_1.killProcess)(constants_1.LIGHT_PROVER_PROCESS_NAME);
|
|
15
18
|
}
|
|
16
|
-
async function
|
|
19
|
+
async function isProverRunningWithFlags(runMode, circuits, proverPort, redisUrl) {
|
|
20
|
+
// Use find-process to get prover processes by name pattern
|
|
21
|
+
const proverProcesses = await (0, find_process_1.default)("name", "prover-");
|
|
22
|
+
const expectedArgs = [];
|
|
23
|
+
if (runMode) {
|
|
24
|
+
expectedArgs.push("--run-mode", runMode);
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(circuits)) {
|
|
27
|
+
for (const c of circuits) {
|
|
28
|
+
expectedArgs.push("--circuit", c);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (proverPort) {
|
|
32
|
+
expectedArgs.push("--prover-address", `0.0.0.0:${proverPort}`);
|
|
33
|
+
}
|
|
34
|
+
if (redisUrl) {
|
|
35
|
+
expectedArgs.push("--redis-url", redisUrl);
|
|
36
|
+
}
|
|
37
|
+
let found = false;
|
|
38
|
+
for (const proc of proverProcesses) {
|
|
39
|
+
if (proc.cmd &&
|
|
40
|
+
(proc.cmd.includes("prover-") || proc.name.startsWith("prover-"))) {
|
|
41
|
+
console.log("\n[Prover Process Detected]");
|
|
42
|
+
console.log(` PID: ${proc.pid}`);
|
|
43
|
+
console.log(` Command: ${proc.cmd}`);
|
|
44
|
+
let matches = true;
|
|
45
|
+
for (const arg of expectedArgs) {
|
|
46
|
+
if (!proc.cmd.includes(arg)) {
|
|
47
|
+
matches = false;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (matches) {
|
|
52
|
+
found = true;
|
|
53
|
+
console.log("\x1b[32m✔ Prover is already running with the same configuration.\x1b[0m");
|
|
54
|
+
console.log(" To restart the prover, stop the process above or use the --force flag.\n");
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const missing = proc.cmd
|
|
59
|
+
? expectedArgs.filter((arg) => !proc.cmd.includes(arg))
|
|
60
|
+
: [];
|
|
61
|
+
if (missing.length > 0) {
|
|
62
|
+
console.log(` (Not a match for current request. Missing args: ${missing.join(", ")})`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!found) {
|
|
68
|
+
console.log("\x1b[33mNo running prover found with the requested configuration.\x1b[0m");
|
|
69
|
+
}
|
|
70
|
+
return found;
|
|
71
|
+
}
|
|
72
|
+
async function startProver(proverPort, runMode, circuits = [], force = false, redisUrl) {
|
|
73
|
+
if (!force &&
|
|
74
|
+
(await isProverRunningWithFlags(runMode, circuits, proverPort))) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
17
77
|
console.log("Kill existing prover process...");
|
|
18
78
|
await killProver();
|
|
19
79
|
await (0, process_1.killProcessByPort)(proverPort);
|
|
@@ -34,10 +94,13 @@ async function startProver(proverPort, runMode, circuits = []) {
|
|
|
34
94
|
console.log(`Starting prover with circuits: ${circuits.join(", ")}...`);
|
|
35
95
|
}
|
|
36
96
|
if ((!circuits || circuits.length === 0) && runMode == null) {
|
|
37
|
-
runMode = "rpc";
|
|
97
|
+
runMode = "local-rpc";
|
|
38
98
|
args.push("--run-mode", runMode);
|
|
39
99
|
console.log(`Starting prover with fallback ${runMode} mode...`);
|
|
40
100
|
}
|
|
101
|
+
if (redisUrl) {
|
|
102
|
+
args.push("--redis-url", redisUrl);
|
|
103
|
+
}
|
|
41
104
|
(0, process_1.spawnBinary)(getProverPathByArch(), args);
|
|
42
105
|
await (0, process_1.waitForServers)([{ port: proverPort, path: "/" }]);
|
|
43
106
|
console.log(`Prover started successfully!`);
|
|
@@ -61,3 +124,21 @@ function getProverPathByArch() {
|
|
|
61
124
|
binaryName = path_1.default.join(binDir, binaryName);
|
|
62
125
|
return binaryName;
|
|
63
126
|
}
|
|
127
|
+
async function healthCheck(port, retries = 3, timeout = 3000) {
|
|
128
|
+
const fetch = (await Promise.resolve().then(() => tslib_1.__importStar(require("node-fetch")))).default;
|
|
129
|
+
for (let i = 0; i < retries; i++) {
|
|
130
|
+
try {
|
|
131
|
+
const res = await fetch(`http://localhost:${port}/health`);
|
|
132
|
+
if (res.ok) {
|
|
133
|
+
console.log("Health check passed!");
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
console.error("Health check error:", e);
|
|
139
|
+
}
|
|
140
|
+
await new Promise((r) => setTimeout(r, timeout));
|
|
141
|
+
}
|
|
142
|
+
console.log("Health check failed after all attempts.");
|
|
143
|
+
return false;
|
|
144
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -61,24 +61,16 @@
|
|
|
61
61
|
"aliases": [],
|
|
62
62
|
"args": {},
|
|
63
63
|
"examples": [
|
|
64
|
-
"$ light balance --
|
|
64
|
+
"$ light balance --owner=<ADDRESS>"
|
|
65
65
|
],
|
|
66
66
|
"flags": {
|
|
67
67
|
"owner": {
|
|
68
|
-
"description": "Address of the
|
|
68
|
+
"description": "Address of the owner.",
|
|
69
69
|
"name": "owner",
|
|
70
70
|
"required": true,
|
|
71
71
|
"hasDynamicHelp": false,
|
|
72
72
|
"multiple": false,
|
|
73
73
|
"type": "option"
|
|
74
|
-
},
|
|
75
|
-
"mint": {
|
|
76
|
-
"description": "Mint address of the compressed token account.",
|
|
77
|
-
"name": "mint",
|
|
78
|
-
"required": true,
|
|
79
|
-
"hasDynamicHelp": false,
|
|
80
|
-
"multiple": false,
|
|
81
|
-
"type": "option"
|
|
82
74
|
}
|
|
83
75
|
},
|
|
84
76
|
"hasDynamicHelp": false,
|
|
@@ -88,7 +80,7 @@
|
|
|
88
80
|
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
89
81
|
"pluginType": "core",
|
|
90
82
|
"strict": true,
|
|
91
|
-
"summary": "Get balance",
|
|
83
|
+
"summary": "Get compressed SOL balance",
|
|
92
84
|
"enableJsonFlag": false,
|
|
93
85
|
"isESM": false,
|
|
94
86
|
"relativePath": [
|
|
@@ -98,47 +90,6 @@
|
|
|
98
90
|
"index.js"
|
|
99
91
|
]
|
|
100
92
|
},
|
|
101
|
-
"compress-sol": {
|
|
102
|
-
"aliases": [],
|
|
103
|
-
"args": {},
|
|
104
|
-
"examples": [
|
|
105
|
-
"$ light compress-sol --to PublicKey --amount 10"
|
|
106
|
-
],
|
|
107
|
-
"flags": {
|
|
108
|
-
"to": {
|
|
109
|
-
"description": "Specify the recipient address.",
|
|
110
|
-
"name": "to",
|
|
111
|
-
"required": true,
|
|
112
|
-
"hasDynamicHelp": false,
|
|
113
|
-
"multiple": false,
|
|
114
|
-
"type": "option"
|
|
115
|
-
},
|
|
116
|
-
"amount": {
|
|
117
|
-
"description": "Amount to compress, in lamports.",
|
|
118
|
-
"name": "amount",
|
|
119
|
-
"required": true,
|
|
120
|
-
"hasDynamicHelp": false,
|
|
121
|
-
"multiple": false,
|
|
122
|
-
"type": "option"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"hasDynamicHelp": false,
|
|
126
|
-
"hiddenAliases": [],
|
|
127
|
-
"id": "compress-sol",
|
|
128
|
-
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
129
|
-
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
130
|
-
"pluginType": "core",
|
|
131
|
-
"strict": true,
|
|
132
|
-
"summary": "Compress SOL.",
|
|
133
|
-
"enableJsonFlag": false,
|
|
134
|
-
"isESM": false,
|
|
135
|
-
"relativePath": [
|
|
136
|
-
"dist",
|
|
137
|
-
"commands",
|
|
138
|
-
"compress-sol",
|
|
139
|
-
"index.js"
|
|
140
|
-
]
|
|
141
|
-
},
|
|
142
93
|
"compress-spl": {
|
|
143
94
|
"aliases": [],
|
|
144
95
|
"args": {},
|
|
@@ -188,16 +139,24 @@
|
|
|
188
139
|
"index.js"
|
|
189
140
|
]
|
|
190
141
|
},
|
|
191
|
-
"
|
|
142
|
+
"compress-sol": {
|
|
192
143
|
"aliases": [],
|
|
193
144
|
"args": {},
|
|
194
145
|
"examples": [
|
|
195
|
-
"$ light
|
|
146
|
+
"$ light compress-sol --to PublicKey --amount 10"
|
|
196
147
|
],
|
|
197
148
|
"flags": {
|
|
198
|
-
"
|
|
199
|
-
"description": "
|
|
200
|
-
"name": "
|
|
149
|
+
"to": {
|
|
150
|
+
"description": "Specify the recipient address.",
|
|
151
|
+
"name": "to",
|
|
152
|
+
"required": true,
|
|
153
|
+
"hasDynamicHelp": false,
|
|
154
|
+
"multiple": false,
|
|
155
|
+
"type": "option"
|
|
156
|
+
},
|
|
157
|
+
"amount": {
|
|
158
|
+
"description": "Amount to compress, in lamports.",
|
|
159
|
+
"name": "amount",
|
|
201
160
|
"required": true,
|
|
202
161
|
"hasDynamicHelp": false,
|
|
203
162
|
"multiple": false,
|
|
@@ -206,18 +165,18 @@
|
|
|
206
165
|
},
|
|
207
166
|
"hasDynamicHelp": false,
|
|
208
167
|
"hiddenAliases": [],
|
|
209
|
-
"id": "
|
|
168
|
+
"id": "compress-sol",
|
|
210
169
|
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
211
170
|
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
212
171
|
"pluginType": "core",
|
|
213
172
|
"strict": true,
|
|
214
|
-
"summary": "
|
|
173
|
+
"summary": "Compress SOL.",
|
|
215
174
|
"enableJsonFlag": false,
|
|
216
175
|
"isESM": false,
|
|
217
176
|
"relativePath": [
|
|
218
177
|
"dist",
|
|
219
178
|
"commands",
|
|
220
|
-
"
|
|
179
|
+
"compress-sol",
|
|
221
180
|
"index.js"
|
|
222
181
|
]
|
|
223
182
|
},
|
|
@@ -271,6 +230,39 @@
|
|
|
271
230
|
"index.js"
|
|
272
231
|
]
|
|
273
232
|
},
|
|
233
|
+
"create-token-pool": {
|
|
234
|
+
"aliases": [],
|
|
235
|
+
"args": {},
|
|
236
|
+
"examples": [
|
|
237
|
+
"$ light create-token-pool --mint-decimals 5"
|
|
238
|
+
],
|
|
239
|
+
"flags": {
|
|
240
|
+
"mint": {
|
|
241
|
+
"description": "Provide a base58 encoded mint address to register",
|
|
242
|
+
"name": "mint",
|
|
243
|
+
"required": true,
|
|
244
|
+
"hasDynamicHelp": false,
|
|
245
|
+
"multiple": false,
|
|
246
|
+
"type": "option"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"hasDynamicHelp": false,
|
|
250
|
+
"hiddenAliases": [],
|
|
251
|
+
"id": "create-token-pool",
|
|
252
|
+
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
253
|
+
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
254
|
+
"pluginType": "core",
|
|
255
|
+
"strict": true,
|
|
256
|
+
"summary": "Register an existing mint with the CompressedToken program",
|
|
257
|
+
"enableJsonFlag": false,
|
|
258
|
+
"isESM": false,
|
|
259
|
+
"relativePath": [
|
|
260
|
+
"dist",
|
|
261
|
+
"commands",
|
|
262
|
+
"create-token-pool",
|
|
263
|
+
"index.js"
|
|
264
|
+
]
|
|
265
|
+
},
|
|
274
266
|
"config:config": {
|
|
275
267
|
"aliases": [],
|
|
276
268
|
"args": {},
|
|
@@ -607,12 +599,13 @@
|
|
|
607
599
|
"type": "option"
|
|
608
600
|
},
|
|
609
601
|
"run-mode": {
|
|
610
|
-
"description": "Specify the running mode (forester, forester-test, rpc, full
|
|
602
|
+
"description": "Specify the running mode (local-rpc, forester, forester-test, rpc, or full). Default: local-rpc",
|
|
611
603
|
"name": "run-mode",
|
|
612
604
|
"required": false,
|
|
613
605
|
"hasDynamicHelp": false,
|
|
614
606
|
"multiple": false,
|
|
615
607
|
"options": [
|
|
608
|
+
"local-rpc",
|
|
616
609
|
"rpc",
|
|
617
610
|
"forester",
|
|
618
611
|
"forester-test",
|
|
@@ -632,15 +625,28 @@
|
|
|
632
625
|
"non-inclusion",
|
|
633
626
|
"combined",
|
|
634
627
|
"append-with-proofs",
|
|
635
|
-
"append-with-subtrees",
|
|
636
628
|
"update",
|
|
637
629
|
"address-append",
|
|
638
630
|
"append-with-proofs-test",
|
|
639
|
-
"append-with-subtrees-test",
|
|
640
631
|
"update-test",
|
|
641
632
|
"address-append-test"
|
|
642
633
|
],
|
|
643
634
|
"type": "option"
|
|
635
|
+
},
|
|
636
|
+
"force": {
|
|
637
|
+
"description": "Force restart the prover even if one is already running with the same flags.",
|
|
638
|
+
"name": "force",
|
|
639
|
+
"required": false,
|
|
640
|
+
"allowNo": false,
|
|
641
|
+
"type": "boolean"
|
|
642
|
+
},
|
|
643
|
+
"redisUrl": {
|
|
644
|
+
"description": "Redis URL to use for the prover (e.g. redis://localhost:6379)",
|
|
645
|
+
"name": "redisUrl",
|
|
646
|
+
"required": false,
|
|
647
|
+
"hasDynamicHelp": false,
|
|
648
|
+
"multiple": false,
|
|
649
|
+
"type": "option"
|
|
644
650
|
}
|
|
645
651
|
},
|
|
646
652
|
"hasDynamicHelp": false,
|
|
@@ -667,7 +673,8 @@
|
|
|
667
673
|
"$ light test-validator",
|
|
668
674
|
"$ light test-validator --skip-indexer",
|
|
669
675
|
"$ light test-validator --geyser-config ./config.json",
|
|
670
|
-
"$ light test-validator --validator-args \"--limit-ledger-size 50000000\""
|
|
676
|
+
"$ light test-validator --validator-args \"--limit-ledger-size 50000000\"",
|
|
677
|
+
"$ light test-validator --sbf-program <address> <path/program>"
|
|
671
678
|
],
|
|
672
679
|
"flags": {
|
|
673
680
|
"skip-indexer": {
|
|
@@ -742,7 +749,7 @@
|
|
|
742
749
|
"type": "option"
|
|
743
750
|
},
|
|
744
751
|
"prover-run-mode": {
|
|
745
|
-
"description": "Specify the running mode for the prover (forester, forester-test, rpc, or full)",
|
|
752
|
+
"description": "Specify the running mode for the prover (local-rpc, forester, forester-test, rpc, or full). Default: local-rpc",
|
|
746
753
|
"exclusive": [
|
|
747
754
|
"skip-prover"
|
|
748
755
|
],
|
|
@@ -751,6 +758,7 @@
|
|
|
751
758
|
"hasDynamicHelp": false,
|
|
752
759
|
"multiple": false,
|
|
753
760
|
"options": [
|
|
761
|
+
"local-rpc",
|
|
754
762
|
"rpc",
|
|
755
763
|
"forester",
|
|
756
764
|
"forester-test",
|
|
@@ -849,6 +857,47 @@
|
|
|
849
857
|
"index.js"
|
|
850
858
|
]
|
|
851
859
|
},
|
|
860
|
+
"token-balance": {
|
|
861
|
+
"aliases": [],
|
|
862
|
+
"args": {},
|
|
863
|
+
"examples": [
|
|
864
|
+
"$ light token-balance --mint=<ADDRESS> --owner=<ADDRESS>"
|
|
865
|
+
],
|
|
866
|
+
"flags": {
|
|
867
|
+
"owner": {
|
|
868
|
+
"description": "Address of the compressed token owner.",
|
|
869
|
+
"name": "owner",
|
|
870
|
+
"required": true,
|
|
871
|
+
"hasDynamicHelp": false,
|
|
872
|
+
"multiple": false,
|
|
873
|
+
"type": "option"
|
|
874
|
+
},
|
|
875
|
+
"mint": {
|
|
876
|
+
"description": "Mint address of the compressed token account.",
|
|
877
|
+
"name": "mint",
|
|
878
|
+
"required": true,
|
|
879
|
+
"hasDynamicHelp": false,
|
|
880
|
+
"multiple": false,
|
|
881
|
+
"type": "option"
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
"hasDynamicHelp": false,
|
|
885
|
+
"hiddenAliases": [],
|
|
886
|
+
"id": "token-balance",
|
|
887
|
+
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
888
|
+
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
889
|
+
"pluginType": "core",
|
|
890
|
+
"strict": true,
|
|
891
|
+
"summary": "Get balance",
|
|
892
|
+
"enableJsonFlag": false,
|
|
893
|
+
"isESM": false,
|
|
894
|
+
"relativePath": [
|
|
895
|
+
"dist",
|
|
896
|
+
"commands",
|
|
897
|
+
"token-balance",
|
|
898
|
+
"index.js"
|
|
899
|
+
]
|
|
900
|
+
},
|
|
852
901
|
"transfer": {
|
|
853
902
|
"aliases": [],
|
|
854
903
|
"args": {},
|
|
@@ -907,5 +956,5 @@
|
|
|
907
956
|
]
|
|
908
957
|
}
|
|
909
958
|
},
|
|
910
|
-
"version": "0.
|
|
959
|
+
"version": "0.25.0"
|
|
911
960
|
}
|