Skip to content

Commit

Permalink
chore: more bn254 defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
PoisonPhang committed Sep 18, 2024
1 parent 1d3383c commit eddc34a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ go 1.23.1
module github.com/cosmos/cosmos-sdk

require (
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect
cosmossdk.io/api v0.8.0 // main
cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab // main
cosmossdk.io/core v1.0.0-alpha.1
Expand Down
6 changes: 3 additions & 3 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
cmtcmd "github.com/cometbft/cometbft/cmd/cometbft/commands"
cmtcfg "github.com/cometbft/cometbft/config"
cmtcrypto "github.com/cometbft/cometbft/crypto"
cmted25519 "github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cometbft/cometbft/crypto/bn254"
cmtjson "github.com/cometbft/cometbft/libs/json"
"github.com/cometbft/cometbft/node"
"github.com/cometbft/cometbft/p2p"
Expand Down Expand Up @@ -375,7 +375,7 @@ func startCmtNode(
}

pv, err := pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile(), func() (cmtcrypto.PrivKey, error) {
return cmted25519.GenPrivKey(), nil
return bn254.GenPrivKey(), nil
}) // TODO: make this modular
if err != nil {
return nil, cleanupFn, err
Expand Down Expand Up @@ -801,7 +801,7 @@ func testnetify[T types.Application](ctx *Context, testnetAppCreator types.AppCr
defer stateDB.Close()

privValidator, err := pvm.LoadOrGenFilePV(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile(), func() (cmtcrypto.PrivKey, error) {
return cmted25519.GenPrivKey(), nil
return bn254.GenPrivKey(), nil
}) // TODO: make this modular
if err != nil {
return nil, err
Expand Down
3 changes: 2 additions & 1 deletion server/v2/cometbft/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
cmtcmd "github.com/cometbft/cometbft/cmd/cometbft/commands"
cmtcfg "github.com/cometbft/cometbft/config"
cmtcrypto "github.com/cometbft/cometbft/crypto"
cmtbn254 "github.com/cometbft/cometbft/crypto/bn254"
cmted25519 "github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cometbft/cometbft/node"
"github.com/cometbft/cometbft/p2p"
Expand Down Expand Up @@ -153,7 +154,7 @@ func (s *CometBFTServer[T]) Start(ctx context.Context) error {
s.config.ConfigTomlConfig.PrivValidatorKeyFile(),
s.config.ConfigTomlConfig.PrivValidatorStateFile(),
func() (cmtcrypto.PrivKey, error) {
return cmted25519.GenPrivKey(), nil
return cmtbn254.GenPrivKey(), nil
},
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion x/auth/ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
txsigning "cosmossdk.io/x/tx/signing"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/bn254"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand Down Expand Up @@ -537,7 +538,6 @@ func DefaultSigVerificationGasConsumer(meter gas.Meter, sig signing.SignatureV2,
}

return nil

default:
return errorsmod.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey)
}
Expand Down
5 changes: 3 additions & 2 deletions x/genutil/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ func InitializeNodeValidatorFilesFromMnemonic(config *cfg.Config, mnemonic, keyT
privKey = cmtbn254.GenPrivKey()
filePV = loadOrGenFilePV(privKey, pvKeyFile, pvStateFile)
default:
filePV = loadOrGenFilePV(tmed25519.GenPrivKey(), pvKeyFile, pvStateFile)
privKey = cmtbn254.GenPrivKey()
filePV = loadOrGenFilePV(privKey, pvKeyFile, pvStateFile)
}
} else {
switch keyType {
Expand All @@ -112,7 +113,7 @@ func InitializeNodeValidatorFilesFromMnemonic(config *cfg.Config, mnemonic, keyT
case "bn254":
privKey = cmtbn254.GenPrivKeyFromSeed([]byte(mnemonic))
default:
privKey = tmed25519.GenPrivKeyFromSecret([]byte(mnemonic))
privKey = cmtbn254.GenPrivKeyFromSeed([]byte(mnemonic))
}
filePV = privval.NewFilePV(privKey, pvKeyFile, pvStateFile)
filePV.Save()
Expand Down

0 comments on commit eddc34a

Please sign in to comment.