diff --git a/CHANGELOG.md b/CHANGELOG.md index e570d70e1..6e13691dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,8 +22,8 @@ if possible. * The metrics support is now compiled by default thanks to a new and more secure HTTP back-end. -* Command-line tools for generating keystores and JSON deposit files suitable for use with the - official network launchpads. +* Command-line tools for generating testnet keystores and JSON deposit files suitable for use + with the official network launchpads. * `setGraffiti` JSON-RPC call for modifying the graffiti bytes of the client at run-time. diff --git a/Makefile b/Makefile index 7d146b798..228496c5d 100644 --- a/Makefile +++ b/Makefile @@ -394,7 +394,7 @@ define CONNECT_TO_NETWORK_WITH_VALIDATOR_CLIENT endef define MAKE_DEPOSIT_DATA - build/nimbus_beacon_node deposits create \ + build/nimbus_beacon_node deposits createTestnetDeposits \ --network=$(1) \ --new-wallet-file=build/data/shared_$(1)_$(NODE_ID)/wallet.json \ --out-validators-dir=build/data/shared_$(1)_$(NODE_ID)/validators \ @@ -404,7 +404,7 @@ define MAKE_DEPOSIT_DATA endef define MAKE_DEPOSIT - build/nimbus_beacon_node deposits create \ + build/nimbus_beacon_node deposits createTestnetDeposits \ --network=$(1) \ --out-deposits-file=nbc-$(1)-deposits.json \ --new-wallet-file=build/data/shared_$(1)_$(NODE_ID)/wallet.json \ diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index 2abc8e9f1..64dbf09cf 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -45,7 +45,7 @@ type list = "Lists details about all wallets" DepositsCmd* {.pure.} = enum - create = "Creates validator keystores and deposits" + createTestnetDeposits = "Creates validator keystores and deposits for testnet usage" `import` = "Imports password-protected keystores interactively" # status = "Displays status information about all deposits" exit = "Submits a validator voluntary exit" @@ -378,7 +378,7 @@ type of deposits: case depositsCmd* {.command.}: DepositsCmd - of DepositsCmd.create: + of DepositsCmd.createTestnetDeposits: totalDeposits* {. defaultValue: 1 desc: "Number of deposits to generate" @@ -654,7 +654,7 @@ func outWalletName*(config: BeaconNodeConf): Option[WalletName] = of WalletsCmd.list: fail() of deposits: case config.depositsCmd - of DepositsCmd.create: config.newWalletNameFlag + of DepositsCmd.createTestnetDeposits: config.newWalletNameFlag else: fail() else: fail() @@ -671,7 +671,7 @@ func outWalletFile*(config: BeaconNodeConf): Option[OutFile] = of WalletsCmd.list: fail() of deposits: case config.depositsCmd - of DepositsCmd.create: config.newWalletFileFlag + of DepositsCmd.createTestnetDeposits: config.newWalletFileFlag else: fail() else: fail() diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 6c812feac..17feb1ed0 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -1751,7 +1751,10 @@ proc findWalletWithoutErrors(config: BeaconNodeConf, proc doDeposits(config: BeaconNodeConf, rng: var BrHmacDrbgContext) {. raises: [Defect, CatchableError].} = case config.depositsCmd - of DepositsCmd.create: + of DepositsCmd.createTestnetDeposits: + if config.eth2Network.isNone: + fatal "Please specify the intended testnet for the deposits" + quit 1 let metadata = config.loadEth2Network() var seed: KeySeed defer: burnMem(seed) diff --git a/scripts/reset_testnet.sh b/scripts/reset_testnet.sh index 2efc70335..e20e3c9b7 100755 --- a/scripts/reset_testnet.sh +++ b/scripts/reset_testnet.sh @@ -65,7 +65,7 @@ if [ "$ETH1_PRIVATE_KEY" != "" ]; then echo "Done: $DEPOSIT_CONTRACT_ADDRESS" fi -echo "Building a local nimbus_beacon_node instance for 'deposits create' and 'createTestnet'" +echo "Building a local nimbus_beacon_node instance for 'deposits createTestnetDeposits' and 'createTestnet'" make -j2 NIMFLAGS="-d:testnet_servers_image ${NETWORK_NIM_FLAGS}" nimbus_beacon_node nimbus_signing_process process_dashboard echo "Generating Grafana dashboards for remote testnet servers" @@ -83,7 +83,7 @@ echo "Building Docker image..." # in docker/Makefile, and are enabled by default. make build -../build/nimbus_beacon_node deposits create \ +../build/nimbus_beacon_node deposits createTestnetDeposits \ --count=$TOTAL_VALIDATORS \ --out-validators-dir="$VALIDATORS_DIR_ABS" \ --out-secrets-dir="$SECRETS_DIR_ABS" \ diff --git a/tests/fuzzing/beacon_node_cli/corpus/spadina-deposits-data.txt b/tests/fuzzing/beacon_node_cli/corpus/spadina-deposits-data.txt index 5561b9a99..dd5dcf9f5 100644 --- a/tests/fuzzing/beacon_node_cli/corpus/spadina-deposits-data.txt +++ b/tests/fuzzing/beacon_node_cli/corpus/spadina-deposits-data.txt @@ -1 +1 @@ -deposits create --network=spadina --new-wallet-file=build/data/shared_spadina_0/wallet.json --out-validators-dir=build/data/shared_spadina_0/validators --out-secrets-dir=build/data/shared_spadina_0/secrets --out-deposits-file=spadina-deposits_data-20201001212925.json --count=1 +deposits createTestnetDeposits --network=spadina --new-wallet-file=build/data/shared_spadina_0/wallet.json --out-validators-dir=build/data/shared_spadina_0/validators --out-secrets-dir=build/data/shared_spadina_0/secrets --out-deposits-file=spadina-deposits_data-20201001212925.json --count=1