Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Remove clientCtx.JSONCodec and rename EncodingConfig.Marshaler to Codec #9521

Merged
merged 8 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (client/tx) [\#9421](https://github.com/cosmos/cosmos-sdk/pull/9421/) `BuildUnsignedTx`, `BuildSimTx`, `PrintUnsignedStdTx` functions are moved to
the Tx Factory as methods.
* [\#9246](https://github.com/cosmos/cosmos-sdk/pull/9246) The `New` method for the network package now returns an error.
* (codec) [\#9521](https://github.com/cosmos/cosmos-sdk/pull/9521) Removed deprecated `clientCtx.JSONCodec` from `client.Context`.
* (codec) [\#9521](https://github.com/cosmos/cosmos-sdk/pull/9521) Rename `EncodingConfig.Marshaler` to `Codec`.
Comment on lines +51 to +52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree with those 2 changes, but otoh I also hear community feedback saying that there are too many breaking changes between releases.

So I'm not 100% sure of adding this change, imo it doesn't cost much to us to keep them deprecated, and give more time to app devs to adapt.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do that for consistency. In the past we renamed Marshaler to Codec, and we forgot about renaming the part in EncodingConfig.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Then we might as well do it here and now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexanderbez - the related rename is part of the 0.43 release, we forgot to update EncodingConfig.


### CLI Breaking Changes

Expand Down
20 changes: 3 additions & 17 deletions client/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ import (
// Context implements a typical context created in SDK modules for transaction
// handling and queries.
type Context struct {
FromAddress sdk.AccAddress
Client rpcclient.Client
ChainID string
// Deprecated: Codec codec will be changed to Codec: codec.Codec
JSONCodec codec.JSONCodec
FromAddress sdk.AccAddress
Client rpcclient.Client
ChainID string
Codec codec.Codec
InterfaceRegistry codectypes.InterfaceRegistry
Input io.Reader
Expand Down Expand Up @@ -74,20 +72,8 @@ func (ctx Context) WithInput(r io.Reader) Context {
return ctx
}

// Deprecated: WithJSONCodec returns a copy of the Context with an updated JSONCodec.
func (ctx Context) WithJSONCodec(m codec.JSONCodec) Context {
ctx.JSONCodec = m
// since we are using ctx.Codec everywhere in the SDK, for backward compatibility
// we need to try to set it here as well.
if c, ok := m.(codec.Codec); ok {
ctx.Codec = c
}
return ctx
}

// WithCodec returns a copy of the Context with an updated Codec.
func (ctx Context) WithCodec(m codec.Codec) Context {
ctx.JSONCodec = m
ctx.Codec = m
return ctx
}
Expand Down
4 changes: 2 additions & 2 deletions client/keys/add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ func Test_runAddCmdDryRun(t *testing.T) {
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn)
require.NoError(t, err)

appCodec := simapp.MakeTestEncodingConfig().Marshaler
appCodec := simapp.MakeTestEncodingConfig().Codec
clientCtx := client.Context{}.
WithJSONCodec(appCodec).
WithCodec(appCodec).
WithKeyringDir(kbHome).
WithKeyring(kb)
ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx)
Expand Down
18 changes: 9 additions & 9 deletions codec/any_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ func TestMarshalProtoPubKey(t *testing.T) {

pkAny, err := codectypes.NewAnyWithValue(pk)
require.NoError(err)
bz, err := ccfg.Marshaler.MarshalJSON(pkAny)
bz, err := ccfg.Codec.MarshalJSON(pkAny)
require.NoError(err)

var pkAny2 codectypes.Any
err = ccfg.Marshaler.UnmarshalJSON(bz, &pkAny2)
err = ccfg.Codec.UnmarshalJSON(bz, &pkAny2)
require.NoError(err)
// Before getting a cached value we need to unpack it.
// Normally this happens in types which implement UnpackInterfaces
Expand All @@ -84,11 +84,11 @@ func TestMarshalProtoPubKey(t *testing.T) {

// **** test binary serialization ****

bz, err = ccfg.Marshaler.Marshal(pkAny)
bz, err = ccfg.Codec.Marshal(pkAny)
require.NoError(err)

var pkAny3 codectypes.Any
err = ccfg.Marshaler.Unmarshal(bz, &pkAny3)
err = ccfg.Codec.Unmarshal(bz, &pkAny3)
require.NoError(err)
err = ccfg.InterfaceRegistry.UnpackAny(&pkAny3, &pkI)
require.NoError(err)
Expand All @@ -106,11 +106,11 @@ func TestMarshalProtoInterfacePubKey(t *testing.T) {

// **** test JSON serialization ****

bz, err := ccfg.Marshaler.MarshalInterfaceJSON(pk)
bz, err := ccfg.Codec.MarshalInterfaceJSON(pk)
require.NoError(err)

var pk3 cryptotypes.PubKey
err = ccfg.Marshaler.UnmarshalInterfaceJSON(bz, &pk3)
err = ccfg.Codec.UnmarshalInterfaceJSON(bz, &pk3)
require.NoError(err)
require.True(pk3.Equals(pk))

Expand All @@ -119,18 +119,18 @@ func TestMarshalProtoInterfacePubKey(t *testing.T) {
// Any can't implement UnpackInterfacesMessage interface. So Any is not
// automatically unpacked and we won't get a value.
var pkAny codectypes.Any
err = ccfg.Marshaler.UnmarshalJSON(bz, &pkAny)
err = ccfg.Codec.UnmarshalJSON(bz, &pkAny)
require.NoError(err)
ifc := pkAny.GetCachedValue()
require.Nil(ifc)

// **** test binary serialization ****

bz, err = ccfg.Marshaler.MarshalInterface(pk)
bz, err = ccfg.Codec.MarshalInterface(pk)
require.NoError(err)

var pk2 cryptotypes.PubKey
err = ccfg.Marshaler.UnmarshalInterface(bz, &pk2)
err = ccfg.Codec.UnmarshalInterface(bz, &pk2)
require.NoError(err)
require.True(pk2.Equals(pk))
}
2 changes: 1 addition & 1 deletion crypto/keys/multisig/multisig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func TestDisplay(t *testing.T) {
func() { require.Empty(msig.String()) },
)
ccfg := simapp.MakeTestEncodingConfig()
bz, err := ccfg.Marshaler.MarshalInterfaceJSON(msig)
bz, err := ccfg.Codec.MarshalInterfaceJSON(msig)
require.NoError(err)
expectedPrefix := `{"@type":"/cosmos.crypto.multisig.LegacyAminoPubKey","threshold":2,"public_keys":[{"@type":"/cosmos.crypto.secp256k1.PubKey"`
require.True(strings.HasPrefix(string(bz), expectedPrefix))
Expand Down
2 changes: 1 addition & 1 deletion server/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func setupApp(t *testing.T, tempDir string) (*simapp.SimApp, context.Context, *t
serverCtx.Config.RootDir = tempDir

clientCtx := client.Context{}.WithCodec(app.AppCodec())
genDoc := newDefaultGenesisDoc(encCfg.Marshaler)
genDoc := newDefaultGenesisDoc(encCfg.Codec)

require.NoError(t, saveGenesisFile(genDoc, serverCtx.Config.GenesisFile()))
app.InitChain(
Expand Down
4 changes: 2 additions & 2 deletions server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/server/config"
"github.com/cosmos/cosmos-sdk/simapp"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
)

var cancelledInPreRun = errors.New("Cancelled in prerun")
Expand Down Expand Up @@ -414,7 +414,7 @@ func TestEmptyMinGasPrices(t *testing.T) {
encCfg := simapp.MakeTestEncodingConfig()

// Run InitCmd to create necessary config files.
clientCtx := client.Context{}.WithHomeDir(tempDir).WithJSONCodec(encCfg.Marshaler)
clientCtx := client.Context{}.WithHomeDir(tempDir).WithCodec(encCfg.Codec)
serverCtx := server.NewDefaultContext()
ctx := context.WithValue(context.Background(), server.ServerContextKey, serverCtx)
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
Expand Down
2 changes: 1 addition & 1 deletion simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func NewSimApp(
appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp),
) *SimApp {

appCodec := encodingConfig.Marshaler
appCodec := encodingConfig.Codec
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

Expand Down
4 changes: 2 additions & 2 deletions simapp/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) {
)
}

genesisState := NewDefaultGenesisState(encCfg.Marshaler)
genesisState := NewDefaultGenesisState(encCfg.Codec)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
require.NoError(t, err)

Expand Down Expand Up @@ -243,7 +243,7 @@ func TestUpgradeStateOnGenesis(t *testing.T) {
encCfg := MakeTestEncodingConfig()
db := dbm.NewMemDB()
app := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{})
genesisState := NewDefaultGenesisState(encCfg.Marshaler)
genesisState := NewDefaultGenesisState(encCfg.Codec)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
require.NoError(t, err)

Expand Down
7 changes: 3 additions & 4 deletions simapp/params/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
// This is provided for compatibility between protobuf and amino implementations.
type EncodingConfig struct {
InterfaceRegistry types.InterfaceRegistry
// NOTE: this field will be renamed to Codec
Marshaler codec.Codec
TxConfig client.TxConfig
Amino *codec.LegacyAmino
Codec codec.Codec
TxConfig client.TxConfig
Amino *codec.LegacyAmino
}
6 changes: 3 additions & 3 deletions simapp/params/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (
func MakeTestEncodingConfig() EncodingConfig {
cdc := codec.NewLegacyAmino()
interfaceRegistry := types.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
codec := codec.NewProtoCodec(interfaceRegistry)

return EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes),
Codec: codec,
TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes),
Amino: cdc,
}
}
2 changes: 1 addition & 1 deletion simapp/simd/cmd/genaccounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestAddGenesisAccountCmd(t *testing.T) {
cfg, err := genutiltest.CreateDefaultTendermintConfig(home)
require.NoError(t, err)

appCodec := simapp.MakeTestEncodingConfig().Marshaler
appCodec := simapp.MakeTestEncodingConfig().Codec
err = genutiltest.ExecInitCmd(testMbm, home, appCodec)
require.NoError(t, err)

Expand Down
4 changes: 2 additions & 2 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
encodingConfig := simapp.MakeTestEncodingConfig()
initClientCtx := client.Context{}.
WithCodec(encodingConfig.Marshaler).
WithCodec(encodingConfig.Codec).
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
Expand Down Expand Up @@ -163,7 +163,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
)

// add rosetta
rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler))
rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec))
}

func addModuleInitFlags(startCmd *cobra.Command) {
Expand Down
6 changes: 3 additions & 3 deletions simapp/simd/cmd/testnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ func Test_TestnetCmd(t *testing.T) {
cfg, err := genutiltest.CreateDefaultTendermintConfig(home)
require.NoError(t, err)

err = genutiltest.ExecInitCmd(simapp.ModuleBasics, home, encodingConfig.Marshaler)
err = genutiltest.ExecInitCmd(simapp.ModuleBasics, home, encodingConfig.Codec)
require.NoError(t, err)

serverCtx := server.NewContext(viper.New(), cfg, logger)
clientCtx := client.Context{}.
WithCodec(encodingConfig.Marshaler).
WithCodec(encodingConfig.Codec).
WithHomeDir(home).
WithTxConfig(encodingConfig.TxConfig)

Expand All @@ -45,6 +45,6 @@ func Test_TestnetCmd(t *testing.T) {
appState, _, err := genutiltypes.GenesisStateFromGenFile(genFile)
require.NoError(t, err)

bankGenState := banktypes.GetGenesisStateFromAppState(encodingConfig.Marshaler, appState)
bankGenState := banktypes.GetGenesisStateFromAppState(encodingConfig.Codec, appState)
require.NotEmpty(t, bankGenState.Supply.String())
}
2 changes: 1 addition & 1 deletion simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) {
encCdc := MakeTestEncodingConfig()
app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, EmptyAppOptions{})
if withGenesis {
return app, NewDefaultGenesisState(encCdc.Marshaler)
return app, NewDefaultGenesisState(encCdc.Codec)
}
return app, GenesisState{}
}
Expand Down
4 changes: 2 additions & 2 deletions testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ func DefaultConfig() Config {
encCfg := simapp.MakeTestEncodingConfig()

return Config{
Codec: encCfg.Marshaler,
Codec: encCfg.Codec,
TxConfig: encCfg.TxConfig,
LegacyAmino: encCfg.Amino,
InterfaceRegistry: encCfg.InterfaceRegistry,
AccountRetriever: authtypes.AccountRetriever{},
AppConstructor: NewAppConstructor(encCfg),
GenesisState: simapp.ModuleBasics.DefaultGenesis(encCfg.Marshaler),
GenesisState: simapp.ModuleBasics.DefaultGenesis(encCfg.Codec),
TimeoutCommit: 2 * time.Second,
ChainID: "chain-" + tmrand.NewRand().Str(6),
NumValidators: 4,
Expand Down
4 changes: 2 additions & 2 deletions x/auth/client/cli/encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestGetCommandEncode(t *testing.T) {
ctx := context.Background()
clientCtx := client.Context{}.
WithTxConfig(encodingConfig.TxConfig).
WithCodec(encodingConfig.Marshaler)
WithCodec(encodingConfig.Codec)
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)

cmd.SetArgs([]string{txFileName})
Expand All @@ -52,7 +52,7 @@ func TestGetCommandDecode(t *testing.T) {

clientCtx := client.Context{}.
WithTxConfig(encodingConfig.TxConfig).
WithCodec(encodingConfig.Marshaler)
WithCodec(encodingConfig.Codec)

cmd := GetDecodeCommand()
_ = testutil.ApplyMockIODiscardOutErr(cmd)
Expand Down
2 changes: 1 addition & 1 deletion x/auth/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestSupply_ValidatePermissions(t *testing.T) {
maccPerms[multiPerm] = []string{types.Burner, types.Minter, types.Staking}
maccPerms[randomPerm] = []string{"random"}

cdc := simapp.MakeTestEncodingConfig().Marshaler
cdc := simapp.MakeTestEncodingConfig().Codec
keeper := keeper.NewAccountKeeper(
cdc, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName),
types.ProtoBaseAccount, maccPerms,
Expand Down
2 changes: 1 addition & 1 deletion x/auth/legacy/v040/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestMigrate(t *testing.T) {
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
WithJSONCodec(encodingConfig.Marshaler)
WithCodec(encodingConfig.Codec)

coins := sdk.NewCoins(sdk.NewInt64Coin("stake", 50))

Expand Down
2 changes: 1 addition & 1 deletion x/auth/legacy/v043/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ func createValidator(t *testing.T, ctx sdk.Context, app *simapp.SimApp, powers i
addrs := simapp.AddTestAddrsIncremental(app, ctx, 1, valTokens)
valAddrs := simapp.ConvertAddrsToValAddrs(addrs)
pks := simapp.CreateTestPubKeys(1)
cdc := simapp.MakeTestEncodingConfig().Marshaler
cdc := simapp.MakeTestEncodingConfig().Codec

app.StakingKeeper = stakingkeeper.NewKeeper(
cdc,
Expand Down
2 changes: 1 addition & 1 deletion x/auth/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (

func TestDecodeStore(t *testing.T) {
app := simapp.Setup(false)
cdc := simapp.MakeTestEncodingConfig().Marshaler
cdc := simapp.MakeTestEncodingConfig().Codec
acc := types.NewBaseAccountWithAddress(delAddr1)
dec := simulation.NewDecodeStore(app.AccountKeeper)

Expand Down
2 changes: 1 addition & 1 deletion x/auth/types/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import (
var (
app = simapp.Setup(false)
ecdc = simapp.MakeTestEncodingConfig()
appCodec, legacyAmino = ecdc.Marshaler, ecdc.Amino
appCodec, legacyAmino = ecdc.Codec, ecdc.Amino
)
2 changes: 1 addition & 1 deletion x/authz/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestDecodeStore(t *testing.T) {
cdc := simapp.MakeTestEncodingConfig().Marshaler
cdc := simapp.MakeTestEncodingConfig().Codec
dec := simulation.NewDecodeStore(cdc)

grant, _ := authz.NewGrant(banktypes.NewSendAuthorization(sdk.NewCoins(sdk.NewInt64Coin("foo", 123))), time.Now().UTC())
Expand Down
2 changes: 1 addition & 1 deletion x/bank/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type IntegrationTestSuite struct {
func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[string]bool) (authkeeper.AccountKeeper, keeper.BaseKeeper) {
app := suite.app
maccPerms := simapp.GetMaccPerms()
appCodec := simapp.MakeTestEncodingConfig().Marshaler
appCodec := simapp.MakeTestEncodingConfig().Codec

maccPerms[holder] = nil
maccPerms[authtypes.Burner] = []string{authtypes.Burner}
Expand Down
2 changes: 1 addition & 1 deletion x/bank/legacy/v040/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestMigrate(t *testing.T) {
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
WithJSONCodec(encodingConfig.Marshaler)
WithCodec(encodingConfig.Codec)

coins := sdk.NewCoins(sdk.NewInt64Coin("stake", 50))
addr1, _ := sdk.AccAddressFromBech32("cosmos1xxkueklal9vejv9unqu80w9vptyepfa95pd53u")
Expand Down
6 changes: 3 additions & 3 deletions x/bank/legacy/v043/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ func TestSupplyMigration(t *testing.T) {
// Old supply was stored as a single blob under the `SupplyKey`.
var oldSupply v040bank.SupplyI
oldSupply = &types.Supply{Total: sdk.NewCoins(oldFooCoin, oldBarCoin)}
oldSupplyBz, err := encCfg.Marshaler.MarshalInterface(oldSupply)
oldSupplyBz, err := encCfg.Codec.MarshalInterface(oldSupply)
require.NoError(t, err)
store.Set(v040bank.SupplyKey, oldSupplyBz)

// Run migration.
err = v043bank.MigrateStore(ctx, bankKey, encCfg.Marshaler)
err = v043bank.MigrateStore(ctx, bankKey, encCfg.Codec)
require.NoError(t, err)

// New supply is indexed by denom.
Expand Down Expand Up @@ -72,7 +72,7 @@ func TestBalanceKeysMigration(t *testing.T) {
oldKey := append(append(v040bank.BalancesPrefix, addr...), denom...)
store.Set(oldKey, value)

err := v043bank.MigrateStore(ctx, bankKey, encCfg.Marshaler)
err := v043bank.MigrateStore(ctx, bankKey, encCfg.Codec)
require.NoError(t, err)

newKey := append(types.CreateAccountBalancesPrefix(addr), denom...)
Expand Down
Loading