diff --git a/testutil/keeper/epoch.go b/testutil/keeper/epoch.go index 57f91de84d..9b952670bc 100644 --- a/testutil/keeper/epoch.go +++ b/testutil/keeper/epoch.go @@ -36,7 +36,7 @@ func EpochKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { cdc := codec.NewProtoCodec(registry) paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, + codec.NewLegacyAmino(), storeKey, memStoreKey, "EpochParams", diff --git a/x/epoch/types/codec.go b/x/epoch/types/codec.go index ed7430baa5..3ff1468d0c 100644 --- a/x/epoch/types/codec.go +++ b/x/epoch/types/codec.go @@ -15,6 +15,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { } var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) ) + +func init() { + RegisterCodec(amino) + amino.Seal() +} diff --git a/x/evm/types/codec.go b/x/evm/types/codec.go index e70f6d7a92..ac4ff396fd 100644 --- a/x/evm/types/codec.go +++ b/x/evm/types/codec.go @@ -18,11 +18,11 @@ import ( var ( amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - AminoCdc = codec.NewAminoCodec(amino) + ModuleCdc = codec.NewAminoCodec(amino) ) func init() { + RegisterCodec(amino) cryptocodec.RegisterCrypto(amino) amino.Seal() } @@ -31,6 +31,14 @@ func GetAmino() *codec.LegacyAmino { return amino } +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgAssociate{}, "evm/MsgAssociate", nil) + cdc.RegisterConcrete(&MsgEVMTransaction{}, "evm/MsgEVMTransaction", nil) + cdc.RegisterConcrete(&MsgSend{}, "evm/MsgSend", nil) + cdc.RegisterConcrete(&MsgRegisterPointer{}, "evm/MsgRegisterPointer", nil) + cdc.RegisterConcrete(&MsgAssociateContractAddress{}, "evm/MsgAssociateContractAddress", nil) +} + func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations((*govtypes.Content)(nil), &AddERCNativePointerProposal{}, diff --git a/x/mint/types/codec.go b/x/mint/types/codec.go index 0f1b15969e..3018320c12 100644 --- a/x/mint/types/codec.go +++ b/x/mint/types/codec.go @@ -7,9 +7,13 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -var amino = codec.NewLegacyAmino() +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) func init() { + RegisterCodec(amino) cryptocodec.RegisterCrypto(amino) amino.Seal() } @@ -23,5 +27,3 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &UpdateMinterProposal{}, ) } - -var ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) diff --git a/x/oracle/keeper/test_utils.go b/x/oracle/keeper/test_utils.go index b8b49ec536..2e2fe60a7b 100644 --- a/x/oracle/keeper/test_utils.go +++ b/x/oracle/keeper/test_utils.go @@ -70,7 +70,7 @@ func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig { ModuleBasics.RegisterLegacyAminoCodec(amino) ModuleBasics.RegisterInterfaces(interfaceRegistry) - types.RegisterLegacyAminoCodec(amino) + types.RegisterCodec(amino) types.RegisterInterfaces(interfaceRegistry) return simparams.EncodingConfig{ InterfaceRegistry: interfaceRegistry, diff --git a/x/oracle/module.go b/x/oracle/module.go index 02c6f9cc02..76f129638d 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -44,7 +44,7 @@ func (AppModuleBasic) Name() string { // RegisterLegacyAminoCodec registers the module's types on the given LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) + types.RegisterCodec(cdc) } // RegisterInterfaces registers the module's interface types diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go index f0feaf2b0d..d84dcaaed5 100755 --- a/x/oracle/types/codec.go +++ b/x/oracle/types/codec.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgAggregateExchangeRateVote{}, "oracle/MsgAggregateExchangeRateVote", nil) cdc.RegisterConcrete(&MsgDelegateFeedConsent{}, "oracle/MsgDelegateFeedConsent", nil) } @@ -24,6 +24,12 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { } var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) ) + +func init() { + RegisterCodec(amino) + sdk.RegisterLegacyAminoCodec(amino) + amino.Seal() +} diff --git a/x/tokenfactory/keeper/migrations_test.go b/x/tokenfactory/keeper/migrations_test.go index 41b9d55641..e0db6d88b0 100644 --- a/x/tokenfactory/keeper/migrations_test.go +++ b/x/tokenfactory/keeper/migrations_test.go @@ -36,7 +36,7 @@ func TestMigrate2to3(t *testing.T) { cdc := codec.NewProtoCodec(registry) paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, + codec.NewLegacyAmino(), storeKey, memStoreKey, "TokenfactoryParams", diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go index c182eea772..4d2237f437 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -10,10 +10,10 @@ import ( ) func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgCreateDenom{}, "tokenfactory/create-denom", nil) - cdc.RegisterConcrete(&MsgMint{}, "tokenfactory/mint", nil) - cdc.RegisterConcrete(&MsgBurn{}, "tokenfactory/burn", nil) - cdc.RegisterConcrete(&MsgChangeAdmin{}, "tokenfactory/change-admin", nil) + cdc.RegisterConcrete(&MsgCreateDenom{}, "tokenfactory/MsgCreateDenom", nil) + cdc.RegisterConcrete(&MsgMint{}, "tokenfactory/MsgMint", nil) + cdc.RegisterConcrete(&MsgBurn{}, "tokenfactory/MsgBurn", nil) + cdc.RegisterConcrete(&MsgChangeAdmin{}, "tokenfactory/MsgChangeAdmin", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -34,6 +34,13 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { } var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) ) + +func init() { + RegisterCodec(amino) + sdk.RegisterLegacyAminoCodec(amino) + + amino.Seal() +}