From 21ca7a3787c3e99d83d32a3ee1e9e7bc8e24c510 Mon Sep 17 00:00:00 2001 From: Sameer Kumar Subudhi Date: Wed, 1 Nov 2023 11:35:04 +0100 Subject: [PATCH 1/3] :hammer: Update flag exclusions for 'network' flag --- docs/migration.md | 2 +- src/index.ts | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/migration.md b/docs/migration.md index 563b166c..e3b07f03 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -96,7 +96,7 @@ OPTIONS --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 Local filepath to the state snapshot to run the migration offline. It could point either to a directory or a tarball (tar.gz). + --snapshot-path=snapshot-path Local filepath to the state snapshot to run the migration offline. It could either point to a directory or a tarball (tar.gz). --snapshot-url=snapshot-url URL to download the state snapshot from. Use to run the migration offline. URL must end with tar.gz. diff --git a/src/index.ts b/src/index.ts index 29088bce..32867721 100644 --- a/src/index.ts +++ b/src/index.ts @@ -91,11 +91,6 @@ class LiskMigrator extends Command { description: 'Path where the Lisk Core v3.x instance is running. When not supplied, defaults to the default data directory for Lisk Core.', }), - config: flagsParser.string({ - char: 'c', - required: false, - description: 'Custom configuration file path for Lisk Core v3.1.x.', - }), 'snapshot-height': flagsParser.integer({ char: 's', required: true, @@ -103,6 +98,11 @@ class LiskMigrator extends Command { description: 'The height at which re-genesis block will be generated. Can be specified with SNAPSHOT_HEIGHT as well.', }), + config: flagsParser.string({ + char: 'c', + required: false, + description: 'Custom configuration file path for Lisk Core v3.1.x.', + }), 'auto-migrate-config': flagsParser.boolean({ required: false, env: 'AUTO_MIGRATE_CONFIG', @@ -127,7 +127,7 @@ class LiskMigrator extends Command { required: false, env: 'SNAPSHOT_PATH', description: - 'Local filepath to the state snapshot to run the migration offline. It could point either to a directory or a tarball (tar.gz).', + 'Local filepath to the state snapshot to run the migration offline. It could either point to a directory or a tarball (tar.gz).', dependsOn: ['network'], exclusive: ['snapshot-url'], }), @@ -146,6 +146,12 @@ class LiskMigrator extends Command { description: "Network to be considered for the migration. Depends on the '--snapshot-path' flag.", options: ['mainnet', 'testnet'], + exclusive: [ + 'lisk-core-v3-data-path', + 'config', + 'auto-migrate-config', + 'auto-start-lisk-core-v4', + ], }), }; From 918044918add79dd36cca4cab9462c257541c9d5 Mon Sep 17 00:00:00 2001 From: Sameer Kumar Subudhi Date: Wed, 1 Nov 2023 11:36:39 +0100 Subject: [PATCH 2/3] :hammer: Fix oclif config to include the 'config' directory in the binary builds --- package.json | 3 ++- src/utils/node.ts | 6 +++--- test/unit/utils/node.spec.ts | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 07f451c9..9245e222 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "/npm-shrinkwrap.json", "/oclif.manifest.json", "/dist", - "/docs" + "/docs", + "/config" ], "dependencies": { "@liskhq/lisk-api-client": "5.2.0", diff --git a/src/utils/node.ts b/src/utils/node.ts index 533ad19b..6d3a3fdd 100644 --- a/src/utils/node.ts +++ b/src/utils/node.ts @@ -100,8 +100,8 @@ const copyLegacyDB = async (_this: Command) => { export const getFinalConfigPath = async (outputDir: string, network: string) => (await exists(`${outputDir}/config.json`)) - ? outputDir - : path.resolve(__dirname, '../..', 'config', network); + ? path.resolve(outputDir, 'config.json') + : path.resolve(__dirname, '../..', 'config', network, 'config.json'); export const validateStartCommandFlags = async ( allowedFlags: string[], @@ -149,7 +149,7 @@ const resolveLiskCoreStartCommand = async (_this: Command, network: string, conf const baseStartCommand = `lisk-core start --network ${network}`; if (!isUserConfirmed) { - const defaultStartCommand = `${baseStartCommand} --config ${configPath}/config.json`; + const defaultStartCommand = `${baseStartCommand} --config ${configPath}`; liskCoreStartCommand = defaultStartCommand; return defaultStartCommand; } diff --git a/test/unit/utils/node.spec.ts b/test/unit/utils/node.spec.ts index 0df150ff..53c9ac59 100644 --- a/test/unit/utils/node.spec.ts +++ b/test/unit/utils/node.spec.ts @@ -143,7 +143,7 @@ describe('Test getFinalConfigPath method', () => { const outputDir = join(__dirname, '../../..', 'test/unit/fixtures/outputDir'); const configPath = await getFinalConfigPath(outputDir, network); - const expectedResponse = join(__dirname, '../../..', 'config/mainnet'); + const expectedResponse = join(__dirname, '../../..', 'config/mainnet/config.json'); expect(configPath).toBe(expectedResponse); }); @@ -151,7 +151,7 @@ describe('Test getFinalConfigPath method', () => { const outputDir = join(__dirname, '../../..', 'config'); const configPath = await getFinalConfigPath(outputDir, network); - const expectedResponse = join(__dirname, '../../..', 'config/mainnet'); + const expectedResponse = join(__dirname, '../../..', 'config/mainnet/config.json'); expect(configPath).toBe(expectedResponse); }); }); From 926ac70e3e284a7a8630a59f6d136c82ffceec71 Mon Sep 17 00:00:00 2001 From: Sameer Kumar Subudhi Date: Wed, 1 Nov 2023 12:07:55 +0100 Subject: [PATCH 3/3] :arrow_up: Bump migrator version to 2.0.0-rc.5 --- package.json | 2 +- yarn.lock | 60 +++++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 9245e222..1e1b4dcb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lisk-migrator", - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.5", "description": "A command-line tool for migrating the blockchain state to the latest protocol after a hard fork", "author": "Lisk Foundation , lightcurve GmbH ", "license": "Apache-2.0", diff --git a/yarn.lock b/yarn.lock index 0c9c234a..43764a86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1180,9 +1180,9 @@ "@types/jest" "*" "@types/jest@*": - version "29.5.6" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.6.tgz#f4cf7ef1b5b0bfc1aa744e41b24d9cc52533130b" - integrity sha512-/t9NnzkOpXb4Nfvg17ieHE6EeSjDS2SGSpNYfoLbUAeL/EOueU/RSdOWFpfQTXBEM7BguYW1XQ0EbM+6RlIh6w== + version "29.5.7" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.7.tgz#2c0dafe2715dd958a455bc10e2ec3e1ec47b5036" + integrity sha512-HLyetab6KVPSiF+7pFcUyMeLsx25LDNDemw9mGsJBkai/oouwrjTycocSDYopMEwFhN2Y4s9oPyOCZNofgSt2g== dependencies: expect "^29.0.0" pretty-format "^29.0.0" @@ -1223,11 +1223,11 @@ integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== "@types/node@*": - version "20.8.8" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.8.tgz#adee050b422061ad5255fc38ff71b2bb96ea2a0e" - integrity sha512-YRsdVxq6OaLfmR9Hy816IMp33xOBjfyOgUd77ehqg96CFywxAPbDbXvAsuN2KVg2HOT8Eh6uAfU+l4WffwPVrQ== + version "20.8.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.10.tgz#a5448b895c753ae929c26ce85cab557c6d4a365e" + integrity sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w== dependencies: - undici-types "~5.25.1" + undici-types "~5.26.4" "@types/node@11.11.6": version "11.11.6" @@ -1240,9 +1240,11 @@ integrity sha512-O+x6uIpa6oMNTkPuHDa9MhMMehlxLAd5QcOvKRjAFsBVpeFWTOPnXbDvILvFgFFZfQ1xh1EZi1FbXxUix+zpsQ== "@types/node@^16 || ^18": - version "18.18.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.6.tgz#26da694f75cdb057750f49d099da5e3f3824cb3e" - integrity sha512-wf3Vz+jCmOQ2HV1YUJuCWdL64adYxumkrxtc+H1VUQlnQI04+5HtH+qZCOE21lBE7gIrt+CwX2Wv8Acrw5Ak6w== + version "18.18.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.8.tgz#2b285361f2357c8c8578ec86b5d097c7f464cfd6" + integrity sha512-OLGBaaK5V3VRBS1bAkMVP2/W9B+H8meUfl866OrMNQqt7wDgdpWPp5o6gmIc9pB+lIQHSq4ZL8ypeH1vPxcPaQ== + dependencies: + undici-types "~5.26.4" "@types/parse-json@^4.0.0": version "4.0.1" @@ -1587,9 +1589,9 @@ acorn-walk@^7.1.1: integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== acorn-walk@^8.1.1: - version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + version "8.3.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.0.tgz#2097665af50fd0cf7a2dfccd2b9368964e66540f" + integrity sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA== acorn@^7.1.1, acorn@^7.4.0: version "7.4.1" @@ -1597,9 +1599,9 @@ acorn@^7.1.1, acorn@^7.4.0: integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== acorn@^8.2.4, acorn@^8.4.1, acorn@^8.9.0: - version "8.10.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" - integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== + version "8.11.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" + integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== agent-base@6, agent-base@^6.0.2: version "6.0.2" @@ -2081,9 +2083,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001541: - version "1.0.30001553" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001553.tgz#e64e7dc8fd4885cd246bb476471420beb5e474b5" - integrity sha512-N0ttd6TrFfuqKNi+pMgWJTb9qrdJu4JSpgPFLe/lrD19ugC6fZgF0pUewRowDwzdDnb9V41mFcdlYgl/PyKf4A== + version "1.0.30001559" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz#95a982440d3d314c471db68d02664fb7536c5a30" + integrity sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA== cardinal@^2.1.1: version "2.1.1" @@ -2662,9 +2664,9 @@ ed2curve@0.3.0: tweetnacl "1.x.x" electron-to-chromium@^1.4.535: - version "1.4.565" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.565.tgz#205f3746a759ec3c43bce98b9eef5445f2721ea9" - integrity sha512-XbMoT6yIvg2xzcbs5hCADi0dXBh4//En3oFXmtPX+jiyyiCTiM9DGFT2SLottjpEs9Z8Mh8SqahbR96MaHfuSg== + version "1.4.572" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.572.tgz#ed9876658998138fe9e3aa47ecfa0bf914192a86" + integrity sha512-RlFobl4D3ieetbnR+2EpxdzFl9h0RAJkPK3pfiwMug2nhBin2ZCsGIAJWdpNniLz43sgXam/CgipOmvTA+rUiA== emittery@^0.8.1: version "0.8.1" @@ -5830,9 +5832,9 @@ pump@^3.0.0: once "^1.3.1" punycode@^2.1.0, punycode@^2.1.1: - version "2.3.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" - integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== qqjs@^0.3.10: version "0.3.11" @@ -6948,10 +6950,10 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici-types@~5.25.1: - version "5.25.3" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.25.3.tgz#e044115914c85f0bcbb229f346ab739f064998c3" - integrity sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA== +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== unique-filename@^1.1.1: version "1.1.1"