Skip to content

Commit

Permalink
remove ibcmock
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Oct 10, 2023
1 parent f086b77 commit e76229c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
33 changes: 4 additions & 29 deletions middleware/packet-forward-middleware/testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
ibcmock "github.com/cosmos/ibc-go/v7/testing/mock"
ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types"
)

Expand Down Expand Up @@ -160,7 +159,6 @@ var (
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
transfer.AppModuleBasic{},
ibcmock.AppModuleBasic{},
packetforward.AppModuleBasic{},
)

Expand All @@ -173,7 +171,6 @@ var (
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcmock.ModuleName: nil,
}
)

Expand Down Expand Up @@ -223,10 +220,6 @@ type SimApp struct {
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

// make IBC modules public for test purposes
// these modules are never directly routed to by the IBC Router
FeeMockModule ibcmock.IBCModule

// the module manager
mm *module.Manager

Expand Down Expand Up @@ -319,10 +312,6 @@ func NewSimApp(
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)

// NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do
// not replicate if you do not need to test core IBC or light clients.
scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName)

// seal capability keeper after scoping modules
app.CapabilityKeeper.Seal()

Expand Down Expand Up @@ -477,16 +466,9 @@ func NewSimApp(
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, // refund timeout
)

// Mock Module setup for testing IBC and also acts as the interchain accounts authentication module
// NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do
// not replicate if you do not need to test core IBC or light clients.
mockModule := ibcmock.NewAppModule(&app.IBCKeeper.PortKeeper)
mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper))

// Create IBC Router
ibcRouter := ibcporttypes.NewRouter().
AddRoute(ibctransfertypes.ModuleName, transferStack).
AddRoute(ibcmock.ModuleName, mockIBCModule)
AddRoute(ibctransfertypes.ModuleName, transferStack)

// Seal the IBC Router
app.IBCKeeper.SetRouter(ibcRouter)
Expand Down Expand Up @@ -534,7 +516,6 @@ func NewSimApp(
ibc.NewAppModule(app.IBCKeeper),
transfer.NewAppModule(app.TransferKeeper),
packetforward.NewAppModule(app.PacketForwardKeeper),
// mockModule,
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand All @@ -546,13 +527,13 @@ func NewSimApp(
upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName,
evidencetypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, authtypes.ModuleName,
banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, feegrant.ModuleName,
paramstypes.ModuleName, vestingtypes.ModuleName, ibctransfertypes.StoreKey, packetforwardtypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName,
paramstypes.ModuleName, vestingtypes.ModuleName, ibctransfertypes.StoreKey, packetforwardtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName,
)
app.mm.SetOrderEndBlockers(
crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName,
capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName,
minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName,
upgradetypes.ModuleName, vestingtypes.ModuleName, ibctransfertypes.StoreKey, packetforwardtypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName,
upgradetypes.ModuleName, vestingtypes.ModuleName, ibctransfertypes.StoreKey, packetforwardtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -565,7 +546,7 @@ func NewSimApp(
capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName,
slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName,
genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName,
ibctransfertypes.StoreKey, packetforwardtypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName,
ibctransfertypes.StoreKey, packetforwardtypes.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName,
vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName,
}

Expand Down Expand Up @@ -668,12 +649,6 @@ func (app *SimApp) LoadHeight(height int64) error {
func (app *SimApp) ModuleAccountAddrs() map[string]bool {
modAccAddrs := make(map[string]bool)
for acc := range maccPerms {
// do not add the following modules to blocked addresses
// this is only used for testing
if acc == ibcmock.ModuleName {
continue
}

modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import (
"os"

"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/testing/simapp"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/testing/simapp/simd/cmd"

"cosmossdk.io/log"

svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
)

func main() {
rootCmd, _ := cmd.NewRootCmd()
rootCmd, _ := NewRootCmd()

if err := svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil {
log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmd
package main

import (
"errors"
Expand Down

0 comments on commit e76229c

Please sign in to comment.