diff --git a/CHANGELOG.md b/CHANGELOG.md index b33db49d7cdf..3fa4ff9a4745 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (x/consensus) [#19483](https://github.com/cosmos/cosmos-sdk/pull/19483) Add consensus messages registration to consensus module. * (types) [#19759](https://github.com/cosmos/cosmos-sdk/pull/19759) Align SignerExtractionAdapter in PriorityNonceMempool Remove. * (client) [#19870](https://github.com/cosmos/cosmos-sdk/pull/19870) Add new query command `wait-tx`. Alias `event-query-tx-for` to `wait-tx` for backward compatibility. +* (genutil) [#19971](https://github.com/cosmos/cosmos-sdk/pull/19971) Allow manually setting the consensus key type in genesis ### Improvements diff --git a/x/genutil/client/cli/init.go b/x/genutil/client/cli/init.go index da33a1060b29..2765eafc9acb 100644 --- a/x/genutil/client/cli/init.go +++ b/x/genutil/client/cli/init.go @@ -9,6 +9,7 @@ import ( "path/filepath" cfg "github.com/cometbft/cometbft/config" + cmttypes "github.com/cometbft/cometbft/types" "github.com/cosmos/go-bip39" "github.com/spf13/cobra" @@ -35,6 +36,9 @@ const ( // FlagDefaultBondDenom defines the default denom to use in the genesis file. FlagDefaultBondDenom = "default-denom" + + // FlagConsensusKeyAlgo defines the algorithm to use for the consensus signing key. + FlagConsensusKeyAlgo = "consensus-key-algo" ) type printInfo struct { @@ -158,7 +162,14 @@ func InitCmd(mm *module.Manager) *cobra.Command { appGenesis.InitialHeight = initHeight appGenesis.Consensus = &types.ConsensusGenesis{ Validators: nil, + Params: cmttypes.DefaultConsensusParams(), + } + + consensusKey, err := cmd.Flags().GetString(FlagConsensusKeyAlgo) + if err != nil { + return errorsmod.Wrap(err, "Failed to get consensus key algo") } + appGenesis.Consensus.Params.Validator.PubKeyTypes = []string{consensusKey} if err = genutil.ExportGenesisFile(appGenesis, genFile); err != nil { return errorsmod.Wrap(err, "Failed to export genesis file") @@ -176,6 +187,7 @@ func InitCmd(mm *module.Manager) *cobra.Command { cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") cmd.Flags().String(FlagDefaultBondDenom, "", "genesis file default denomination, if left blank default value is 'stake'") cmd.Flags().Int64(flags.FlagInitHeight, 1, "specify the initial block height at genesis") + cmd.Flags().String(FlagConsensusKeyAlgo, "ed25519", "algorithm to use for the consensus key") return cmd }