Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: clean up module impls #7865

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions modules/apps/27-interchain-accounts/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
coreregistry "cosmossdk.io/core/registry"

Expand All @@ -30,12 +31,21 @@ import (
)

var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModule)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasConsensusVersion = (*AppModule)(nil)
_ appmodule.HasRegisterInterfaces = (*AppModule)(nil)

_ module.AppModule = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)
_ module.HasGRPCGateway = (*AppModule)(nil)

// Sims
_ module.AppModuleSimulation = (*AppModule)(nil)
_ module.HasLegacyProposalMsgs = (*AppModule)(nil)

_ autocli.HasCustomTxCommand = (*AppModule)(nil)
_ autocli.HasCustomQueryCommand = (*AppModule)(nil)

_ porttypes.IBCModule = (*host.IBCModule)(nil)
)
Expand Down Expand Up @@ -67,9 +77,6 @@ func (AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (AppModule) IsAppModule() {}

// RegisterLegacyAminoCodec implements AppModule.
func (AppModule) RegisterLegacyAminoCodec(cdc coreregistry.AminoRegistrar) {}

// RegisterInterfaces registers module concrete types into protobuf Any
func (AppModule) RegisterInterfaces(registry coreregistry.InterfaceRegistrar) {
controllertypes.RegisterInterfaces(registry)
Expand Down Expand Up @@ -193,11 +200,6 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei
return simulation.ProposalMsgs(am.controllerKeeper, am.hostKeeper)
}

// WeightedOperations is unimplemented.
func (AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
return nil
}

// RegisterStoreDecoder registers a decoder for interchain accounts module's types
func (AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) {
sdr[controllertypes.StoreKey] = simulation.NewDecodeStore()
Expand Down
36 changes: 12 additions & 24 deletions modules/apps/29-fee/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@ import (
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
coreregistry "cosmossdk.io/core/registry"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"

"github.com/cosmos/ibc-go/v9/modules/apps/29-fee/client/cli"
"github.com/cosmos/ibc-go/v9/modules/apps/29-fee/keeper"
"github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types"
)

var (
_ module.AppModule = (*AppModule)(nil)
_ module.HasAminoCodec = AppModule{}
_ module.AppModuleSimulation = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ appmodule.HasConsensusVersion = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasConsensusVersion = (*AppModule)(nil)
_ appmodule.HasAminoCodec = (*AppModule)(nil)
_ appmodule.HasRegisterInterfaces = (*AppModule)(nil)

_ module.AppModule = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)

_ autocli.HasCustomTxCommand = (*AppModule)(nil)
_ autocli.HasCustomQueryCommand = (*AppModule)(nil)
)

// AppModule represents the AppModule for this module
Expand Down Expand Up @@ -129,18 +132,3 @@ func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error)

// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 2 }

// AppModuleSimulation functions

// GenerateGenesisState creates a randomized GenState of the 29-fee module.
func (AppModule) GenerateGenesisState(_ *module.SimulationState) {
}

// RegisterStoreDecoder registers a decoder for 29-fee module's types
func (AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {
}

// WeightedOperations returns the all the 29-fee module operations with their respective weights.
func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation {
return nil
}
51 changes: 0 additions & 51 deletions modules/apps/transfer/keeper/invariants.go
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

invariants are kill cosmos/cosmos-sdk#22993

This file was deleted.

79 changes: 0 additions & 79 deletions modules/apps/transfer/keeper/invariants_test.go

This file was deleted.

31 changes: 17 additions & 14 deletions modules/apps/transfer/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
coreregistry "cosmossdk.io/core/registry"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"

Expand All @@ -25,14 +25,22 @@ import (
)

var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModule)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ appmodule.HasConsensusVersion = (*AppModule)(nil)
_ module.HasInvariants = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasConsensusVersion = (*AppModule)(nil)
_ appmodule.HasRegisterInterfaces = (*AppModule)(nil)

_ module.AppModule = (*AppModule)(nil)
_ module.HasGRPCGateway = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)

// Sims
_ module.AppModuleSimulation = (*AppModule)(nil)
_ module.HasLegacyProposalMsgs = (*AppModule)(nil)
_ module.HasLegacyWeightedOperations = (*AppModule)(nil)

_ autocli.HasCustomTxCommand = (*AppModule)(nil)
_ autocli.HasCustomQueryCommand = (*AppModule)(nil)

_ porttypes.IBCModule = (*IBCModule)(nil)
)
Expand Down Expand Up @@ -109,11 +117,6 @@ func (AppModule) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}

// RegisterInvariants implements the AppModule interface
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
keeper.RegisterInvariants(ir, &am.keeper)
}

// RegisterServices registers module services.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), am.keeper)
Expand Down
32 changes: 16 additions & 16 deletions modules/core/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
coreregistry "cosmossdk.io/core/registry"

Expand All @@ -32,14 +33,21 @@ import (
)

var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModule)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ appmodule.HasConsensusVersion = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasBeginBlocker = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasBeginBlocker = (*AppModule)(nil)
_ appmodule.HasConsensusVersion = (*AppModule)(nil)
_ appmodule.HasRegisterInterfaces = (*AppModule)(nil)

_ module.AppModule = (*AppModule)(nil)
_ module.HasGRPCGateway = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)

_ module.HasLegacyProposalMsgs = (*AppModule)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)

_ autocli.HasCustomTxCommand = (*AppModule)(nil)
_ autocli.HasCustomQueryCommand = (*AppModule)(nil)
)

// AppModule implements an application module for the ibc module.
Expand Down Expand Up @@ -67,9 +75,6 @@ func (AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (AppModule) IsAppModule() {}

// RegisterLegacyAminoCodec does nothing. IBC does not support amino.
func (AppModule) RegisterLegacyAminoCodec(coreregistry.AminoRegistrar) {}

// DefaultGenesis returns default genesis state as raw bytes for the ibc
// module.
func (am AppModule) DefaultGenesis() json.RawMessage {
Expand Down Expand Up @@ -202,8 +207,3 @@ func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Weight
func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) {
sdr[exported.StoreKey] = simulation.NewDecodeStore(*am.keeper)
}

// WeightedOperations returns the all the ibc module operations with their respective weights.
func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation {
return nil
}
Loading
Loading