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

fix: add missing ibcconsumer.AppModule #3848

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 8 additions & 17 deletions ignite/templates/app/files/app/app.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ import (
icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper"
ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper"
ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
<%= if (IsConsumerChain) { %>
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"<%= if (IsConsumerChain) { %>
"fmt"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcconsumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper"
ibcconsumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
<% } else { %>
ibcconsumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"<% } else { %>
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
Expand Down Expand Up @@ -93,14 +91,11 @@ type App struct {
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
<%= if (IsConsumerChain) { %>
ConsumerKeeper ibcconsumerkeeper.Keeper
<% } else { %>
<%= if (IsConsumerChain) { %>ConsumerKeeper ibcconsumerkeeper.Keeper<% } else { %>
StakingKeeper *stakingkeeper.Keeper
MintKeeper mintkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper *govkeeper.Keeper
<% } %>
GovKeeper *govkeeper.Keeper<% } %>
CrisisKeeper *crisiskeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
Expand Down Expand Up @@ -199,10 +194,8 @@ func New(
// This needs to be removed after IBC supports App Wiring.
app.GetIBCKeeper,
app.GetCapabilityScopedKeeper,
<%= if (IsConsumerChain) { %>
// Supply the consumer keeper for the consumer module
&app.ConsumerKeeper,
<% } %>
<%= if (IsConsumerChain) { %>// Supply the consumer keeper for the consumer module
&app.ConsumerKeeper,<% } %>
// Supply the logger
logger,

Expand Down Expand Up @@ -256,13 +249,11 @@ func New(
&app.interfaceRegistry,
&app.AccountKeeper,
&app.BankKeeper,
&app.SlashingKeeper,
<%= if (!IsConsumerChain) { %>
&app.SlashingKeeper,<%= if (!IsConsumerChain) { %>
&app.StakingKeeper,
&app.MintKeeper,
&app.DistrKeeper,
&app.GovKeeper,
<% } %>
&app.GovKeeper,<% } %>
&app.CrisisKeeper,
&app.UpgradeKeeper,
&app.ParamsKeeper,
Expand Down
52 changes: 20 additions & 32 deletions ignite/templates/app/files/app/app_config.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,19 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
"google.golang.org/protobuf/types/known/durationpb"
<%= if (IsConsumerChain) { %>
ibcconsumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
<% } else { %>
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects
distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1"
govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1"
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1"
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
<% } %>

<%= if (IsConsumerChain) { %>ibcconsumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"<% } else { %>
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects
distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1"
govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1"
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1"
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
<% } %>
// this line is used by starport scaffolding # stargate/app/moduleImport
)

Expand Down Expand Up @@ -134,11 +131,8 @@ var (
<% } %>
slashingtypes.ModuleName,
evidencetypes.ModuleName,
<%= if (IsConsumerChain) { %>
ibcconsumertypes.ModuleName,
<% } else { %>
stakingtypes.ModuleName,
<% } %>
<%= if (IsConsumerChain) { %>ibcconsumertypes.ModuleName,<% } else { %>
stakingtypes.ModuleName,<% } %>
authz.ModuleName,
genutiltypes.ModuleName,
// ibc modules
Expand All @@ -154,12 +148,9 @@ var (
endBlockers = []string{
// cosmos sdk modules
crisistypes.ModuleName,
<%= if (IsConsumerChain) { %>
ibcconsumertypes.ModuleName,
<% } else { %>
<%= if (IsConsumerChain) { %>ibcconsumertypes.ModuleName,<% } else { %>
govtypes.ModuleName,
stakingtypes.ModuleName,
<% } %>
stakingtypes.ModuleName,<% } %>
feegrant.ModuleName,
group.ModuleName,
genutiltypes.ModuleName,
Expand All @@ -180,18 +171,15 @@ var (

// module account permissions
moduleAccPerms = []*authmodulev1.ModuleAccountPermission{
{Account: authtypes.FeeCollectorName},
<%= if (IsConsumerChain) { %>
{Account: authtypes.FeeCollectorName},<%= if (IsConsumerChain) { %>
{Account: icatypes.ModuleName},
{Account: ibcconsumertypes.ConsumerRedistributeName},
{Account: ibcconsumertypes.ConsumerToSendToProviderName},
<% } else { %>
{Account: ibcconsumertypes.ConsumerToSendToProviderName},<% } else { %>
{Account: distrtypes.ModuleName},
{Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}},
{Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
{Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
{Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}},
<% } %>
{Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}},<% } %>
{Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
{Account: ibcfeetypes.ModuleName},
{Account: icatypes.ModuleName},
Expand Down
7 changes: 2 additions & 5 deletions ignite/templates/app/files/app/export.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
<%= if (IsConsumerChain) { %>
tmtypes "github.com/cometbft/cometbft/types"
<%= } else { %>
<%= if (IsConsumerChain) { %>tmtypes "github.com/cometbft/cometbft/types"<% } else { %>
"log"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
<% } %>
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"<% } %>
)

// ExportAppStateAndValidators exports the state of the application for a genesis
Expand Down
44 changes: 18 additions & 26 deletions ignite/templates/app/files/app/ibc.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ package app
import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
<%= if (IsConsumerChain) { %>
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" <%= if (IsConsumerChain) { %>
sdk "github.com/cosmos/cosmos-sdk/types"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
ibcconsumer "github.com/cosmos/interchain-security/v3/x/ccv/consumer"
ibcconsumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper"
ibcccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types"
<% } else { %>
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
<% } %>
ibcconsumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
ibcccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" <% } else { %>
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" <% } %>
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
Expand Down Expand Up @@ -53,9 +51,7 @@ func (app *App) registerIBCModules() {
storetypes.NewKVStoreKey(ibctransfertypes.StoreKey),
storetypes.NewKVStoreKey(ibcfeetypes.StoreKey),
storetypes.NewKVStoreKey(icahosttypes.StoreKey),
<%= if (IsConsumerChain) { %>
storetypes.NewKVStoreKey(ibcccvtypes.StoreKey),
<% } %>
<%= if (IsConsumerChain) { %>storetypes.NewKVStoreKey(ibcccvtypes.StoreKey), <% } %>
storetypes.NewKVStoreKey(icacontrollertypes.StoreKey),
storetypes.NewMemoryStoreKey(capabilitytypes.MemStoreKey),
storetypes.NewTransientStoreKey(paramstypes.TStoreKey),
Expand All @@ -69,9 +65,7 @@ func (app *App) registerIBCModules() {
app.ParamsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable)
app.ParamsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable())
app.ParamsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable())
<%= if (IsConsumerChain) { %>
app.ParamsKeeper.Subspace(ibcccvtypes.ModuleName).WithKeyTable(ibcccvtypes.ParamKeyTable())
<% } %>
<%= if (IsConsumerChain) { %>app.ParamsKeeper.Subspace(ibcccvtypes.ModuleName).WithKeyTable(ibcccvtypes.ParamKeyTable()) <% } %>
app.ParamsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable())

// add capability keeper and ScopeToModule for ibc module
Expand All @@ -87,20 +81,18 @@ func (app *App) registerIBCModules() {
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
<%= if (IsConsumerChain) { %>
scopedIBCConsumerKeeper := app.CapabilityKeeper.ScopeToModule(ibcccvtypes.ModuleName)
scopedIBCConsumerKeeper := app.CapabilityKeeper.ScopeToModule(ibcccvtypes.ModuleName)

// pre-initialize ConsumerKeeper to satisfy ibckeeper.NewKeeper
// which would panic on nil or zero keeper
// ConsumerKeeper implements StakingKeeper but all function calls result in no-ops so this is safe
// communication over IBC is not affected by these changes
app.ConsumerKeeper = ibcconsumerkeeper.NewNonZeroKeeper(
app.appCodec,
app.GetKey(ibcccvtypes.StoreKey),
app.GetSubspace(ibcccvtypes.ModuleName),
)

// pre-initialize ConsumerKeeper to satisfy ibckeeper.NewKeeper
// which would panic on nil or zero keeper
// ConsumerKeeper implements StakingKeeper but all function calls result in no-ops so this is safe
// communication over IBC is not affected by these changes
app.ConsumerKeeper = ibcconsumerkeeper.NewNonZeroKeeper(
app.appCodec,
app.GetKey(ibcccvtypes.StoreKey),
app.GetSubspace(ibcccvtypes.ModuleName),
)
<% } %>

<%= if (IsConsumerChain) { %>
// Create IBC keeper
app.IBCKeeper = ibckeeper.NewKeeper(
app.appCodec,
Expand Down Expand Up @@ -135,7 +127,6 @@ func (app *App) registerIBCModules() {

// register slashing module Slashing hooks to the consumer keeper
app.ConsumerKeeper = *app.ConsumerKeeper.SetHooks(app.SlashingKeeper.Hooks())

consumerModule := ibcconsumer.NewAppModule(app.ConsumerKeeper, app.GetSubspace(ibcccvtypes.ModuleName))

<% } else { %>
Expand Down Expand Up @@ -254,4 +245,5 @@ func AddIBCModuleManager(moduleManager module.BasicManager) {
moduleManager[ibcfeetypes.ModuleName] = ibcfee.AppModule{}
moduleManager[icatypes.ModuleName] = icamodule.AppModule{}
moduleManager[capabilitytypes.ModuleName] = capability.AppModule{}
<%= if (IsConsumerChain) { %>moduleManager[ibcconsumertypes.ModuleName] = ibcconsumer.AppModule{}<% } %>
}
Loading