Skip to content

Commit

Permalink
Discontinue the chain after the snapshot height finalizes (#926)
Browse files Browse the repository at this point in the history
* 📦 Update dependencies

* 🔨 Shutdown node after backup height finalization

* ⬆️ Bump version

* 👌 Apply review suggestions
  • Loading branch information
sameersubudhi committed May 7, 2024
1 parent 52dc9b3 commit 70ff52f
Show file tree
Hide file tree
Showing 24 changed files with 294 additions and 172 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $ npm install -g lisk-core
$ lisk-core COMMAND
running command...
$ lisk-core (-v|--version|version)
lisk-core/4.0.5 darwin-arm64 node-v18.20.2
lisk-core/4.0.6 darwin-arm64 node-v18.20.2
$ lisk-core --help [COMMAND]
USAGE
$ lisk-core COMMAND
Expand Down
12 changes: 10 additions & 2 deletions config/mainnet/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
"logLevel": "info",
"keepEventsForHeights": 300,
"keepInclusionProofsForHeights": 300,
"inclusionProofKeys": []
"inclusionProofKeys": [],
"backup": {
"height": 24823618
}
},
"rpc": {
"modes": ["ipc", "ws"],
"port": 7887,
"host": "127.0.0.1",
"allowedMethods": []
"allowedMethods": [
"system_getMetadata",
"system_getSchema",
"system_getNodeInfo",
"pos_getConstants"
]
},
"genesis": {
"block": {
Expand Down
12 changes: 6 additions & 6 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Run a "lisk-core" container against the mainnet:
docker run --volume lisk-data:/home/lisk/.lisk \
--publish 7667:7667 \
--name lisk-core \
lisk/core:4.0.5 \
lisk/core:4.0.6 \
start --network=mainnet
```

Expand All @@ -25,7 +25,7 @@ docker run --volume lisk-data:/home/lisk/.lisk \
--publish 7667:7667 \
--publish 127.0.0.1:7887:7887 \
--name lisk-core \
lisk/core:4.0.5 \
lisk/core:4.0.6 \
start --network=mainnet --api-ws --api-http --log=debug
```

Expand All @@ -36,7 +36,7 @@ docker run --volume lisk-data:/home/lisk/.lisk \
--publish 7667:7667 \
--env LISK_LOG_LEVEL=debug \
--name lisk-core \
lisk/core:4.0.5 \
lisk/core:4.0.6 \
start --network=mainnet
```

Expand All @@ -45,11 +45,11 @@ See https://lisk.com/documentation/lisk-core/management/configuration.html for a
## Import blockchain snapshot

```
docker run --volume lisk-data:/home/lisk/.lisk -it --rm lisk/core:4.0.5 blockchain:download --network=mainnet --output=/home/lisk/.lisk/tmp/
docker run --volume lisk-data:/home/lisk/.lisk -it --rm lisk/core:4.0.6 blockchain:download --network=mainnet --output=/home/lisk/.lisk/tmp/
docker run --volume lisk-data:/home/lisk/.lisk -it --rm lisk/core:4.0.5 blockchain:import /home/lisk/.lisk/tmp/blockchain.db.tar.gz
docker run --volume lisk-data:/home/lisk/.lisk -it --rm lisk/core:4.0.6 blockchain:import /home/lisk/.lisk/tmp/blockchain.db.tar.gz
docker run --volume lisk-data:/home/lisk/.lisk -it --rm --entrypoint rm lisk/core:4.0.5 -f /home/lisk/.lisk/tmp/blockchain.db.tar.gz
docker run --volume lisk-data:/home/lisk/.lisk -it --rm --entrypoint rm lisk/core:4.0.6 -f /home/lisk/.lisk/tmp/blockchain.db.tar.gz
docker start lisk-core
Expand Down
2 changes: 1 addition & 1 deletion docs/antora/modules/ROOT/pages/core-cli.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Displays a summary of all available CLI commands of Lisk Core.
Lisk blockchain application platform
VERSION
lisk-core/4.0.5 darwin-arm64 node-v18.20.2
lisk-core/4.0.6 darwin-arm64 node-v18.20.2
USAGE
$ lisk-core [COMMAND]
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ EXAMPLES
block:get 2
```

_See code: [dist/commands/block/get.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/block/get.ts)_
_See code: [dist/commands/block/get.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/block/get.ts)_
10 changes: 5 additions & 5 deletions docs/commands/blockchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ EXAMPLES
download --url https://snapshots.lisk.com/mainnet/blockchain.db.tar.gz --output ./downloads
```

_See code: [dist/commands/blockchain/download.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/blockchain/download.ts)_
_See code: [dist/commands/blockchain/download.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/blockchain/download.ts)_

## `lisk-core blockchain:export`

Expand All @@ -53,7 +53,7 @@ EXAMPLES
blockchain:export --data-path ./data --output ./my/path/
```

_See code: [dist/commands/blockchain/export.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/blockchain/export.ts)_
_See code: [dist/commands/blockchain/export.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/blockchain/export.ts)_

## `lisk-core blockchain:hash`

Expand All @@ -72,7 +72,7 @@ EXAMPLES
blockchain:hash --data-path ./data
```

_See code: [dist/commands/blockchain/hash.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/blockchain/hash.ts)_
_See code: [dist/commands/blockchain/hash.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/blockchain/hash.ts)_

## `lisk-core blockchain:import FILEPATH`

Expand All @@ -97,7 +97,7 @@ EXAMPLES
blockchain:import ./path/to/blockchain.tar.gz --data-path ./lisk/ --force
```

_See code: [dist/commands/blockchain/import.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/blockchain/import.ts)_
_See code: [dist/commands/blockchain/import.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/blockchain/import.ts)_

## `lisk-core blockchain:reset`

Expand All @@ -119,4 +119,4 @@ EXAMPLES
blockchain:reset --yes
```

_See code: [dist/commands/blockchain/reset.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/blockchain/reset.ts)_
_See code: [dist/commands/blockchain/reset.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/blockchain/reset.ts)_
4 changes: 2 additions & 2 deletions docs/commands/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ EXAMPLES
config:create --output mydir --label beta-sdk-app --community-identifier sdk
```

_See code: [dist/commands/config/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/config/create.ts)_
_See code: [dist/commands/config/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/config/create.ts)_

## `lisk-core config:show`

Expand All @@ -51,4 +51,4 @@ EXAMPLES
config:show --config ./custom-config.json --data-path ./data
```

_See code: [dist/commands/config/show.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/config/show.ts)_
_See code: [dist/commands/config/show.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/config/show.ts)_
2 changes: 1 addition & 1 deletion docs/commands/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ EXAMPLES
console --api-ipc=/path/to/server
```

_See code: [dist/commands/console.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/console.ts)_
_See code: [dist/commands/console.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/console.ts)_
4 changes: 2 additions & 2 deletions docs/commands/endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ EXAMPLES
endpoint:invoke consensus_getBFTParameters -f ./input.json
```

_See code: [dist/commands/endpoint/invoke.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/endpoint/invoke.ts)_
_See code: [dist/commands/endpoint/invoke.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/endpoint/invoke.ts)_

## `lisk-core endpoint:list [ENDPOINT]`

Expand Down Expand Up @@ -68,4 +68,4 @@ EXAMPLES
endpoint:list getBalances -m token -d ~/.lisk/pos-mainchain
```

_See code: [dist/commands/endpoint/list.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/endpoint/list.ts)_
_See code: [dist/commands/endpoint/list.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/endpoint/list.ts)_
10 changes: 5 additions & 5 deletions docs/commands/generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ EXAMPLES
generator:disable lskycz7hvr8yfu74bcwxy2n4mopfmjancgdvxq8xz --data-path ./data --password your_password
```

_See code: [dist/commands/generator/disable.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/generator/disable.ts)_
_See code: [dist/commands/generator/disable.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/generator/disable.ts)_

## `lisk-core generator:enable ADDRESS`

Expand Down Expand Up @@ -80,7 +80,7 @@ EXAMPLES
--max-height-prevoted=10 --data-path ./data --password your_password
```

_See code: [dist/commands/generator/enable.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/generator/enable.ts)_
_See code: [dist/commands/generator/enable.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/generator/enable.ts)_

## `lisk-core generator:export`

Expand All @@ -104,7 +104,7 @@ EXAMPLES
generator:export --output /mypath/generator_info.json --data-path ./data
```

_See code: [dist/commands/generator/export.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/generator/export.ts)_
_See code: [dist/commands/generator/export.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/generator/export.ts)_

## `lisk-core generator:import`

Expand All @@ -127,7 +127,7 @@ EXAMPLES
generator:import --file-path ./my/path/genInfo.json --data-path ./data
```

_See code: [dist/commands/generator/import.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/generator/import.ts)_
_See code: [dist/commands/generator/import.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/generator/import.ts)_

## `lisk-core generator:status`

Expand All @@ -148,4 +148,4 @@ EXAMPLES
generator:status --data-path ./sample --pretty
```

_See code: [dist/commands/generator/status.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/generator/status.ts)_
_See code: [dist/commands/generator/status.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/generator/status.ts)_
4 changes: 2 additions & 2 deletions docs/commands/genesis-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ EXAMPLES
085d7c9b7bddc8052be9eefe185f407682a495f1b4498677df1480026b74f2e9
```

_See code: [dist/commands/genesis-block/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/genesis-block/create.ts)_
_See code: [dist/commands/genesis-block/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/genesis-block/create.ts)_

## `lisk-core genesis-block:download`

Expand All @@ -66,4 +66,4 @@ EXAMPLES
genesis-block:download --url http://mydomain.com/genesis_block.blob.tar.gz --data-path ./lisk/ --force
```

_See code: [dist/commands/genesis-block/download.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/genesis-block/download.ts)_
_See code: [dist/commands/genesis-block/download.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/genesis-block/download.ts)_
2 changes: 1 addition & 1 deletion docs/commands/hash-onion.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ EXAMPLES
hash-onion --count=1000000 --distance=2000 --output ~/my_onion.json
```

_See code: [dist/commands/hash-onion.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/hash-onion.ts)_
_See code: [dist/commands/hash-onion.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/hash-onion.ts)_
8 changes: 4 additions & 4 deletions docs/commands/keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ EXAMPLES
/mypath/keys.json
```

_See code: [dist/commands/keys/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/keys/create.ts)_
_See code: [dist/commands/keys/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/keys/create.ts)_

## `lisk-core keys:encrypt`

Expand All @@ -71,7 +71,7 @@ EXAMPLES
keys:encrypt --file-path ./my/path/keys.json --password mypass
```

_See code: [dist/commands/keys/encrypt.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/keys/encrypt.ts)_
_See code: [dist/commands/keys/encrypt.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/keys/encrypt.ts)_

## `lisk-core keys:export`

Expand All @@ -94,7 +94,7 @@ EXAMPLES
keys:export --output /mypath/keys.json --data-path ./data
```

_See code: [dist/commands/keys/export.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/keys/export.ts)_
_See code: [dist/commands/keys/export.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/keys/export.ts)_

## `lisk-core keys:import`

Expand All @@ -117,4 +117,4 @@ EXAMPLES
keys:import --file-path ./my/path/keys.json --data-path ./data
```

_See code: [dist/commands/keys/import.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/keys/import.ts)_
_See code: [dist/commands/keys/import.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/keys/import.ts)_
6 changes: 3 additions & 3 deletions docs/commands/passphrase.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ EXAMPLES
passphrase:create --output /mypath/passphrase.json
```

_See code: [dist/commands/passphrase/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/passphrase/create.ts)_
_See code: [dist/commands/passphrase/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/passphrase/create.ts)_

## `lisk-core passphrase:decrypt`

Expand All @@ -46,7 +46,7 @@ EXAMPLES
passphrase:decrypt --file-path ./my/path/output.json --password your-password
```

_See code: [dist/commands/passphrase/decrypt.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/passphrase/decrypt.ts)_
_See code: [dist/commands/passphrase/decrypt.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/passphrase/decrypt.ts)_

## `lisk-core passphrase:encrypt`

Expand Down Expand Up @@ -81,4 +81,4 @@ EXAMPLES
passphrase:encrypt --output-public-key --output /mypath/keys.json
```

_See code: [dist/commands/passphrase/encrypt.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/passphrase/encrypt.ts)_
_See code: [dist/commands/passphrase/encrypt.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/passphrase/encrypt.ts)_
2 changes: 1 addition & 1 deletion docs/commands/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ EXAMPLE
sdk:link /path/to/lisk-sdk/sdk
```

_See code: [dist/commands/sdk/link.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/sdk/link.ts)_
_See code: [dist/commands/sdk/link.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/sdk/link.ts)_
2 changes: 1 addition & 1 deletion docs/commands/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ EXAMPLES
start --network testnet --config ~/my_custom_config.json
```

_See code: [dist/commands/start.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/start.ts)_
_See code: [dist/commands/start.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/start.ts)_
4 changes: 2 additions & 2 deletions docs/commands/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ EXAMPLES
system:metadata --data-path ./lisk
```

_See code: [dist/commands/system/metadata.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/system/metadata.ts)_
_See code: [dist/commands/system/metadata.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/system/metadata.ts)_

## `lisk-core system:node-info`

Expand All @@ -46,4 +46,4 @@ EXAMPLES
system:node-info --data-path ./lisk
```

_See code: [dist/commands/system/node-info.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/system/node-info.ts)_
_See code: [dist/commands/system/node-info.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/system/node-info.ts)_
8 changes: 4 additions & 4 deletions docs/commands/transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ EXAMPLES
transaction:create token transfer 100000000 --file=/txn_params.json --json
```

_See code: [dist/commands/transaction/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/transaction/create.ts)_
_See code: [dist/commands/transaction/create.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/transaction/create.ts)_

## `lisk-core transaction:get ID`

Expand All @@ -93,7 +93,7 @@ EXAMPLE
transaction:get eab06c6a22e88bca7150e0347a7d976acd070cb9284423e6eabecd657acc1263
```

_See code: [dist/commands/transaction/get.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/transaction/get.ts)_
_See code: [dist/commands/transaction/get.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/transaction/get.ts)_

## `lisk-core transaction:send TRANSACTION`

Expand All @@ -118,7 +118,7 @@ EXAMPLE
2cea39d58aa84809aa87bcfe6feaac46211c80472ad9297fd87727709f5d7e7b4134caf106b02
```

_See code: [dist/commands/transaction/send.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/transaction/send.ts)_
_See code: [dist/commands/transaction/send.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/transaction/send.ts)_

## `lisk-core transaction:sign TRANSACTION`

Expand Down Expand Up @@ -161,4 +161,4 @@ EXAMPLES
transaction:sign <hex-encoded-binary-transaction> --network testnet
```

_See code: [dist/commands/transaction/sign.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.5/dist/commands/transaction/sign.ts)_
_See code: [dist/commands/transaction/sign.ts](https://github.com/LiskHQ/lisk-core/blob/v4.0.6/dist/commands/transaction/sign.ts)_
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lisk-core",
"version": "4.0.5",
"version": "4.0.6",
"description": "Lisk blockchain application platform",
"author": "Lisk Foundation <admin@lisk.com>, lightcurve GmbH <admin@lightcurve.io>",
"license": "Apache-2.0",
Expand Down
6 changes: 5 additions & 1 deletion src/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
import { Application, PartialApplicationConfig } from 'lisk-sdk';

import { LegacyModule } from './modules';
import { ShutdownNodePlugin } from './plugins';

export const getApplication = (config: PartialApplicationConfig): Application => {
const { app, method } = Application.defaultApplication(config, true);
const legacyModule = new LegacyModule();

const legacyModule = new LegacyModule();
legacyModule.addDependencies(method.token, method.validator, method.pos);
app.registerModule(legacyModule);

// Important: For the plugin to work, do not load it as a child process
app.registerPlugin(new ShutdownNodePlugin());

return app;
};
15 changes: 15 additions & 0 deletions src/application/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright © 2024 Lisk Foundation
*
* See the LICENSE file at the top-level directory of this distribution
* for licensing information.
*
* Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
* no part of this software, including this file, may be copied, modified,
* propagated, or distributed except according to the terms contained in the
* LICENSE file.
*
* Removal or modification of this copyright notice is prohibited.
*/

export * from './shutdown-node';

0 comments on commit 70ff52f

Please sign in to comment.