From 21701d72edad17f0aa3b089117cd8e9408e3e62c Mon Sep 17 00:00:00 2001 From: kenta92115 Date: Fri, 22 Mar 2024 07:23:32 +0000 Subject: [PATCH] chore: fix bas module interface registry --- app/utils.go | 10 ++++++++++ cmd/swisstronikd/cmd/root.go | 6 ++---- encoding/config.go | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/utils.go b/app/utils.go index ac6b44f9..acad704a 100644 --- a/app/utils.go +++ b/app/utils.go @@ -42,6 +42,9 @@ import ( feemarkettypes "swisstronik/x/feemarket/types" + "swisstronik/encoding" + evmmoduletypes "swisstronik/types" + sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/baseapp" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -340,3 +343,10 @@ func GenesisStateWithValSet(app *App, genesisState simapp.GenesisState, return genesisState } + +func MakeConfig() evmmoduletypes.EncodingConfig { + config := encoding.MakeConfig() + ModuleBasics.RegisterLegacyAminoCodec(config.Amino) + ModuleBasics.RegisterInterfaces(config.InterfaceRegistry) + return config +} diff --git a/cmd/swisstronikd/cmd/root.go b/cmd/swisstronikd/cmd/root.go index 6082efa8..50d43cbb 100644 --- a/cmd/swisstronikd/cmd/root.go +++ b/cmd/swisstronikd/cmd/root.go @@ -10,7 +10,6 @@ import ( "path/filepath" "time" - "swisstronik/encoding" "swisstronik/ethereum/eip712" "cosmossdk.io/client/v2/autocli" @@ -18,7 +17,6 @@ import ( confixcmd "cosmossdk.io/tools/confix/cmd" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/types/module" @@ -77,7 +75,7 @@ func NewRootCmd() (*cobra.Command, ethermint.EncodingConfig) { // Initialize the SDK config the first before doing anything else. InitSDKConfig() - encodingConfig := encoding.MakeConfig() + encodingConfig := app.MakeConfig() initClientCtx := client.Context{}. WithCodec(encodingConfig.Codec). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). @@ -139,7 +137,7 @@ func NewRootCmd() (*cobra.Command, ethermint.EncodingConfig) { txConfig := authtx.NewTxConfig(encodingConfig.Codec, authtx.DefaultSignModes) // gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) - valOperAddressCodec := address.NewBech32Codec(sdktypes.GetConfig().GetBech32ValidatorAddrPrefix()) + valOperAddressCodec := encodingConfig.TxConfig.SigningContext().ValidatorAddressCodec() a := appCreator{encodingConfig} rootCmd.AddCommand( evmmoduleclient.ValidateChainID( diff --git a/encoding/config.go b/encoding/config.go index a3451b80..0726fccf 100644 --- a/encoding/config.go +++ b/encoding/config.go @@ -85,5 +85,6 @@ func MakeConfig() ethermint.EncodingConfig { // This is needed for the EIP712 txs because currently is using // the deprecated method legacytx.StdSignBytes legacytx.RegressionTestingAminoCodec = cdc + return encodingConfig }