Skip to content

Commit

Permalink
fix: unused test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Lockwarr committed Oct 15, 2024
1 parent b88fe6e commit d738f6a
Show file tree
Hide file tree
Showing 3 changed files with 355 additions and 357 deletions.
79 changes: 38 additions & 41 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"

capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types"

"cosmossdk.io/log"
abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
Expand Down Expand Up @@ -491,40 +487,41 @@ func (app *App) RegisterNodeService(clientCtx client.Context, cfg config.Config)
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg)
}

// GetTxConfig implements the TestingApp interface.
func (app *App) GetTxConfig() client.TxConfig {
return app.encodingConfig.TxConfig
}

// GetIBCKeeper implements the TestingApp interface.
func (app *App) GetIBCKeeper() *ibckeeper.Keeper {
return app.IBCKeeper
}

// GetScopedIBCKeeper implements the TestingApp interface.
func (app *App) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper {
return app.ScopedIBCKeeper
}

// GetStakingKeeper implements the TestingApp interface.
func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper {
return app.StakingKeeper
}

// InitChainer application update at chain initialization.
// ONLY FOR TESTING PURPOSES.
func (app *App) TestInitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) {
var genesisState GenesisState
if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
panic(err)
}

// manually set consensus params here, cause there is no way to set it using ibctesting stuff for now
// TODO: app.ConsensusParamsKeeper.Set(ctx, sims.DefaultConsensusParams)

err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
if err != nil {
return nil, fmt.Errorf("failed to set module version map: %w", err)
}
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
}
// TODO
// // GetTxConfig implements the TestingApp interface.
// func (app *App) GetTxConfig() client.TxConfig {
// return app.encodingConfig.TxConfig
// }

// // GetIBCKeeper implements the TestingApp interface.
// func (app *App) GetIBCKeeper() *ibckeeper.Keeper {
// return app.IBCKeeper
// }

// // GetScopedIBCKeeper implements the TestingApp interface.
// func (app *App) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper {
// return app.ScopedIBCKeeper
// }

// // GetStakingKeeper implements the TestingApp interface.
// func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper {
// return app.StakingKeeper
// }

// // InitChainer application update at chain initialization.
// // ONLY FOR TESTING PURPOSES.
// func (app *App) TestInitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) {
// var genesisState GenesisState
// if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
// panic(err)
// }

// // manually set consensus params here, cause there is no way to set it using ibctesting stuff for now
// // TODO: app.ConsensusParamsKeeper.Set(ctx, sims.DefaultConsensusParams)

// err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
// if err != nil {
// return nil, fmt.Errorf("failed to set module version map: %w", err)
// }
// return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
// }
Loading

0 comments on commit d738f6a

Please sign in to comment.