From c628334df304213d04b9796a355fc0cc7eb19634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20=C5=BDivkovi=C4=87?= Date: Fri, 19 Apr 2024 15:00:06 +0200 Subject: [PATCH] refactor!: move `genesis` to `gnoland genesis` (#1954) ## Description Closes #1953 This PR moves the `genesis` command suite to be a subcommand of `gnoland`, making it callable with `gnoland genesis`.
Contributors' checklist... - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
--- gno.land/Makefile | 6 ++---- .../cmd/{genesis/main.go => gnoland/genesis.go} | 17 +++++------------ .../balances.go => gnoland/genesis_balances.go} | 0 .../genesis_balances_add.go} | 0 .../genesis_balances_add_test.go} | 7 +++++++ .../genesis_balances_export.go} | 0 .../genesis_balances_export_test.go} | 4 ++++ .../genesis_balances_remove.go} | 0 .../genesis_balances_remove_test.go} | 4 ++++ .../generate.go => gnoland/genesis_generate.go} | 0 .../genesis_generate_test.go} | 7 +++++++ .../{genesis/txs.go => gnoland/genesis_txs.go} | 0 .../txs_add.go => gnoland/genesis_txs_add.go} | 0 .../genesis_txs_add_test.go} | 6 ++++++ .../genesis_txs_export.go} | 0 .../genesis_txs_export_test.go} | 4 ++++ .../genesis_txs_remove.go} | 0 .../genesis_txs_remove_test.go} | 4 ++++ .../genesis_validator.go} | 0 .../genesis_validator_add.go} | 12 ++++++------ .../genesis_validator_add_test.go} | 10 +++++++++- .../genesis_validator_remove.go} | 0 .../genesis_validator_remove_test.go} | 4 ++++ .../verify.go => gnoland/genesis_verify.go} | 0 .../genesis_verify_test.go} | 5 +++++ gno.land/cmd/gnoland/root.go | 1 + gno.land/cmd/{genesis => gnoland}/types.go | 0 27 files changed, 68 insertions(+), 23 deletions(-) rename gno.land/cmd/{genesis/main.go => gnoland/genesis.go} (68%) rename gno.land/cmd/{genesis/balances.go => gnoland/genesis_balances.go} (100%) rename gno.land/cmd/{genesis/balances_add.go => gnoland/genesis_balances_add.go} (100%) rename gno.land/cmd/{genesis/balances_add_test.go => gnoland/genesis_balances_add_test.go} (99%) rename gno.land/cmd/{genesis/balances_export.go => gnoland/genesis_balances_export.go} (100%) rename gno.land/cmd/{genesis/balances_export_test.go => gnoland/genesis_balances_export_test.go} (98%) rename gno.land/cmd/{genesis/balances_remove.go => gnoland/genesis_balances_remove.go} (100%) rename gno.land/cmd/{genesis/balances_remove_test.go => gnoland/genesis_balances_remove_test.go} (98%) rename gno.land/cmd/{genesis/generate.go => gnoland/genesis_generate.go} (100%) rename gno.land/cmd/{genesis/generate_test.go => gnoland/genesis_generate_test.go} (98%) rename gno.land/cmd/{genesis/txs.go => gnoland/genesis_txs.go} (100%) rename gno.land/cmd/{genesis/txs_add.go => gnoland/genesis_txs_add.go} (100%) rename gno.land/cmd/{genesis/txs_add_test.go => gnoland/genesis_txs_add_test.go} (98%) rename gno.land/cmd/{genesis/txs_export.go => gnoland/genesis_txs_export.go} (100%) rename gno.land/cmd/{genesis/txs_export_test.go => gnoland/genesis_txs_export_test.go} (98%) rename gno.land/cmd/{genesis/txs_remove.go => gnoland/genesis_txs_remove.go} (100%) rename gno.land/cmd/{genesis/txs_remove_test.go => gnoland/genesis_txs_remove_test.go} (98%) rename gno.land/cmd/{genesis/validator.go => gnoland/genesis_validator.go} (100%) rename gno.land/cmd/{genesis/validator_add.go => gnoland/genesis_validator_add.go} (86%) rename gno.land/cmd/{genesis/validator_add_test.go => gnoland/genesis_validator_add_test.go} (97%) rename gno.land/cmd/{genesis/validator_remove.go => gnoland/genesis_validator_remove.go} (100%) rename gno.land/cmd/{genesis/validator_remove_test.go => gnoland/genesis_validator_remove_test.go} (98%) rename gno.land/cmd/{genesis/verify.go => gnoland/genesis_verify.go} (100%) rename gno.land/cmd/{genesis/verify_test.go => gnoland/genesis_verify_test.go} (98%) rename gno.land/cmd/{genesis => gnoland}/types.go (100%) diff --git a/gno.land/Makefile b/gno.land/Makefile index eddab28270d..e82a90efb2f 100644 --- a/gno.land/Makefile +++ b/gno.land/Makefile @@ -31,23 +31,21 @@ start.gnoland:; go run ./cmd/gnoland start start.gnoweb:; go run ./cmd/gnoweb .PHONY: build -build: build.gnoland build.gnokey build.gnoweb build.genesis +build: build.gnoland build.gnokey build.gnoweb build.gnoland:; go build -o build/gnoland ./cmd/gnoland build.gnoweb:; go build -o build/gnoweb ./cmd/gnoweb build.gnokey:; go build -o build/gnokey ./cmd/gnokey -build.genesis:; go build -o build/genesis ./cmd/genesis run.gnoland:; go run ./cmd/gnoland start run.gnoweb:; go run ./cmd/gnoweb .PHONY: install -install: install.gnoland install.gnoweb install.gnokey install.genesis +install: install.gnoland install.gnoweb install.gnokey install.gnoland:; go install ./cmd/gnoland install.gnoweb:; go install ./cmd/gnoweb install.gnokey:; go install ./cmd/gnokey -install.genesis:; go install ./cmd/genesis .PHONY: fclean fclean: clean diff --git a/gno.land/cmd/genesis/main.go b/gno.land/cmd/gnoland/genesis.go similarity index 68% rename from gno.land/cmd/genesis/main.go rename to gno.land/cmd/gnoland/genesis.go index 53bb48c3c64..37c0f8f2926 100644 --- a/gno.land/cmd/genesis/main.go +++ b/gno.land/cmd/gnoland/genesis.go @@ -1,25 +1,18 @@ package main import ( - "context" "flag" - "os" "github.com/gnolang/gno/tm2/pkg/commands" ) -func main() { - io := commands.NewDefaultIO() - cmd := newRootCmd(io) - - cmd.Execute(context.Background(), os.Args[1:]) -} - -func newRootCmd(io commands.IO) *commands.Command { +func newGenesisCmd(io commands.IO) *commands.Command { cmd := commands.NewCommand( commands.Metadata{ - ShortUsage: " [flags] [...]", - LongHelp: "Gno Genesis manipulation suite", + Name: "genesis", + ShortUsage: "genesis [flags] [...]", + ShortHelp: "gno genesis manipulation suite", + LongHelp: "Gno genesis.json manipulation suite, for managing genesis parameters", }, commands.NewEmptyConfig(), commands.HelpExec, diff --git a/gno.land/cmd/genesis/balances.go b/gno.land/cmd/gnoland/genesis_balances.go similarity index 100% rename from gno.land/cmd/genesis/balances.go rename to gno.land/cmd/gnoland/genesis_balances.go diff --git a/gno.land/cmd/genesis/balances_add.go b/gno.land/cmd/gnoland/genesis_balances_add.go similarity index 100% rename from gno.land/cmd/genesis/balances_add.go rename to gno.land/cmd/gnoland/genesis_balances_add.go diff --git a/gno.land/cmd/genesis/balances_add_test.go b/gno.land/cmd/gnoland/genesis_balances_add_test.go similarity index 99% rename from gno.land/cmd/genesis/balances_add_test.go rename to gno.land/cmd/gnoland/genesis_balances_add_test.go index 0dd3366869f..3f97acd1aba 100644 --- a/gno.land/cmd/genesis/balances_add_test.go +++ b/gno.land/cmd/gnoland/genesis_balances_add_test.go @@ -27,6 +27,7 @@ func TestGenesis_Balances_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "add", "--genesis-path", @@ -50,6 +51,7 @@ func TestGenesis_Balances_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "add", "--genesis-path", @@ -67,6 +69,7 @@ func TestGenesis_Balances_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "add", "--genesis-path", @@ -92,6 +95,7 @@ func TestGenesis_Balances_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "add", "--genesis-path", @@ -181,6 +185,7 @@ func TestGenesis_Balances_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "add", "--genesis-path", @@ -280,6 +285,7 @@ func TestGenesis_Balances_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "add", "--genesis-path", @@ -353,6 +359,7 @@ func TestGenesis_Balances_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "add", "--genesis-path", diff --git a/gno.land/cmd/genesis/balances_export.go b/gno.land/cmd/gnoland/genesis_balances_export.go similarity index 100% rename from gno.land/cmd/genesis/balances_export.go rename to gno.land/cmd/gnoland/genesis_balances_export.go diff --git a/gno.land/cmd/genesis/balances_export_test.go b/gno.land/cmd/gnoland/genesis_balances_export_test.go similarity index 98% rename from gno.land/cmd/genesis/balances_export_test.go rename to gno.land/cmd/gnoland/genesis_balances_export_test.go index d7441fd438f..ee88af4c56b 100644 --- a/gno.land/cmd/genesis/balances_export_test.go +++ b/gno.land/cmd/gnoland/genesis_balances_export_test.go @@ -41,6 +41,7 @@ func TestGenesis_Balances_Export(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "export", "--genesis-path", @@ -65,6 +66,7 @@ func TestGenesis_Balances_Export(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "export", "--genesis-path", @@ -91,6 +93,7 @@ func TestGenesis_Balances_Export(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "export", "--genesis-path", @@ -124,6 +127,7 @@ func TestGenesis_Balances_Export(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "export", "--genesis-path", diff --git a/gno.land/cmd/genesis/balances_remove.go b/gno.land/cmd/gnoland/genesis_balances_remove.go similarity index 100% rename from gno.land/cmd/genesis/balances_remove.go rename to gno.land/cmd/gnoland/genesis_balances_remove.go diff --git a/gno.land/cmd/genesis/balances_remove_test.go b/gno.land/cmd/gnoland/genesis_balances_remove_test.go similarity index 98% rename from gno.land/cmd/genesis/balances_remove_test.go rename to gno.land/cmd/gnoland/genesis_balances_remove_test.go index b9d10d0db08..a8ec6ddac10 100644 --- a/gno.land/cmd/genesis/balances_remove_test.go +++ b/gno.land/cmd/gnoland/genesis_balances_remove_test.go @@ -20,6 +20,7 @@ func TestGenesis_Balances_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "remove", "--genesis-path", @@ -46,6 +47,7 @@ func TestGenesis_Balances_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "remove", "--genesis-path", @@ -83,6 +85,7 @@ func TestGenesis_Balances_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "remove", "--genesis-path", @@ -125,6 +128,7 @@ func TestGenesis_Balances_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "balances", "remove", "--genesis-path", diff --git a/gno.land/cmd/genesis/generate.go b/gno.land/cmd/gnoland/genesis_generate.go similarity index 100% rename from gno.land/cmd/genesis/generate.go rename to gno.land/cmd/gnoland/genesis_generate.go diff --git a/gno.land/cmd/genesis/generate_test.go b/gno.land/cmd/gnoland/genesis_generate_test.go similarity index 98% rename from gno.land/cmd/genesis/generate_test.go rename to gno.land/cmd/gnoland/genesis_generate_test.go index ca742e55150..f078a161662 100644 --- a/gno.land/cmd/genesis/generate_test.go +++ b/gno.land/cmd/gnoland/genesis_generate_test.go @@ -27,6 +27,7 @@ func TestGenesis_Generate(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "generate", "--output-path", genesisPath, @@ -60,6 +61,7 @@ func TestGenesis_Generate(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "generate", "--chain-id", chainID, @@ -91,6 +93,7 @@ func TestGenesis_Generate(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "generate", "--block-max-tx-bytes", fmt.Sprintf("%d", blockMaxTxBytes), @@ -126,6 +129,7 @@ func TestGenesis_Generate(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "generate", "--block-max-data-bytes", fmt.Sprintf("%d", blockMaxDataBytes), @@ -161,6 +165,7 @@ func TestGenesis_Generate(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "generate", "--block-max-gas", fmt.Sprintf("%d", blockMaxGas), @@ -196,6 +201,7 @@ func TestGenesis_Generate(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "generate", "--block-time-iota", fmt.Sprintf("%d", blockTimeIota), @@ -231,6 +237,7 @@ func TestGenesis_Generate(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "generate", "--chain-id", invalidChainID, diff --git a/gno.land/cmd/genesis/txs.go b/gno.land/cmd/gnoland/genesis_txs.go similarity index 100% rename from gno.land/cmd/genesis/txs.go rename to gno.land/cmd/gnoland/genesis_txs.go diff --git a/gno.land/cmd/genesis/txs_add.go b/gno.land/cmd/gnoland/genesis_txs_add.go similarity index 100% rename from gno.land/cmd/genesis/txs_add.go rename to gno.land/cmd/gnoland/genesis_txs_add.go diff --git a/gno.land/cmd/genesis/txs_add_test.go b/gno.land/cmd/gnoland/genesis_txs_add_test.go similarity index 98% rename from gno.land/cmd/genesis/txs_add_test.go rename to gno.land/cmd/gnoland/genesis_txs_add_test.go index 7d194182fb0..048aaf889be 100644 --- a/gno.land/cmd/genesis/txs_add_test.go +++ b/gno.land/cmd/gnoland/genesis_txs_add_test.go @@ -71,6 +71,7 @@ func TestGenesis_Txs_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "add", "--genesis-path", @@ -94,6 +95,7 @@ func TestGenesis_Txs_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "add", "--genesis-path", @@ -118,6 +120,7 @@ func TestGenesis_Txs_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "add", "--genesis-path", @@ -141,6 +144,7 @@ func TestGenesis_Txs_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "add", "--genesis-path", @@ -180,6 +184,7 @@ func TestGenesis_Txs_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "add", "--genesis-path", @@ -238,6 +243,7 @@ func TestGenesis_Txs_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "add", "--genesis-path", diff --git a/gno.land/cmd/genesis/txs_export.go b/gno.land/cmd/gnoland/genesis_txs_export.go similarity index 100% rename from gno.land/cmd/genesis/txs_export.go rename to gno.land/cmd/gnoland/genesis_txs_export.go diff --git a/gno.land/cmd/genesis/txs_export_test.go b/gno.land/cmd/gnoland/genesis_txs_export_test.go similarity index 98% rename from gno.land/cmd/genesis/txs_export_test.go rename to gno.land/cmd/gnoland/genesis_txs_export_test.go index bc84bc45f73..9927f671efb 100644 --- a/gno.land/cmd/genesis/txs_export_test.go +++ b/gno.land/cmd/gnoland/genesis_txs_export_test.go @@ -23,6 +23,7 @@ func TestGenesis_Txs_Export(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "export", "--genesis-path", @@ -47,6 +48,7 @@ func TestGenesis_Txs_Export(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "export", "--genesis-path", @@ -73,6 +75,7 @@ func TestGenesis_Txs_Export(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "export", "--genesis-path", @@ -106,6 +109,7 @@ func TestGenesis_Txs_Export(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "export", "--genesis-path", diff --git a/gno.land/cmd/genesis/txs_remove.go b/gno.land/cmd/gnoland/genesis_txs_remove.go similarity index 100% rename from gno.land/cmd/genesis/txs_remove.go rename to gno.land/cmd/gnoland/genesis_txs_remove.go diff --git a/gno.land/cmd/genesis/txs_remove_test.go b/gno.land/cmd/gnoland/genesis_txs_remove_test.go similarity index 98% rename from gno.land/cmd/genesis/txs_remove_test.go rename to gno.land/cmd/gnoland/genesis_txs_remove_test.go index b89f2af761a..ff5af479449 100644 --- a/gno.land/cmd/genesis/txs_remove_test.go +++ b/gno.land/cmd/gnoland/genesis_txs_remove_test.go @@ -21,6 +21,7 @@ func TestGenesis_Txs_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "remove", "--genesis-path", @@ -45,6 +46,7 @@ func TestGenesis_Txs_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "remove", "--genesis-path", @@ -73,6 +75,7 @@ func TestGenesis_Txs_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "remove", "--genesis-path", @@ -105,6 +108,7 @@ func TestGenesis_Txs_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "txs", "remove", "--genesis-path", diff --git a/gno.land/cmd/genesis/validator.go b/gno.land/cmd/gnoland/genesis_validator.go similarity index 100% rename from gno.land/cmd/genesis/validator.go rename to gno.land/cmd/gnoland/genesis_validator.go diff --git a/gno.land/cmd/genesis/validator_add.go b/gno.land/cmd/gnoland/genesis_validator_add.go similarity index 86% rename from gno.land/cmd/genesis/validator_add.go rename to gno.land/cmd/gnoland/genesis_validator_add.go index 502b572effb..dc232ab6e4e 100644 --- a/gno.land/cmd/genesis/validator_add.go +++ b/gno.land/cmd/gnoland/genesis_validator_add.go @@ -13,10 +13,10 @@ import ( ) var ( - errInvalidPower = errors.New("invalid validator power") - errInvalidName = errors.New("invalid validator name") - errPublicKeyMismatch = errors.New("provided public key and address do not match") - errAddressPresent = errors.New("validator with same address already present in genesis.json") + errInvalidPower = errors.New("invalid validator power") + errInvalidName = errors.New("invalid validator name") + errPublicKeyAddressMismatch = errors.New("provided public key and address do not match") + errAddressPresent = errors.New("validator with same address already present in genesis.json") ) type validatorAddCfg struct { @@ -89,7 +89,7 @@ func execValidatorAdd(cfg *validatorAddCfg, io commands.IO) error { // Check the name if cfg.name == "" { - return errors.New("invalid validator name") + return errInvalidName } // Check the public key @@ -100,7 +100,7 @@ func execValidatorAdd(cfg *validatorAddCfg, io commands.IO) error { // Check the public key matches the address if pubKey.Address() != address { - return errors.New("provided public key and address do not match") + return errPublicKeyAddressMismatch } validator := types.GenesisValidator{ diff --git a/gno.land/cmd/genesis/validator_add_test.go b/gno.land/cmd/gnoland/genesis_validator_add_test.go similarity index 97% rename from gno.land/cmd/genesis/validator_add_test.go rename to gno.land/cmd/gnoland/genesis_validator_add_test.go index 37af4157e7c..528255b3029 100644 --- a/gno.land/cmd/genesis/validator_add_test.go +++ b/gno.land/cmd/gnoland/genesis_validator_add_test.go @@ -65,6 +65,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "add", "--genesis-path", @@ -88,6 +89,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "add", "--genesis-path", @@ -115,6 +117,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "add", "--genesis-path", @@ -144,6 +147,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "add", "--genesis-path", @@ -173,6 +177,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "add", "--genesis-path", @@ -204,6 +209,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "add", "--genesis-path", @@ -218,7 +224,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Run the command cmdErr := cmd.ParseAndRun(context.Background(), args) - assert.ErrorContains(t, cmdErr, errPublicKeyMismatch.Error()) + assert.ErrorContains(t, cmdErr, errPublicKeyAddressMismatch.Error()) }) t.Run("validator with same address exists", func(t *testing.T) { @@ -243,6 +249,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "add", "--genesis-path", @@ -274,6 +281,7 @@ func TestGenesis_Validator_Add(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "add", "--genesis-path", diff --git a/gno.land/cmd/genesis/validator_remove.go b/gno.land/cmd/gnoland/genesis_validator_remove.go similarity index 100% rename from gno.land/cmd/genesis/validator_remove.go rename to gno.land/cmd/gnoland/genesis_validator_remove.go diff --git a/gno.land/cmd/genesis/validator_remove_test.go b/gno.land/cmd/gnoland/genesis_validator_remove_test.go similarity index 98% rename from gno.land/cmd/genesis/validator_remove_test.go rename to gno.land/cmd/gnoland/genesis_validator_remove_test.go index 953657afe33..e73e867c5c3 100644 --- a/gno.land/cmd/genesis/validator_remove_test.go +++ b/gno.land/cmd/gnoland/genesis_validator_remove_test.go @@ -20,6 +20,7 @@ func TestGenesis_Validator_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "remove", "--genesis-path", @@ -43,6 +44,7 @@ func TestGenesis_Validator_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "remove", "--genesis-path", @@ -78,6 +80,7 @@ func TestGenesis_Validator_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "remove", "--genesis-path", @@ -114,6 +117,7 @@ func TestGenesis_Validator_Remove(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "validator", "remove", "--genesis-path", diff --git a/gno.land/cmd/genesis/verify.go b/gno.land/cmd/gnoland/genesis_verify.go similarity index 100% rename from gno.land/cmd/genesis/verify.go rename to gno.land/cmd/gnoland/genesis_verify.go diff --git a/gno.land/cmd/genesis/verify_test.go b/gno.land/cmd/gnoland/genesis_verify_test.go similarity index 98% rename from gno.land/cmd/genesis/verify_test.go rename to gno.land/cmd/gnoland/genesis_verify_test.go index 8388949898b..9c93519e495 100644 --- a/gno.land/cmd/genesis/verify_test.go +++ b/gno.land/cmd/gnoland/genesis_verify_test.go @@ -55,6 +55,7 @@ func TestGenesis_Verify(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "verify", "--genesis-path", tempFile.Name(), @@ -85,6 +86,7 @@ func TestGenesis_Verify(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "verify", "--genesis-path", tempFile.Name(), @@ -112,6 +114,7 @@ func TestGenesis_Verify(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "verify", "--genesis-path", tempFile.Name(), @@ -134,6 +137,7 @@ func TestGenesis_Verify(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "verify", "--genesis-path", tempFile.Name(), @@ -157,6 +161,7 @@ func TestGenesis_Verify(t *testing.T) { // Create the command cmd := newRootCmd(commands.NewTestIO()) args := []string{ + "genesis", "verify", "--genesis-path", tempFile.Name(), diff --git a/gno.land/cmd/gnoland/root.go b/gno.land/cmd/gnoland/root.go index acef192e0c6..d670151b358 100644 --- a/gno.land/cmd/gnoland/root.go +++ b/gno.land/cmd/gnoland/root.go @@ -35,6 +35,7 @@ func newRootCmd(io commands.IO) *commands.Command { newStartCmd(io), newSecretsCmd(io), newConfigCmd(io), + newGenesisCmd(io), ) return cmd diff --git a/gno.land/cmd/genesis/types.go b/gno.land/cmd/gnoland/types.go similarity index 100% rename from gno.land/cmd/genesis/types.go rename to gno.land/cmd/gnoland/types.go