refactor: remove global valaddress bech32 codec calls (1/2) (#17098)
Co-authored-by: Devon Bear <itsdevbear@berachain.com> Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
co-authored by
Devon Bear
Julien Robert
parent
026073ba19
commit
58855c6859
@@ -521,7 +521,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
||||
}
|
||||
|
||||
createValMsg, err := stakingtypes.NewMsgCreateValidator(
|
||||
sdk.ValAddress(addr),
|
||||
sdk.ValAddress(addr).String(),
|
||||
valPubKeys[i],
|
||||
sdk.NewCoin(cfg.BondDenom, cfg.BondedTokens),
|
||||
stakingtypes.NewDescription(nodeDirName, "", "", "", ""),
|
||||
|
||||
@@ -142,7 +142,7 @@ func collectGenFiles(cfg Config, vals []*Validator, outputDir string) error {
|
||||
}
|
||||
|
||||
appState, err := genutil.GenAppStateFromConfig(cfg.Codec, cfg.TxConfig,
|
||||
cmtCfg, initCfg, appGenesis, banktypes.GenesisBalancesIterator{}, genutiltypes.DefaultMessageValidator)
|
||||
cmtCfg, initCfg, appGenesis, banktypes.GenesisBalancesIterator{}, genutiltypes.DefaultMessageValidator, cfg.TxConfig.SigningContext().ValidatorAddressCodec())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"cosmossdk.io/math"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/address"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
@@ -97,7 +98,7 @@ func (b *GenesisBuilder) GenTx(privVal secp256k1.PrivKey, val cmttypes.GenesisVa
|
||||
|
||||
// Produce the create validator message.
|
||||
msg, err := stakingtypes.NewMsgCreateValidator(
|
||||
privVal.PubKey().Address().Bytes(),
|
||||
sdk.ValAddress(privVal.PubKey().Address()).String(),
|
||||
pubKey,
|
||||
amount,
|
||||
stakingtypes.Description{
|
||||
@@ -114,7 +115,7 @@ func (b *GenesisBuilder) GenTx(privVal secp256k1.PrivKey, val cmttypes.GenesisVa
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := msg.Validate(); err != nil {
|
||||
if err := msg.Validate(address.NewBech32Codec("cosmosvaloper")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user