diff --git a/docs/migration.md b/docs/migration.md index 3a7bef3b..fd54930e 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -78,18 +78,27 @@ The Lisk Migrator v2 also allows users to download and start the Lisk Core v4.x USAGE $ lisk-migrator [-d ] [-m ] [-c ] [-o ] [-p ] [-p ] [--snapshot-time-gap ] [--auto-migrate-config] [--auto-start-lisk-core-v4] [--snapshot-path] [--network] -FLAGS - -c, --config=config Custom configuration file path. - -d, --lisk-core-v3-data-path=lisk-core-v3-data-path Path where the lisk-core v3.x instance is running. Current home directory will be considered the default if not provided. - -h, --help Shows CLI help. - -o, --output=output File path to write the genesis block json. If not provided, it will default to cwd/genesis_block.json. - -p, --page-size Maximum number of blocks to be iterated at once for computation. Default to 100000. - -s, --snapshot-height=snapshot-height (Required) The height at which the re-genesis block will be generated. Can be specified with the SNAPSHOT_HEIGHT as well. - -v, --version Shows the CLI version. - --auto-migrate-config Migrate user configuration automatically. Default to false. - --auto-start-lisk-core-v4 Start lisk-core v4 automatically. Default to false. - --snapshot-path Path where the state snapshot is available. - --network Network for the migration. +OPTIONS + -c, --config=config Custom configuration file path for Lisk Core v3.1.x. + -d, --lisk-core-v3-data-path=lisk-core-v3-data-path Path where the Lisk Core v3.x instance is running. When not supplied, defaults to the default data directory for Lisk Core. + -h, --help show CLI help + -n, --network=network Network to be considered for the migration. Only necessary when the snapshot-path flag is used. + + -o, --output=output File path to write the genesis block. If not provided, it will default to cwd/output/{v3_networkIdentifier}/genesis_block.blob. Do not use any value + starting with the default data path reserved for Lisk Core: '~/.lisk/lisk-core'. + + -p, --page-size=page-size [default: 100000] Maximum number of blocks to be iterated at once for computation. Defaults to 100000. + + -s, --snapshot-height=snapshot-height (required) The height at which re-genesis block will be generated. Can be specified with SNAPSHOT_HEIGHT as well. + + -v, --version show CLI version + + --auto-migrate-config Migrate user configuration automatically. Defaults to false. + + --auto-start-lisk-core-v4 Start Lisk Core v4 automatically. Defaults to false. When using this flag, kindly open another terminal window to stop Lisk Core v3.1.x for when the + migrator prompts. + + --snapshot-path=snapshot-path Path to the state snapshot. It could point either to a directory containing the snapshot files or a tarball (tar.gz). EXAMPLES lisk-migrator --snapshot-height 20931763 --lisk-core-path /path/to/data-dir diff --git a/src/index.ts b/src/index.ts index e3d65621..35c0064a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -77,7 +77,6 @@ class LiskMigrator extends Command { public static description = 'Migrate Lisk Core to latest version'; public static flags = { - // add --version flag to show CLI version version: flagsParser.version({ char: 'v' }), help: flagsParser.help({ char: 'h' }), @@ -124,18 +123,20 @@ class LiskMigrator extends Command { description: 'Maximum number of blocks to be iterated at once for computation. Defaults to 100000.', }), - network: flagsParser.string({ - char: 'n', - required: false, - env: 'NETWORK', - description: 'Network for the migration.', - }), 'snapshot-path': flagsParser.string({ required: false, env: 'SNAPSHOT_PATH', - description: 'Path where the state snapshot is available.', + description: + 'Path to the state snapshot. It could point either to a directory containing the snapshot files or a tarball (tar.gz).', dependsOn: ['network'], }), + network: flagsParser.string({ + char: 'n', + required: false, + env: 'NETWORK', + description: + 'Network to be considered for the migration. Only necessary when the snapshot-path flag is used.', + }), }; public async run(): Promise { @@ -177,7 +178,7 @@ class LiskMigrator extends Command { cli.action.start('Verifying if backup height from node config matches snapshot height'); if (snapshotHeight !== nodeInfo.backup.height) { this.error( - `Lisk Core v3 backup height (${nodeInfo.backup.height}) does not match the expected snapshot height (${snapshotHeight}).`, + `Lisk Core v3 backup height mismatch. Actual: ${nodeInfo.backup.height}, Expected: ${snapshotHeight}.`, ); } cli.action.stop('Snapshot height matches backup height'); @@ -214,7 +215,7 @@ class LiskMigrator extends Command { // Using 'gt' instead of 'gte' because the behavior is swapped // i.e. 'gt' acts as 'gte' and vice-versa - if (semver.gt(`${MIN_SUPPORTED_LISK_CORE_VERSION}-rc.0`, appVersion)) { + if (semver.gt(MIN_SUPPORTED_LISK_CORE_VERSION, appVersion)) { this.error( `Lisk Migrator is not compatible with Lisk Core version ${appVersion}. Minimum supported version is ${MIN_SUPPORTED_LISK_CORE_VERSION}.`, );