From 874e521a369f4568f75d4c2ce97a5701f31fb614 Mon Sep 17 00:00:00 2001 From: anilCSE Date: Sat, 5 Sep 2020 15:43:29 +0530 Subject: [PATCH 1/7] rename RegisterCodec to RegisterLegacyAminoCodec --- baseapp/baseapp_test.go | 2 +- crypto/keyring/codec.go | 6 ++--- docs/basics/app-anatomy.md | 4 +-- docs/building-modules/module-manager.md | 4 +-- docs/cn/basics/app-anatomy.md | 4 +-- docs/core/encoding.md | 2 +- simapp/encoding.go | 4 +-- simapp/utils_test.go | 4 +-- std/codec.go | 6 ++--- tests/mocks/types_module_module.go | 36 ++++++++++++------------- types/codec.go | 4 +-- types/coin_test.go | 2 +- types/module/module.go | 8 +++--- types/module/module_test.go | 4 +-- x/auth/client/cli/cli_test.go | 12 ++++----- x/auth/client/cli/encode_test.go | 6 ++--- x/auth/client/tx_test.go | 4 +-- x/auth/legacy/v0_38/types.go | 2 +- x/auth/legacy/v0_39/types.go | 2 +- x/auth/legacy/v0_40/migrate_test.go | 2 +- x/auth/module.go | 6 ++--- x/auth/signing/verify_test.go | 4 +-- x/auth/types/client_tx_test.go | 2 +- x/auth/types/codec.go | 8 +++--- x/auth/types/stdtx_test.go | 12 ++++----- x/auth/vesting/types/codec.go | 8 +++--- x/bank/legacy/v0_40/migrate_test.go | 2 +- x/bank/module.go | 4 +-- x/bank/types/codec.go | 8 +++--- x/capability/module.go | 6 ++--- x/capability/types/codec.go | 6 ++--- x/crisis/module.go | 6 ++--- x/crisis/types/codec.go | 8 +++--- x/distribution/keeper/querier_test.go | 4 +-- x/distribution/module.go | 6 ++--- x/distribution/types/codec.go | 8 +++--- x/evidence/module.go | 6 ++--- x/evidence/types/codec.go | 6 ++--- x/genutil/client/cli/init_test.go | 2 +- x/genutil/legacy/v0_36/migrate.go | 4 +-- x/genutil/legacy/v0_38/migrate.go | 2 +- x/genutil/legacy/v0_39/migrate.go | 4 +-- x/genutil/legacy/v0_40/migrate.go | 4 +-- x/genutil/module.go | 4 +-- x/gov/client/utils/query_test.go | 6 ++--- x/gov/legacy/v0_34/types.go | 2 +- x/gov/legacy/v0_36/types.go | 2 +- x/gov/module.go | 6 ++--- x/gov/types/codec.go | 6 ++--- x/ibc-transfer/module.go | 4 +-- x/ibc/module.go | 4 +-- x/ibc/testing/mock/mock.go | 4 +-- x/mint/module.go | 4 +-- x/params/keeper/common_test.go | 2 +- x/params/module.go | 6 ++--- x/params/proposal_handler_test.go | 2 +- x/params/types/proposal/codec.go | 4 +-- x/slashing/module.go | 6 ++--- x/slashing/types/codec.go | 6 ++--- x/staking/module.go | 6 ++--- x/staking/simulation/decoder_test.go | 4 +-- x/staking/types/codec.go | 8 +++--- x/upgrade/module.go | 8 +++--- x/upgrade/types/codec.go | 4 +-- x/upgrade/types/proposal_test.go | 4 +-- 65 files changed, 173 insertions(+), 173 deletions(-) diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index 4371be44f6e9..71f9494cabbb 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -82,7 +82,7 @@ func newBaseApp(name string, options ...func(*BaseApp)) *BaseApp { func registerTestCodec(cdc *codec.LegacyAmino) { // register Tx, Msg - sdk.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) // register test types cdc.RegisterConcrete(&txTest{}, "cosmos-sdk/baseapp/txTest", nil) diff --git a/crypto/keyring/codec.go b/crypto/keyring/codec.go index a71006228f97..5e7e74439177 100644 --- a/crypto/keyring/codec.go +++ b/crypto/keyring/codec.go @@ -12,12 +12,12 @@ var CryptoCdc *codec.LegacyAmino func init() { CryptoCdc = codec.New() cryptocodec.RegisterCrypto(CryptoCdc) - RegisterCodec(CryptoCdc) + RegisterLegacyAminoCodec(CryptoCdc) CryptoCdc.Seal() } -// RegisterCodec registers concrete types and interfaces on the given codec. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers concrete types and interfaces on the given codec. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*Info)(nil), nil) cdc.RegisterConcrete(hd.BIP44Params{}, "crypto/keys/hd/BIP44Params", nil) cdc.RegisterConcrete(localInfo{}, "crypto/keys/localInfo", nil) diff --git a/docs/basics/app-anatomy.md b/docs/basics/app-anatomy.md index f27bfdce5ee1..fc64b772423f 100644 --- a/docs/basics/app-anatomy.md +++ b/docs/basics/app-anatomy.md @@ -106,9 +106,9 @@ See an example of `BeginBlocker` and `EndBlocker` functions from [`gaia`](https: ### Register Codec -The `MakeCodec` function is the last important function of the `app.go` file. The goal of this function is to instantiate a [codec `cdc`](../core/encoding.md) (e.g. amino) initialize the codec of the SDK and each of the application's modules using the `RegisterCodec` function. +The `MakeCodec` function is the last important function of the `app.go` file. The goal of this function is to instantiate a [codec `cdc`](../core/encoding.md) (e.g. amino) initialize the codec of the SDK and each of the application's modules using the `RegisterLegacyAminoCodec` function. -To register the application's modules, the `MakeCodec` function calls `RegisterCodec` on `ModuleBasics`. `ModuleBasics` is a [basic manager](../building-modules/module-manager.md#basicmanager) which lists all of the application's modules. It is instanciated in the `init()` function, and only serves to easily register non-dependant elements of application's modules (such as codec). To learn more about the basic module manager, click [here](../building-modules/module-manager.md#basicmanager). +To register the application's modules, the `MakeCodec` function calls `RegisterLegacyAminoCodec` on `ModuleBasics`. `ModuleBasics` is a [basic manager](../building-modules/module-manager.md#basicmanager) which lists all of the application's modules. It is instanciated in the `init()` function, and only serves to easily register non-dependant elements of application's modules (such as codec). To learn more about the basic module manager, click [here](../building-modules/module-manager.md#basicmanager). See an example of a `MakeCodec` from [`gaia`](https://github.com/cosmos/gaia): diff --git a/docs/building-modules/module-manager.md b/docs/building-modules/module-manager.md index 17bf12a036e9..dad35a9da3aa 100644 --- a/docs/building-modules/module-manager.md +++ b/docs/building-modules/module-manager.md @@ -34,7 +34,7 @@ The `AppModuleBasic` interface defines the independent methods modules need to i Let us go through the methods: - `Name()`: Returns the name of the module as a `string`. -- `RegisterCodec(*codec.LegacyAmino)`: Registers the `amino` codec for the module, which is used to marhsal and unmarshal structs to/from `[]byte` in order to persist them in the moduel's `KVStore`. +- `RegisterLegacyAminoCodec(*codec.LegacyAmino)`: Registers the `amino` codec for the module, which is used to marhsal and unmarshal structs to/from `[]byte` in order to persist them in the moduel's `KVStore`. - `DefaultGenesis()`: Returns a default [`GenesisState`](./genesis.md#genesisstate) for the module, marshalled to `json.RawMessage`. The default `GenesisState` need to be defined by the module developer and is primarily used for testing. - `ValidateGenesis(json.RawMessage)`: Used to validate the `GenesisState` defined by a module, given in its `json.RawMessage` form. It will usually unmarshall the `json` before running a custom [`ValidateGenesis`](./genesis.md#validategenesis) function defined by the module developer. - `RegisterRESTRoutes(client.Context, *mux.Router)`: Registers the REST routes for the module. These routes will be used to map REST request to the module in order to process them. See [../interfaces/rest.md] for more. @@ -108,7 +108,7 @@ The `BasicManager` is a structure that lists all the `AppModuleBasic` of an appl It implements the following methods: - `NewBasicManager(modules ...AppModuleBasic)`: Constructor function. It takes a list of the application's `AppModuleBasic` and builds a new `BasicManager`. This function is generally called in the `init()` function of [`app.go`](../basics/app-anatomy.md#core-application-file) to quickly initialize the independent elements of the application's modules (click [here](https://github.com/cosmos/gaia/blob/master/app/app.go#L59-L74) to see an example). -- `RegisterCodec(cdc *codec.LegacyAmino)`: Registers the [`codec`s](../core/encoding.md) of each of the application's `AppModuleBasic`. This function is usually called early on in the [application's construction](../basics/app-anatomy.md#constructor). +- `RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)`: Registers the [`codec`s](../core/encoding.md) of each of the application's `AppModuleBasic`. This function is usually called early on in the [application's construction](../basics/app-anatomy.md#constructor). - `DefaultGenesis()`: Provides default genesis information for modules in the application by calling the [`DefaultGenesis()`](./genesis.md#defaultgenesis) function of each module. It is used to construct a default genesis file for the application. - `ValidateGenesis(genesis map[string]json.RawMessage)`: Validates the genesis information modules by calling the [`ValidateGenesis()`](./genesis.md#validategenesis) function of each module. - `RegisterRESTRoutes(ctx client.Context, rtr *mux.Router)`: Registers REST routes for modules by calling the [`RegisterRESTRoutes`](./module-interfaces.md#register-routes) function of each module. This function is usually called function from the `main.go` function of the [application's command-line interface](../interfaces/cli.md). diff --git a/docs/cn/basics/app-anatomy.md b/docs/cn/basics/app-anatomy.md index 84ba5ff6e516..7909c40c8a71 100644 --- a/docs/cn/basics/app-anatomy.md +++ b/docs/cn/basics/app-anatomy.md @@ -104,9 +104,9 @@ See an example of an `InitChainer` from [`gaia`](https://github.com/cosmos/gaia) ### Register Codec -MakeCodec 函数是 app.go 文件的最后一个重要功能。 此函数的目的是使用 RegisterCodec 函数实例化 codec`cdc`,例如 amino 初始化 SDK 的编解码器以及每个应用程序的模块。 +MakeCodec 函数是 app.go 文件的最后一个重要功能。 此函数的目的是使用 RegisterLegacyAminoCodec 函数实例化 codec`cdc`,例如 amino 初始化 SDK 的编解码器以及每个应用程序的模块。 -为了注册应用程序的模块,`MakeCodec` 函数在 `ModuleBasics` 上调用 `RegisterCodec`。`ModuleBasics` 是一个基本管理器,其中列出了应用程序的所有模块。 它在`init()`函数中得到实例化,仅用于注册应用程序模块的非依赖元素(例如编解码器)。 要了解有关基本模块管理器的更多信息,请点击[这里](https://docs.cosmos.network/master/building-modules/module-manager.html#basicmanager)。 +为了注册应用程序的模块,`MakeCodec` 函数在 `ModuleBasics` 上调用 `RegisterLegacyAminoCodec`。`ModuleBasics` 是一个基本管理器,其中列出了应用程序的所有模块。 它在`init()`函数中得到实例化,仅用于注册应用程序模块的非依赖元素(例如编解码器)。 要了解有关基本模块管理器的更多信息,请点击[这里](https://docs.cosmos.network/master/building-modules/module-manager.html#basicmanager)。 请参阅 [gaia](https://github.com/cosmos/gaia) 中的 `MakeCodec` 示例: diff --git a/docs/core/encoding.md b/docs/core/encoding.md index 44b6d1348335..3af7c1cc5990 100644 --- a/docs/core/encoding.md +++ b/docs/core/encoding.md @@ -56,7 +56,7 @@ for their types, they may use an Amino codec directly. Every module uses an Amino codec to serialize types and interfaces. This codec typically has types and interfaces registered in that module's domain only (e.g. messages), -but there are exceptions like `x/gov`. Each module exposes a `RegisterCodec` function +but there are exceptions like `x/gov`. Each module exposes a `RegisterLegacyAminoCodec` function that allows a user to provide a codec and have all the types registered. An application will call this method for each necessary module. diff --git a/simapp/encoding.go b/simapp/encoding.go index 120d1e74380c..0ceb12274342 100644 --- a/simapp/encoding.go +++ b/simapp/encoding.go @@ -8,9 +8,9 @@ import ( // MakeEncodingConfig creates an EncodingConfig for testing func MakeEncodingConfig() params.EncodingConfig { encodingConfig := params.MakeEncodingConfig() - std.RegisterCodec(encodingConfig.Amino) + std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterCodec(encodingConfig.Amino) + ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) return encodingConfig } diff --git a/simapp/utils_test.go b/simapp/utils_test.go index 22e362480500..1165d0cd2087 100644 --- a/simapp/utils_test.go +++ b/simapp/utils_test.go @@ -17,8 +17,8 @@ import ( func makeCodec(bm module.BasicManager) *codec.LegacyAmino { cdc := codec.New() - bm.RegisterCodec(cdc) - std.RegisterCodec(cdc) + bm.RegisterLegacyAminoCodec(cdc) + std.RegisterLegacyAminoCodec(cdc) return cdc } diff --git a/std/codec.go b/std/codec.go index a7a09031bb2c..4563e955b09c 100644 --- a/std/codec.go +++ b/std/codec.go @@ -8,9 +8,9 @@ import ( vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) -func RegisterCodec(cdc *codec.LegacyAmino) { - vesting.RegisterCodec(cdc) - sdk.RegisterCodec(cdc) +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + vesting.RegisterLegacyAminoCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) cryptocodec.RegisterCrypto(cdc) } diff --git a/tests/mocks/types_module_module.go b/tests/mocks/types_module_module.go index 81221aef036f..816a486b2ec7 100644 --- a/tests/mocks/types_module_module.go +++ b/tests/mocks/types_module_module.go @@ -56,16 +56,16 @@ func (mr *MockAppModuleBasicMockRecorder) Name() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAppModuleBasic)(nil).Name)) } -// RegisterCodec mocks base method -func (m *MockAppModuleBasic) RegisterCodec(arg0 *codec.LegacyAmino) { +// RegisterLegacyAminoCodec mocks base method +func (m *MockAppModuleBasic) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterCodec", arg0) + m.ctrl.Call(m, "RegisterLegacyAminoCodec", arg0) } -// RegisterCodec indicates an expected call of RegisterCodec -func (mr *MockAppModuleBasicMockRecorder) RegisterCodec(arg0 interface{}) *gomock.Call { +// RegisterLegacyAminoCodec indicates an expected call of RegisterLegacyAminoCodec +func (mr *MockAppModuleBasicMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterCodec", reflect.TypeOf((*MockAppModuleBasic)(nil).RegisterCodec), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModuleBasic)(nil).RegisterLegacyAminoCodec), arg0) } // RegisterInterfaces mocks base method @@ -197,16 +197,16 @@ func (mr *MockAppModuleGenesisMockRecorder) Name() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAppModuleGenesis)(nil).Name)) } -// RegisterCodec mocks base method -func (m *MockAppModuleGenesis) RegisterCodec(arg0 *codec.LegacyAmino) { +// RegisterLegacyAminoCodec mocks base method +func (m *MockAppModuleGenesis) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterCodec", arg0) + m.ctrl.Call(m, "RegisterLegacyAminoCodec", arg0) } -// RegisterCodec indicates an expected call of RegisterCodec -func (mr *MockAppModuleGenesisMockRecorder) RegisterCodec(arg0 interface{}) *gomock.Call { +// RegisterLegacyAminoCodec indicates an expected call of RegisterLegacyAminoCodec +func (mr *MockAppModuleGenesisMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterCodec", reflect.TypeOf((*MockAppModuleGenesis)(nil).RegisterCodec), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModuleGenesis)(nil).RegisterLegacyAminoCodec), arg0) } // RegisterInterfaces mocks base method @@ -366,16 +366,16 @@ func (mr *MockAppModuleMockRecorder) Name() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAppModule)(nil).Name)) } -// RegisterCodec mocks base method -func (m *MockAppModule) RegisterCodec(arg0 *codec.LegacyAmino) { +// RegisterLegacyAminoCodec mocks base method +func (m *MockAppModule) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterCodec", arg0) + m.ctrl.Call(m, "RegisterLegacyAminoCodec", arg0) } -// RegisterCodec indicates an expected call of RegisterCodec -func (mr *MockAppModuleMockRecorder) RegisterCodec(arg0 interface{}) *gomock.Call { +// RegisterLegacyAminoCodec indicates an expected call of RegisterLegacyAminoCodec +func (mr *MockAppModuleMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterCodec", reflect.TypeOf((*MockAppModule)(nil).RegisterCodec), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModule)(nil).RegisterLegacyAminoCodec), arg0) } // RegisterInterfaces mocks base method diff --git a/types/codec.go b/types/codec.go index bf3c4c4d049c..c654508b4c49 100644 --- a/types/codec.go +++ b/types/codec.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -// RegisterCodec registers the sdk message type. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers the sdk message type. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*Msg)(nil), nil) cdc.RegisterInterface((*Tx)(nil), nil) } diff --git a/types/coin_test.go b/types/coin_test.go index f16bd682e5ef..af5b6ae698cf 100644 --- a/types/coin_test.go +++ b/types/coin_test.go @@ -874,7 +874,7 @@ func TestCoinsIsAnyGT(t *testing.T) { func TestMarshalJSONCoins(t *testing.T) { cdc := codec.New() - RegisterCodec(cdc) + RegisterLegacyAminoCodec(cdc) testCases := []struct { name string diff --git a/types/module/module.go b/types/module/module.go index 34904f5d797f..6934ce89f18b 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -49,7 +49,7 @@ import ( // AppModuleBasic is the standard form for basic non-dependant elements of an application module. type AppModuleBasic interface { Name() string - RegisterCodec(*codec.LegacyAmino) + RegisterLegacyAminoCodec(*codec.LegacyAmino) RegisterInterfaces(codectypes.InterfaceRegistry) DefaultGenesis(codec.JSONMarshaler) json.RawMessage @@ -74,10 +74,10 @@ func NewBasicManager(modules ...AppModuleBasic) BasicManager { return moduleMap } -// RegisterCodec registers all module codecs -func (bm BasicManager) RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers all module codecs +func (bm BasicManager) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { for _, b := range bm { - b.RegisterCodec(cdc) + b.RegisterLegacyAminoCodec(cdc) } } diff --git a/types/module/module_test.go b/types/module/module_test.go index 6472370b4c68..69ce7c1f8b5e 100644 --- a/types/module/module_test.go +++ b/types/module/module_test.go @@ -39,7 +39,7 @@ func TestBasicManager(t *testing.T) { mockAppModuleBasic1.EXPECT().DefaultGenesis(gomock.Eq(cdc)).Times(1).Return(json.RawMessage(``)) mockAppModuleBasic1.EXPECT().ValidateGenesis(gomock.Eq(cdc), gomock.Eq(nil), gomock.Eq(wantDefaultGenesis["mockAppModuleBasic1"])).Times(1).Return(errFoo) mockAppModuleBasic1.EXPECT().RegisterRESTRoutes(gomock.Eq(client.Context{}), gomock.Eq(&mux.Router{})).Times(1) - mockAppModuleBasic1.EXPECT().RegisterCodec(gomock.Eq(legacyAmino)).Times(1) + mockAppModuleBasic1.EXPECT().RegisterLegacyAminoCodec(gomock.Eq(legacyAmino)).Times(1) mockAppModuleBasic1.EXPECT().RegisterInterfaces(gomock.Eq(interfaceRegistry)).Times(1) mockAppModuleBasic1.EXPECT().GetTxCmd().Times(1).Return(nil) mockAppModuleBasic1.EXPECT().GetQueryCmd().Times(1).Return(nil) @@ -47,7 +47,7 @@ func TestBasicManager(t *testing.T) { mm := module.NewBasicManager(mockAppModuleBasic1) require.Equal(t, mm["mockAppModuleBasic1"], mockAppModuleBasic1) - mm.RegisterCodec(legacyAmino) + mm.RegisterLegacyAminoCodec(legacyAmino) mm.RegisterInterfaces(interfaceRegistry) require.Equal(t, wantDefaultGenesis, mm.DefaultGenesis(cdc)) diff --git a/x/auth/client/cli/cli_test.go b/x/auth/client/cli/cli_test.go index 8440aea5b002..19a8720ae304 100644 --- a/x/auth/client/cli/cli_test.go +++ b/x/auth/client/cli/cli_test.go @@ -335,8 +335,8 @@ func (s *IntegrationTestSuite) TestCLIMultisignInsufficientCosigners() { val1 := s.network.Validators[0] codec := codec2.New() - sdk.RegisterCodec(codec) - banktypes.RegisterCodec(codec) + sdk.RegisterLegacyAminoCodec(codec) + banktypes.RegisterLegacyAminoCodec(codec) val1.ClientCtx.LegacyAmino = codec // Generate 2 accounts and a multisig. @@ -446,8 +446,8 @@ func (s *IntegrationTestSuite) TestCLIMultisignSortSignatures() { val1 := s.network.Validators[0] codec := codec2.New() - sdk.RegisterCodec(codec) - banktypes.RegisterCodec(codec) + sdk.RegisterLegacyAminoCodec(codec) + banktypes.RegisterLegacyAminoCodec(codec) val1.ClientCtx.LegacyAmino = codec // Generate 2 accounts and a multisig. @@ -547,8 +547,8 @@ func (s *IntegrationTestSuite) TestCLIMultisign() { val1 := s.network.Validators[0] codec := codec2.New() - sdk.RegisterCodec(codec) - banktypes.RegisterCodec(codec) + sdk.RegisterLegacyAminoCodec(codec) + banktypes.RegisterLegacyAminoCodec(codec) val1.ClientCtx.LegacyAmino = codec // Generate 2 accounts and a multisig. diff --git a/x/auth/client/cli/encode_test.go b/x/auth/client/cli/encode_test.go index 8b245af985f3..61464bb951ab 100644 --- a/x/auth/client/cli/encode_test.go +++ b/x/auth/client/cli/encode_test.go @@ -20,8 +20,8 @@ func TestGetCommandEncode(t *testing.T) { cmd := GetEncodeCommand() _ = testutil.ApplyMockIODiscardOutErr(cmd) - authtypes.RegisterCodec(encodingConfig.Amino) - sdk.RegisterCodec(encodingConfig.Amino) + authtypes.RegisterLegacyAminoCodec(encodingConfig.Amino) + sdk.RegisterLegacyAminoCodec(encodingConfig.Amino) txCfg := encodingConfig.TxConfig @@ -58,7 +58,7 @@ func TestGetCommandDecode(t *testing.T) { cmd := GetDecodeCommand() _ = testutil.ApplyMockIODiscardOutErr(cmd) - sdk.RegisterCodec(encodingConfig.Amino) + sdk.RegisterLegacyAminoCodec(encodingConfig.Amino) txCfg := encodingConfig.TxConfig clientCtx = clientCtx.WithTxConfig(txCfg) diff --git a/x/auth/client/tx_test.go b/x/auth/client/tx_test.go index 3483f17f4a59..070b3470a53a 100644 --- a/x/auth/client/tx_test.go +++ b/x/auth/client/tx_test.go @@ -153,9 +153,9 @@ func compareEncoders(t *testing.T, expected sdk.TxEncoder, actual sdk.TxEncoder) func makeCodec() *codec.LegacyAmino { var cdc = codec.New() - sdk.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) cryptocodec.RegisterCrypto(cdc) - authtypes.RegisterCodec(cdc) + authtypes.RegisterLegacyAminoCodec(cdc) cdc.RegisterConcrete(testdata.TestMsg{}, "cosmos-sdk/Test", nil) return cdc } diff --git a/x/auth/legacy/v0_38/types.go b/x/auth/legacy/v0_38/types.go index 6d5708c114e3..f576648279bf 100644 --- a/x/auth/legacy/v0_38/types.go +++ b/x/auth/legacy/v0_38/types.go @@ -521,7 +521,7 @@ func ValidateGenAccounts(genAccounts GenesisAccounts) error { return nil } -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*GenesisAccount)(nil), nil) cdc.RegisterInterface((*Account)(nil), nil) cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/Account", nil) diff --git a/x/auth/legacy/v0_39/types.go b/x/auth/legacy/v0_39/types.go index 32b527cce74c..ed5a790a5a31 100644 --- a/x/auth/legacy/v0_39/types.go +++ b/x/auth/legacy/v0_39/types.go @@ -419,7 +419,7 @@ func (ma *ModuleAccount) UnmarshalJSON(bz []byte) error { return nil } -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*v038auth.GenesisAccount)(nil), nil) cdc.RegisterInterface((*v038auth.Account)(nil), nil) cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/Account", nil) diff --git a/x/auth/legacy/v0_40/migrate_test.go b/x/auth/legacy/v0_40/migrate_test.go index 108273b6e720..2295bcc9bd6b 100644 --- a/x/auth/legacy/v0_40/migrate_test.go +++ b/x/auth/legacy/v0_40/migrate_test.go @@ -17,7 +17,7 @@ import ( func TestMigrate(t *testing.T) { v039Codec := codec.New() cryptocodec.RegisterCrypto(v039Codec) - v039auth.RegisterCodec(v039Codec) + v039auth.RegisterLegacyAminoCodec(v039Codec) coins := sdk.NewCoins(sdk.NewInt64Coin("stake", 50)) addr1, _ := sdk.AccAddressFromBech32("cosmos1xxkueklal9vejv9unqu80w9vptyepfa95pd53u") diff --git a/x/auth/module.go b/x/auth/module.go index 9567b4dd8ed4..80a738551bfd 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -40,9 +40,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the auth module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the auth module's types for the given codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the auth diff --git a/x/auth/signing/verify_test.go b/x/auth/signing/verify_test.go index 3a8d82c23632..f9026c0fdd7d 100644 --- a/x/auth/signing/verify_test.go +++ b/x/auth/signing/verify_test.go @@ -30,8 +30,8 @@ func TestVerifySignature(t *testing.T) { ctx = ctx.WithBlockHeight(1) cdc := codec.New() - sdk.RegisterCodec(cdc) - types.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) cdc.RegisterConcrete(testdata.TestMsg{}, "cosmos-sdk/Test", nil) acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr) diff --git a/x/auth/types/client_tx_test.go b/x/auth/types/client_tx_test.go index 683487c70b6b..71e31f830c82 100644 --- a/x/auth/types/client_tx_test.go +++ b/x/auth/types/client_tx_test.go @@ -18,7 +18,7 @@ import ( func testCodec() *codec.LegacyAmino { cdc := codec.New() - sdk.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) cryptoAmino.RegisterCrypto(cdc) cdc.RegisterConcrete(&testdata.TestMsg{}, "cosmos-sdk/Test", nil) return cdc diff --git a/x/auth/types/codec.go b/x/auth/types/codec.go index f309c9c78909..773dc34369a2 100644 --- a/x/auth/types/codec.go +++ b/x/auth/types/codec.go @@ -6,9 +6,9 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" ) -// RegisterCodec registers the account interfaces and concrete types on the -// provided Amino codec. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers the account interfaces and concrete types on the +// provided LegacyAmino codec. These types are used for Amino JSON serialization +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*ModuleAccountI)(nil), nil) cdc.RegisterInterface((*GenesisAccount)(nil), nil) cdc.RegisterInterface((*AccountI)(nil), nil) @@ -48,6 +48,6 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) } diff --git a/x/auth/types/stdtx_test.go b/x/auth/types/stdtx_test.go index eb1f94c71a07..33b6971e0d64 100644 --- a/x/auth/types/stdtx_test.go +++ b/x/auth/types/stdtx_test.go @@ -155,8 +155,8 @@ func TestTxValidateBasic(t *testing.T) { func TestDefaultTxEncoder(t *testing.T) { cdc := codec.New() - sdk.RegisterCodec(cdc) - RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) + RegisterLegacyAminoCodec(cdc) cdc.RegisterConcrete(testdata.TestMsg{}, "cosmos-sdk/Test", nil) encoder := DefaultTxEncoder(cdc) @@ -206,8 +206,8 @@ func TestStdSignatureMarshalYAML(t *testing.T) { func TestSignatureV2Conversions(t *testing.T) { _, pubKey, _ := testdata.KeyTestPubAddr() cdc := codec.New() - sdk.RegisterCodec(cdc) - RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) + RegisterLegacyAminoCodec(cdc) dummy := []byte("dummySig") sig := StdSignature{PubKey: pubKey, Signature: dummy} @@ -263,9 +263,9 @@ func TestGetSignaturesV2(t *testing.T) { dummy := []byte("dummySig") cdc := codec.New() - sdk.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) cryptocodec.RegisterCrypto(cdc) - RegisterCodec(cdc) + RegisterLegacyAminoCodec(cdc) fee := NewStdFee(50000, sdk.Coins{sdk.NewInt64Coin("atom", 150)}) sig := StdSignature{PubKey: pubKey, Signature: dummy} diff --git a/x/auth/vesting/types/codec.go b/x/auth/vesting/types/codec.go index 4edd9acdebd1..2b12b39aabcc 100644 --- a/x/auth/vesting/types/codec.go +++ b/x/auth/vesting/types/codec.go @@ -7,9 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" ) -// RegisterCodec registers the vesting interfaces and concrete types on the -// provided Amino codec. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers the vesting interfaces and concrete types on the +// provided LegacyAmino codec. These types are used for Amino JSON serialization +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*exported.VestingAccount)(nil), nil) cdc.RegisterConcrete(&BaseVestingAccount{}, "cosmos-sdk/BaseVestingAccount", nil) cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil) @@ -46,6 +46,6 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { var amino = codec.New() func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) amino.Seal() } diff --git a/x/bank/legacy/v0_40/migrate_test.go b/x/bank/legacy/v0_40/migrate_test.go index 10b245c5ec7d..556f8174665b 100644 --- a/x/bank/legacy/v0_40/migrate_test.go +++ b/x/bank/legacy/v0_40/migrate_test.go @@ -17,7 +17,7 @@ import ( func TestMigrate(t *testing.T) { v040Codec := codec.New() cryptocodec.RegisterCrypto(v040Codec) - v039auth.RegisterCodec(v040Codec) + v039auth.RegisterLegacyAminoCodec(v040Codec) coins := sdk.NewCoins(sdk.NewInt64Coin("stake", 50)) addr1, _ := sdk.AccAddressFromBech32("cosmos1xxkueklal9vejv9unqu80w9vptyepfa95pd53u") diff --git a/x/bank/module.go b/x/bank/module.go index 41677b8cd9d4..0245f7f773de 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -39,8 +39,8 @@ type AppModuleBasic struct { // Name returns the bank module's name. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the bank module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { types.RegisterCodec(cdc) } +// RegisterLegacyAminoCodec registers the bank module's types on the LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the bank // module. diff --git a/x/bank/types/codec.go b/x/bank/types/codec.go index b0acd6b7c190..7b886854f860 100644 --- a/x/bank/types/codec.go +++ b/x/bank/types/codec.go @@ -8,9 +8,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank/exported" ) -// RegisterCodec registers the necessary x/bank interfaces and concrete types -// on the provided Amino codec. These types are used for Amino JSON serialization. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers the necessary x/bank interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*exported.SupplyI)(nil), nil) cdc.RegisterConcrete(&Supply{}, "cosmos-sdk/Supply", nil) cdc.RegisterConcrete(&MsgSend{}, "cosmos-sdk/MsgSend", nil) @@ -43,7 +43,7 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) amino.Seal() } diff --git a/x/capability/module.go b/x/capability/module.go index e1bd4c99c3c9..a946c137e4cf 100644 --- a/x/capability/module.go +++ b/x/capability/module.go @@ -47,9 +47,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the capability module's types to the provided codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the capability module's types to the LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers the module's interface types diff --git a/x/capability/types/codec.go b/x/capability/types/codec.go index 57f1312cc5e7..68241fc2a570 100644 --- a/x/capability/types/codec.go +++ b/x/capability/types/codec.go @@ -4,9 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -// RegisterCodec registers all the necessary types and interfaces for the +// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the // capability module. -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&Capability{}, "cosmos-sdk/Capability", nil) cdc.RegisterConcrete(Owner{}, "cosmos-sdk/Owner", nil) cdc.RegisterConcrete(&CapabilityOwners{}, "cosmos-sdk/CapabilityOwners", nil) @@ -17,6 +17,6 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) amino.Seal() } diff --git a/x/crisis/module.go b/x/crisis/module.go index 76acb86e4f30..cc0beac0637a 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -33,9 +33,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the crisis module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the crisis module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the crisis diff --git a/x/crisis/types/codec.go b/x/crisis/types/codec.go index 57732fa0dadd..e25c419f9f5d 100644 --- a/x/crisis/types/codec.go +++ b/x/crisis/types/codec.go @@ -7,9 +7,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// RegisterCodec registers the necessary x/crisis interfaces and concrete types -// on the provided Amino codec. These types are used for Amino JSON serialization. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers the necessary x/crisis interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgVerifyInvariant{}, "cosmos-sdk/MsgVerifyInvariant", nil) } @@ -32,7 +32,7 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) amino.Seal() } diff --git a/x/distribution/keeper/querier_test.go b/x/distribution/keeper/querier_test.go index 2a30c7bc9069..92b8b2725b4e 100644 --- a/x/distribution/keeper/querier_test.go +++ b/x/distribution/keeper/querier_test.go @@ -112,8 +112,8 @@ func getQueriedCommunityPool(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmi func TestQueries(t *testing.T) { cdc := codec.New() - types.RegisterCodec(cdc) - banktypes.RegisterCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) + banktypes.RegisterLegacyAminoCodec(cdc) app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) diff --git a/x/distribution/module.go b/x/distribution/module.go index 2b896fe8418e..efd6bcc739a2 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -43,9 +43,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the distribution module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the distribution module's types for the given codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the distribution diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 08d7ad9d0d6a..812b3577257d 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -8,9 +8,9 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -// RegisterCodec registers the necessary x/distribution interfaces and concrete types -// on the provided Amino codec. These types are used for Amino JSON serialization. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers the necessary x/distribution interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgWithdrawDelegatorReward{}, "cosmos-sdk/MsgWithdrawDelegationReward", nil) cdc.RegisterConcrete(&MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValidatorCommission", nil) cdc.RegisterConcrete(&MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress", nil) @@ -45,7 +45,7 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) amino.Seal() } diff --git a/x/evidence/module.go b/x/evidence/module.go index 97d1e941ae3e..078cd6e2c925 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -55,9 +55,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the evidence module's types to the provided codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the evidence module's types to the LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns the evidence module's default genesis state. diff --git a/x/evidence/types/codec.go b/x/evidence/types/codec.go index ce8f81ed0963..68701fd6fc89 100644 --- a/x/evidence/types/codec.go +++ b/x/evidence/types/codec.go @@ -8,9 +8,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/evidence/exported" ) -// RegisterCodec registers all the necessary types and interfaces for the +// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the // evidence module. -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*exported.Evidence)(nil), nil) cdc.RegisterConcrete(&MsgSubmitEvidence{}, "cosmos-sdk/MsgSubmitEvidence", nil) cdc.RegisterConcrete(&Equivocation{}, "cosmos-sdk/Equivocation", nil) @@ -38,7 +38,7 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) amino.Seal() } diff --git a/x/genutil/client/cli/init_test.go b/x/genutil/client/cli/init_test.go index 2adaf4a62b46..3e6538580660 100644 --- a/x/genutil/client/cli/init_test.go +++ b/x/genutil/client/cli/init_test.go @@ -192,7 +192,7 @@ func TestInitNodeValidatorFiles(t *testing.T) { // custom tx codec func makeCodec() *codec.LegacyAmino { var cdc = codec.New() - sdk.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) cryptocodec.RegisterCrypto(cdc) return cdc } diff --git a/x/genutil/legacy/v0_36/migrate.go b/x/genutil/legacy/v0_36/migrate.go index cabfd285ef42..f43930dff92b 100644 --- a/x/genutil/legacy/v0_36/migrate.go +++ b/x/genutil/legacy/v0_36/migrate.go @@ -21,11 +21,11 @@ import ( func Migrate(appState types.AppMap) types.AppMap { v034Codec := codec.New() cryptocodec.RegisterCrypto(v034Codec) - v034gov.RegisterCodec(v034Codec) + v034gov.RegisterLegacyAminoCodec(v034Codec) v036Codec := codec.New() cryptocodec.RegisterCrypto(v036Codec) - v036gov.RegisterCodec(v036Codec) + v036gov.RegisterLegacyAminoCodec(v036Codec) // migrate genesis accounts state if appState[v034genAccounts.ModuleName] != nil { diff --git a/x/genutil/legacy/v0_38/migrate.go b/x/genutil/legacy/v0_38/migrate.go index 6c9e8c003676..b4fe91118374 100644 --- a/x/genutil/legacy/v0_38/migrate.go +++ b/x/genutil/legacy/v0_38/migrate.go @@ -20,7 +20,7 @@ func Migrate(appState types.AppMap) types.AppMap { v038Codec := codec.New() cryptocodec.RegisterCrypto(v038Codec) - v038auth.RegisterCodec(v038Codec) + v038auth.RegisterLegacyAminoCodec(v038Codec) if appState[v036genaccounts.ModuleName] != nil { // unmarshal relative source genesis application state diff --git a/x/genutil/legacy/v0_39/migrate.go b/x/genutil/legacy/v0_39/migrate.go index f1d1b45d5868..cc7e07d96d01 100644 --- a/x/genutil/legacy/v0_39/migrate.go +++ b/x/genutil/legacy/v0_39/migrate.go @@ -15,11 +15,11 @@ import ( func Migrate(appState types.AppMap) types.AppMap { v038Codec := codec.New() cryptocodec.RegisterCrypto(v038Codec) - v038auth.RegisterCodec(v038Codec) + v038auth.RegisterLegacyAminoCodec(v038Codec) v039Codec := codec.New() cryptocodec.RegisterCrypto(v039Codec) - v039auth.RegisterCodec(v039Codec) + v039auth.RegisterLegacyAminoCodec(v039Codec) // migrate x/auth state (JSON serialization only) if appState[v038auth.ModuleName] != nil { diff --git a/x/genutil/legacy/v0_40/migrate.go b/x/genutil/legacy/v0_40/migrate.go index 9b04a9222d06..f47dab470078 100644 --- a/x/genutil/legacy/v0_40/migrate.go +++ b/x/genutil/legacy/v0_40/migrate.go @@ -14,11 +14,11 @@ import ( func Migrate(appState types.AppMap) types.AppMap { v039Codec := codec.New() cryptocodec.RegisterCrypto(v039Codec) - v039auth.RegisterCodec(v039Codec) + v039auth.RegisterLegacyAminoCodec(v039Codec) v040Codec := codec.New() cryptocodec.RegisterCrypto(v040Codec) - v039auth.RegisterCodec(v040Codec) + v039auth.RegisterLegacyAminoCodec(v040Codec) // remove balances from existing accounts if appState[v039auth.ModuleName] != nil { diff --git a/x/genutil/module.go b/x/genutil/module.go index b1dd164759c3..0280ffa3a3e7 100644 --- a/x/genutil/module.go +++ b/x/genutil/module.go @@ -31,8 +31,8 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the genutil module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) {} +// RegisterLegacyAminoCodec registers the genutil module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {} diff --git a/x/gov/client/utils/query_test.go b/x/gov/client/utils/query_test.go index 3a448c2f5f88..fa83d3bd7d79 100644 --- a/x/gov/client/utils/query_test.go +++ b/x/gov/client/utils/query_test.go @@ -49,9 +49,9 @@ func (mock TxSearchMock) Block(height *int64) (*ctypes.ResultBlock, error) { func newTestCodec() *codec.LegacyAmino { cdc := codec.New() - sdk.RegisterCodec(cdc) - types.RegisterCodec(cdc) - authtypes.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) + authtypes.RegisterLegacyAminoCodec(cdc) return cdc } diff --git a/x/gov/legacy/v0_34/types.go b/x/gov/legacy/v0_34/types.go index 349206f232cc..4b78b6987f10 100644 --- a/x/gov/legacy/v0_34/types.go +++ b/x/gov/legacy/v0_34/types.go @@ -326,7 +326,7 @@ func (pt ProposalKind) String() string { } } -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*ProposalContent)(nil), nil) cdc.RegisterConcrete(TextProposal{}, "gov/TextProposal", nil) } diff --git a/x/gov/legacy/v0_36/types.go b/x/gov/legacy/v0_36/types.go index 0c874a9205cf..54fd9d748032 100644 --- a/x/gov/legacy/v0_36/types.go +++ b/x/gov/legacy/v0_36/types.go @@ -127,7 +127,7 @@ func ValidateAbstract(c Content) error { return nil } -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*Content)(nil), nil) cdc.RegisterConcrete(TextProposal{}, "cosmos-sdk/TextProposal", nil) } diff --git a/x/gov/module.go b/x/gov/module.go index b0f43fb6e923..82b6392340b1 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -53,9 +53,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the gov module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the gov module's types for the given codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the gov diff --git a/x/gov/types/codec.go b/x/gov/types/codec.go index 6abb77d9feb0..55be4fc11cdc 100644 --- a/x/gov/types/codec.go +++ b/x/gov/types/codec.go @@ -7,9 +7,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// RegisterCodec registers all the necessary types and interfaces for the +// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the // governance module. -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*Content)(nil), nil) cdc.RegisterConcrete(&MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal", nil) cdc.RegisterConcrete(&MsgDeposit{}, "cosmos-sdk/MsgDeposit", nil) @@ -53,6 +53,6 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) } diff --git a/x/ibc-transfer/module.go b/x/ibc-transfer/module.go index 085385eedad9..d98462cf150f 100644 --- a/x/ibc-transfer/module.go +++ b/x/ibc-transfer/module.go @@ -45,8 +45,8 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec implements AppModuleBasic interface -func (AppModuleBasic) RegisterCodec(*codec.LegacyAmino) {} +// RegisterLegacyAminoCodec implements AppModuleBasic interface +func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} // RegisterInterfaces registers module concrete types into protobuf Any. func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { diff --git a/x/ibc/module.go b/x/ibc/module.go index f6489b9d1fd9..8b6f96e2a877 100644 --- a/x/ibc/module.go +++ b/x/ibc/module.go @@ -46,8 +46,8 @@ func (AppModuleBasic) Name() string { return host.ModuleName } -// RegisterCodec does nothing. IBC does not support amino. -func (AppModuleBasic) RegisterCodec(*codec.LegacyAmino) {} +// RegisterLegacyAminoCodec does nothing. IBC does not support amino. +func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} // DefaultGenesis returns default genesis state as raw bytes for the ibc // module. diff --git a/x/ibc/testing/mock/mock.go b/x/ibc/testing/mock/mock.go index 639b68df4a00..e8a72ba10a58 100644 --- a/x/ibc/testing/mock/mock.go +++ b/x/ibc/testing/mock/mock.go @@ -38,8 +38,8 @@ func (AppModuleBasic) Name() string { return ModuleName } -// RegisterCodec implements AppModuleBasic interface. -func (AppModuleBasic) RegisterCodec(*codec.LegacyAmino) {} +// RegisterLegacyAminoCodec implements AppModuleBasic interface. +func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} // RegisterInterfaces implements AppModuleBasic interface. func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {} diff --git a/x/mint/module.go b/x/mint/module.go index 69aeaeffa7a9..b483696b9228 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -43,8 +43,8 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the mint module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) {} +// RegisterLegacyAminoCodec registers the mint module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {} diff --git a/x/params/keeper/common_test.go b/x/params/keeper/common_test.go index 139aaccc9aba..c7692d56735d 100644 --- a/x/params/keeper/common_test.go +++ b/x/params/keeper/common_test.go @@ -32,7 +32,7 @@ type s struct { func createTestCodec() *codec.LegacyAmino { cdc := codec.New() - sdk.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) cdc.RegisterConcrete(s{}, "test/s", nil) cdc.RegisterConcrete(invalid{}, "test/invalid", nil) return cdc diff --git a/x/params/module.go b/x/params/module.go index 89a76facd9d4..0c947938311d 100644 --- a/x/params/module.go +++ b/x/params/module.go @@ -39,9 +39,9 @@ func (AppModuleBasic) Name() string { return proposal.ModuleName } -// RegisterCodec registers the params module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - proposal.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the params module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + proposal.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the params diff --git a/x/params/proposal_handler_test.go b/x/params/proposal_handler_test.go index 163182d9c029..332e1a80260d 100644 --- a/x/params/proposal_handler_test.go +++ b/x/params/proposal_handler_test.go @@ -62,7 +62,7 @@ func testProposal(changes ...proposal.ParamChange) *proposal.ParameterChangeProp func newTestInput(t *testing.T) testInput { cdc := codec.New() - proposal.RegisterCodec(cdc) + proposal.RegisterLegacyAminoCodec(cdc) db := dbm.NewMemDB() cms := store.NewCommitMultiStore(db) diff --git a/x/params/types/proposal/codec.go b/x/params/types/proposal/codec.go index d274da798458..d638caccaf65 100644 --- a/x/params/types/proposal/codec.go +++ b/x/params/types/proposal/codec.go @@ -6,8 +6,8 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -// RegisterCodec registers all necessary param module types with a given codec. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers all necessary param module types with a given LegacyAmino codec. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal", nil) } diff --git a/x/slashing/module.go b/x/slashing/module.go index b653e38decb5..21fa5e336090 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -46,9 +46,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the slashing module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the slashing module's types for the given codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers the module's interface types diff --git a/x/slashing/types/codec.go b/x/slashing/types/codec.go index 340f4317463f..a92c67339e86 100644 --- a/x/slashing/types/codec.go +++ b/x/slashing/types/codec.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// RegisterCodec registers concrete types on codec -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers concrete types on LegacyAmino codec +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgUnjail{}, "cosmos-sdk/MsgUnjail", nil) } @@ -31,7 +31,7 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) amino.Seal() } diff --git a/x/staking/module.go b/x/staking/module.go index 03480080a558..f91d0eee7617 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -44,9 +44,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the staking module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers the module's interface types diff --git a/x/staking/simulation/decoder_test.go b/x/staking/simulation/decoder_test.go index f442f648dd6e..3d343e10fb22 100644 --- a/x/staking/simulation/decoder_test.go +++ b/x/staking/simulation/decoder_test.go @@ -25,9 +25,9 @@ var ( func makeTestCodec() (cdc *codec.LegacyAmino) { cdc = codec.New() - sdk.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) cryptocodec.RegisterCrypto(cdc) - types.RegisterCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) return } diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go index 7a69e259edb0..74574f14c4b7 100644 --- a/x/staking/types/codec.go +++ b/x/staking/types/codec.go @@ -7,9 +7,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// RegisterCodec registers the necessary x/staking interfaces and concrete types -// on the provided Amino codec. These types are used for Amino JSON serialization. -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers the necessary x/staking interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateValidator{}, "cosmos-sdk/MsgCreateValidator", nil) cdc.RegisterConcrete(&MsgEditValidator{}, "cosmos-sdk/MsgEditValidator", nil) cdc.RegisterConcrete(&MsgDelegate{}, "cosmos-sdk/MsgDelegate", nil) @@ -41,7 +41,7 @@ var ( ) func init() { - RegisterCodec(amino) + RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) amino.Seal() } diff --git a/x/upgrade/module.go b/x/upgrade/module.go index cb1e4932823a..1e5ba707d1d3 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -27,7 +27,7 @@ import ( var moduleCdc = codec.New() func init() { - types.RegisterCodec(moduleCdc) + types.RegisterLegacyAminoCodec(moduleCdc) } var ( @@ -43,9 +43,9 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the upgrade types on the amino codec -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the upgrade types on the LegacyAmino codec +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) } // RegisterRESTRoutes registers all REST query handlers diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 6b274e467d6a..59703f57a8f9 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -6,8 +6,8 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -// RegisterCodec registers concrete types on the Amino codec -func RegisterCodec(cdc *codec.LegacyAmino) { +// RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(Plan{}, "cosmos-sdk/Plan", nil) cdc.RegisterConcrete(&SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal", nil) cdc.RegisterConcrete(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal", nil) diff --git a/x/upgrade/types/proposal_test.go b/x/upgrade/types/proposal_test.go index cf4fd6eee1a2..17bd7b1478f4 100644 --- a/x/upgrade/types/proposal_test.go +++ b/x/upgrade/types/proposal_test.go @@ -43,8 +43,8 @@ func TestContentAccessors(t *testing.T) { } cdc := codec.New() - gov.RegisterCodec(cdc) - RegisterCodec(cdc) + gov.RegisterLegacyAminoCodec(cdc) + RegisterLegacyAminoCodec(cdc) for name, tc := range cases { tc := tc // copy to local variable for scopelint From 0766c8c6c50eb9032753f4241e39db94cc725455 Mon Sep 17 00:00:00 2001 From: anilCSE Date: Sat, 5 Sep 2020 15:48:23 +0530 Subject: [PATCH 2/7] Add changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd21171417e0..d89054736a05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +