ignite / cli-plugin-network

Apache License 2.0
7 stars 9 forks source link

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

Open mondainai247 opened 6 months ago

mondainai247 commented 6 months ago

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 commented 6 months ago

@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.

yohanelly95 commented 5 months ago

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

mondainai247 commented 5 months ago

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

mondainai247 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

@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 commented 4 months ago

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

mondainai247 commented 4 months ago

@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 commented 4 months ago

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

GoBig87 commented 3 months ago

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 commented 3 months ago

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(),
    )
}