From 98610e499900b79481bc088afa4b88a2a0944141 Mon Sep 17 00:00:00 2001 From: wellplay <37444439+edgelang@users.noreply.github.com> Date: Tue, 25 Aug 2020 17:06:47 +0800 Subject: [PATCH] fix ethermintcli->keys add algo flag defValue (#466) * fix ethermintcli->keys add algo flag defValue * fix documentation and scripts Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> --- client/keys.go | 4 ++++ docs/quickstart/run_node.md | 4 ++-- docs/quickstart/testnet.md | 4 ++-- init.sh | 2 +- scripts/integration-test-all.sh | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/client/keys.go b/client/keys.go index 769bafd2..22810e67 100644 --- a/client/keys.go +++ b/client/keys.go @@ -38,6 +38,10 @@ func KeyCommands() *cobra.Command { // update the default signing algorithm value to "eth_secp256k1" algoFlag := addCmd.Flag("algo") algoFlag.DefValue = string(crypto.EthSecp256k1) + err := algoFlag.Value.Set(string(crypto.EthSecp256k1)) + if err != nil { + panic(err) + } addCmd.RunE = runAddCmd cmd.AddCommand( diff --git a/docs/quickstart/run_node.md b/docs/quickstart/run_node.md index 1017eccd..111511e2 100644 --- a/docs/quickstart/run_node.md +++ b/docs/quickstart/run_node.md @@ -47,7 +47,7 @@ ethermintd start To run a node with the same key every time: replace `ethermintcli keys add $KEY` in `./init.sh` with: ```bash -echo "your mnemonic here" | ethermintcli keys add $KEY --recover --algo "eth_secp256k1" +echo "your mnemonic here" | ethermintcli keys add $KEY --recover ``` ::: tip Ethermint currently only supports 24 word mnemonics. @@ -56,7 +56,7 @@ echo "your mnemonic here" | ethermintcli keys add $KEY --recover --algo "eth_sec You can generate a new key/mnemonic with: ```bash -ethermintcli keys add $KEY --algo "eth_secp256k1" +ethermintcli keys add $KEY ``` To export your ethermint key as an ethereum private key (for use with Metamask for example): diff --git a/docs/quickstart/testnet.md b/docs/quickstart/testnet.md index 1f13043a..100c9e1c 100644 --- a/docs/quickstart/testnet.md +++ b/docs/quickstart/testnet.md @@ -57,7 +57,7 @@ minimum-gas-prices = "" ```bash # Create a key to hold your account -ethermintcli keys add $KEY --algo "eth_secp256k1" +ethermintcli keys add $KEY # Add that key into the genesis.app_state.accounts array in the genesis file # NOTE: this command lets you set the number of coins. Make sure this account has some coins @@ -268,7 +268,7 @@ Now that accounts exists, you may create new accounts and send those accounts funds! ::: tip -**Note**: Each node's seed is located at `./build/nodeN/ethermintcli/key_seed.json` and can be restored to the CLI using the `ethermintcli keys add --restore --algo "eth_secp256k1"` command +**Note**: Each node's seed is located at `./build/nodeN/ethermintcli/key_seed.json` and can be restored to the CLI using the `ethermintcli keys add --restore` command ::: ### Special Binaries diff --git a/init.sh b/init.sh index eab16a30..320f3b61 100755 --- a/init.sh +++ b/init.sh @@ -18,7 +18,7 @@ ethermintcli config indent true ethermintcli config trust-node true # if $KEY exists it should be deleted -ethermintcli keys add $KEY --algo "eth_secp256k1" +ethermintcli keys add $KEY # Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) ethermintd init $MONIKER --chain-id $CHAINID diff --git a/scripts/integration-test-all.sh b/scripts/integration-test-all.sh index 0ac3a7dc..c5452229 100755 --- a/scripts/integration-test-all.sh +++ b/scripts/integration-test-all.sh @@ -74,7 +74,7 @@ arrcli=() init_func() { echo "create and add new keys" "$PWD"/build/ethermintcli config keyring-backend test --home "$DATA_CLI_DIR$i" - "$PWD"/build/ethermintcli keys add $KEY"$i" --home "$DATA_CLI_DIR$i" --no-backup --chain-id $CHAINID --algo "eth_secp256k1" + "$PWD"/build/ethermintcli keys add $KEY"$i" --home "$DATA_CLI_DIR$i" --no-backup --chain-id $CHAINID echo "init Ethermint with moniker=$MONIKER and chain-id=$CHAINID" "$PWD"/build/ethermintd init $MONIKER --chain-id $CHAINID --home "$DATA_DIR$i" echo "init ethermintcli with chain-id=$CHAINID and config it trust-node true"