feat(crypto): add blst (#20296)
Co-authored-by: itsdevbear <itsdevbear@berachain.com> Co-authored-by: Akhil Kumar P <36399231+akhilkumarpilli@users.noreply.github.com>
This commit is contained in:
co-authored by
itsdevbear
Akhil Kumar P
parent
78327f40c5
commit
05ff7a7cb7
@@ -26,7 +26,12 @@ func CollectGenTxsCmd(genBalIterator types.GenesisBalancesIterator, validator ty
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
cdc := clientCtx.Codec
|
||||
|
||||
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(config)
|
||||
consensusKey, err := cmd.Flags().GetString(FlagConsensusKeyAlgo)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Failed to get consensus key algo")
|
||||
}
|
||||
|
||||
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(config, consensusKey)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to initialize node validator files")
|
||||
}
|
||||
@@ -55,7 +60,7 @@ func CollectGenTxsCmd(genBalIterator types.GenesisBalancesIterator, validator ty
|
||||
return displayInfo(cmd.ErrOrStderr(), toPrint)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().String(FlagConsensusKeyAlgo, "ed25519", "algorithm to use for the consensus key")
|
||||
cmd.Flags().String(flagGenTxDir, "", "override default \"gentx\" directory from which collect and execute genesis transactions; default [--home]/config/gentx/")
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -62,7 +62,12 @@ $ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=o
|
||||
}
|
||||
cdc := clientCtx.Codec
|
||||
|
||||
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(config)
|
||||
consensusKey, err := cmd.Flags().GetString(FlagConsensusKeyAlgo)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Failed to get consensus key algo")
|
||||
}
|
||||
|
||||
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(config, consensusKey)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to initialize node validator files")
|
||||
}
|
||||
@@ -212,6 +217,7 @@ $ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=o
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().String(FlagConsensusKeyAlgo, "ed25519", "algorithm to use for the consensus key: ed25519 | secp256k1 | bls12_381 | sr25519 | multi")
|
||||
cmd.Flags().String(flags.FlagOutputDocument, "", "Write the genesis transaction JSON document to the given file instead of the default location")
|
||||
cmd.Flags().AddFlagSet(fsCreateValidator)
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
|
||||
@@ -9,14 +9,10 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
cfg "github.com/cometbft/cometbft/config"
|
||||
cmttypes "github.com/cometbft/cometbft/types"
|
||||
"github.com/cosmos/go-bip39"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
"cosmossdk.io/math/unsafe"
|
||||
|
||||
cfg "github.com/cometbft/cometbft/config"
|
||||
cmttypes "github.com/cometbft/cometbft/types"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/input"
|
||||
@@ -25,6 +21,8 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
"github.com/cosmos/go-bip39"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -113,7 +111,12 @@ func InitCmd(mm *module.Manager) *cobra.Command {
|
||||
initHeight = 1
|
||||
}
|
||||
|
||||
nodeID, _, err := genutil.InitializeNodeValidatorFilesFromMnemonic(config, mnemonic)
|
||||
consensusKey, err := cmd.Flags().GetString(FlagConsensusKeyAlgo)
|
||||
if err != nil {
|
||||
return errorsmod.Wrap(err, "Failed to get consensus key algo")
|
||||
}
|
||||
|
||||
nodeID, _, err := genutil.InitializeNodeValidatorFilesFromMnemonic(config, mnemonic, consensusKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -163,10 +166,6 @@ func InitCmd(mm *module.Manager) *cobra.Command {
|
||||
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 {
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
servercmtlog "github.com/cosmos/cosmos-sdk/server/log"
|
||||
"github.com/cosmos/cosmos-sdk/server/mock"
|
||||
@@ -243,7 +244,7 @@ func TestInitNodeValidatorFiles(t *testing.T) {
|
||||
cfg, err := genutiltest.CreateDefaultCometConfig(home)
|
||||
require.NoError(t, err)
|
||||
|
||||
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(cfg)
|
||||
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(cfg, ed25519.KeyType)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NotEqual(t, "", nodeID)
|
||||
|
||||
Reference in New Issue
Block a user