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

Implement appmodule.AppModule interface for ibc-go packages' modules #4332

Merged
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 8 additions & 0 deletions modules/apps/27-interchain-accounts/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"
"github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/client/cli"
controllerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
Expand All @@ -34,6 +35,7 @@ var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModuleBasic)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)

_ porttypes.IBCModule = (*host.IBCModule)(nil)
)
Expand All @@ -46,6 +48,12 @@ func (AppModuleBasic) Name() string {
return types.ModuleName
}

// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}

// RegisterLegacyAminoCodec implements AppModuleBasic.
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}

Expand Down
9 changes: 9 additions & 0 deletions modules/apps/29-fee/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ import (

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"
"github.com/cosmos/ibc-go/v7/modules/apps/29-fee/client/cli"

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

var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModuleBasic)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
)

// AppModuleBasic is the 29-fee AppModuleBasic
Expand All @@ -35,6 +38,12 @@ func (AppModuleBasic) Name() string {
return types.ModuleName
}

// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}

// RegisterLegacyAminoCodec implements AppModuleBasic interface
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}

Expand Down
8 changes: 8 additions & 0 deletions modules/apps/transfer/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"

"cosmossdk.io/core/appmodule"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

Expand All @@ -27,6 +28,7 @@ import (
var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModuleBasic)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ porttypes.IBCModule = (*IBCModule)(nil)
)

Expand All @@ -38,6 +40,12 @@ func (AppModuleBasic) Name() string {
return types.ModuleName
}

// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}

// RegisterLegacyAminoCodec implements AppModuleBasic interface
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterLegacyAminoCodec(cdc)
Expand Down
8 changes: 8 additions & 0 deletions modules/core/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"

"cosmossdk.io/core/appmodule"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

Expand Down Expand Up @@ -34,6 +35,7 @@ var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModuleBasic)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
)

// AppModuleBasic defines the basic application module used by the ibc module.
Expand All @@ -44,6 +46,12 @@ func (AppModuleBasic) Name() string {
return exported.ModuleName
}

// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}

// RegisterLegacyAminoCodec does nothing. IBC does not support amino.
func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {}

Expand Down
12 changes: 4 additions & 8 deletions testing/simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, b
rootCmd.AddCommand(
rpc.StatusCommand(),
genesisCommand(encodingConfig, basicManager),
txCommand(basicManager),
queryCommand(basicManager),
txCommand(),
queryCommand(),
keys.Commands(),
)
}
Expand All @@ -217,7 +217,7 @@ func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
}

func queryCommand(basicManager module.BasicManager) *cobra.Command {
func queryCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "query",
Aliases: []string{"q"},
Expand All @@ -236,12 +236,10 @@ func queryCommand(basicManager module.BasicManager) *cobra.Command {
authcmd.GetSimulateCmd(),
)

basicManager.AddQueryCommands(cmd)

return cmd
}

func txCommand(basicManager module.BasicManager) *cobra.Command {
func txCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "tx",
Short: "Transactions subcommands",
Expand All @@ -262,8 +260,6 @@ func txCommand(basicManager module.BasicManager) *cobra.Command {
authcmd.GetAuxToFeeCommand(),
)

basicManager.AddTxCommands(cmd)

return cmd
}

Expand Down