Skip to content

Commit

Permalink
chore: use correct address codec
Browse files Browse the repository at this point in the history
  • Loading branch information
kenta92115 committed Mar 22, 2024
1 parent 4e1e1e2 commit 14fc62c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 1 addition & 4 deletions cmd/swisstronikd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ func NewRootCmd() (*cobra.Command, ethermint.EncodingConfig) {
},
}

txConfig := authtx.NewTxConfig(encodingConfig.Codec, authtx.DefaultSignModes)
// gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic)

valOperAddressCodec := encodingConfig.TxConfig.SigningContext().ValidatorAddressCodec()
a := appCreator{encodingConfig}
rootCmd.AddCommand(
Expand All @@ -147,7 +144,7 @@ func NewRootCmd() (*cobra.Command, ethermint.EncodingConfig) {
genutilcli.MigrateGenesisCmd(genutilcli.MigrationMap),
genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, valOperAddressCodec),
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
AddGenesisAccountCmd(app.DefaultNodeHome, txConfig.SigningContext().ValidatorAddressCodec()),
AddGenesisAccountCmd(app.DefaultNodeHome, valOperAddressCodec),
tmcli.NewCompletionCmd(rootCmd, true),
NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}),
confixcmd.ConfigCommand(),
Expand Down
12 changes: 5 additions & 7 deletions encoding/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package encoding

import (
amino "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/address"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -49,13 +49,11 @@ func customGetSignerFn(path string) func(msg proto.Message) ([][]byte, error) {
// MakeConfig creates an EncodingConfig for testing
func MakeConfig() ethermint.EncodingConfig {
cdc := amino.NewLegacyAmino()
addrPrefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
valAddrPrefix := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
signingOptions := signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
AddressCodec: addresscodec.NewBech32Codec(addrPrefix),
ValidatorAddressCodec: addresscodec.NewBech32Codec(valAddrPrefix),
CustomGetSigners: map[protoreflect.FullName]signing.GetSignersFunc{
"ethermint.evm.v1.MsgHandleTx": customGetSignerFn("from"),
},
Expand Down

0 comments on commit 14fc62c

Please sign in to comment.