Skip to content

Commit

Permalink
Voting Key generation using typescript and multi file support (#177)
Browse files Browse the repository at this point in the history
feat: Native voting key generation
feat: Multi voting file support
feat: Improved link to support multi voting keys
feat: Added updateVotingKeys command
  • Loading branch information
fboucquez authored Jun 15, 2021
1 parent 70af2ae commit 8f889b6
Show file tree
Hide file tree
Showing 40 changed files with 3,308 additions and 1,329 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e
## [1.0.7] - NEXT
**Milestone**: Mainnet(1.0.1.0)

- Added multi voting key file support.
- Added `updateVotingKeys` command.

| Package | Version | Link |
| ---------------- | ------- | ------------------------------------------------------------------ |
| Symbol Bootstrap | v1.0.3 | [symbol-bootstrap](https://www.npmjs.com/package/symbol-bootstrap) |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ General users should install this tool like any other node module.
* [`symbol-bootstrap run`](docs/run.md) - It boots the network via docker using the generated `docker-compose.yml` file and configuration. The config and compose methods/commands need to be called before this method. This is just a wrapper for the `docker-compose up` bash call.
* [`symbol-bootstrap start`](docs/start.md) - Single command that aggregates config, compose and run in one line!
* [`symbol-bootstrap stop`](docs/stop.md) - It stops the docker-compose network if running (symbol-bootstrap started with --detached). This is just a wrapper for the `docker-compose down` bash call.
* [`symbol-bootstrap updateVotingKeys`](docs/updateVotingKeys.md) - It updates the voting files containing the voting keys when required.
* [`symbol-bootstrap verify`](docs/verify.md) - It tests the installed software in the current computer reporting if there is any missing dependency, invalid version, or software related issue.

<!-- commandsstop -->
Expand Down
2 changes: 1 addition & 1 deletion cmds/link-testnet-supernode-external-node.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
symbol-bootstrap link -t target/testnet-supernode --useKnownRestGateways $1 $2 $3 $4 $5 $6 $7
symbol-bootstrap link -t target/testnet-supernode --useKnownRestGateways --password 1111 $1 $2 $3 $4 $5 $6 $7
4 changes: 4 additions & 0 deletions cmds/stop-testnet-supernode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
# docker rm -f $(docker ps -aq)
symbol-bootstrap stop -t target/testnet-supernode
3 changes: 3 additions & 0 deletions cmds/upgradeVotingKeys-testnet-supernode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -e
symbol-bootstrap upgradeVotingKeys -t target/testnet-supernode $1 $2 $3
3 changes: 0 additions & 3 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ OPTIONS
can be provided in the command line (--password=XXXX) or disabled in the
command line (--noPassword).
--pullImages It pulls the utility images from DockerHub when running the configuration.
It only affects alpha/dev docker images.
--report It generates reStructuredText (.rst) reports describing the configuration of
each node.
Expand Down
2 changes: 1 addition & 1 deletion docs/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ OPTIONS
line (--noPassword).
--pullImages
It pulls the utility images from DockerHub when running the configuration. It only affects alpha/dev docker images.
It pulls the images from DockerHub when running the configuration. It only affects alpha/dev docker images.
--report
It generates reStructuredText (.rst) reports describing the configuration of each node.
Expand Down
47 changes: 47 additions & 0 deletions docs/updateVotingKeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
`symbol-bootstrap updateVotingKeys`
===================================

It updates the voting files containing the voting keys when required.

If the node's current voting file has an end epoch close to the current network epoch, this command will create a new 'private_key_treeX.dat' that continues the current file.

By default, bootstrap creates a new voting file once the current file reaches its last month. The current network epoch is resolved from the network or you can provide it with the `finalizationEpoch` param.

When a new voting file is created, Bootstrap will advise running the `link` command again.

* [`symbol-bootstrap updateVotingKeys`](#symbol-bootstrap-updatevotingkeys)

## `symbol-bootstrap updateVotingKeys`

It updates the voting files containing the voting keys when required.

```
USAGE
$ symbol-bootstrap updateVotingKeys
OPTIONS
-h, --help It shows the help of this command.
-t, --target=target [default: target] The target folder where the symbol-bootstrap network is
generated
-u, --user=user [default: current] User used to run docker images when creating the the voting
key files. "current" means the current user.
--finalizationEpoch=finalizationEpoch The network's finalization epoch. It can be retrieved from the /chain/info rest
endpoint. If not provided, the bootstrap known epoch is used.
DESCRIPTION
If the node's current voting file has an end epoch close to the current network epoch, this command will create a new
'private_key_treeX.dat' that continues the current file.
By default, bootstrap creates a new voting file once the current file reaches its last month. The current network
epoch is resolved from the network or you can provide it with the `finalizationEpoch` param.
When a new voting file is created, Bootstrap will advise running the `link` command again.
EXAMPLE
$ symbol-bootstrap updateVotingKeys
```

_See code: [src/commands/updateVotingKeys.ts](https://github.com/nemtech/symbol-bootstrap/blob/v1.0.7/src/commands/updateVotingKeys.ts)_
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"js-yaml": "^3.14.0",
"lodash": "^4.17.21",
"memorystream": "^0.3.1",
"noble-ed25519": "^1.0.3",
"node-forge": "^0.10.0",
"rxjs": "^6.6.3",
"semver": "^7.3.5",
Expand Down Expand Up @@ -100,8 +101,8 @@
"posttest": "eslint src/ test/ --ext .ts",
"oclif-doc": "oclif-dev manifest && oclif-dev readme --multi",
"prepack": "shx rm -rf lib && tsc -b && npm run oclif-doc",
"test": "nyc --reporter=lcov --extension .ts mocha -r ts-node/register --timeout 600000 --forbid-only \"test/**/*.test.ts\"",
"e2e": "nyc --reporter=lcov --extension .ts mocha -r ts-node/register --timeout 600000 --forbid-only \"test/**/*.e2e.ts\"",
"test": "nyc --reporter=lcov --extension .ts mocha -r ts-node/register --timeout 900000 --forbid-only \"test/**/*.test.ts\"",
"e2e": "nyc --reporter=lcov --extension .ts mocha -r ts-node/register --timeout 900000 --forbid-only \"test/**/*.e2e.ts\"",
"coveralls-report": "cat ./coverage/lcov.info | coveralls",
"version": "echo $npm_package_version",
"install-cli": "npm pack && npm i -g",
Expand Down
3 changes: 3 additions & 0 deletions presets/bootstrap/network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ harvestingName: 'harvest'
explorerUrl: http://localhost:90/
faucetUrl: http://localhost:100/
beneficiaryAddress: ''
votingKeyDesiredLifetime: 720
votingKeyDesiredFutureLifetime: 120
lastKnownNetworkEpoch: 1
restExtensions: 'accountLink, aggregate, lockHash, lockSecret, mosaic, metadata, multisig, namespace, receipts, restrictions, transfer'
nemesis:
mosaics:
Expand Down
Loading

0 comments on commit 8f889b6

Please sign in to comment.