Skip to content

Commit 2d625a5

Browse files
shimkivymekuria
andauthored
zk lightnet logs command implementation. (#520)
Co-authored-by: Yoni Mekuria <ymekuria@gmail.com>
1 parent 7a0a3a0 commit 2d625a5

File tree

6 files changed

+329
-75
lines changed

6 files changed

+329
-75
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.15.1] - 2023-11-29
9+
10+
### Added
11+
12+
- Lightnet sub-commands implementation (`logs`). [#520](https://github.com/o1-labs/zkapp-cli/pull/520)
13+
814
## [0.15.0] - 2023-11-07
915

10-
### Changed
16+
### Added
1117

12-
- Lightnet sub-commands implementation (start/stop/status). [#510](https://github.com/o1-labs/zkapp-cli/pull/510)
18+
- Lightnet sub-commands implementation (`start`/`stop`/`status`). [#510](https://github.com/o1-labs/zkapp-cli/pull/510)
1319

1420
## [0.14.1] - 2023-11-03
1521

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zkapp-cli",
3-
"version": "0.15.0",
3+
"version": "0.15.1",
44
"description": "CLI to create zkApps (zero-knowledge apps) for Mina Protocol",
55
"homepage": "https://github.com/o1-labs/zkapp-cli/",
66
"keywords": [

src/bin/index.js

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import { deploy } from '../lib/deploy.js';
1212
import { example } from '../lib/example.js';
1313
import { file } from '../lib/file.js';
1414
import {
15+
lightnetFollowLogs,
16+
lightnetSaveLogs,
17+
lightnetStart,
1518
lightnetStatus,
16-
startLightnet,
17-
stopLightnet,
19+
lightnetStop,
1820
} from '../lib/lightnet.js';
1921
import { project } from '../lib/project.js';
2022
import system from '../lib/system.js';
@@ -193,7 +195,7 @@ yargs(hideBin(process.argv))
193195
},
194196
...commonOptions,
195197
},
196-
async (argv) => await startLightnet(argv)
198+
async (argv) => await lightnetStart(argv)
197199
)
198200
.command(
199201
['stop [save-logs] [clean-up] [debug]'],
@@ -219,7 +221,7 @@ yargs(hideBin(process.argv))
219221
},
220222
...commonOptions,
221223
},
222-
async (argv) => await stopLightnet(argv)
224+
async (argv) => await lightnetStop(argv)
223225
)
224226
.command(
225227
['status [debug]'],
@@ -233,6 +235,41 @@ yargs(hideBin(process.argv))
233235
debug: argv.debug,
234236
})
235237
)
238+
.command(
239+
['logs <sub-command> [options]'],
240+
'Handle the lightweight Mina blockchain network Docker container processes logs.',
241+
(yargs) => {
242+
yargs
243+
.command(
244+
['save [debug]'],
245+
'Save the lightweight Mina blockchain network Docker container processes logs to the host file system.',
246+
{
247+
...commonOptions,
248+
},
249+
async (argv) => await lightnetSaveLogs(argv)
250+
)
251+
.command(
252+
['follow [process] [debug]'],
253+
'Follow one of the lightweight Mina blockchain network Docker container processes logs.',
254+
{
255+
process: {
256+
alias: 'p',
257+
demand: false,
258+
string: true,
259+
hidden: false,
260+
choices: [
261+
...Constants.lightnetProcessToLogFileMapping.keys(),
262+
],
263+
description:
264+
'The name of the Docker container process to follow the logs of.',
265+
},
266+
...commonOptions,
267+
},
268+
async (argv) => await lightnetFollowLogs(argv)
269+
)
270+
.demandCommand();
271+
}
272+
)
236273
.demandCommand();
237274
}
238275
)

src/lib/constants.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import path from 'path';
99
* @typedef {'none' | 'full'} LightnetProofLevel
1010
* @typedef {'o1js-main' | 'berkeley' | 'develop'} LightnetMinaBranch
1111
*
12-
* @type {{ uiTypes: UiType[], exampleTypes: ExampleType[], feePayerCacheDir: string, lightnetWorkDir: string, lightnetModes: LightnetMode[], lightnetTypes: LightnetType[], lightnetProofLevels: LightnetProofLevel[], lightnetMinaBranches: LightnetMinaBranch[] }}
12+
* @type {{ uiTypes: UiType[], exampleTypes: ExampleType[], feePayerCacheDir: string, lightnetWorkDir: string, lightnetModes: LightnetMode[], lightnetTypes: LightnetType[], lightnetProofLevels: LightnetProofLevel[], lightnetMinaBranches: LightnetMinaBranch[], lightnetProcessToLogFileMapping: Map<string, string> }}
1313
*/
1414
const Constants = Object.freeze({
1515
uiTypes: ['next', 'svelte', 'nuxt', 'empty', 'none'],
@@ -20,6 +20,18 @@ const Constants = Object.freeze({
2020
lightnetTypes: ['fast', 'real'],
2121
lightnetProofLevels: ['none', 'full'],
2222
lightnetMinaBranches: ['o1js-main', 'berkeley', 'develop'],
23+
lightnetProcessToLogFileMapping: new Map([
24+
['Archive-Node-API application', 'logs/archive-node-api.log'],
25+
['Mina Archive process', 'logs/archive-node.log,archive/log.txt'],
26+
['Mina multi-purpose Daemon', 'logs/single-node-network.log'],
27+
['Fish BP #1', 'fish_0/log.txt'],
28+
['Non-consensus node #1', 'node_0/log.txt'],
29+
['Seed node #1', 'seed/log.txt'],
30+
['SNARK coordinator #1', 'snark_coordinator/log.txt'],
31+
['SNARK worker #1', 'snark_workers/worker_0/log.txt'],
32+
['Whale BP #1', 'whale_0/log.txt'],
33+
['Whale BP #2', 'whale_1/log.txt'],
34+
]),
2335
});
2436

2537
export default Constants;

0 commit comments

Comments
 (0)