diff --git a/UPGRADING.md b/UPGRADING.md index 70eaeaa472c1..ce2cec52d1a0 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -377,11 +377,11 @@ The signature of the extension interface `HasRegisterInterfaces` has been change +func (AppModule) RegisterInterfaces(registry registry.InterfaceRegistrar) { ``` -The signature of the extension interface `HasAminoCodec` has been changed to accept a `cosmossdk.io/core/legacy.Amino` instead of a `codec.LegacyAmino`. Modules should update their `HasAminoCodec` implementation to accept a `cosmossdk.io/core/legacy.Amino` interface. +The signature of the extension interface `HasAminoCodec` has been changed to accept a `cosmossdk.io/core/registry.AminoRegistrar` instead of a `codec.LegacyAmino`. Modules should update their `HasAminoCodec` implementation to accept a `cosmossdk.io/core/registry.AminoRegistrar` interface. ```diff -func (AppModule) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { -+func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { ++func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { ``` ##### Simulation diff --git a/codec/amino.go b/codec/amino.go index 7dcdb844d518..52623b2db8f0 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -10,7 +10,7 @@ import ( cmttypes "github.com/cometbft/cometbft/types" "github.com/tendermint/go-amino" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" "github.com/cosmos/cosmos-sdk/codec/types" ) @@ -25,7 +25,7 @@ func (cdc *LegacyAmino) Seal() { cdc.Amino.Seal() } -var _ legacy.Amino = &LegacyAmino{} +var _ registry.AminoRegistrar = &LegacyAmino{} func NewLegacyAmino() *LegacyAmino { return &LegacyAmino{amino.NewCodec()} @@ -33,9 +33,9 @@ func NewLegacyAmino() *LegacyAmino { // RegisterEvidences registers CometBFT evidence types with the provided Amino // codec. -func RegisterEvidences(cdc legacy.Amino) { - cdc.RegisterInterface((*cmttypes.Evidence)(nil), nil) - cdc.RegisterConcrete(&cmttypes.DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence") +func RegisterEvidences(registrar registry.AminoRegistrar) { + registrar.RegisterInterface((*cmttypes.Evidence)(nil), nil) + registrar.RegisterConcrete(&cmttypes.DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence") } // MarshalJSONIndent provides a utility for indented JSON encoding of an object @@ -179,7 +179,7 @@ func (*LegacyAmino) UnpackAny(*types.Any, interface{}) error { return errors.New("AminoCodec can't handle unpack protobuf Any's") } -func (cdc *LegacyAmino) RegisterInterface(ptr interface{}, iopts *legacy.InterfaceOptions) { +func (cdc *LegacyAmino) RegisterInterface(ptr interface{}, iopts *registry.AminoInterfaceOptions) { if iopts == nil { cdc.Amino.RegisterInterface(ptr, nil) } else { diff --git a/codec/depinject.go b/codec/depinject.go index d541ea7b5485..c685a3763e15 100644 --- a/codec/depinject.go +++ b/codec/depinject.go @@ -8,7 +8,6 @@ import ( authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" "cosmossdk.io/core/address" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/depinject" "cosmossdk.io/x/tx/signing" @@ -45,7 +44,7 @@ func ProvideInterfaceRegistry( return interfaceRegistry, interfaceRegistry, nil } -func ProvideLegacyAmino() legacy.Amino { +func ProvideLegacyAmino() registry.AminoRegistrar { return NewLegacyAmino() } diff --git a/codec/legacy/amino_msg.go b/codec/legacy/amino_msg.go index a3aca8e7a139..a8249034438b 100644 --- a/codec/legacy/amino_msg.go +++ b/codec/legacy/amino_msg.go @@ -3,7 +3,7 @@ package legacy import ( "fmt" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -11,9 +11,9 @@ import ( // RegisterAminoMsg first checks that the msgName is <40 chars // (else this would break ledger nano signing: https://github.com/cosmos/cosmos-sdk/issues/10870), // then registers the concrete msg type with amino. -func RegisterAminoMsg(cdc legacy.Amino, msg sdk.Msg, msgName string) { +func RegisterAminoMsg(registrar registry.AminoRegistrar, msg sdk.Msg, msgName string) { if len(msgName) > 39 { panic(fmt.Errorf("msg name %s is too long to be registered with amino", msgName)) } - cdc.RegisterConcrete(msg, msgName) + registrar.RegisterConcrete(msg, msgName) } diff --git a/core/appmodule/module.go b/core/appmodule/module.go index 279b3c8d6fad..bf61bc050e42 100644 --- a/core/appmodule/module.go +++ b/core/appmodule/module.go @@ -4,7 +4,7 @@ import ( "context" appmodulev2 "cosmossdk.io/core/appmodule/v2" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" ) // AppModule is a tag interface for app module implementations to use as a basis @@ -68,5 +68,5 @@ type HasPrecommit interface { // HasAminoCodec is an extension interface that module must implement to support JSON encoding and decoding of its types // through amino. This is used in genesis & the CLI client. type HasAminoCodec interface { - RegisterLegacyAminoCodec(legacy.Amino) + RegisterLegacyAminoCodec(registry.AminoRegistrar) } diff --git a/core/legacy/amino.go b/core/legacy/amino.go deleted file mode 100644 index eefcfd0c5576..000000000000 --- a/core/legacy/amino.go +++ /dev/null @@ -1,16 +0,0 @@ -package legacy - -// Amino is an interface that allow to register concrete types and interfaces with the Amino codec. -type Amino interface { - // RegisterInterface registers an interface and its concrete type with the Amino codec. - RegisterInterface(interfacePtr any, iopts *InterfaceOptions) - - // RegisterConcrete registers a concrete type with the Amino codec. - RegisterConcrete(cdcType interface{}, name string) -} - -// InterfaceOptions defines options for registering an interface with the Amino codec. -type InterfaceOptions struct { - Priority []string // Disamb priority. - AlwaysDisambiguate bool // If true, include disamb for all types. -} diff --git a/core/registry/amino.go b/core/registry/amino.go new file mode 100644 index 000000000000..9778ed1ac9f5 --- /dev/null +++ b/core/registry/amino.go @@ -0,0 +1,16 @@ +package registry + +// AminoRegistrar is an interface that allow to register concrete types and interfaces with the Amino codec. +type AminoRegistrar interface { + // RegisterInterface registers an interface and its concrete type with the Amino codec. + RegisterInterface(interfacePtr any, iopts *AminoInterfaceOptions) + + // RegisterConcrete registers a concrete type with the Amino codec. + RegisterConcrete(cdcType interface{}, name string) +} + +// AminoInterfaceOptions defines options for registering an interface with the Amino codec. +type AminoInterfaceOptions struct { + Priority []string // Disamb priority. + AlwaysDisambiguate bool // If true, include disamb for all types. +} diff --git a/core/registry/legacy.go b/core/registry/interface_registrar.go similarity index 100% rename from core/registry/legacy.go rename to core/registry/interface_registrar.go diff --git a/crypto/codec/amino.go b/crypto/codec/amino.go index 373ef14621f8..737210952e9b 100644 --- a/crypto/codec/amino.go +++ b/crypto/codec/amino.go @@ -3,7 +3,7 @@ package codec import ( "github.com/cometbft/cometbft/crypto/sr25519" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" bls12_381 "github.com/cosmos/cosmos-sdk/crypto/keys/bls12_381" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" @@ -14,24 +14,23 @@ import ( // RegisterCrypto registers all crypto dependency types with the provided Amino // codec. -func RegisterCrypto(cdc legacy.Amino) { - cdc.RegisterInterface((*cryptotypes.PubKey)(nil), nil) - cdc.RegisterConcrete(sr25519.PubKey{}, +func RegisterCrypto(registrar registry.AminoRegistrar) { + registrar.RegisterInterface((*cryptotypes.PubKey)(nil), nil) + registrar.RegisterConcrete(sr25519.PubKey{}, sr25519.PubKeyName) - cdc.RegisterConcrete(&ed25519.PubKey{}, + registrar.RegisterConcrete(&ed25519.PubKey{}, ed25519.PubKeyName) - cdc.RegisterConcrete(&secp256k1.PubKey{}, + registrar.RegisterConcrete(&secp256k1.PubKey{}, secp256k1.PubKeyName) - cdc.RegisterConcrete(&bls12_381.PubKey{}, bls12_381.PubKeyName) - cdc.RegisterConcrete(&kmultisig.LegacyAminoPubKey{}, + registrar.RegisterConcrete(&bls12_381.PubKey{}, bls12_381.PubKeyName) + registrar.RegisterConcrete(&kmultisig.LegacyAminoPubKey{}, kmultisig.PubKeyAminoRoute) - - cdc.RegisterInterface((*cryptotypes.PrivKey)(nil), nil) - cdc.RegisterConcrete(sr25519.PrivKey{}, + registrar.RegisterInterface((*cryptotypes.PrivKey)(nil), nil) + registrar.RegisterConcrete(sr25519.PrivKey{}, sr25519.PrivKeyName) - cdc.RegisterConcrete(&ed25519.PrivKey{}, + registrar.RegisterConcrete(&ed25519.PrivKey{}, ed25519.PrivKeyName) - cdc.RegisterConcrete(&secp256k1.PrivKey{}, + registrar.RegisterConcrete(&secp256k1.PrivKey{}, secp256k1.PrivKeyName) - cdc.RegisterConcrete(&bls12_381.PrivKey{}, bls12_381.PrivKeyName) + registrar.RegisterConcrete(&bls12_381.PrivKey{}, bls12_381.PrivKeyName) } diff --git a/docs/build/building-modules/01-module-manager.md b/docs/build/building-modules/01-module-manager.md index f69f9887265b..d5e0aac04daa 100644 --- a/docs/build/building-modules/01-module-manager.md +++ b/docs/build/building-modules/01-module-manager.md @@ -53,7 +53,7 @@ The usage of extension interfaces allows modules to define only the functionalit https://github.com/cosmos/cosmos-sdk/blob/eee5e21e1c8d0995b6d4f83b7f55ec0b58d27ba7/core/appmodule/module.go#L74-L78 ``` -* `RegisterLegacyAminoCodec(*codec.LegacyAmino)`: Registers the `amino` codec for the module, which is used to marshal and unmarshal structs to/from `[]byte` in order to persist them in the module's `KVStore`. +* `RegisterLegacyAminoCodec(registry.AminoRegistrar)`: Registers the `amino` codec for the module, which is used to marshal and unmarshal structs to/from `[]byte` in order to persist them in the module's `KVStore`. ### `HasRegisterInterfaces` diff --git a/runtime/app.go b/runtime/app.go index c5533d79ce1b..0c2d070bea5b 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -10,7 +10,7 @@ import ( runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -50,7 +50,7 @@ type App struct { storeKeys []storetypes.StoreKey interfaceRegistry codectypes.InterfaceRegistry cdc codec.Codec - amino legacy.Amino + amino registry.AminoRegistrar baseAppOptions []BaseAppOption msgServiceRouter *baseapp.MsgServiceRouter grpcQueryRouter *baseapp.GRPCQueryRouter diff --git a/runtime/module.go b/runtime/module.go index f8883e0e8e27..2b2a9bb1b9df 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -14,7 +14,7 @@ import ( reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/comet" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/depinject" @@ -112,7 +112,7 @@ func init() { func ProvideApp( interfaceRegistry codectypes.InterfaceRegistry, - amino legacy.Amino, + amino registry.AminoRegistrar, protoCodec *codec.ProtoCodec, ) ( *AppBuilder, @@ -159,7 +159,7 @@ type AppInputs struct { ModuleManager *module.Manager BaseAppOptions []BaseAppOption InterfaceRegistry codectypes.InterfaceRegistry - LegacyAmino legacy.Amino + LegacyAmino registry.AminoRegistrar AppOptions servertypes.AppOptions `optional:"true"` // can be nil in client wiring } diff --git a/runtime/v2/app.go b/runtime/v2/app.go index 1fdbd2aa0b65..c6415021fabd 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -8,7 +8,6 @@ import ( gogoproto "github.com/cosmos/gogoproto/proto" runtimev2 "cosmossdk.io/api/cosmos/app/runtime/v2" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" "cosmossdk.io/log" @@ -41,7 +40,7 @@ type App[T transaction.Tx] struct { // modules configuration storeKeys []string interfaceRegistrar registry.InterfaceRegistrar - amino legacy.Amino + amino registry.AminoRegistrar moduleManager *MM[T] // GRPCMethodsToMessageMap maps gRPC method name to a function that decodes the request diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index ddec8015fe21..3aeb9770e170 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -20,7 +20,6 @@ import ( cosmosmsg "cosmossdk.io/api/cosmos/msg/v1" "cosmossdk.io/core/appmodule" appmodulev2 "cosmossdk.io/core/appmodule/v2" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" "cosmossdk.io/log" @@ -85,10 +84,10 @@ func (m *MM[T]) Modules() map[string]appmodulev2.AppModule { } // RegisterLegacyAminoCodec registers all module codecs -func (m *MM[T]) RegisterLegacyAminoCodec(cdc legacy.Amino) { +func (m *MM[T]) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { for _, b := range m.modules { if mod, ok := b.(appmodule.HasAminoCodec); ok { - mod.RegisterLegacyAminoCodec(cdc) + mod.RegisterLegacyAminoCodec(registrar) } } } diff --git a/runtime/v2/module.go b/runtime/v2/module.go index 6ae735505d02..d67c31b7a9e5 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -17,7 +17,6 @@ import ( reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/comet" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/core/server" "cosmossdk.io/core/store" @@ -107,7 +106,7 @@ func init() { func ProvideAppBuilder[T transaction.Tx]( interfaceRegistrar registry.InterfaceRegistrar, - amino legacy.Amino, + amino registry.AminoRegistrar, ) ( *AppBuilder[T], *stf.MsgRouterBuilder, @@ -146,7 +145,7 @@ type AppInputs struct { AppBuilder *AppBuilder[transaction.Tx] ModuleManager *MM[transaction.Tx] InterfaceRegistrar registry.InterfaceRegistrar - LegacyAmino legacy.Amino + LegacyAmino registry.AminoRegistrar Logger log.Logger Viper *viper.Viper `optional:"true"` // can be nil in client wiring } diff --git a/simapp/app_di.go b/simapp/app_di.go index 94764c72eeb3..95a813c72b14 100644 --- a/simapp/app_di.go +++ b/simapp/app_di.go @@ -10,7 +10,7 @@ import ( clienthelpers "cosmossdk.io/client/v2/helpers" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" corestore "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/log" @@ -65,7 +65,7 @@ var ( // capabilities aren't needed for testing. type SimApp struct { *runtime.App - legacyAmino legacy.Amino + legacyAmino registry.AminoRegistrar appCodec codec.Codec txConfig client.TxConfig interfaceRegistry codectypes.InterfaceRegistry diff --git a/simapp/simd/cmd/root_di.go b/simapp/simd/cmd/root_di.go index 24373b0c9595..7182fe4c9bf9 100644 --- a/simapp/simd/cmd/root_di.go +++ b/simapp/simd/cmd/root_di.go @@ -12,7 +12,7 @@ import ( stakingv1 "cosmossdk.io/api/cosmos/staking/module/v1" "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/address" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/simapp" @@ -100,7 +100,7 @@ func ProvideClientContext( appCodec codec.Codec, interfaceRegistry codectypes.InterfaceRegistry, txConfigOpts tx.ConfigOptions, - legacyAmino legacy.Amino, + legacyAmino registry.AminoRegistrar, addressCodec address.Codec, validatorAddressCodec address.ValidatorAddressCodec, consensusAddressCodec address.ConsensusAddressCodec, diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index 116c96446700..75a8881d67e1 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/viper" clienthelpers "cosmossdk.io/client/v2/helpers" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" @@ -47,7 +47,7 @@ var DefaultNodeHome string // capabilities aren't needed for testing. type SimApp[T transaction.Tx] struct { *runtime.App[T] - legacyAmino legacy.Amino + legacyAmino registry.AminoRegistrar appCodec codec.Codec txConfig client.TxConfig interfaceRegistry codectypes.InterfaceRegistry diff --git a/simapp/v2/simdv2/cmd/root_di.go b/simapp/v2/simdv2/cmd/root_di.go index a4646a705e5c..9653106d36c1 100644 --- a/simapp/v2/simdv2/cmd/root_di.go +++ b/simapp/v2/simdv2/cmd/root_di.go @@ -8,7 +8,7 @@ import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/address" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" "cosmossdk.io/log" @@ -99,7 +99,7 @@ func ProvideClientContext( appCodec codec.Codec, interfaceRegistry codectypes.InterfaceRegistry, txConfigOpts tx.ConfigOptions, - legacyAmino legacy.Amino, + legacyAmino registry.AminoRegistrar, addressCodec address.Codec, validatorAddressCodec address.ValidatorAddressCodec, consensusAddressCodec address.ConsensusAddressCodec, @@ -108,7 +108,7 @@ func ProvideClientContext( amino, ok := legacyAmino.(*codec.LegacyAmino) if !ok { - panic("legacy.Amino must be an *codec.LegacyAmino instance for legacy ClientContext") + panic("registry.AminoRegistrar must be an *codec.LegacyAmino instance for legacy ClientContext") } clientCtx := client.Context{}. diff --git a/std/codec.go b/std/codec.go index a0c6dbe76c48..e5997ff14be5 100644 --- a/std/codec.go +++ b/std/codec.go @@ -1,7 +1,6 @@ package std import ( - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "github.com/cosmos/cosmos-sdk/codec" @@ -11,10 +10,10 @@ import ( ) // RegisterLegacyAminoCodec registers types with the Amino codec. -func RegisterLegacyAminoCodec(cdc legacy.Amino) { - sdk.RegisterLegacyAminoCodec(cdc) - cryptocodec.RegisterCrypto(cdc) - codec.RegisterEvidences(cdc) +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + sdk.RegisterLegacyAminoCodec(registrar) + cryptocodec.RegisterCrypto(registrar) + codec.RegisterEvidences(registrar) } // RegisterInterfaces registers Interfaces from sdk/types, vesting, crypto, tx. diff --git a/tests/systemtests/Makefile b/tests/systemtests/Makefile index 948d43bf8161..634f2a39e9d7 100644 --- a/tests/systemtests/Makefile +++ b/tests/systemtests/Makefile @@ -2,7 +2,7 @@ WAIT_TIME ?= 45s -all: test +all: test format test: go test -mod=readonly -failfast -tags='system_test' ./... --wait-time=$(WAIT_TIME) --verbose $(if $(findstring v2,$(COSMOS_BUILD_OPTIONS)),--binary=simdv2) diff --git a/testutil/mock/types_module_module.go b/testutil/mock/types_module_module.go index be1de62e6626..2cbeff8e6b54 100644 --- a/testutil/mock/types_module_module.go +++ b/testutil/mock/types_module_module.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - legacy "cosmossdk.io/core/legacy" + registry "cosmossdk.io/core/registry" client "github.com/cosmos/cosmos-sdk/client" types "github.com/cosmos/cosmos-sdk/types" module "github.com/cosmos/cosmos-sdk/types/module" @@ -53,7 +53,7 @@ func (mr *MockAppModuleBasicMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 i } // RegisterLegacyAminoCodec mocks base method. -func (m *MockAppModuleBasic) RegisterLegacyAminoCodec(arg0 legacy.Amino) { +func (m *MockAppModuleBasic) RegisterLegacyAminoCodec(arg0 registry.AminoRegistrar) { m.ctrl.T.Helper() m.ctrl.Call(m, "RegisterLegacyAminoCodec", arg0) } @@ -149,7 +149,7 @@ func (m *MockHasAminoCodec) EXPECT() *MockHasAminoCodecMockRecorder { } // RegisterLegacyAminoCodec mocks base method. -func (m *MockHasAminoCodec) RegisterLegacyAminoCodec(arg0 legacy.Amino) { +func (m *MockHasAminoCodec) RegisterLegacyAminoCodec(arg0 registry.AminoRegistrar) { m.ctrl.T.Helper() m.ctrl.Call(m, "RegisterLegacyAminoCodec", arg0) } diff --git a/testutil/network/network.go b/testutil/network/network.go index 183adfbe1758..ec703ab6f0bd 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -23,7 +23,7 @@ import ( "github.com/spf13/viper" "cosmossdk.io/core/address" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" "cosmossdk.io/depinject" "cosmossdk.io/log" sdkmath "cosmossdk.io/math" @@ -168,7 +168,7 @@ func DefaultConfigWithAppConfig(appConfig depinject.Config, baseappOpts ...func( var ( appBuilder *runtime.AppBuilder txConfig client.TxConfig - legacyAmino legacy.Amino + legacyAmino registry.AminoRegistrar cdc codec.Codec interfaceRegistry codectypes.InterfaceRegistry addressCodec address.Codec diff --git a/types/codec.go b/types/codec.go index 5eb7ecf2c2d0..379178605087 100644 --- a/types/codec.go +++ b/types/codec.go @@ -1,9 +1,8 @@ package types import ( - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" - coretransaction "cosmossdk.io/core/transaction" + "cosmossdk.io/core/transaction" ) const ( @@ -12,9 +11,9 @@ const ( ) // RegisterLegacyAminoCodec registers the sdk message type. -func RegisterLegacyAminoCodec(cdc legacy.Amino) { - cdc.RegisterInterface((*coretransaction.Msg)(nil), nil) - cdc.RegisterInterface((*Tx)(nil), nil) +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterInterface((*transaction.Msg)(nil), nil) + registrar.RegisterInterface((*Tx)(nil), nil) } // RegisterInterfaces registers the sdk message type. diff --git a/types/module/core_module.go b/types/module/core_module.go index 104ea1aab924..b458348f7181 100644 --- a/types/module/core_module.go +++ b/types/module/core_module.go @@ -9,7 +9,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/genesis" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" storetypes "cosmossdk.io/store/types" @@ -198,9 +197,9 @@ func (c coreAppModuleAdaptor) RegisterInterfaces(reg registry.InterfaceRegistrar } // RegisterLegacyAminoCodec implements HasAminoCodec -func (c coreAppModuleAdaptor) RegisterLegacyAminoCodec(amino legacy.Amino) { +func (c coreAppModuleAdaptor) RegisterLegacyAminoCodec(amino registry.AminoRegistrar) { if mod, ok := c.module.(interface { - RegisterLegacyAminoCodec(amino legacy.Amino) + RegisterLegacyAminoCodec(amino registry.AminoRegistrar) }); ok { mod.RegisterLegacyAminoCodec(amino) } diff --git a/types/module/module.go b/types/module/module.go index 1a20635f9dac..4d947fe2d7ac 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -36,7 +36,6 @@ import ( "cosmossdk.io/core/appmodule" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/genesis" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" @@ -69,7 +68,7 @@ type HasGenesisBasics = appmodule.HasGenesisBasics // HasAminoCodec is the interface for modules that have amino codec registration. // Deprecated: modules should not need to register their own amino codecs. type HasAminoCodec interface { - RegisterLegacyAminoCodec(legacy.Amino) + RegisterLegacyAminoCodec(registry.AminoRegistrar) } // HasGRPCGateway is the interface for modules to register their gRPC gateway routes. @@ -294,14 +293,14 @@ func (m *Manager) SetOrderMigrations(moduleNames ...string) { } // RegisterLegacyAminoCodec registers all module codecs -func (m *Manager) RegisterLegacyAminoCodec(cdc legacy.Amino) { +func (m *Manager) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { for name, b := range m.Modules { if _, ok := b.(interface{ RegisterLegacyAminoCodec(*codec.LegacyAmino) }); ok { panic(fmt.Sprintf("%s uses a deprecated amino registration api, implement HasAminoCodec instead if necessary", name)) } if mod, ok := b.(HasAminoCodec); ok { - mod.RegisterLegacyAminoCodec(cdc) + mod.RegisterLegacyAminoCodec(registrar) } } } diff --git a/x/auth/migrations/legacytx/codec.go b/x/auth/migrations/legacytx/codec.go index 541a15470687..c2d6d1174096 100644 --- a/x/auth/migrations/legacytx/codec.go +++ b/x/auth/migrations/legacytx/codec.go @@ -1,9 +1,7 @@ package legacytx -import ( - "cosmossdk.io/core/legacy" -) +import "cosmossdk.io/core/registry" -func RegisterLegacyAminoCodec(cdc legacy.Amino) { - cdc.RegisterConcrete(StdTx{}, "cosmos-sdk/StdTx") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterConcrete(StdTx{}, "cosmos-sdk/StdTx") } diff --git a/x/auth/module.go b/x/auth/module.go index 9cd8d0f79a5e..095304de78eb 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -10,7 +10,6 @@ import ( "cosmossdk.io/core/appmodule" appmodulev2 "cosmossdk.io/core/appmodule/v2" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" @@ -75,8 +74,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the auth module's types for the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the auth module. diff --git a/x/auth/types/codec.go b/x/auth/types/codec.go index 5cff5c407948..7f429d3b945b 100644 --- a/x/auth/types/codec.go +++ b/x/auth/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -13,18 +12,18 @@ import ( // RegisterLegacyAminoCodec registers the account interfaces and concrete types on the // provided LegacyAmino codec. These types are used for Amino JSON serialization -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - cdc.RegisterInterface((*sdk.ModuleAccountI)(nil), nil) - cdc.RegisterInterface((*GenesisAccount)(nil), nil) - cdc.RegisterInterface((*sdk.AccountI)(nil), nil) - cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount") - cdc.RegisterConcrete(&ModuleAccount{}, "cosmos-sdk/ModuleAccount") - cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/auth/Params") - cdc.RegisterConcrete(&ModuleCredential{}, "cosmos-sdk/GroupAccountCredential") - - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/auth/MsgUpdateParams") - - legacytx.RegisterLegacyAminoCodec(cdc) +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterInterface((*sdk.ModuleAccountI)(nil), nil) + registrar.RegisterInterface((*GenesisAccount)(nil), nil) + registrar.RegisterInterface((*sdk.AccountI)(nil), nil) + registrar.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount") + registrar.RegisterConcrete(&ModuleAccount{}, "cosmos-sdk/ModuleAccount") + registrar.RegisterConcrete(Params{}, "cosmos-sdk/x/auth/Params") + registrar.RegisterConcrete(&ModuleCredential{}, "cosmos-sdk/GroupAccountCredential") + + legacy.RegisterAminoMsg(registrar, &MsgUpdateParams{}, "cosmos-sdk/x/auth/MsgUpdateParams") + + legacytx.RegisterLegacyAminoCodec(registrar) } // RegisterInterfaces associates protoName with AccountI interface diff --git a/x/auth/vesting/module.go b/x/auth/vesting/module.go index 5c79520e1857..1c618acd4954 100644 --- a/x/auth/vesting/module.go +++ b/x/auth/vesting/module.go @@ -2,7 +2,6 @@ package vesting import ( "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -34,8 +33,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the module's types with the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterInterfaces registers the module's interfaces and implementations with diff --git a/x/auth/vesting/types/codec.go b/x/auth/vesting/types/codec.go index e263124bfd00..165a3d43c77e 100644 --- a/x/auth/vesting/types/codec.go +++ b/x/auth/vesting/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" sdk "github.com/cosmos/cosmos-sdk/types" @@ -11,13 +10,13 @@ import ( // RegisterLegacyAminoCodec registers the vesting interfaces and concrete types on the // provided LegacyAmino codec. These types are used for Amino JSON serialization -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - cdc.RegisterInterface((*exported.VestingAccount)(nil), nil) - cdc.RegisterConcrete(&BaseVestingAccount{}, "cosmos-sdk/BaseVestingAccount") - cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount") - cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount") - cdc.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount") - cdc.RegisterConcrete(&PermanentLockedAccount{}, "cosmos-sdk/PermanentLockedAccount") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterInterface((*exported.VestingAccount)(nil), nil) + registrar.RegisterConcrete(&BaseVestingAccount{}, "cosmos-sdk/BaseVestingAccount") + registrar.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount") + registrar.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount") + registrar.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount") + registrar.RegisterConcrete(&PermanentLockedAccount{}, "cosmos-sdk/PermanentLockedAccount") } // RegisterInterfaces associates protoName with AccountI and VestingAccount diff --git a/x/authz/codec.go b/x/authz/codec.go index 925fd90b639b..4580a8b04f4f 100644 --- a/x/authz/codec.go +++ b/x/authz/codec.go @@ -1,7 +1,6 @@ package authz import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" bank "cosmossdk.io/x/bank/types" @@ -13,13 +12,13 @@ import ( // RegisterLegacyAminoCodec registers the necessary x/authz interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - legacy.RegisterAminoMsg(cdc, &MsgGrant{}, "cosmos-sdk/MsgGrant") - legacy.RegisterAminoMsg(cdc, &MsgRevoke{}, "cosmos-sdk/MsgRevoke") - legacy.RegisterAminoMsg(cdc, &MsgExec{}, "cosmos-sdk/MsgExec") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + legacy.RegisterAminoMsg(registrar, &MsgGrant{}, "cosmos-sdk/MsgGrant") + legacy.RegisterAminoMsg(registrar, &MsgRevoke{}, "cosmos-sdk/MsgRevoke") + legacy.RegisterAminoMsg(registrar, &MsgExec{}, "cosmos-sdk/MsgExec") - cdc.RegisterInterface((*Authorization)(nil), nil) - cdc.RegisterConcrete(&GenericAuthorization{}, "cosmos-sdk/GenericAuthorization") + registrar.RegisterInterface((*Authorization)(nil), nil) + registrar.RegisterConcrete(&GenericAuthorization{}, "cosmos-sdk/GenericAuthorization") } // RegisterInterfaces registers the interfaces types with the interface registry diff --git a/x/authz/module/module.go b/x/authz/module/module.go index 03e6dddf2302..1acb5727b2e8 100644 --- a/x/authz/module/module.go +++ b/x/authz/module/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/errors" "cosmossdk.io/x/authz" @@ -93,8 +92,8 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { } // RegisterLegacyAminoCodec registers the authz module's types for the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - authz.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + authz.RegisterLegacyAminoCodec(registrar) } // RegisterInterfaces registers the authz module's interface types diff --git a/x/bank/module.go b/x/bank/module.go index 763bc69056f7..721c3dc6a0cf 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/x/bank/client/cli" "cosmossdk.io/x/bank/keeper" @@ -63,8 +62,8 @@ func (am AppModule) IsAppModule() {} func (AppModule) Name() string { return types.ModuleName } // RegisterLegacyAminoCodec registers the bank module's types on the LegacyAmino codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the bank module. diff --git a/x/bank/types/codec.go b/x/bank/types/codec.go index 643621fe90dd..c5fca96ba125 100644 --- a/x/bank/types/codec.go +++ b/x/bank/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -11,14 +10,14 @@ import ( // 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 corelegacy.Amino) { - legacy.RegisterAminoMsg(cdc, &MsgSend{}, "cosmos-sdk/MsgSend") - legacy.RegisterAminoMsg(cdc, &MsgMultiSend{}, "cosmos-sdk/MsgMultiSend") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/bank/MsgUpdateParams") - legacy.RegisterAminoMsg(cdc, &MsgSetSendEnabled{}, "cosmos-sdk/MsgSetSendEnabled") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + legacy.RegisterAminoMsg(registrar, &MsgSend{}, "cosmos-sdk/MsgSend") + legacy.RegisterAminoMsg(registrar, &MsgMultiSend{}, "cosmos-sdk/MsgMultiSend") + legacy.RegisterAminoMsg(registrar, &MsgUpdateParams{}, "cosmos-sdk/x/bank/MsgUpdateParams") + legacy.RegisterAminoMsg(registrar, &MsgSetSendEnabled{}, "cosmos-sdk/MsgSetSendEnabled") - cdc.RegisterConcrete(&SendAuthorization{}, "cosmos-sdk/SendAuthorization") - cdc.RegisterConcrete(&Params{}, "cosmos-sdk/x/bank/Params") + registrar.RegisterConcrete(&SendAuthorization{}, "cosmos-sdk/SendAuthorization") + registrar.RegisterConcrete(&Params{}, "cosmos-sdk/x/bank/Params") } func RegisterInterfaces(registrar registry.InterfaceRegistrar) { diff --git a/x/consensus/module.go b/x/consensus/module.go index 72c04496addc..298a80bad428 100644 --- a/x/consensus/module.go +++ b/x/consensus/module.go @@ -8,7 +8,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/x/consensus/keeper" "cosmossdk.io/x/consensus/types" @@ -72,8 +71,8 @@ func (AppModule) IsAppModule() {} func (AppModule) Name() string { return types.ModuleName } // RegisterLegacyAminoCodec registers the consensus module's types on the LegacyAmino codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes diff --git a/x/consensus/types/codec.go b/x/consensus/types/codec.go index e814aedef617..966065fccbc1 100644 --- a/x/consensus/types/codec.go +++ b/x/consensus/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -21,6 +20,6 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) { // RegisterLegacyAminoCodec registers the necessary x/consensus interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/consensus/MsgUpdateParams") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + legacy.RegisterAminoMsg(registrar, &MsgUpdateParams{}, "cosmos-sdk/x/consensus/MsgUpdateParams") } diff --git a/x/distribution/module.go b/x/distribution/module.go index 869c8aa5cfe7..db043b3bdabe 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/x/distribution/client/cli" "cosmossdk.io/x/distribution/keeper" @@ -73,8 +72,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the distribution module's types for the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the distribution module. diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 79e5c78c0613..8b1a7dbab890 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -12,14 +11,14 @@ import ( // 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 corelegacy.Amino) { - legacy.RegisterAminoMsg(cdc, &MsgWithdrawDelegatorReward{}, "cosmos-sdk/MsgWithdrawDelegationReward") - legacy.RegisterAminoMsg(cdc, &MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValCommission") - legacy.RegisterAminoMsg(cdc, &MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/distribution/MsgUpdateParams") - legacy.RegisterAminoMsg(cdc, &MsgDepositValidatorRewardsPool{}, "cosmos-sdk/distr/MsgDepositValRewards") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + legacy.RegisterAminoMsg(registrar, &MsgWithdrawDelegatorReward{}, "cosmos-sdk/MsgWithdrawDelegationReward") + legacy.RegisterAminoMsg(registrar, &MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValCommission") + legacy.RegisterAminoMsg(registrar, &MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress") + legacy.RegisterAminoMsg(registrar, &MsgUpdateParams{}, "cosmos-sdk/distribution/MsgUpdateParams") + legacy.RegisterAminoMsg(registrar, &MsgDepositValidatorRewardsPool{}, "cosmos-sdk/distr/MsgDepositValRewards") - cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/distribution/Params") + registrar.RegisterConcrete(Params{}, "cosmos-sdk/x/distribution/Params") } func RegisterInterfaces(registrar registry.InterfaceRegistrar) { diff --git a/x/epochs/module.go b/x/epochs/module.go index 211ec0d49b58..6930d82174a2 100644 --- a/x/epochs/module.go +++ b/x/epochs/module.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" + "cosmossdk.io/core/registry" "cosmossdk.io/x/epochs/keeper" "cosmossdk.io/x/epochs/simulation" "cosmossdk.io/x/epochs/types" @@ -56,7 +56,7 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the epochs module's types for the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) {} +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the epochs module. func (AppModule) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux) { diff --git a/x/evidence/module.go b/x/evidence/module.go index 9de5e4297033..513563aec10d 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -11,7 +11,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/comet" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" eviclient "cosmossdk.io/x/evidence/client" "cosmossdk.io/x/evidence/client/cli" @@ -66,8 +65,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the evidence module's types to the LegacyAmino codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the evidence module. diff --git a/x/evidence/types/codec.go b/x/evidence/types/codec.go index d26766dad7d5..adaa2211d15d 100644 --- a/x/evidence/types/codec.go +++ b/x/evidence/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" "cosmossdk.io/x/evidence/exported" @@ -12,10 +11,10 @@ import ( // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the // evidence module. -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - cdc.RegisterInterface((*exported.Evidence)(nil), nil) - legacy.RegisterAminoMsg(cdc, &MsgSubmitEvidence{}, "cosmos-sdk/MsgSubmitEvidence") - cdc.RegisterConcrete(&Equivocation{}, "cosmos-sdk/Equivocation") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterInterface((*exported.Evidence)(nil), nil) + legacy.RegisterAminoMsg(registrar, &MsgSubmitEvidence{}, "cosmos-sdk/MsgSubmitEvidence") + registrar.RegisterConcrete(&Equivocation{}, "cosmos-sdk/Equivocation") } // RegisterInterfaces registers the interfaces types with the interface registry. diff --git a/x/feegrant/codec.go b/x/feegrant/codec.go index d27a3a22db90..5fcfdb4f945d 100644 --- a/x/feegrant/codec.go +++ b/x/feegrant/codec.go @@ -1,7 +1,6 @@ package feegrant import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -11,14 +10,14 @@ import ( // RegisterLegacyAminoCodec registers the necessary x/feegrant interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - legacy.RegisterAminoMsg(cdc, &MsgGrantAllowance{}, "cosmos-sdk/MsgGrantAllowance") - legacy.RegisterAminoMsg(cdc, &MsgRevokeAllowance{}, "cosmos-sdk/MsgRevokeAllowance") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + legacy.RegisterAminoMsg(registrar, &MsgGrantAllowance{}, "cosmos-sdk/MsgGrantAllowance") + legacy.RegisterAminoMsg(registrar, &MsgRevokeAllowance{}, "cosmos-sdk/MsgRevokeAllowance") - cdc.RegisterInterface((*FeeAllowanceI)(nil), nil) - cdc.RegisterConcrete(&BasicAllowance{}, "cosmos-sdk/BasicAllowance") - cdc.RegisterConcrete(&PeriodicAllowance{}, "cosmos-sdk/PeriodicAllowance") - cdc.RegisterConcrete(&AllowedMsgAllowance{}, "cosmos-sdk/AllowedMsgAllowance") + registrar.RegisterInterface((*FeeAllowanceI)(nil), nil) + registrar.RegisterConcrete(&BasicAllowance{}, "cosmos-sdk/BasicAllowance") + registrar.RegisterConcrete(&PeriodicAllowance{}, "cosmos-sdk/PeriodicAllowance") + registrar.RegisterConcrete(&AllowedMsgAllowance{}, "cosmos-sdk/AllowedMsgAllowance") } // RegisterInterfaces registers the interfaces types with the interface registry diff --git a/x/feegrant/module/module.go b/x/feegrant/module/module.go index 5fde472bdbf9..c6c79fa396e3 100644 --- a/x/feegrant/module/module.go +++ b/x/feegrant/module/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/errors" "cosmossdk.io/x/feegrant" @@ -68,8 +67,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the feegrant module's types for the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - feegrant.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + feegrant.RegisterLegacyAminoCodec(registrar) } // RegisterInterfaces registers the feegrant module's interface types diff --git a/x/gov/module.go b/x/gov/module.go index abdb888e0d73..01a66ef07b1d 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" govclient "cosmossdk.io/x/gov/client" "cosmossdk.io/x/gov/client/cli" @@ -79,9 +78,9 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the gov module's types for the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - v1beta1.RegisterLegacyAminoCodec(cdc) - v1.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + v1beta1.RegisterLegacyAminoCodec(registrar) + v1.RegisterLegacyAminoCodec(registrar) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the gov module. diff --git a/x/gov/types/v1/codec.go b/x/gov/types/v1/codec.go index bb0beae33ea7..c23928b5f1fc 100644 --- a/x/gov/types/v1/codec.go +++ b/x/gov/types/v1/codec.go @@ -1,7 +1,6 @@ package v1 import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -11,16 +10,16 @@ import ( // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the // governance module. -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - legacy.RegisterAminoMsg(cdc, &MsgSubmitProposal{}, "cosmos-sdk/v1/MsgSubmitProposal") - legacy.RegisterAminoMsg(cdc, &MsgSubmitMultipleChoiceProposal{}, "gov/MsgSubmitMultipleChoiceProposal") - legacy.RegisterAminoMsg(cdc, &MsgDeposit{}, "cosmos-sdk/v1/MsgDeposit") - legacy.RegisterAminoMsg(cdc, &MsgVote{}, "cosmos-sdk/v1/MsgVote") - legacy.RegisterAminoMsg(cdc, &MsgVoteWeighted{}, "cosmos-sdk/v1/MsgVoteWeighted") - legacy.RegisterAminoMsg(cdc, &MsgExecLegacyContent{}, "cosmos-sdk/v1/MsgExecLegacyContent") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/gov/v1/MsgUpdateParams") - legacy.RegisterAminoMsg(cdc, &MsgUpdateMessageParams{}, "x/gov/v1/MsgUpdateMessageParams") - legacy.RegisterAminoMsg(cdc, &MsgSudoExec{}, "cosmos-sdk/x/gov/v1/MsgSudoExec") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + legacy.RegisterAminoMsg(registrar, &MsgSubmitProposal{}, "cosmos-sdk/v1/MsgSubmitProposal") + legacy.RegisterAminoMsg(registrar, &MsgSubmitMultipleChoiceProposal{}, "gov/MsgSubmitMultipleChoiceProposal") + legacy.RegisterAminoMsg(registrar, &MsgDeposit{}, "cosmos-sdk/v1/MsgDeposit") + legacy.RegisterAminoMsg(registrar, &MsgVote{}, "cosmos-sdk/v1/MsgVote") + legacy.RegisterAminoMsg(registrar, &MsgVoteWeighted{}, "cosmos-sdk/v1/MsgVoteWeighted") + legacy.RegisterAminoMsg(registrar, &MsgExecLegacyContent{}, "cosmos-sdk/v1/MsgExecLegacyContent") + legacy.RegisterAminoMsg(registrar, &MsgUpdateParams{}, "cosmos-sdk/x/gov/v1/MsgUpdateParams") + legacy.RegisterAminoMsg(registrar, &MsgUpdateMessageParams{}, "x/gov/v1/MsgUpdateMessageParams") + legacy.RegisterAminoMsg(registrar, &MsgSudoExec{}, "cosmos-sdk/x/gov/v1/MsgSudoExec") } // RegisterInterfaces registers the interfaces types with the Interface Registry. diff --git a/x/gov/types/v1beta1/codec.go b/x/gov/types/v1beta1/codec.go index 475a8dc451dd..ccc907d0b9dd 100644 --- a/x/gov/types/v1beta1/codec.go +++ b/x/gov/types/v1beta1/codec.go @@ -1,7 +1,6 @@ package v1beta1 import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -11,13 +10,13 @@ import ( // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the // governance module. -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - cdc.RegisterInterface((*Content)(nil), nil) - legacy.RegisterAminoMsg(cdc, &MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal") - legacy.RegisterAminoMsg(cdc, &MsgDeposit{}, "cosmos-sdk/MsgDeposit") - legacy.RegisterAminoMsg(cdc, &MsgVote{}, "cosmos-sdk/MsgVote") - legacy.RegisterAminoMsg(cdc, &MsgVoteWeighted{}, "cosmos-sdk/MsgVoteWeighted") - cdc.RegisterConcrete(&TextProposal{}, "cosmos-sdk/TextProposal") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterInterface((*Content)(nil), nil) + legacy.RegisterAminoMsg(registrar, &MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal") + legacy.RegisterAminoMsg(registrar, &MsgDeposit{}, "cosmos-sdk/MsgDeposit") + legacy.RegisterAminoMsg(registrar, &MsgVote{}, "cosmos-sdk/MsgVote") + legacy.RegisterAminoMsg(registrar, &MsgVoteWeighted{}, "cosmos-sdk/MsgVoteWeighted") + registrar.RegisterConcrete(&TextProposal{}, "cosmos-sdk/TextProposal") } // RegisterInterfaces registers the interfaces types with the Interface Registry. diff --git a/x/group/codec.go b/x/group/codec.go index f4d80229fb79..11b8f8482f71 100644 --- a/x/group/codec.go +++ b/x/group/codec.go @@ -1,7 +1,6 @@ package group import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -12,25 +11,25 @@ import ( // RegisterLegacyAminoCodec registers all the necessary group module concrete // types and interfaces with the provided codec reference. // These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - cdc.RegisterInterface((*DecisionPolicy)(nil), nil) - cdc.RegisterConcrete(&ThresholdDecisionPolicy{}, "cosmos-sdk/ThresholdDecisionPolicy") - cdc.RegisterConcrete(&PercentageDecisionPolicy{}, "cosmos-sdk/PercentageDecisionPolicy") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterInterface((*DecisionPolicy)(nil), nil) + registrar.RegisterConcrete(&ThresholdDecisionPolicy{}, "cosmos-sdk/ThresholdDecisionPolicy") + registrar.RegisterConcrete(&PercentageDecisionPolicy{}, "cosmos-sdk/PercentageDecisionPolicy") - legacy.RegisterAminoMsg(cdc, &MsgCreateGroup{}, "cosmos-sdk/MsgCreateGroup") - legacy.RegisterAminoMsg(cdc, &MsgUpdateGroupMembers{}, "cosmos-sdk/MsgUpdateGroupMembers") - legacy.RegisterAminoMsg(cdc, &MsgUpdateGroupAdmin{}, "cosmos-sdk/MsgUpdateGroupAdmin") - legacy.RegisterAminoMsg(cdc, &MsgUpdateGroupMetadata{}, "cosmos-sdk/MsgUpdateGroupMetadata") - legacy.RegisterAminoMsg(cdc, &MsgCreateGroupWithPolicy{}, "cosmos-sdk/MsgCreateGroupWithPolicy") - legacy.RegisterAminoMsg(cdc, &MsgCreateGroupPolicy{}, "cosmos-sdk/MsgCreateGroupPolicy") - legacy.RegisterAminoMsg(cdc, &MsgUpdateGroupPolicyAdmin{}, "cosmos-sdk/MsgUpdateGroupPolicyAdmin") - legacy.RegisterAminoMsg(cdc, &MsgUpdateGroupPolicyDecisionPolicy{}, "cosmos-sdk/MsgUpdateGroupDecisionPolicy") - legacy.RegisterAminoMsg(cdc, &MsgUpdateGroupPolicyMetadata{}, "cosmos-sdk/MsgUpdateGroupPolicyMetadata") - legacy.RegisterAminoMsg(cdc, &MsgSubmitProposal{}, "cosmos-sdk/group/MsgSubmitProposal") - legacy.RegisterAminoMsg(cdc, &MsgWithdrawProposal{}, "cosmos-sdk/group/MsgWithdrawProposal") - legacy.RegisterAminoMsg(cdc, &MsgVote{}, "cosmos-sdk/group/MsgVote") - legacy.RegisterAminoMsg(cdc, &MsgExec{}, "cosmos-sdk/group/MsgExec") - legacy.RegisterAminoMsg(cdc, &MsgLeaveGroup{}, "cosmos-sdk/group/MsgLeaveGroup") + legacy.RegisterAminoMsg(registrar, &MsgCreateGroup{}, "cosmos-sdk/MsgCreateGroup") + legacy.RegisterAminoMsg(registrar, &MsgUpdateGroupMembers{}, "cosmos-sdk/MsgUpdateGroupMembers") + legacy.RegisterAminoMsg(registrar, &MsgUpdateGroupAdmin{}, "cosmos-sdk/MsgUpdateGroupAdmin") + legacy.RegisterAminoMsg(registrar, &MsgUpdateGroupMetadata{}, "cosmos-sdk/MsgUpdateGroupMetadata") + legacy.RegisterAminoMsg(registrar, &MsgCreateGroupWithPolicy{}, "cosmos-sdk/MsgCreateGroupWithPolicy") + legacy.RegisterAminoMsg(registrar, &MsgCreateGroupPolicy{}, "cosmos-sdk/MsgCreateGroupPolicy") + legacy.RegisterAminoMsg(registrar, &MsgUpdateGroupPolicyAdmin{}, "cosmos-sdk/MsgUpdateGroupPolicyAdmin") + legacy.RegisterAminoMsg(registrar, &MsgUpdateGroupPolicyDecisionPolicy{}, "cosmos-sdk/MsgUpdateGroupDecisionPolicy") + legacy.RegisterAminoMsg(registrar, &MsgUpdateGroupPolicyMetadata{}, "cosmos-sdk/MsgUpdateGroupPolicyMetadata") + legacy.RegisterAminoMsg(registrar, &MsgSubmitProposal{}, "cosmos-sdk/group/MsgSubmitProposal") + legacy.RegisterAminoMsg(registrar, &MsgWithdrawProposal{}, "cosmos-sdk/group/MsgWithdrawProposal") + legacy.RegisterAminoMsg(registrar, &MsgVote{}, "cosmos-sdk/group/MsgVote") + legacy.RegisterAminoMsg(registrar, &MsgExec{}, "cosmos-sdk/group/MsgExec") + legacy.RegisterAminoMsg(registrar, &MsgLeaveGroup{}, "cosmos-sdk/group/MsgLeaveGroup") } // RegisterInterfaces registers the interfaces types with the interface registry. diff --git a/x/group/module/module.go b/x/group/module/module.go index 85599e6d5daa..3f6aecffd827 100644 --- a/x/group/module/module.go +++ b/x/group/module/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/x/group" "cosmossdk.io/x/group/client/cli" @@ -88,8 +87,8 @@ func (AppModule) RegisterInterfaces(registrar registry.InterfaceRegistrar) { } // RegisterLegacyAminoCodec registers the group module's types for the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - group.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + group.RegisterLegacyAminoCodec(registrar) } // RegisterInvariants does nothing, there are no invariants to enforce diff --git a/x/mint/module.go b/x/mint/module.go index 6607b371c16d..fa27a6838df2 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -9,7 +9,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/x/mint/keeper" "cosmossdk.io/x/mint/simulation" @@ -80,8 +79,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the mint module's types on the given LegacyAmino codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterInterfaces registers the module's interface types diff --git a/x/mint/types/codec.go b/x/mint/types/codec.go index a90efe4abbe1..1e10558c9ea3 100644 --- a/x/mint/types/codec.go +++ b/x/mint/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -10,9 +9,9 @@ import ( ) // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/mint/Params") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/mint/MsgUpdateParams") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterConcrete(Params{}, "cosmos-sdk/x/mint/Params") + legacy.RegisterAminoMsg(registrar, &MsgUpdateParams{}, "cosmos-sdk/x/mint/MsgUpdateParams") } // RegisterInterfaces registers the interfaces types with the interface registry. diff --git a/x/params/module.go b/x/params/module.go index 9d4aba372fa2..006afd56b33c 100644 --- a/x/params/module.go +++ b/x/params/module.go @@ -7,7 +7,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/x/params/keeper" "cosmossdk.io/x/params/types/proposal" @@ -51,8 +50,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the params module's types on the given LegacyAmino codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - proposal.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + proposal.RegisterLegacyAminoCodec(registrar) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the params module. diff --git a/x/params/types/proposal/codec.go b/x/params/types/proposal/codec.go index a2a226e683e8..5ac249f3ad6f 100644 --- a/x/params/types/proposal/codec.go +++ b/x/params/types/proposal/codec.go @@ -1,14 +1,13 @@ package proposal import ( - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" govtypes "cosmossdk.io/x/gov/types/v1beta1" ) // RegisterLegacyAminoCodec registers all necessary param module types with a given LegacyAmino codec. -func RegisterLegacyAminoCodec(cdc legacy.Amino) { - cdc.RegisterConcrete(&ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterConcrete(&ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal") } func RegisterInterfaces(registrar registry.InterfaceRegistrar) { diff --git a/x/slashing/module.go b/x/slashing/module.go index b5f018101602..e210daf33af8 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -10,7 +10,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/comet" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/x/slashing/keeper" "cosmossdk.io/x/slashing/simulation" @@ -81,8 +80,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the slashing module's types for the given codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterInterfaces registers the slashing module's interface types diff --git a/x/slashing/types/codec.go b/x/slashing/types/codec.go index 7e58c25d9f5a..4ea7f62797c6 100644 --- a/x/slashing/types/codec.go +++ b/x/slashing/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -10,10 +9,10 @@ import ( ) // RegisterLegacyAminoCodec registers concrete types on LegacyAmino codec -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/slashing/Params") - legacy.RegisterAminoMsg(cdc, &MsgUnjail{}, "cosmos-sdk/MsgUnjail") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/slashing/MsgUpdateParams") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterConcrete(Params{}, "cosmos-sdk/x/slashing/Params") + legacy.RegisterAminoMsg(registrar, &MsgUnjail{}, "cosmos-sdk/MsgUnjail") + legacy.RegisterAminoMsg(registrar, &MsgUpdateParams{}, "cosmos-sdk/x/slashing/MsgUpdateParams") } // RegisterInterfaces registers the interfaces types with the Interface Registry. diff --git a/x/staking/module.go b/x/staking/module.go index 30435bed7b9c..cddb3ba4c4d2 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/depinject" "cosmossdk.io/x/staking/client/cli" @@ -75,8 +74,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterInterfaces registers the module's interface types diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go index 0d4fb4a4d001..6f0a82632341 100644 --- a/x/staking/types/codec.go +++ b/x/staking/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -11,21 +10,21 @@ import ( // 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 corelegacy.Amino) { - legacy.RegisterAminoMsg(cdc, &MsgCreateValidator{}, "cosmos-sdk/MsgCreateValidator") - legacy.RegisterAminoMsg(cdc, &MsgEditValidator{}, "cosmos-sdk/MsgEditValidator") - legacy.RegisterAminoMsg(cdc, &MsgDelegate{}, "cosmos-sdk/MsgDelegate") - legacy.RegisterAminoMsg(cdc, &MsgUndelegate{}, "cosmos-sdk/MsgUndelegate") - legacy.RegisterAminoMsg(cdc, &MsgBeginRedelegate{}, "cosmos-sdk/MsgBeginRedelegate") - legacy.RegisterAminoMsg(cdc, &MsgCancelUnbondingDelegation{}, "cosmos-sdk/MsgCancelUnbondingDelegation") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/staking/MsgUpdateParams") - legacy.RegisterAminoMsg(cdc, &MsgRotateConsPubKey{}, "cosmos-sdk/MsgRotateConsPubKey") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + legacy.RegisterAminoMsg(registrar, &MsgCreateValidator{}, "cosmos-sdk/MsgCreateValidator") + legacy.RegisterAminoMsg(registrar, &MsgEditValidator{}, "cosmos-sdk/MsgEditValidator") + legacy.RegisterAminoMsg(registrar, &MsgDelegate{}, "cosmos-sdk/MsgDelegate") + legacy.RegisterAminoMsg(registrar, &MsgUndelegate{}, "cosmos-sdk/MsgUndelegate") + legacy.RegisterAminoMsg(registrar, &MsgBeginRedelegate{}, "cosmos-sdk/MsgBeginRedelegate") + legacy.RegisterAminoMsg(registrar, &MsgCancelUnbondingDelegation{}, "cosmos-sdk/MsgCancelUnbondingDelegation") + legacy.RegisterAminoMsg(registrar, &MsgUpdateParams{}, "cosmos-sdk/x/staking/MsgUpdateParams") + legacy.RegisterAminoMsg(registrar, &MsgRotateConsPubKey{}, "cosmos-sdk/MsgRotateConsPubKey") - cdc.RegisterInterface((*isStakeAuthorization_Validators)(nil), nil) - cdc.RegisterConcrete(&StakeAuthorization_AllowList{}, "cosmos-sdk/StakeAuthorization/AllowList") - cdc.RegisterConcrete(&StakeAuthorization_DenyList{}, "cosmos-sdk/StakeAuthorization/DenyList") - cdc.RegisterConcrete(&StakeAuthorization{}, "cosmos-sdk/StakeAuthorization") - cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/staking/Params") + registrar.RegisterInterface((*isStakeAuthorization_Validators)(nil), nil) + registrar.RegisterConcrete(&StakeAuthorization_AllowList{}, "cosmos-sdk/StakeAuthorization/AllowList") + registrar.RegisterConcrete(&StakeAuthorization_DenyList{}, "cosmos-sdk/StakeAuthorization/DenyList") + registrar.RegisterConcrete(&StakeAuthorization{}, "cosmos-sdk/StakeAuthorization") + registrar.RegisterConcrete(Params{}, "cosmos-sdk/x/staking/Params") } // RegisterInterfaces registers the x/staking interfaces types with the interface registry diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 3b5967adba44..be391bce2f6f 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" "cosmossdk.io/x/upgrade/client/cli" "cosmossdk.io/x/upgrade/keeper" @@ -56,8 +55,8 @@ func (AppModule) Name() string { } // RegisterLegacyAminoCodec registers the upgrade types on the LegacyAmino codec -func (AppModule) RegisterLegacyAminoCodec(cdc legacy.Amino) { - types.RegisterLegacyAminoCodec(cdc) +func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + types.RegisterLegacyAminoCodec(registrar) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the upgrade module. diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 64d3b919cb1c..0ab589acf313 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -1,7 +1,6 @@ package types import ( - corelegacy "cosmossdk.io/core/legacy" "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" @@ -10,12 +9,12 @@ import ( ) // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec -func RegisterLegacyAminoCodec(cdc corelegacy.Amino) { - cdc.RegisterConcrete(Plan{}, "cosmos-sdk/Plan") - cdc.RegisterConcrete(&SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal") - cdc.RegisterConcrete(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal") - legacy.RegisterAminoMsg(cdc, &MsgSoftwareUpgrade{}, "cosmos-sdk/MsgSoftwareUpgrade") - legacy.RegisterAminoMsg(cdc, &MsgCancelUpgrade{}, "cosmos-sdk/MsgCancelUpgrade") +func RegisterLegacyAminoCodec(registrar registry.AminoRegistrar) { + registrar.RegisterConcrete(Plan{}, "cosmos-sdk/Plan") + registrar.RegisterConcrete(&SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal") + registrar.RegisterConcrete(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal") + legacy.RegisterAminoMsg(registrar, &MsgSoftwareUpgrade{}, "cosmos-sdk/MsgSoftwareUpgrade") + legacy.RegisterAminoMsg(registrar, &MsgCancelUpgrade{}, "cosmos-sdk/MsgCancelUpgrade") } // RegisterInterfaces registers the interfaces types with the Interface Registry.