feat(genutil): allow manually setting the consensus key type in genesis. (#19971)
Co-authored-by: Marko <marko@baricevic.me> Co-authored-by: marbar3778 <marbar3778@yahoo.com>
This commit is contained in:
parent
128bb968b2
commit
abb2994a8f
@ -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
|
||||
|
||||
|
||||
@ -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,8 +162,15 @@ 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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user