We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
package keeper_test import ( "testing" "github.com/stretchr/testify/suite" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/core/address" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" sdkaddress "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil/integration" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ondoprotocol/ondochain/app" module "github.com/ondoprotocol/ondochain/x/controlpanel" "github.com/ondoprotocol/ondochain/x/controlpanel/keeper" "github.com/ondoprotocol/ondochain/x/controlpanel/types" ) var maccPerms = map[string][]string{ authtypes.FeeCollectorName: nil, stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, minttypes.ModuleName: {authtypes.Minter}, govtypes.ModuleName: {authtypes.Burner}, } type testFixture struct { suite.Suite ctx sdk.Context k keeper.Keeper msgServer types.MsgServer queryServer types.QueryServer appModule *module.AppModule accountkeeper authkeeper.AccountKeeper bankkeeper bankkeeper.BaseKeeper stakingKeeper *stakingkeeper.Keeper mintkeeper mintkeeper.Keeper addrs []sdk.AccAddress vals []sdk.ValAddress govModAddr string } func SetupTest(t *testing.T) *testFixture { t.Helper() f := new(testFixture) cfg := sdk.GetConfig() // do not seal, more set later cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) cfg.SetBech32PrefixForValidator(app.Bech32PrefixValAddr, app.Bech32PrefixValPub) cfg.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) cfg.SetCoinType(60) validatorAddressCodec := sdkaddress.NewBech32Codec(app.Bech32PrefixValAddr) accountAddressCodec := sdkaddress.NewBech32Codec(app.Bech32PrefixAccAddr) consensusAddressCodec := sdkaddress.NewBech32Codec(app.Bech32PrefixConsAddr) // Base setup logger := log.NewTestLogger(t) encCfg := moduletestutil.MakeTestEncodingConfig() f.govModAddr = authtypes.NewModuleAddress(govtypes.ModuleName).String() f.addrs = simtestutil.CreateIncrementalAccounts(3) for _, addr := range f.addrs { f.vals = append(f.vals, sdk.ValAddress(addr)) } keys := storetypes.NewKVStoreKeys(authtypes.ModuleName, banktypes.ModuleName, stakingtypes.ModuleName, minttypes.ModuleName, types.ModuleName) f.ctx = sdk.NewContext(integration.CreateMultiStore(keys, logger), cmtproto.Header{}, false, logger) // Register SDK modules. registerBaseSDKModules(logger, f, encCfg, keys, accountAddressCodec, validatorAddressCodec, consensusAddressCodec) // Setup Keeper. f.k = keeper.NewKeeper(encCfg.Codec, runtime.NewKVStoreService(keys[types.ModuleName]), logger, validatorAddressCodec, accountAddressCodec, f.govModAddr) f.k.InitGenesis(f.ctx, types.DefaultGenesis()) f.msgServer = keeper.NewMsgServerImpl(f.k) f.queryServer = keeper.NewQuerier(f.k) f.appModule = module.NewAppModule(encCfg.Codec, f.k) return f } func registerModuleInterfaces(encCfg moduletestutil.TestEncodingConfig) { authtypes.RegisterInterfaces(encCfg.InterfaceRegistry) stakingtypes.RegisterInterfaces(encCfg.InterfaceRegistry) banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) minttypes.RegisterInterfaces(encCfg.InterfaceRegistry) types.RegisterInterfaces(encCfg.InterfaceRegistry) } func registerBaseSDKModules( logger log.Logger, f *testFixture, encCfg moduletestutil.TestEncodingConfig, keys map[string]*storetypes.KVStoreKey, ac address.Codec, validator address.Codec, consensus address.Codec, ) { registerModuleInterfaces(encCfg) // Auth Keeper. f.accountkeeper = authkeeper.NewAccountKeeper( encCfg.Codec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, ac, app.Bech32PrefixAccAddr, f.govModAddr, ) // Bank Keeper. f.bankkeeper = bankkeeper.NewBaseKeeper( encCfg.Codec, runtime.NewKVStoreService(keys[banktypes.StoreKey]), f.accountkeeper, nil, f.govModAddr, logger, ) // Staking Keeper. f.stakingKeeper = stakingkeeper.NewKeeper( encCfg.Codec, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), f.accountkeeper, f.bankkeeper, f.govModAddr, validator, consensus, ) // Mint Keeper. f.mintkeeper = mintkeeper.NewKeeper( encCfg.Codec, runtime.NewKVStoreService(keys[minttypes.StoreKey]), f.stakingKeeper, f.accountkeeper, f.bankkeeper, authtypes.FeeCollectorName, f.govModAddr, ) }
The text was updated successfully, but these errors were encountered:
fixes the 'no_key' collections issue
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
The text was updated successfully, but these errors were encountered: