Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #207 from LiskHQ/206-tag-lisk-migrator-v2-0-0
Browse files Browse the repository at this point in the history
Tag Lisk Migrator v2.0.0
  • Loading branch information
sameersubudhi authored Nov 13, 2023
2 parents 6383c3e + a9a7874 commit 8381088
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 22 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The following system requirements are recommended to run Lisk Migrator v2.0.0:

## Setup

Follow our Lisk Documentation guide for [setting up the Lisk migrator](https://lisk.com/documentation/lisk-core/management/migration.html#setting-up-the-lisk-migrator).
Follow our Lisk Documentation guide for [setting up the Lisk migrator](https://lisk.com/documentation/lisk-core/v4/management/migration.html#setting-up-the-lisk-migrator).

### Build Distributions (Linux, Darwin) from source

Expand Down Expand Up @@ -77,10 +77,11 @@ $ export PATH="$PATH:$HOME/lisk-migrator-extract/lisk-migrator/bin"
<!-- usage -->

```sh-session
$ npm install -g lisk-migrator
$ lisk-migrator COMMAND
running command...
$ lisk-migrator (-v|--version|version)
lisk-migrator/2.0.0-rc.4 darwin-arm64 node-v18.16.1
lisk-migrator/2.0.0 darwin-arm64 node-v18.16.1
$ lisk-migrator --help [COMMAND]
USAGE
$ lisk-migrator COMMAND
Expand All @@ -89,6 +90,8 @@ USAGE

<!-- usagestop -->

> **NOTE**: To verify the final results, please run the following command: `cat genesis_block.blob.SHA256` under the output directory and compare the results with other participants on [Discord](https://lisk.chat/).
<!-- commands -->

# Command Topics
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lisk-migrator",
"version": "2.0.0-rc.5",
"version": "2.0.0",
"description": "A command-line tool for migrating the blockchain state to the latest protocol after a hard fork",
"author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>",
"license": "Apache-2.0",
Expand Down
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export const FILE_NAME = {
COMMANDS_TO_EXEC: 'commandsToExecute.txt',
FORGING_STATUS: 'forgingStatus.json',
KEYS: 'keys.json',
GENESIS_ASSETS: 'genesis_assets.json',
GENESIS_BLOCK_JSON: 'genesis_block.json',
GENESIS_BLOCK_BLOB: 'genesis_block.blob',
};

export const enum ERROR_CODE {
Expand Down
34 changes: 24 additions & 10 deletions src/utils/genesis_block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import path from 'path';
import { Command } from '@oclif/command';

import { BlockHeader } from '@liskhq/lisk-chain';
import { ERROR_CODE, SNAPSHOT_TIME_GAP } from '../constants';
import { ERROR_CODE, FILE_NAME, SNAPSHOT_TIME_GAP } from '../constants';
import { GenesisAssetEntry } from '../types';
import { execAsync } from './process';
import { copyFile, createTarball } from './fs';
Expand Down Expand Up @@ -84,7 +84,7 @@ export const writeGenesisAssets = async (
genesisAssets: GenesisAssetEntry[],
outputDir: string,
): Promise<void> => {
const genesisAssetsJsonFilepath = path.resolve(outputDir, 'genesis_assets.json');
const genesisAssetsJsonFilepath = path.resolve(outputDir, FILE_NAME.GENESIS_ASSETS);
fs.writeFileSync(
genesisAssetsJsonFilepath,
JSON.stringify({ assets: genesisAssets }, null, '\t'),
Expand All @@ -97,21 +97,35 @@ export const copyGenesisBlock = async (
): Promise<boolean | Error> => copyFile(currGenesisBlockFilepath, liskCoreV4ConfigPath);

export const writeGenesisBlock = async (outputDir: string): Promise<void> => {
const genesisBlockJsonFilepath = path.resolve(outputDir, 'genesis_block.json');
await createTarball(genesisBlockJsonFilepath, outputDir);
// Genesis BLOB handling
const genesisBlockBlobFilepath = path.resolve(outputDir, FILE_NAME.GENESIS_BLOCK_BLOB);

const genesisBlockBlobHash = await createChecksum(genesisBlockBlobFilepath);
fs.writeFileSync(
path.resolve(outputDir, `${FILE_NAME.GENESIS_BLOCK_BLOB}.SHA256`),
genesisBlockBlobHash,
);

const genesisBlockBlobFilepath = path.resolve(outputDir, 'genesis_block.blob');
await createTarball(genesisBlockBlobFilepath, outputDir);
const genesisBlockBlobTarballHash = await createChecksum(`${genesisBlockBlobFilepath}.tar.gz`);
fs.writeFileSync(
path.resolve(outputDir, `${FILE_NAME.GENESIS_BLOCK_BLOB}.tar.gz.SHA256`),
genesisBlockBlobTarballHash,
);

// Genesis JSON handling
const genesisBlockJsonFilepath = path.resolve(outputDir, FILE_NAME.GENESIS_BLOCK_JSON);

const genesisBlockJsonHash = await createChecksum(`${genesisBlockJsonFilepath}.tar.gz`);
const genesisBlockJsonHash = await createChecksum(genesisBlockJsonFilepath);
fs.writeFileSync(
path.resolve(outputDir, 'genesis_block.json.tar.gz.SHA256'),
path.resolve(outputDir, `${FILE_NAME.GENESIS_BLOCK_JSON}.SHA256`),
genesisBlockJsonHash,
);

const genesisBlockBlobHash = await createChecksum(`${genesisBlockBlobFilepath}.tar.gz`);
await createTarball(genesisBlockJsonFilepath, outputDir);
const genesisBlockJsonTarBallHash = await createChecksum(`${genesisBlockJsonFilepath}.tar.gz`);
fs.writeFileSync(
path.resolve(outputDir, 'genesis_block.blob.tar.gz.SHA256'),
genesisBlockBlobHash,
path.resolve(outputDir, `${FILE_NAME.GENESIS_BLOCK_JSON}.tar.gz.SHA256`),
genesisBlockJsonTarBallHash,
);
};
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1280,9 +1280,9 @@
minipass "^4.0.0"

"@types/tar@^6.1.4":
version "6.1.8"
resolved "https://registry.yarnpkg.com/@types/tar/-/tar-6.1.8.tgz#1432a625a86705788989a9d09cb6893b51e0f33f"
integrity sha512-p8Rc0vas9n+7cv0JiSdUMHiL42gOflrj3v0RMSbe8x5lauEygCEFpS0B/Rw9ZI62qrxlsvZqTggIEIas2gBQrA==
version "6.1.9"
resolved "https://registry.yarnpkg.com/@types/tar/-/tar-6.1.9.tgz#1f8f7033494224e61b97895070fafcdd6ec370f3"
integrity sha512-T3+O+OQd9cdGmOXuKQY9+B0ceZHRlGVPQ7M5QZqkaPyP/vWnxPXM2aCegq8GP/n1n9dBfq2EBUqCSKKjQAVOPA==
dependencies:
"@types/node" "*"
minipass "^4.0.0"
Expand Down Expand Up @@ -2666,9 +2666,9 @@ ed2curve@0.3.0:
tweetnacl "1.x.x"

electron-to-chromium@^1.4.535:
version "1.4.580"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.580.tgz#2f8f70f70733a6be1fb6f31de1224e6dc4bb196d"
integrity sha512-T5q3pjQon853xxxHUq3ZP68ZpvJHuSMY2+BZaW3QzjS4HvNuvsMmZ/+lU+nCrftre1jFZ+OSlExynXWBihnXzw==
version "1.4.581"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.581.tgz#23b684c67bf56d4284e95598c05a5d266653b6d8"
integrity sha512-6uhqWBIapTJUxgPTCHH9sqdbxIMPt7oXl0VcAL1kOtlU6aECdcMncCrX5Z7sHQ/invtrC9jUQUef7+HhO8vVFw==

emittery@^0.8.1:
version "0.8.1"
Expand Down Expand Up @@ -3302,9 +3302,9 @@ find-versions@^4.0.0:
semver-regex "^3.1.2"

flat-cache@^3.0.4:
version "3.1.1"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.1.1.tgz#a02a15fdec25a8f844ff7cc658f03dd99eb4609b"
integrity sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==
version "3.2.0"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee"
integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==
dependencies:
flatted "^3.2.9"
keyv "^4.5.3"
Expand Down

0 comments on commit 8381088

Please sign in to comment.