Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✘ Blockchain init failed: unknown command "validate-genesis" #27

Open
mondainai247 opened this issue Dec 21, 2023 · 15 comments
Open

✘ Blockchain init failed: unknown command "validate-genesis" #27

mondainai247 opened this issue Dec 21, 2023 · 15 comments
Assignees

Comments

@mondainai247
Copy link

steps to reproduce:
git clone https://github.com/dhealthproject/dhealth-testnet
cd dhealth-testnet
ignite network chain publish github.com/dhealthproject/dhealth-testnet.git
Screenshot from 2023-12-21 09-41-47

@mondainai247
Copy link
Author

@jeronimoalbi I think this is due to previous versions of ignite having an "appd validate-genesis" and that seems to have been moved to "appd genesis validate", so the network command runs a command that no longer exists perhaps.

@Pantani Pantani self-assigned this Jan 17, 2024
@yohanelly95
Copy link

Hi, is there a workaround for this? Want to release a testnet chain as soon as possible. Thank you @mondainai247

@mondainai247
Copy link
Author

@yohanelly95 you can launch the chain manually. I don't see any great tutorials for this online, so I intend to create one.

@mondainai247
Copy link
Author

Here is the reason for the error, version 26 uses appd validate-genesis
v26 appd validate-genesis

Version 28 uses appd genesis validate-genesis. So the network plugin seems to be using the older command.
v28 appd genesis validate-geneis

@yohanelly95
Copy link

Here is the reason for the error, version 26 uses appd validate-genesis v26 appd validate-genesis

Version 28 uses appd genesis validate-genesis. So the network plugin seems to be using the older command. v28 appd genesis validate-geneis

noted the error, does not seem like theres a workaround I can do. Yes I tried finding some documentation around launching a chain manually but to no avail! Do let me know if you've created a tutorial, thank you!

@mondainai247
Copy link
Author

@yohanelly95 please check out this documentation below. You can also create a chain using ignite an push it to github, then install on a VPS using SSH commands.

https://docs.cosmos.network/main/user/run-node/run-node

@ManuelBilbao
Copy link

Any updates on this? Tried to fork and change the ignite/cli dependency to v28 but it makes many other dependencies to fail

@mondainai247
Copy link
Author

@ManuelBilbao FYI - if you use version 26 it should work fine. I think we are still trying to find a solution for this, as seems a newer version of sdk caused this issue.

@ManuelBilbao
Copy link

Thank you. As I'm working with version 28 because I want Cosmos v0.50, I'll wait for the solution

@GoBig87
Copy link

GoBig87 commented Mar 24, 2024

The issue actually isn't the name validate-genesis vs validate, its that its at the wrong level. The network plugin expects it to be at the root command level instead of the genesis sub command level. A work around hack you can do is add the validate cmd to the root command inside your comsos blockchain code.

In your cmd/<your module>d/cmd/commands.go file you want to add these lines

func initRootCmd(
	rootCmd *cobra.Command,
	txConfig client.TxConfig,
	basicManager module.BasicManager,
) {
	rootCmd.AddCommand(
		genutilcli.InitCmd(basicManager, app.DefaultNodeHome),
		debug.Cmd(),
		confixcmd.ConfigCommand(),
		pruning.Cmd(newApp, app.DefaultNodeHome),
		snapshot.Cmd(newApp),
	)

	server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags)

	validateGenesisCmd := genutilcli.ValidateGenesisCmd(basicManager) // <- add this line

	// add keybase, auxiliary RPC, query, genesis, and tx child commands
	rootCmd.AddCommand(
		server.StatusCommand(),
		genesisCommand(txConfig, basicManager),
		queryCommand(),
		txCommand(),
		keys.Commands(),
		validateGenesisCmd, // <- Add this line
	)
}

This will then give you

~/GitProjects/compliance-blockchain$ complianced validate --help
Validates the genesis file at the default location or at the location passed as an arg

Usage:
  complianced validate [file] [flags]

Aliases:
  validate, validate-genesis

Flags:
  -h, --help   help for validate

Global Flags:
      --home string         directory for config and data (default "/home/jason-inbody/.compliance")
      --log_format string   The logging format (json|plain) (default "plain")
      --log_level string    The logging level (trace|debug|info|warn|error|fatal|panic|disabled or '*:<level>,<key>:<level>') (default "info")
      --log_no_color        Disable colored logs
      --trace               print out full stack trace on errors

Which allows the network module to find the validate command at your top level. The validate command has an alias that will pick up validate-genesis just FYI.

Also make sure to check in your code as the network module pulls the data from your repo and rebuilds your appd binary.

@GoBig87
Copy link

GoBig87 commented Mar 24, 2024

To get past the ignite network chain init you'll need to add all the genesis sub commands to the root command like this

func initRootCmd(
	rootCmd *cobra.Command,
	txConfig client.TxConfig,
	basicManager module.BasicManager,
) {
	rootCmd.AddCommand(
		genutilcli.InitCmd(basicManager, app.DefaultNodeHome),
		debug.Cmd(),
		confixcmd.ConfigCommand(),
		pruning.Cmd(newApp, app.DefaultNodeHome),
		snapshot.Cmd(newApp),
	)

	server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags)
	
	gentxModule := basicManager[genutiltypes.ModuleName].(genutil.AppModuleBasic)
	rootCmd.AddCommand(
		genutilcli.GenTxCmd(basicManager, txConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, txConfig.SigningContext().ValidatorAddressCodec()),
		genutilcli.MigrateGenesisCmd(genutilcli.MigrationMap),
		genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, gentxModule.GenTxValidator, txConfig.SigningContext().ValidatorAddressCodec()),
		genutilcli.ValidateGenesisCmd(basicManager),
		genutilcli.AddGenesisAccountCmd(app.DefaultNodeHome, txConfig.SigningContext().AddressCodec()),
		genutilcli.ValidateGenesisCmd(basicManager),
		server.StatusCommand(),
		genesisCommand(txConfig, basicManager),
		queryCommand(),
		txCommand(),
		keys.Commands(),
	)
}

@VuKhuongDuy
Copy link

VuKhuongDuy commented Jul 15, 2024

@julienrbrt Hi, how about this issue? I still get this error.
I curious to discover ignite but I'm stuck here

@VuKhuongDuy
Copy link

I switch to ignite v0.26, which version should use for github.com/ignite/cli-plugin-network?

@ikeda-minden
Copy link

Still the same error with
Ignite CLI version: v28.5.1.

@julienrbrt
Copy link
Member

A change in network needs to happen to work with v0.50 chains. @Pantani is on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants